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