]> git.saurik.com Git - wxWidgets.git/blob - include/wx/serbase.h
wxHandleFatalExceptions() added, documented
[wxWidgets.git] / include / wx / serbase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: serbase.h
3 // Purpose: Serialization plug-ins
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: July 1998
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WX_SERBASEH_H__
12 #define _WX_WX_SERBASEH_H__
13
14 #include "wx/setup.h"
15 #include "wx/dynlib.h"
16
17 #define WXSERIAL(classname) classname##_Serialize
18
19 #if wxUSE_SERIAL
20 class wxObject_Serialize : public wxObject {
21 DECLARE_DYNAMIC_CLASS(wxObject_Serialize)
22 public:
23 wxObject_Serialize() {}
24 virtual ~wxObject_Serialize() {}
25
26 void SetObject(wxObject *obj) { m_object = obj; }
27 wxObject *Object() { return m_object; }
28
29 protected:
30 wxObject *m_object;
31 };
32 #endif
33 // wxUSE_SERIAL
34
35
36 #define DECLARE_SERIAL_CLASS(classname, parent) \
37 class WXSERIAL(classname) : public WXSERIAL(parent) { \
38 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
39 public: \
40 WXSERIAL(classname)() { } \
41 virtual ~WXSERIAL(classname)() { } \
42 \
43 virtual void StoreObject(wxObjectOutputStream& stream); \
44 virtual void LoadObject(wxObjectInputStream& stream); \
45 };
46
47 #define DECLARE_ALIAS_SERIAL_CLASS(classname, parent) \
48 class WXSERIAL(classname) : public WXSERIAL(parent) { \
49 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
50 public: \
51 WXSERIAL(classname)() { } \
52 virtual ~WXSERIAL(classname)() { } \
53 };
54
55 #define IMPLEMENT_SERIAL_CLASS(classname, parent) \
56 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
57
58 #define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
59 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
60
61 #if wxUSE_SERIAL
62 DECLARE_SERIAL_CLASS(wxList, wxObject)
63 DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
64 #endif
65 // wxUSE_SERIAL
66
67 #endif