]>
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
;
30 bool duplicate
, recall
;
33 class wxObjectOutputStream
: public wxFilterOutputStream
{
35 wxObjectOutputStream(wxOutputStream
& s
);
37 void AddChild(wxObject
*obj
);
38 bool SaveObject(wxObject
& obj
);
40 bool FirstStage() const { return m_stage
== 0; }
42 wxString
GetObjectName(wxObject
*obj
);
45 void WriteObjectDef(wxObjectStreamInfo
& info
);
46 void ProcessObjectDef(wxObjectStreamInfo
*info
);
47 void ProcessObjectData(wxObjectStreamInfo
*info
);
52 wxObjectStreamInfo
*m_current_info
;
56 class wxObjectInputStream
: public wxFilterInputStream
{
58 wxObjectInputStream(wxInputStream
& s
);
60 bool SecondCall() const { return m_secondcall
; }
61 void Recall(bool on
= TRUE
) { m_current_info
->recall
= on
; }
63 wxObject
*GetChild(int no
) const;
65 int NumberOfChildren() const { return m_current_info
->n_children
; }
66 void RemoveChildren(int nb
);
67 wxObject
*GetParent() const;
68 wxObject
*LoadObject();
70 wxObject
*SolveName(const wxString
& objName
) const;
73 bool ReadObjectDef(wxObjectStreamInfo
*info
);
74 wxObjectStreamInfo
*ProcessObjectDef(wxObjectStreamInfo
*info
);
75 void ProcessObjectData(wxObjectStreamInfo
*info
);
79 wxObjectStreamInfo
*m_current_info
;