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