]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/objstrm.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxObjectStream classes
4 // Author: Guilhem Lavaux
8 // Copyright: (c) 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WXOBJSTRM_H__
12 #define _WX_WXOBJSTRM_H__
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/stream.h"
23 class wxObjectStreamInfo
: public wxObject
{
26 int n_children
, children_removed
;
28 wxObjectStreamInfo
*parent
;
32 class wxObjectOutputStream
: public wxFilterOutputStream
{
34 wxObjectOutputStream(wxOutputStream
& s
);
36 void AddChild(wxObject
*obj
);
37 bool SaveObject(wxObject
& obj
);
39 bool FirstStage() const { return m_stage
== 0; }
41 wxString
GetObjectName(wxObject
*obj
);
44 void WriteObjectDef(wxObjectStreamInfo
& info
);
45 void ProcessObjectDef(wxObjectStreamInfo
*info
);
46 void ProcessObjectData(wxObjectStreamInfo
*info
);
51 wxObjectStreamInfo
*m_current_info
;
54 class wxObjectInputStream
: public wxFilterInputStream
{
56 wxObjectInputStream(wxInputStream
& s
);
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();
64 wxObject
*SolveName(const wxString
& objName
) const;
67 bool ReadObjectDef(wxObjectStreamInfo
*info
);
68 wxObjectStreamInfo
*ProcessObjectDef(wxObjectStreamInfo
*info
);
69 void ProcessObjectData(wxObjectStreamInfo
*info
);
72 wxObjectStreamInfo
*m_current_info
;