1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: streaming runtime metadata information (extended class info)
4 // Author: Stefan Csomor
7 // Copyright: (c) 2003 Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _CODEDEPERSISTER_
12 #define _CODEDEPERSISTER_
15 #include "wx/sstream.h"
18 wxObjectCodeReaderCallback implements the callbacks that will depersist
19 an object into a C++ initialization function.
22 class WXDLLIMPEXP_BASE wxTextOutputStream
;
24 class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback
: public wxObjectReaderCallback
27 struct wxObjectCodeReaderCallbackInternal
;
28 wxObjectCodeReaderCallbackInternal
* m_data
;
29 wxString
& m_headerincludes
;
33 wxObjectCodeReaderCallback(wxString
& headerincludes
, wxString
&source
);
34 virtual ~wxObjectCodeReaderCallback();
36 // allocate the new object on the heap, that object will have the passed in ID
37 virtual void AllocateObject(int objectID
, wxClassInfo
*classInfo
,
38 wxStringToAnyHashMap
&metadata
);
40 // initialize the already allocated object having the ID objectID
41 // with the Create method creation parameters which are objects are
42 // having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
44 virtual void CreateObject(int objectID
,
45 const wxClassInfo
*classInfo
,
49 const wxClassInfo
**objectClassInfos
,
50 wxStringToAnyHashMap
&metadata
53 // construct the new object on the heap, that object will have the
54 // passed in ID (for objects that don't support allocate-create type
55 // of creation) creation parameters which are objects are having their
56 // Ids passed in objectIDValues having objectId <> wxInvalidObjectID
58 virtual void ConstructObject(int objectID
,
59 const wxClassInfo
*classInfo
,
63 const wxClassInfo
**objectClassInfos
,
64 wxStringToAnyHashMap
&metadata
);
66 // destroy the heap-allocated object having the ID objectID, this may
67 // be used if an object is embedded in another object and set via value
68 // semantics, so the intermediate object can be destroyed after safely
69 virtual void DestroyObject(int objectID
, wxClassInfo
*classInfo
);
71 // set the corresponding property
72 virtual void SetProperty(int objectID
,
73 const wxClassInfo
*classInfo
,
74 const wxPropertyInfo
* propertyInfo
,
75 const wxAny
&variantValue
);
77 // sets the corresponding property (value is an object)
78 virtual void SetPropertyAsObject(int objectId
,
79 const wxClassInfo
*classInfo
,
80 const wxPropertyInfo
* propertyInfo
,
83 // adds an element to a property collection
84 virtual void AddToPropertyCollection( int objectID
,
85 const wxClassInfo
*classInfo
,
86 const wxPropertyInfo
* propertyInfo
,
87 const wxAny
&VariantValue
);
89 // sets the corresponding property (value is an object)
90 virtual void AddToPropertyCollectionAsObject(int objectID
,
91 const wxClassInfo
*classInfo
,
92 const wxPropertyInfo
* propertyInfo
,
95 // sets the corresponding event handler
96 virtual void SetConnect(int eventSourceObjectID
,
97 const wxClassInfo
*eventSourceClassInfo
,
98 const wxPropertyInfo
*delegateInfo
,
99 const wxClassInfo
*eventSinkClassInfo
,
100 const wxHandlerInfo
* handlerInfo
,
101 int eventSinkObjectID
);
103 // utility function exposed for callbacks
104 wxString
ValueAsCode( const wxAny
¶m
);