]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/objstrm.h
implemented, tested and documented wxTextCtrl::SetMaxLength()
[wxWidgets.git] / include / wx / objstrm.h
... / ...
CommitLineData
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 _WX_WXOBJSTRM_H__
12#define _WX_WXOBJSTRM_H__
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
18#include "wx/defs.h"
19
20#if wxUSE_STREAMS && wxUSE_SERIAL
21
22#include "wx/object.h"
23#include "wx/string.h"
24#include "wx/stream.h"
25
26class wxObjectStreamInfo : public wxObject {
27 public:
28 wxString object_name;
29 int n_children, children_removed;
30 wxList children;
31 wxObjectStreamInfo *parent;
32 wxObject *object;
33 bool duplicate, recall;
34};
35
36class wxObjectOutputStream : public wxFilterOutputStream {
37 public:
38 wxObjectOutputStream(wxOutputStream& s);
39
40 void AddChild(wxObject *obj);
41 bool SaveObject(wxObject& obj);
42
43 bool FirstStage() const { return m_stage == 0; }
44
45 wxString GetObjectName(wxObject *obj);
46
47 protected:
48 void WriteObjectDef(wxObjectStreamInfo& info);
49 void ProcessObjectDef(wxObjectStreamInfo *info);
50 void ProcessObjectData(wxObjectStreamInfo *info);
51
52 protected:
53 int m_stage;
54 bool m_saving;
55 wxObjectStreamInfo *m_current_info;
56 wxList m_saved_objs;
57};
58
59class wxObjectInputStream : public wxFilterInputStream {
60 public:
61 wxObjectInputStream(wxInputStream& s);
62
63 bool SecondCall() const { return m_secondcall; }
64 void Recall(bool on = TRUE) { m_current_info->recall = on; }
65
66 wxObject *GetChild(int no) const;
67 wxObject *GetChild();
68 int NumberOfChildren() const { return m_current_info->n_children; }
69 void RemoveChildren(int nb);
70 wxObject *GetParent() const;
71 wxObject *LoadObject();
72
73 wxObject *SolveName(const wxString& objName) const;
74
75 protected:
76 bool ReadObjectDef(wxObjectStreamInfo *info);
77 wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
78 void ProcessObjectData(wxObjectStreamInfo *info);
79
80 protected:
81 bool m_secondcall;
82 wxObjectStreamInfo *m_current_info;
83 wxList m_solver;
84};
85
86#endif
87 // wxUSE_STREAMS && wxUSE_SERIAL
88
89#endif
90// _WX_WXOBJSTRM_H__