]> git.saurik.com Git - wxWidgets.git/blame - include/wx/objstrm.h
Some more Motif work; included utils.h in fileconf.cpp (for wxGetHomeDir or something)
[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 29 wxObject *object;
1d44aaf8 30 bool duplicate, recall;
d602f1d8
GL
31};
32
33class 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
56class wxObjectInputStream : public wxFilterInputStream {
57 public:
58 wxObjectInputStream(wxInputStream& s);
59
1d44aaf8
GL
60 bool SecondCall() const { return m_secondcall; }
61 void Recall(bool on = TRUE) { m_current_info->recall = on; }
62
d602f1d8 63 wxObject *GetChild(int no) const;
8d43638d 64 wxObject *GetChild();
7a4b9130
GL
65 int NumberOfChildren() const { return m_current_info->n_children; }
66 void RemoveChildren(int nb);
67 wxObject *GetParent() const;
d602f1d8
GL
68 wxObject *LoadObject();
69
70 wxObject *SolveName(const wxString& objName) const;
71
72 protected:
73 bool ReadObjectDef(wxObjectStreamInfo *info);
74 wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
75 void ProcessObjectData(wxObjectStreamInfo *info);
76
77 protected:
1d44aaf8 78 bool m_secondcall;
d602f1d8
GL
79 wxObjectStreamInfo *m_current_info;
80 wxList m_solver;
81};
82
83#endif