1998-07-24 13:44:44 -04: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-14 20:23:28 -04:00
|
|
|
#ifndef _WX_WXOBJSTRM_H__
|
|
|
|
#define _WX_WXOBJSTRM_H__
|
1998-07-24 13:44:44 -04:00
|
|
|
|
|
|
|
#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;
|
1998-08-04 13:49:26 -04:00
|
|
|
int n_children, children_removed;
|
1998-07-24 13:44:44 -04:00
|
|
|
wxList children;
|
1998-08-04 13:49:26 -04:00
|
|
|
wxObjectStreamInfo *parent;
|
1998-07-24 13:44:44 -04:00
|
|
|
wxObject *object;
|
1998-08-23 05:23:27 -04:00
|
|
|
bool duplicate, recall;
|
1998-07-24 13:44:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class wxObjectOutputStream : public wxFilterOutputStream {
|
|
|
|
public:
|
|
|
|
wxObjectOutputStream(wxOutputStream& s);
|
|
|
|
|
1998-07-27 13:08:49 -04:00
|
|
|
void AddChild(wxObject *obj);
|
1998-07-24 13:44:44 -04: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 14:33:19 -04:00
|
|
|
wxList m_saved_objs;
|
1998-07-24 13:44:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class wxObjectInputStream : public wxFilterInputStream {
|
|
|
|
public:
|
|
|
|
wxObjectInputStream(wxInputStream& s);
|
|
|
|
|
1998-08-23 05:23:27 -04:00
|
|
|
bool SecondCall() const { return m_secondcall; }
|
|
|
|
void Recall(bool on = TRUE) { m_current_info->recall = on; }
|
|
|
|
|
1998-07-24 13:44:44 -04:00
|
|
|
wxObject *GetChild(int no) const;
|
1998-08-19 14:33:19 -04:00
|
|
|
wxObject *GetChild();
|
1998-08-04 13:49:26 -04:00
|
|
|
int NumberOfChildren() const { return m_current_info->n_children; }
|
|
|
|
void RemoveChildren(int nb);
|
|
|
|
wxObject *GetParent() const;
|
1998-07-24 13:44:44 -04: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 05:23:27 -04:00
|
|
|
bool m_secondcall;
|
1998-07-24 13:44:44 -04:00
|
|
|
wxObjectStreamInfo *m_current_info;
|
|
|
|
wxList m_solver;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|