]> git.saurik.com Git - wxWidgets.git/blame - include/wx/serbase.h
Explicit casting/instantiation to resolve ambiguous overload.
[wxWidgets.git] / include / wx / serbase.h
CommitLineData
7a4b9130
GL
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/////////////////////////////////////////////////////////////////////////////
34138703
JS
11#ifndef _WX_WX_SERBASEH_H__
12#define _WX_WX_SERBASEH_H__
7a4b9130 13
8870c26e 14#include <wx/setup.h>
7a4b9130
GL
15#include <wx/dynlib.h>
16
17#define WXSERIAL(classname) classname##_Serialize
18
8870c26e 19#if wxUSE_SERIAL
7a4b9130
GL
20class 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};
8870c26e
JS
32#endif
33 // wxUSE_SERIAL
7a4b9130
GL
34
35
36#define DECLARE_SERIAL_CLASS(classname, parent) \
37class 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) \
48class 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) \
56IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
57
58#define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
59IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
60
8870c26e 61#if wxUSE_SERIAL
907789a0
RR
62DECLARE_SERIAL_CLASS(wxList, wxObject)
63DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
8870c26e
JS
64#endif
65 // wxUSE_SERIAL
907789a0 66
7a4b9130 67#endif