| 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/wx.h" |
| 16 | |
| 17 | #if wxUSE_EXTENDED_RTTI |
| 18 | |
| 19 | #include "wx/xtistrm.h" |
| 20 | |
| 21 | class WXDLLIMPEXP_XML wxXmlNode ; |
| 22 | |
| 23 | class WXDLLIMPEXP_XML wxXmlWriter : public wxWriter |
| 24 | { |
| 25 | public : |
| 26 | |
| 27 | wxXmlWriter( wxXmlNode * parent ) ; |
| 28 | ~wxXmlWriter() ; |
| 29 | |
| 30 | // |
| 31 | // streaming callbacks |
| 32 | // |
| 33 | // these callbacks really write out the values in the stream format |
| 34 | // |
| 35 | |
| 36 | // |
| 37 | // streaming callbacks |
| 38 | // |
| 39 | // these callbacks really write out the values in the stream format |
| 40 | |
| 41 | // begins writing out a new toplevel entry which has the indicated unique name |
| 42 | virtual void DoBeginWriteTopLevelEntry( const wxString &name ) ; |
| 43 | |
| 44 | // ends writing out a new toplevel entry which has the indicated unique name |
| 45 | virtual void DoEndWriteTopLevelEntry( const wxString &name ) ; |
| 46 | |
| 47 | // start of writing an object having the passed in ID |
| 48 | virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata ) ; |
| 49 | |
| 50 | // end of writing an toplevel object name param is used for unique identification within the container |
| 51 | virtual void DoEndWriteObject(const wxObject *object, const wxClassInfo *classInfo, int objectID ) ; |
| 52 | |
| 53 | // writes a simple property in the stream format |
| 54 | virtual void DoWriteSimpleType( wxxVariant &value ) ; |
| 55 | |
| 56 | // start of writing a complex property into the stream ( |
| 57 | virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) ; |
| 58 | |
| 59 | // end of writing a complex property into the stream |
| 60 | virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) ; |
| 61 | |
| 62 | virtual void DoBeginWriteElement() ; |
| 63 | virtual void DoEndWriteElement() ; |
| 64 | |
| 65 | // insert an object reference to an already written object |
| 66 | virtual void DoWriteRepeatedObject( int objectID ) ; |
| 67 | |
| 68 | // insert a null reference |
| 69 | virtual void DoWriteNullObject() ; |
| 70 | |
| 71 | // writes a delegate in the stream format |
| 72 | virtual void DoWriteDelegate( const wxObject *object, const wxClassInfo* classInfo , const wxPropertyInfo *propInfo , |
| 73 | const wxObject *eventSink , int sinkObjectID , const wxClassInfo* eventSinkClassInfo , const wxHandlerInfo* handlerIndo ) ; |
| 74 | private : |
| 75 | struct wxXmlWriterInternal ; |
| 76 | wxXmlWriterInternal* m_data ; |
| 77 | } ; |
| 78 | |
| 79 | /* |
| 80 | wxXmlReader handles streaming in a class from XML |
| 81 | */ |
| 82 | |
| 83 | class WXDLLIMPEXP_XML wxXmlReader : public wxReader |
| 84 | { |
| 85 | public: |
| 86 | wxXmlReader(wxXmlNode *parent) { m_parent = parent ; } |
| 87 | ~wxXmlReader() {} |
| 88 | |
| 89 | // Reads a component from XML. The return value is the root object ID, which can |
| 90 | // then be used to ask the depersister about that object |
| 91 | |
| 92 | virtual int ReadObject( const wxString &name , wxDepersister *depersist ) ; |
| 93 | |
| 94 | private : |
| 95 | int ReadComponent(wxXmlNode *parent, wxDepersister *callbacks); |
| 96 | |
| 97 | // read the content of this node (simple type) and return the corresponding value |
| 98 | wxxVariant ReadValue(wxXmlNode *Node, |
| 99 | const wxTypeInfo *type ); |
| 100 | |
| 101 | wxXmlNode * m_parent ; |
| 102 | }; |
| 103 | |
| 104 | #endif // wxUSE_EXTENDED_RTTI |
| 105 | |
| 106 | #endif |