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"
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
;
30 class WXDLLIMPEXP_XML wxObjectXmlWriter
: public wxObjectWriter
34 wxObjectXmlWriter( wxXmlNode
* parent
);
35 virtual ~wxObjectXmlWriter();
38 // streaming callbacks
40 // these callbacks really write out the values in the stream format
44 // streaming callbacks
46 // these callbacks really write out the values in the stream format
48 // begins writing out a new toplevel entry which has the indicated unique name
49 virtual void DoBeginWriteTopLevelEntry( const wxString
&name
);
51 // ends writing out a new toplevel entry which has the indicated unique name
52 virtual void DoEndWriteTopLevelEntry( const wxString
&name
);
54 // start of writing an object having the passed in ID
55 virtual void DoBeginWriteObject(const wxObject
*object
,
56 const wxClassInfo
*classInfo
, int objectID
, wxVariantBaseArray
&metadata
);
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
);
63 // writes a simple property in the stream format
64 virtual void DoWriteSimpleType( wxVariantBase
&value
);
66 // start of writing a complex property into the stream (
67 virtual void DoBeginWriteProperty( const wxPropertyInfo
*propInfo
);
69 // end of writing a complex property into the stream
70 virtual void DoEndWriteProperty( const wxPropertyInfo
*propInfo
);
72 virtual void DoBeginWriteElement();
73 virtual void DoEndWriteElement();
75 // insert an object reference to an already written object
76 virtual void DoWriteRepeatedObject( int objectID
);
78 // insert a null reference
79 virtual void DoWriteNullObject();
81 // writes a delegate in the stream format
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
);
88 struct wxObjectXmlWriterInternal
;
89 wxObjectXmlWriterInternal
* m_data
;
93 wxObjectXmlReader handles streaming in a class from XML
96 class WXDLLIMPEXP_XML wxObjectXmlReader
: public wxObjectReader
99 wxObjectXmlReader(wxXmlNode
*parent
) { m_parent
= parent
; }
100 virtual ~wxObjectXmlReader() {}
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
105 virtual int ReadObject( const wxString
&name
, wxObjectWriterCallback
*depersist
);
108 int ReadComponent(wxXmlNode
*parent
, wxObjectWriterCallback
*callbacks
);
110 // read the content of this node (simple type) and return the corresponding value
111 wxVariantBase
ReadValue(wxXmlNode
*Node
, const wxTypeInfo
*type
);
113 wxXmlNode
* m_parent
;
116 #endif // wxUSE_EXTENDED_RTTI