1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: xml streaming runtime metadata information (extended class info)
4 // Author: Stefan Csomor
8 // Copyright: (c) 2003 Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 #if wxUSE_EXTENDED_RTTI
19 #include "wx/string.h"
20 #include "wx/xtistrm.h"
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;
32 class WXDLLIMPEXP_XML wxObjectXmlWriter
: public wxObjectWriter
36 wxObjectXmlWriter( wxXmlNode
* parent
);
37 virtual ~wxObjectXmlWriter();
40 // streaming callbacks
42 // these callbacks really write out the values in the stream format
46 // streaming callbacks
48 // these callbacks really write out the values in the stream format
50 // begins writing out a new toplevel entry which has the indicated unique name
51 virtual void DoBeginWriteTopLevelEntry( const wxString
&name
);
53 // ends writing out a new toplevel entry which has the indicated unique name
54 virtual void DoEndWriteTopLevelEntry( const wxString
&name
);
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
);
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
);
65 // writes a simple property in the stream format
66 virtual void DoWriteSimpleType( const wxAny
&value
);
68 // start of writing a complex property into the stream (
69 virtual void DoBeginWriteProperty( const wxPropertyInfo
*propInfo
);
71 // end of writing a complex property into the stream
72 virtual void DoEndWriteProperty( const wxPropertyInfo
*propInfo
);
74 virtual void DoBeginWriteElement();
75 virtual void DoEndWriteElement();
77 // insert an object reference to an already written object
78 virtual void DoWriteRepeatedObject( int objectID
);
80 // insert a null reference
81 virtual void DoWriteNullObject();
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
);
90 struct wxObjectXmlWriterInternal
;
91 wxObjectXmlWriterInternal
* m_data
;
95 wxObjectXmlReader handles streaming in a class from XML
98 class WXDLLIMPEXP_XML wxObjectXmlReader
: public wxObjectReader
101 wxObjectXmlReader(wxXmlNode
*parent
) { m_parent
= parent
; }
102 virtual ~wxObjectXmlReader() {}
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
107 virtual int ReadObject( const wxString
&name
, wxObjectReaderCallback
*readercallback
);
110 int ReadComponent(wxXmlNode
*parent
, wxObjectReaderCallback
*callbacks
);
112 // read the content of this node (simple type) and return the corresponding value
113 wxAny
ReadValue(wxXmlNode
*Node
, const wxTypeInfo
*type
);
115 wxXmlNode
* m_parent
;
118 #endif // wxUSE_EXTENDED_RTTI