]>
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__
20 #if wxUSE_STREAMS && wxUSE_SERIAL
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/stream.h"
26 class wxObjectStreamInfo
: public wxObject
{
29 int n_children
, children_removed
;
31 wxObjectStreamInfo
*parent
;
33 bool duplicate
, recall
;
36 class wxObjectOutputStream
: public wxFilterOutputStream
{
38 wxObjectOutputStream(wxOutputStream
& s
);
40 void AddChild(wxObject
*obj
);
41 bool SaveObject(wxObject
& obj
);
43 bool FirstStage() const { return m_stage
== 0; }
45 wxString
GetObjectName(wxObject
*obj
);
48 void WriteObjectDef(wxObjectStreamInfo
& info
);
49 void ProcessObjectDef(wxObjectStreamInfo
*info
);
50 void ProcessObjectData(wxObjectStreamInfo
*info
);
55 wxObjectStreamInfo
*m_current_info
;
59 class wxObjectInputStream
: public wxFilterInputStream
{
61 wxObjectInputStream(wxInputStream
& s
);
63 bool SecondCall() const { return m_secondcall
; }
64 void Recall(bool on
= TRUE
) { m_current_info
->recall
= on
; }
66 wxObject
*GetChild(int no
) const;
68 int NumberOfChildren() const { return m_current_info
->n_children
; }
69 void RemoveChildren(int nb
);
70 wxObject
*GetParent() const;
71 wxObject
*LoadObject();
73 wxObject
*SolveName(const wxString
& objName
) const;
76 bool ReadObjectDef(wxObjectStreamInfo
*info
);
77 wxObjectStreamInfo
*ProcessObjectDef(wxObjectStreamInfo
*info
);
78 void ProcessObjectData(wxObjectStreamInfo
*info
);
82 wxObjectStreamInfo
*m_current_info
;
87 // wxUSE_STREAMS && wxUSE_SERIAL