]>
Commit | Line | Data |
---|---|---|
d602f1d8 GL |
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 | ///////////////////////////////////////////////////////////////////////////// | |
34138703 JS |
11 | #ifndef _WX_WXOBJSTRM_H__ |
12 | #define _WX_WXOBJSTRM_H__ | |
d602f1d8 GL |
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; | |
7a4b9130 | 26 | int n_children, children_removed; |
d602f1d8 | 27 | wxList children; |
7a4b9130 | 28 | wxObjectStreamInfo *parent; |
d602f1d8 | 29 | wxObject *object; |
8d43638d | 30 | bool duplicate; |
d602f1d8 GL |
31 | }; |
32 | ||
33 | class wxObjectOutputStream : public wxFilterOutputStream { | |
34 | public: | |
35 | wxObjectOutputStream(wxOutputStream& s); | |
36 | ||
1eac776c | 37 | void AddChild(wxObject *obj); |
d602f1d8 GL |
38 | bool SaveObject(wxObject& obj); |
39 | ||
40 | bool FirstStage() const { return m_stage == 0; } | |
41 | ||
42 | wxString GetObjectName(wxObject *obj); | |
43 | ||
44 | protected: | |
45 | void WriteObjectDef(wxObjectStreamInfo& info); | |
46 | void ProcessObjectDef(wxObjectStreamInfo *info); | |
47 | void ProcessObjectData(wxObjectStreamInfo *info); | |
48 | ||
49 | protected: | |
50 | int m_stage; | |
51 | bool m_saving; | |
52 | wxObjectStreamInfo *m_current_info; | |
8d43638d | 53 | wxList m_saved_objs; |
d602f1d8 GL |
54 | }; |
55 | ||
56 | class wxObjectInputStream : public wxFilterInputStream { | |
57 | public: | |
58 | wxObjectInputStream(wxInputStream& s); | |
59 | ||
60 | wxObject *GetChild(int no) const; | |
8d43638d | 61 | wxObject *GetChild(); |
7a4b9130 GL |
62 | int NumberOfChildren() const { return m_current_info->n_children; } |
63 | void RemoveChildren(int nb); | |
64 | wxObject *GetParent() const; | |
d602f1d8 GL |
65 | wxObject *LoadObject(); |
66 | ||
67 | wxObject *SolveName(const wxString& objName) const; | |
68 | ||
69 | protected: | |
70 | bool ReadObjectDef(wxObjectStreamInfo *info); | |
71 | wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info); | |
72 | void ProcessObjectData(wxObjectStreamInfo *info); | |
73 | ||
74 | protected: | |
75 | wxObjectStreamInfo *m_current_info; | |
76 | wxList m_solver; | |
77 | }; | |
78 | ||
79 | #endif |