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