]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/serbase.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Serialization plug-ins
4 // Author: Guilhem Lavaux
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WX_SERBASEH_H__
12 #define _WX_WX_SERBASEH_H__
15 #include "wx/dynlib.h"
17 #define WXSERIAL(classname) classname##_Serialize
20 class wxObject_Serialize
: public wxObject
{
21 DECLARE_DYNAMIC_CLASS(wxObject_Serialize
)
23 wxObject_Serialize() {}
24 virtual ~wxObject_Serialize() {}
26 void SetObject(wxObject
*obj
) { m_object
= obj
; }
27 wxObject
*Object() { return m_object
; }
36 #define DECLARE_SERIAL_CLASS(classname, parent) \
37 class WXSERIAL(classname) : public WXSERIAL(parent) { \
38 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
40 WXSERIAL(classname)() { } \
41 virtual ~WXSERIAL(classname)() { } \
43 virtual void StoreObject(wxObjectOutputStream& stream); \
44 virtual void LoadObject(wxObjectInputStream& stream); \
47 #define DECLARE_ALIAS_SERIAL_CLASS(classname, parent) \
48 class WXSERIAL(classname) : public WXSERIAL(parent) { \
49 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
51 WXSERIAL(classname)() { } \
52 virtual ~WXSERIAL(classname)() { } \
55 #define IMPLEMENT_SERIAL_CLASS(classname, parent) \
56 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
58 #define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
59 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
62 DECLARE_SERIAL_CLASS(wxList
, wxObject
)
63 DECLARE_SERIAL_CLASS(wxHashTable
, wxObject
)