]>
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 | ||
eb515996 | 22 | /* |
28953245 SC |
23 | class WXDLLIMPEXP_XML wxXmlNode; |
24 | class WXDLLIMPEXP_BASE wxPropertyInfo; | |
25 | class WXDLLIMPEXP_BASE wxObject; | |
26 | class WXDLLIMPEXP_BASE wxClassInfo; | |
cbca59a8 | 27 | class WXDLLIMPEXP_BASE wxAnyList; |
28953245 SC |
28 | class WXDLLIMPEXP_BASE wxHandlerInfo; |
29 | class WXDLLIMPEXP_BASE wxObjectWriterCallback; | |
eb515996 | 30 | */ |
9c8046dd | 31 | |
28953245 | 32 | class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter |
9c8046dd | 33 | { |
28953245 | 34 | public: |
9c8046dd | 35 | |
28953245 SC |
36 | wxObjectXmlWriter( wxXmlNode * parent ); |
37 | virtual ~wxObjectXmlWriter(); | |
9c8046dd SC |
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 | |
28953245 | 51 | virtual void DoBeginWriteTopLevelEntry( const wxString &name ); |
9c8046dd SC |
52 | |
53 | // ends writing out a new toplevel entry which has the indicated unique name | |
28953245 | 54 | virtual void DoEndWriteTopLevelEntry( const wxString &name ); |
9c8046dd SC |
55 | |
56 | // start of writing an object having the passed in ID | |
28953245 | 57 | virtual void DoBeginWriteObject(const wxObject *object, |
cbca59a8 | 58 | const wxClassInfo *classInfo, int objectID, const wxStringToAnyHashMap &metadata ); |
9c8046dd | 59 | |
28953245 SC |
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 ); | |
9c8046dd SC |
64 | |
65 | // writes a simple property in the stream format | |
cbca59a8 | 66 | virtual void DoWriteSimpleType( const wxAny &value ); |
9c8046dd SC |
67 | |
68 | // start of writing a complex property into the stream ( | |
28953245 | 69 | virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ); |
9c8046dd SC |
70 | |
71 | // end of writing a complex property into the stream | |
28953245 | 72 | virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ); |
9c8046dd | 73 | |
28953245 SC |
74 | virtual void DoBeginWriteElement(); |
75 | virtual void DoEndWriteElement(); | |
9c8046dd | 76 | |
cab1a605 | 77 | // insert an object reference to an already written object |
28953245 | 78 | virtual void DoWriteRepeatedObject( int objectID ); |
9c8046dd SC |
79 | |
80 | // insert a null reference | |
28953245 | 81 | virtual void DoWriteNullObject(); |
9c8046dd SC |
82 | |
83 | // writes a delegate in the stream format | |
28953245 SC |
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 | }; | |
9c8046dd SC |
93 | |
94 | /* | |
28953245 | 95 | wxObjectXmlReader handles streaming in a class from XML |
9c8046dd SC |
96 | */ |
97 | ||
28953245 | 98 | class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader |
9c8046dd SC |
99 | { |
100 | public: | |
28953245 SC |
101 | wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; } |
102 | virtual ~wxObjectXmlReader() {} | |
9c8046dd SC |
103 | |
104 | // Reads a component from XML. The return value is the root object ID, which can | |
cbca59a8 | 105 | // then be used to ask the readercallback about that object |
9c8046dd | 106 | |
cbca59a8 | 107 | virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ); |
9c8046dd | 108 | |
28953245 | 109 | private: |
cbca59a8 | 110 | int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks); |
9c8046dd SC |
111 | |
112 | // read the content of this node (simple type) and return the corresponding value | |
cbca59a8 | 113 | wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type ); |
9c8046dd | 114 | |
28953245 | 115 | wxXmlNode * m_parent; |
9c8046dd SC |
116 | }; |
117 | ||
118 | #endif // wxUSE_EXTENDED_RTTI | |
119 | ||
120 | #endif |