wxWidgets/include/wx/objstrm.h
Guilhem Lavaux 8d43638db1 * Some new feature in wxObject*Stream (objects aren't duplicated)
* Added SetBackgroundBrush in wxGridCell
* New classes/fixes in wxSerial


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1998-08-19 18:33:19 +00:00

80 lines
1.9 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: objstrm.h
// Purpose: wxObjectStream classes
// Author: Guilhem Lavaux
// Modified by:
// Created: 16/07/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WXOBJSTRM_H__
#define _WX_WXOBJSTRM_H__
#ifdef __GNUG__
#pragma interface
#endif
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/string.h"
#include "wx/stream.h"
class wxObjectStreamInfo : public wxObject {
public:
wxString object_name;
int n_children, children_removed;
wxList children;
wxObjectStreamInfo *parent;
wxObject *object;
bool duplicate;
};
class wxObjectOutputStream : public wxFilterOutputStream {
public:
wxObjectOutputStream(wxOutputStream& s);
void AddChild(wxObject *obj);
bool SaveObject(wxObject& obj);
bool FirstStage() const { return m_stage == 0; }
wxString GetObjectName(wxObject *obj);
protected:
void WriteObjectDef(wxObjectStreamInfo& info);
void ProcessObjectDef(wxObjectStreamInfo *info);
void ProcessObjectData(wxObjectStreamInfo *info);
protected:
int m_stage;
bool m_saving;
wxObjectStreamInfo *m_current_info;
wxList m_saved_objs;
};
class wxObjectInputStream : public wxFilterInputStream {
public:
wxObjectInputStream(wxInputStream& s);
wxObject *GetChild(int no) const;
wxObject *GetChild();
int NumberOfChildren() const { return m_current_info->n_children; }
void RemoveChildren(int nb);
wxObject *GetParent() const;
wxObject *LoadObject();
wxObject *SolveName(const wxString& objName) const;
protected:
bool ReadObjectDef(wxObjectStreamInfo *info);
wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
void ProcessObjectData(wxObjectStreamInfo *info);
protected:
wxObjectStreamInfo *m_current_info;
wxList m_solver;
};
#endif