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