]> git.saurik.com Git - wxWidgets.git/blob - include/wx/xtixml.h
Added NSApplicationDelegate's openFiles for wxOSX-Cocoa.
[wxWidgets.git] / include / wx / xtixml.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/xtixml.h
3 // Purpose: xml streaming runtime metadata information (extended class info)
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 27/07/03
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_XTIXMLH__
13 #define _WX_XTIXMLH__
14
15 #include "wx/defs.h"
16
17 #if wxUSE_EXTENDED_RTTI
18
19 #include "wx/string.h"
20 #include "wx/xtistrm.h"
21
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;
29
30 class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter
31 {
32 public:
33
34 wxObjectXmlWriter( wxXmlNode * parent );
35 virtual ~wxObjectXmlWriter();
36
37 //
38 // streaming callbacks
39 //
40 // these callbacks really write out the values in the stream format
41 //
42
43 //
44 // streaming callbacks
45 //
46 // these callbacks really write out the values in the stream format
47
48 // begins writing out a new toplevel entry which has the indicated unique name
49 virtual void DoBeginWriteTopLevelEntry( const wxString &name );
50
51 // ends writing out a new toplevel entry which has the indicated unique name
52 virtual void DoEndWriteTopLevelEntry( const wxString &name );
53
54 // start of writing an object having the passed in ID
55 virtual void DoBeginWriteObject(const wxObject *object,
56 const wxClassInfo *classInfo, int objectID, const wxStringToAnyHashMap &metadata );
57
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 );
62
63 // writes a simple property in the stream format
64 virtual void DoWriteSimpleType( const wxAny &value );
65
66 // start of writing a complex property into the stream (
67 virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo );
68
69 // end of writing a complex property into the stream
70 virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo );
71
72 virtual void DoBeginWriteElement();
73 virtual void DoEndWriteElement();
74
75 // insert an object reference to an already written object
76 virtual void DoWriteRepeatedObject( int objectID );
77
78 // insert a null reference
79 virtual void DoWriteNullObject();
80
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 );
86
87 private:
88 struct wxObjectXmlWriterInternal;
89 wxObjectXmlWriterInternal* m_data;
90 };
91
92 /*
93 wxObjectXmlReader handles streaming in a class from XML
94 */
95
96 class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader
97 {
98 public:
99 wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; }
100 virtual ~wxObjectXmlReader() {}
101
102 // Reads a component from XML. The return value is the root object ID, which can
103 // then be used to ask the readercallback about that object
104
105 virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback );
106
107 private:
108 int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks);
109
110 // read the content of this node (simple type) and return the corresponding value
111 wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type );
112
113 wxXmlNode * m_parent;
114 };
115
116 #endif // wxUSE_EXTENDED_RTTI
117
118 #endif