]>
Commit | Line | Data |
---|---|---|
9c8046dd SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/xtixml.h | |
3 | // Purpose: xml streaming runtime metadata information (extended class info) | |
4 | // Author: Stefan Csomor | |
cab1a605 | 5 | // Modified by: |
9c8046dd SC |
6 | // Created: 27/07/03 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2003 Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
9c8046dd SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_XTIXMLH__ | |
13 | #define _WX_XTIXMLH__ | |
14 | ||
28953245 | 15 | #include "wx/defs.h" |
9c8046dd SC |
16 | |
17 | #if wxUSE_EXTENDED_RTTI | |
18 | ||
28953245 | 19 | #include "wx/string.h" |
9c8046dd SC |
20 | #include "wx/xtistrm.h" |
21 | ||
28953245 SC |
22 | class WXDLLIMPEXP_XML wxXmlNode; |
23 | class WXDLLIMPEXP_BASE wxPropertyInfo; | |
24 | class WXDLLIMPEXP_BASE wxObject; | |
25 | class WXDLLIMPEXP_BASE wxClassInfo; | |
26 | class WXDLLIMPEXP_BASE wxVariantBaseArray; | |
27 | class WXDLLIMPEXP_BASE wxHandlerInfo; | |
28 | class WXDLLIMPEXP_BASE wxObjectWriterCallback; | |
9c8046dd | 29 | |
28953245 | 30 | class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter |
9c8046dd | 31 | { |
28953245 | 32 | public: |
9c8046dd | 33 | |
28953245 SC |
34 | wxObjectXmlWriter( wxXmlNode * parent ); |
35 | virtual ~wxObjectXmlWriter(); | |
9c8046dd SC |
36 | |
37 | // | |
38 | // streaming callbacks | |
39 | // | |
40 | // these callbacks really write out the values in the stream format | |
41 | // | |
42 | ||
43 | // | |
44 | // streaming callbacks | |
45 | // | |
46 | // these callbacks really write out the values in the stream format | |
47 | ||
48 | // begins writing out a new toplevel entry which has the indicated unique name | |
28953245 | 49 | virtual void DoBeginWriteTopLevelEntry( const wxString &name ); |
9c8046dd SC |
50 | |
51 | // ends writing out a new toplevel entry which has the indicated unique name | |
28953245 | 52 | virtual void DoEndWriteTopLevelEntry( const wxString &name ); |
9c8046dd SC |
53 | |
54 | // start of writing an object having the passed in ID | |
28953245 SC |
55 | virtual void DoBeginWriteObject(const wxObject *object, |
56 | const wxClassInfo *classInfo, int objectID, wxVariantBaseArray &metadata ); | |
9c8046dd | 57 | |
28953245 SC |
58 | // end of writing an toplevel object name param is used for unique |
59 | // identification within the container | |
60 | virtual void DoEndWriteObject(const wxObject *object, | |
61 | const wxClassInfo *classInfo, int objectID ); | |
9c8046dd SC |
62 | |
63 | // writes a simple property in the stream format | |
28953245 | 64 | virtual void DoWriteSimpleType( wxVariantBase &value ); |
9c8046dd SC |
65 | |
66 | // start of writing a complex property into the stream ( | |
28953245 | 67 | virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ); |
9c8046dd SC |
68 | |
69 | // end of writing a complex property into the stream | |
28953245 | 70 | virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ); |
9c8046dd | 71 | |
28953245 SC |
72 | virtual void DoBeginWriteElement(); |
73 | virtual void DoEndWriteElement(); | |
9c8046dd | 74 | |
cab1a605 | 75 | // insert an object reference to an already written object |
28953245 | 76 | virtual void DoWriteRepeatedObject( int objectID ); |
9c8046dd SC |
77 | |
78 | // insert a null reference | |
28953245 | 79 | virtual void DoWriteNullObject(); |
9c8046dd SC |
80 | |
81 | // writes a delegate in the stream format | |
28953245 SC |
82 | virtual void DoWriteDelegate( const wxObject *object, |
83 | const wxClassInfo* classInfo, const wxPropertyInfo *propInfo, | |
84 | const wxObject *eventSink, int sinkObjectID, | |
85 | const wxClassInfo* eventSinkClassInfo, const wxHandlerInfo* handlerIndo ); | |
86 | ||
87 | private: | |
88 | struct wxObjectXmlWriterInternal; | |
89 | wxObjectXmlWriterInternal* m_data; | |
90 | }; | |
9c8046dd SC |
91 | |
92 | /* | |
28953245 | 93 | wxObjectXmlReader handles streaming in a class from XML |
9c8046dd SC |
94 | */ |
95 | ||
28953245 | 96 | class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader |
9c8046dd SC |
97 | { |
98 | public: | |
28953245 SC |
99 | wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; } |
100 | virtual ~wxObjectXmlReader() {} | |
9c8046dd SC |
101 | |
102 | // Reads a component from XML. The return value is the root object ID, which can | |
103 | // then be used to ask the depersister about that object | |
104 | ||
28953245 | 105 | virtual int ReadObject( const wxString &name, wxObjectWriterCallback *depersist ); |
9c8046dd | 106 | |
28953245 SC |
107 | private: |
108 | int ReadComponent(wxXmlNode *parent, wxObjectWriterCallback *callbacks); | |
9c8046dd SC |
109 | |
110 | // read the content of this node (simple type) and return the corresponding value | |
28953245 | 111 | wxVariantBase ReadValue(wxXmlNode *Node, const wxTypeInfo *type ); |
9c8046dd | 112 | |
28953245 | 113 | wxXmlNode * m_parent; |
9c8046dd SC |
114 | }; |
115 | ||
116 | #endif // wxUSE_EXTENDED_RTTI | |
117 | ||
118 | #endif |