]> git.saurik.com Git - wxWidgets.git/blame - include/wx/objstrm.h
Small changes after Robert's edits
[wxWidgets.git] / include / wx / objstrm.h
CommitLineData
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
23class 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
GL
29 wxObject *object;
30};
31
32class wxObjectOutputStream : public wxFilterOutputStream {
33 public:
34 wxObjectOutputStream(wxOutputStream& s);
35
1eac776c 36 void AddChild(wxObject *obj);
d602f1d8
GL
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
54class wxObjectInputStream : public wxFilterInputStream {
55 public:
56 wxObjectInputStream(wxInputStream& s);
57
58 wxObject *GetChild(int no) const;
7a4b9130
GL
59 int NumberOfChildren() const { return m_current_info->n_children; }
60 void RemoveChildren(int nb);
61 wxObject *GetParent() const;
d602f1d8
GL
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