]> git.saurik.com Git - wxWidgets.git/blob - include/wx/objstrm.h
Changed floats to doubles in wxexpr.h; added a flag in accel.h (wxACCEL_NONE for
[wxWidgets.git] / include / wx / objstrm.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: objstrm.h
3 // Purpose: wxObjectStream classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 16/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WXOBJSTRM_H__
12 #define _WX_WXOBJSTRM_H__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/stream.h"
22
23 class wxObjectStreamInfo : public wxObject {
24 public:
25 wxString object_name;
26 int n_children, children_removed;
27 wxList children;
28 wxObjectStreamInfo *parent;
29 wxObject *object;
30 };
31
32 class wxObjectOutputStream : public wxFilterOutputStream {
33 public:
34 wxObjectOutputStream(wxOutputStream& s);
35
36 void AddChild(wxObject *obj);
37 bool SaveObject(wxObject& obj);
38
39 bool FirstStage() const { return m_stage == 0; }
40
41 wxString GetObjectName(wxObject *obj);
42
43 protected:
44 void WriteObjectDef(wxObjectStreamInfo& info);
45 void ProcessObjectDef(wxObjectStreamInfo *info);
46 void ProcessObjectData(wxObjectStreamInfo *info);
47
48 protected:
49 int m_stage;
50 bool m_saving;
51 wxObjectStreamInfo *m_current_info;
52 };
53
54 class wxObjectInputStream : public wxFilterInputStream {
55 public:
56 wxObjectInputStream(wxInputStream& s);
57
58 wxObject *GetChild(int no) const;
59 int NumberOfChildren() const { return m_current_info->n_children; }
60 void RemoveChildren(int nb);
61 wxObject *GetParent() const;
62 wxObject *LoadObject();
63
64 wxObject *SolveName(const wxString& objName) const;
65
66 protected:
67 bool ReadObjectDef(wxObjectStreamInfo *info);
68 wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
69 void ProcessObjectData(wxObjectStreamInfo *info);
70
71 protected:
72 wxObjectStreamInfo *m_current_info;
73 wxList m_solver;
74 };
75
76 #endif