1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: xml streaming runtime metadata information (extended class info)
4 // Author: Stefan Csomor
7 // Copyright: (c) 2003 Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
16 #if wxUSE_EXTENDED_RTTI
18 #include "wx/string.h"
19 #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 wxAnyList;
27 class WXDLLIMPEXP_BASE wxHandlerInfo;
28 class WXDLLIMPEXP_BASE wxObjectWriterCallback;
31 class WXDLLIMPEXP_XML wxObjectXmlWriter
: public wxObjectWriter
35 wxObjectXmlWriter( wxXmlNode
* parent
);
36 virtual ~wxObjectXmlWriter();
39 // streaming callbacks
41 // these callbacks really write out the values in the stream format
45 // streaming callbacks
47 // these callbacks really write out the values in the stream format
49 // begins writing out a new toplevel entry which has the indicated unique name
50 virtual void DoBeginWriteTopLevelEntry( const wxString
&name
);
52 // ends writing out a new toplevel entry which has the indicated unique name
53 virtual void DoEndWriteTopLevelEntry( const wxString
&name
);
55 // start of writing an object having the passed in ID
56 virtual void DoBeginWriteObject(const wxObject
*object
,
57 const wxClassInfo
*classInfo
, int objectID
, const wxStringToAnyHashMap
&metadata
);
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
);
64 // writes a simple property in the stream format
65 virtual void DoWriteSimpleType( const wxAny
&value
);
67 // start of writing a complex property into the stream (
68 virtual void DoBeginWriteProperty( const wxPropertyInfo
*propInfo
);
70 // end of writing a complex property into the stream
71 virtual void DoEndWriteProperty( const wxPropertyInfo
*propInfo
);
73 virtual void DoBeginWriteElement();
74 virtual void DoEndWriteElement();
76 // insert an object reference to an already written object
77 virtual void DoWriteRepeatedObject( int objectID
);
79 // insert a null reference
80 virtual void DoWriteNullObject();
82 // writes a delegate in the stream format
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
);
89 struct wxObjectXmlWriterInternal
;
90 wxObjectXmlWriterInternal
* m_data
;
94 wxObjectXmlReader handles streaming in a class from XML
97 class WXDLLIMPEXP_XML wxObjectXmlReader
: public wxObjectReader
100 wxObjectXmlReader(wxXmlNode
*parent
) { m_parent
= parent
; }
101 virtual ~wxObjectXmlReader() {}
103 // Reads a component from XML. The return value is the root object ID, which can
104 // then be used to ask the readercallback about that object
106 virtual int ReadObject( const wxString
&name
, wxObjectReaderCallback
*readercallback
);
109 int ReadComponent(wxXmlNode
*parent
, wxObjectReaderCallback
*callbacks
);
111 // read the content of this node (simple type) and return the corresponding value
112 wxAny
ReadValue(wxXmlNode
*Node
, const wxTypeInfo
*type
);
114 wxXmlNode
* m_parent
;
117 #endif // wxUSE_EXTENDED_RTTI