]>
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__
14 #include <wx/dynlib.h>
16 #define WXSERIAL(classname) classname##_Serialize
18 class wxObject_Serialize
: public wxObject
{
19 DECLARE_DYNAMIC_CLASS(wxObject_Serialize
)
21 wxObject_Serialize() {}
22 virtual ~wxObject_Serialize() {}
24 void SetObject(wxObject
*obj
) { m_object
= obj
; }
25 wxObject
*Object() { return m_object
; }
32 #define DECLARE_SERIAL_CLASS(classname, parent) \
33 class WXSERIAL(classname) : public WXSERIAL(parent) { \
34 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
36 WXSERIAL(classname)() { } \
37 virtual ~WXSERIAL(classname)() { } \
39 virtual void StoreObject(wxObjectOutputStream& stream); \
40 virtual void LoadObject(wxObjectInputStream& stream); \
43 #define DECLARE_ALIAS_SERIAL_CLASS(classname, parent) \
44 class WXSERIAL(classname) : public WXSERIAL(parent) { \
45 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
47 WXSERIAL(classname)() { } \
48 virtual ~WXSERIAL(classname)() { } \
51 #define IMPLEMENT_SERIAL_CLASS(classname, parent) \
52 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
54 #define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
55 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)