]> git.saurik.com Git - wxWidgets.git/blame - include/wx/objstrm.h
wxFrame::SetIcon()
[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/////////////////////////////////////////////////////////////////////////////
11#ifndef __WXOBJSTRM_H__
12#define __WXOBJSTRM_H__
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;
26 int n_children;
27 wxList children;
28 wxObject *parent;
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;
59 wxObject *GetParent() const { return m_current_info->parent; }
60 wxObject *LoadObject();
61
62 wxObject *SolveName(const wxString& objName) const;
63
64 protected:
65 bool ReadObjectDef(wxObjectStreamInfo *info);
66 wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
67 void ProcessObjectData(wxObjectStreamInfo *info);
68
69 protected:
70 wxObjectStreamInfo *m_current_info;
71 wxList m_solver;
72};
73
74#endif