1998-07-24 17:44:44 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_WXOBJSTRM_H__
|
|
|
|
#define _WX_WXOBJSTRM_H__
|
1998-07-24 17:44:44 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-06-15 20:21:59 +00:00
|
|
|
|
|
|
|
#if wxUSE_STREAMS && wxUSE_SERIAL
|
|
|
|
|
1998-07-24 17:44:44 +00:00
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/stream.h"
|
|
|
|
|
|
|
|
class wxObjectStreamInfo : public wxObject {
|
|
|
|
public:
|
|
|
|
wxString object_name;
|
1998-08-04 17:49:26 +00:00
|
|
|
int n_children, children_removed;
|
1998-07-24 17:44:44 +00:00
|
|
|
wxList children;
|
1998-08-04 17:49:26 +00:00
|
|
|
wxObjectStreamInfo *parent;
|
1998-07-24 17:44:44 +00:00
|
|
|
wxObject *object;
|
1998-08-23 09:23:27 +00:00
|
|
|
bool duplicate, recall;
|
1998-07-24 17:44:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class wxObjectOutputStream : public wxFilterOutputStream {
|
|
|
|
public:
|
|
|
|
wxObjectOutputStream(wxOutputStream& s);
|
|
|
|
|
1998-07-27 17:08:49 +00:00
|
|
|
void AddChild(wxObject *obj);
|
1998-07-24 17:44:44 +00:00
|
|
|
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;
|
1998-08-19 18:33:19 +00:00
|
|
|
wxList m_saved_objs;
|
1998-07-24 17:44:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class wxObjectInputStream : public wxFilterInputStream {
|
|
|
|
public:
|
|
|
|
wxObjectInputStream(wxInputStream& s);
|
|
|
|
|
1998-08-23 09:23:27 +00:00
|
|
|
bool SecondCall() const { return m_secondcall; }
|
|
|
|
void Recall(bool on = TRUE) { m_current_info->recall = on; }
|
|
|
|
|
1998-07-24 17:44:44 +00:00
|
|
|
wxObject *GetChild(int no) const;
|
1998-08-19 18:33:19 +00:00
|
|
|
wxObject *GetChild();
|
1998-08-04 17:49:26 +00:00
|
|
|
int NumberOfChildren() const { return m_current_info->n_children; }
|
|
|
|
void RemoveChildren(int nb);
|
|
|
|
wxObject *GetParent() const;
|
1998-07-24 17:44:44 +00:00
|
|
|
wxObject *LoadObject();
|
|
|
|
|
|
|
|
wxObject *SolveName(const wxString& objName) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool ReadObjectDef(wxObjectStreamInfo *info);
|
|
|
|
wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
|
|
|
|
void ProcessObjectData(wxObjectStreamInfo *info);
|
|
|
|
|
|
|
|
protected:
|
1998-08-23 09:23:27 +00:00
|
|
|
bool m_secondcall;
|
1998-07-24 17:44:44 +00:00
|
|
|
wxObjectStreamInfo *m_current_info;
|
|
|
|
wxList m_solver;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1999-06-15 20:21:59 +00:00
|
|
|
// wxUSE_STREAMS && wxUSE_SERIAL
|
|
|
|
|
|
|
|
#endif
|
1999-06-17 10:03:00 +00:00
|
|
|
// _WX_WXOBJSTRM_H__
|