1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/////////////////////////////////////////////////////////////////////////////
// Name: objstrm.h
// Purpose: wxObjectStream classes
// Author: Guilhem Lavaux
// Modified by:
// Created: 16/07/98
// RCS-ID: $Id: objstrm.h,v 1.8 1999/06/17 10:03:00 KB Exp $
// 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"
#if wxUSE_STREAMS && wxUSE_SERIAL
#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, recall;
};
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);
bool SecondCall() const { return m_secondcall; }
void Recall(bool on = TRUE) { m_current_info->recall = on; }
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:
bool m_secondcall;
wxObjectStreamInfo *m_current_info;
wxList m_solver;
};
#endif
// wxUSE_STREAMS && wxUSE_SERIAL
#endif
// _WX_WXOBJSTRM_H__
|