2003-08-23 15:40:04 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/xtixml.h
|
|
|
|
// Purpose: xml streaming runtime metadata information (extended class info)
|
|
|
|
// Author: Stefan Csomor
|
2004-09-24 10:32:35 -04:00
|
|
|
// Modified by:
|
2003-08-23 15:40:04 -04:00
|
|
|
// Created: 27/07/03
|
|
|
|
// Copyright: (c) 2003 Stefan Csomor
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-08-23 15:40:04 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_XTIXMLH__
|
|
|
|
#define _WX_XTIXMLH__
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#include "wx/defs.h"
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#include "wx/string.h"
|
2003-08-23 15:40:04 -04:00
|
|
|
#include "wx/xtistrm.h"
|
|
|
|
|
2012-01-19 04:45:49 -05:00
|
|
|
/*
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_XML wxXmlNode;
|
|
|
|
class WXDLLIMPEXP_BASE wxPropertyInfo;
|
|
|
|
class WXDLLIMPEXP_BASE wxObject;
|
|
|
|
class WXDLLIMPEXP_BASE wxClassInfo;
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxAnyList;
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxHandlerInfo;
|
|
|
|
class WXDLLIMPEXP_BASE wxObjectWriterCallback;
|
2012-01-19 04:45:49 -05:00
|
|
|
*/
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_XML wxObjectXmlWriter: public wxObjectWriter
|
2003-08-23 15:40:04 -04:00
|
|
|
{
|
2011-01-04 03:31:53 -05:00
|
|
|
public:
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectXmlWriter( wxXmlNode * parent );
|
|
|
|
virtual ~wxObjectXmlWriter();
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// streaming callbacks
|
|
|
|
//
|
|
|
|
// these callbacks really write out the values in the stream format
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// streaming callbacks
|
|
|
|
//
|
|
|
|
// these callbacks really write out the values in the stream format
|
|
|
|
|
|
|
|
// begins writing out a new toplevel entry which has the indicated unique name
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoBeginWriteTopLevelEntry( const wxString &name );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// ends writing out a new toplevel entry which has the indicated unique name
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoEndWriteTopLevelEntry( const wxString &name );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// start of writing an object having the passed in ID
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoBeginWriteObject(const wxObject *object,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxClassInfo *classInfo, int objectID, const wxStringToAnyHashMap &metadata );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// end of writing an toplevel object name param is used for unique
|
|
|
|
// identification within the container
|
|
|
|
virtual void DoEndWriteObject(const wxObject *object,
|
|
|
|
const wxClassInfo *classInfo, int objectID );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// writes a simple property in the stream format
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual void DoWriteSimpleType( const wxAny &value );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// start of writing a complex property into the stream (
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// end of writing a complex property into the stream
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoBeginWriteElement();
|
|
|
|
virtual void DoEndWriteElement();
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2004-09-24 10:32:35 -04:00
|
|
|
// insert an object reference to an already written object
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoWriteRepeatedObject( int objectID );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// insert a null reference
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoWriteNullObject();
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// writes a delegate in the stream format
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoWriteDelegate( const wxObject *object,
|
|
|
|
const wxClassInfo* classInfo, const wxPropertyInfo *propInfo,
|
|
|
|
const wxObject *eventSink, int sinkObjectID,
|
|
|
|
const wxClassInfo* eventSinkClassInfo, const wxHandlerInfo* handlerIndo );
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct wxObjectXmlWriterInternal;
|
|
|
|
wxObjectXmlWriterInternal* m_data;
|
|
|
|
};
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
/*
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectXmlReader handles streaming in a class from XML
|
2003-08-23 15:40:04 -04:00
|
|
|
*/
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_XML wxObjectXmlReader: public wxObjectReader
|
2003-08-23 15:40:04 -04:00
|
|
|
{
|
|
|
|
public:
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectXmlReader(wxXmlNode *parent) { m_parent = parent; }
|
|
|
|
virtual ~wxObjectXmlReader() {}
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// Reads a component from XML. The return value is the root object ID, which can
|
2011-01-07 12:22:59 -05:00
|
|
|
// then be used to ask the readercallback about that object
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
private:
|
2011-01-07 12:22:59 -05:00
|
|
|
int ReadComponent(wxXmlNode *parent, wxObjectReaderCallback *callbacks);
|
2003-08-23 15:40:04 -04:00
|
|
|
|
|
|
|
// read the content of this node (simple type) and return the corresponding value
|
2011-01-07 12:22:59 -05:00
|
|
|
wxAny ReadValue(wxXmlNode *Node, const wxTypeInfo *type );
|
2003-08-23 15:40:04 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
wxXmlNode * m_parent;
|
2003-08-23 15:40:04 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_EXTENDED_RTTI
|
|
|
|
|
|
|
|
#endif
|