]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/xtixml.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / xtixml.h
... / ...
CommitLineData
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// Copyright: (c) 2003 Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_XTIXMLH__
12#define _WX_XTIXMLH__
13
14#include "wx/defs.h"
15
16#if wxUSE_EXTENDED_RTTI
17
18#include "wx/string.h"
19#include "wx/xtistrm.h"
20
21/*
22class WXDLLIMPEXP_XML wxXmlNode;
23class WXDLLIMPEXP_BASE wxPropertyInfo;
24class WXDLLIMPEXP_BASE wxObject;
25class WXDLLIMPEXP_BASE wxClassInfo;
26class WXDLLIMPEXP_BASE wxAnyList;
27class WXDLLIMPEXP_BASE wxHandlerInfo;
28class WXDLLIMPEXP_BASE wxObjectWriterCallback;
29*/
30
31class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter
32{
33public:
34
35 wxObjectXmlWriter( wxXmlNode * parent );
36 virtual ~wxObjectXmlWriter();
37
38 //
39 // streaming callbacks
40 //
41 // these callbacks really write out the values in the stream format
42 //
43
44 //
45 // streaming callbacks
46 //
47 // these callbacks really write out the values in the stream format
48
49 // begins writing out a new toplevel entry which has the indicated unique name
50 virtual void DoBeginWriteTopLevelEntry( const wxString &name );
51
52 // ends writing out a new toplevel entry which has the indicated unique name
53 virtual void DoEndWriteTopLevelEntry( const wxString &name );
54
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 );
58
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 );
63
64 // writes a simple property in the stream format
65 virtual void DoWriteSimpleType( const wxAny &value );
66
67 // start of writing a complex property into the stream (
68 virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo );
69
70 // end of writing a complex property into the stream
71 virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo );
72
73 virtual void DoBeginWriteElement();
74 virtual void DoEndWriteElement();
75
76 // insert an object reference to an already written object
77 virtual void DoWriteRepeatedObject( int objectID );
78
79 // insert a null reference
80 virtual void DoWriteNullObject();
81
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 );
87
88private:
89 struct wxObjectXmlWriterInternal;
90 wxObjectXmlWriterInternal* m_data;
91};
92
93/*
94wxObjectXmlReader handles streaming in a class from XML
95*/
96
97class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader
98{
99public:
100 wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; }
101 virtual ~wxObjectXmlReader() {}
102
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
105
106 virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback );
107
108private:
109 int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks);
110
111 // read the content of this node (simple type) and return the corresponding value
112 wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type );
113
114 wxXmlNode * m_parent;
115};
116
117#endif // wxUSE_EXTENDED_RTTI
118
119#endif