]>
Commit | Line | Data |
---|---|---|
e1d3601a PC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/xtistrm.h | |
3 | // Purpose: streaming runtime metadata information (extended class info) | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 27/07/03 | |
e1d3601a PC |
7 | // Copyright: (c) 2003 Stefan Csomor |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _CODEDEPERSISTER_ | |
12 | #define _CODEDEPERSISTER_ | |
13 | ||
14 | #include "wx/defs.h" | |
1bf29304 | 15 | #include "wx/sstream.h" |
e1d3601a PC |
16 | |
17 | /* | |
18 | wxObjectCodeReaderCallback implements the callbacks that will depersist | |
19 | an object into a C++ initialization function. | |
20 | */ | |
21 | ||
22 | class WXDLLIMPEXP_BASE wxTextOutputStream; | |
23 | ||
1bf29304 | 24 | class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback |
e1d3601a PC |
25 | { |
26 | private: | |
27 | struct wxObjectCodeReaderCallbackInternal; | |
28 | wxObjectCodeReaderCallbackInternal * m_data; | |
1bf29304 SC |
29 | wxString& m_headerincludes; |
30 | wxString& m_source; | |
e1d3601a PC |
31 | |
32 | public: | |
1bf29304 | 33 | wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source); |
e1d3601a PC |
34 | virtual ~wxObjectCodeReaderCallback(); |
35 | ||
36 | // allocate the new object on the heap, that object will have the passed in ID | |
37 | virtual void AllocateObject(int objectID, wxClassInfo *classInfo, | |
1bf29304 | 38 | wxStringToAnyHashMap &metadata); |
e1d3601a PC |
39 | |
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 | |
43 | ||
44 | virtual void CreateObject(int objectID, | |
45 | const wxClassInfo *classInfo, | |
46 | int paramCount, | |
1bf29304 | 47 | wxAny *variantValues, |
e1d3601a PC |
48 | int *objectIDValues, |
49 | const wxClassInfo **objectClassInfos, | |
1bf29304 | 50 | wxStringToAnyHashMap &metadata |
e1d3601a PC |
51 | ); |
52 | ||
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 | |
57 | ||
58 | virtual void ConstructObject(int objectID, | |
59 | const wxClassInfo *classInfo, | |
60 | int paramCount, | |
1bf29304 | 61 | wxAny *VariantValues, |
e1d3601a PC |
62 | int *objectIDValues, |
63 | const wxClassInfo **objectClassInfos, | |
1bf29304 | 64 | wxStringToAnyHashMap &metadata); |
e1d3601a PC |
65 | |
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); | |
70 | ||
71 | // set the corresponding property | |
72 | virtual void SetProperty(int objectID, | |
73 | const wxClassInfo *classInfo, | |
74 | const wxPropertyInfo* propertyInfo, | |
1bf29304 | 75 | const wxAny &variantValue); |
e1d3601a PC |
76 | |
77 | // sets the corresponding property (value is an object) | |
78 | virtual void SetPropertyAsObject(int objectId, | |
79 | const wxClassInfo *classInfo, | |
80 | const wxPropertyInfo* propertyInfo, | |
81 | int valueObjectId); | |
82 | ||
83 | // adds an element to a property collection | |
84 | virtual void AddToPropertyCollection( int objectID, | |
85 | const wxClassInfo *classInfo, | |
86 | const wxPropertyInfo* propertyInfo, | |
1bf29304 | 87 | const wxAny &VariantValue); |
e1d3601a PC |
88 | |
89 | // sets the corresponding property (value is an object) | |
90 | virtual void AddToPropertyCollectionAsObject(int objectID, | |
91 | const wxClassInfo *classInfo, | |
92 | const wxPropertyInfo* propertyInfo, | |
93 | int valueObjectId); | |
94 | ||
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 ); | |
1bf29304 SC |
102 | |
103 | // utility function exposed for callbacks | |
104 | wxString ValueAsCode( const wxAny ¶m ); | |
e1d3601a PC |
105 | }; |
106 | ||
107 | #endif |