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