2003-07-28 16:44:57 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/xtistrm.h
|
|
|
|
// Purpose: streaming runtime metadata information (extended class info)
|
|
|
|
// Author: Stefan Csomor
|
2004-09-24 10:32:35 -04:00
|
|
|
// Modified by:
|
2003-07-28 16:44:57 -04:00
|
|
|
// Created: 27/07/03
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2003 Stefan Csomor
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-07-28 16:44:57 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_XTISTRMH__
|
|
|
|
#define _WX_XTISTRMH__
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#include "wx/defs.h"
|
2003-07-28 16:44:57 -04:00
|
|
|
|
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
#include "wx/object.h"
|
|
|
|
|
|
|
|
const int wxInvalidObjectID = -2;
|
|
|
|
const int wxNullObjectID = -3;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2003-07-28 16:44:57 -04:00
|
|
|
// Filer contains the interfaces for streaming objects in and out of XML,
|
|
|
|
// rendering them either to objects in memory, or to code. Note: We
|
|
|
|
// consider the process of generating code to be one of *depersisting* the
|
|
|
|
// object from xml, *not* of persisting the object to code from an object
|
2011-01-07 12:22:59 -05:00
|
|
|
// in memory. This distinction can be confusing, and should be kept
|
2003-07-28 16:44:57 -04:00
|
|
|
// in mind when looking at the property streamers and callback interfaces
|
|
|
|
// listed below.
|
|
|
|
|
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
2011-01-07 12:22:59 -05:00
|
|
|
// wxObjectWriterCallback
|
2003-08-13 12:59:46 -04:00
|
|
|
//
|
|
|
|
// This class will be asked during the streaming-out process about every single
|
|
|
|
// property or object instance. It can veto streaming out by returning false
|
|
|
|
// or modify the value before it is streamed-out.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2012-01-19 04:00:29 -05:00
|
|
|
/*
|
|
|
|
class WXDLLIMPEXP_BASE wxClassInfo;
|
|
|
|
class WXDLLIMPEXP_BASE wxAnyList;
|
|
|
|
class WXDLLIMPEXP_BASE wxPropertyInfo;
|
|
|
|
class WXDLLIMPEXP_BASE wxAny;
|
|
|
|
class WXDLLIMPEXP_BASE wxHandlerInfo;
|
|
|
|
*/
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectWriter;
|
|
|
|
class WXDLLIMPEXP_BASE wxObjectReader;
|
2003-08-13 12:59:46 -04:00
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectWriterCallback
|
2003-08-08 16:35:19 -04:00
|
|
|
{
|
2011-01-04 03:31:53 -05:00
|
|
|
public:
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual ~wxObjectWriterCallback() {}
|
2007-04-11 06:32:01 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// will be called before an object is written, may veto by returning false
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual bool BeforeWriteObject( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxClassInfo *WXUNUSED(classInfo),
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxStringToAnyHashMap &WXUNUSED(metadata))
|
2011-01-04 03:31:53 -05:00
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// will be called after this object has been written, may be
|
|
|
|
// needed for adjusting stacks
|
|
|
|
virtual void AfterWriteObject( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxClassInfo *WXUNUSED(classInfo) )
|
|
|
|
{}
|
|
|
|
|
|
|
|
// will be called before a property gets written, may change the value,
|
|
|
|
// eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
|
|
|
|
// or veto writing that property at all by returning false
|
|
|
|
virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxPropertyInfo *WXUNUSED(propInfo),
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAny &WXUNUSED(value) )
|
2011-01-04 03:31:53 -05:00
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// will be called before a property gets written, may change the value,
|
|
|
|
// eg replace a concrete wxSize by wxSize( wxDefaultCoord, wxDefaultCoord )
|
|
|
|
// or veto writing that property at all by returning false
|
|
|
|
virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxPropertyInfo *WXUNUSED(propInfo),
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAnyList &WXUNUSED(value) )
|
2011-01-04 03:31:53 -05:00
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
// will be called after a property has been written out, may be needed
|
|
|
|
// for adjusting stacks
|
|
|
|
virtual void AfterWriteProperty( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxPropertyInfo *WXUNUSED(propInfo) )
|
|
|
|
{}
|
2003-08-13 12:59:46 -04:00
|
|
|
|
|
|
|
// will be called before this delegate gets written
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual bool BeforeWriteDelegate( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxClassInfo* WXUNUSED(classInfo),
|
|
|
|
const wxPropertyInfo *WXUNUSED(propInfo),
|
|
|
|
const wxObject *&WXUNUSED(eventSink),
|
|
|
|
const wxHandlerInfo* &WXUNUSED(handlerInfo) )
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
virtual void AfterWriteDelegate( wxObjectWriter *WXUNUSED(writer),
|
|
|
|
const wxObject *WXUNUSED(object),
|
|
|
|
const wxClassInfo* WXUNUSED(classInfo),
|
|
|
|
const wxPropertyInfo *WXUNUSED(propInfo),
|
|
|
|
const wxObject *&WXUNUSED(eventSink),
|
|
|
|
const wxHandlerInfo* &WXUNUSED(handlerInfo) )
|
|
|
|
{ }
|
|
|
|
};
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectWriterFunctor: public wxObjectFunctor
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectWriter: public wxObject
|
2003-08-08 16:35:19 -04:00
|
|
|
{
|
2011-01-07 12:22:59 -05:00
|
|
|
friend class wxObjectWriterFunctor;
|
2011-01-04 03:31:53 -05:00
|
|
|
public:
|
|
|
|
wxObjectWriter();
|
|
|
|
virtual ~wxObjectWriter();
|
2003-08-08 16:35:19 -04:00
|
|
|
|
|
|
|
// with this call you start writing out a new top-level object
|
2011-01-04 03:31:53 -05:00
|
|
|
void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxObjectWriterCallback *writercallback, const wxString &name,
|
|
|
|
const wxStringToAnyHashMap &metadata);
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// Managing the object identity table a.k.a context
|
|
|
|
//
|
2011-01-04 03:31:53 -05:00
|
|
|
// these methods make sure that no object gets written twice,
|
|
|
|
// because sometimes multiple calls to the WriteObject will be
|
|
|
|
// made without wanting to have duplicate objects written, the
|
|
|
|
// object identity table will be reset manually
|
|
|
|
virtual void ClearObjectContext();
|
2003-08-24 08:22:08 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// gets the object Id for a passed in object in the context
|
2011-01-04 03:31:53 -05:00
|
|
|
int GetObjectID(const wxObject *obj);
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// returns true if this object has already been written in this context
|
2011-01-04 03:31:53 -05:00
|
|
|
bool IsObjectKnown( const wxObject *obj );
|
2003-08-08 16:35:19 -04:00
|
|
|
|
|
|
|
//
|
|
|
|
// streaming callbacks
|
|
|
|
//
|
|
|
|
// these callbacks really write out the values in the stream format
|
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// 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 ) = 0;
|
2003-08-13 12:59:46 -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 ) = 0;
|
2003-08-13 12:59:46 -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, const wxClassInfo *classInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
int objectID, const wxStringToAnyHashMap &metadata ) = 0;
|
2003-08-08 16:35:19 -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 ) = 0;
|
2003-08-13 12:59:46 -04:00
|
|
|
|
|
|
|
// writes a simple property in the stream format
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual void DoWriteSimpleType( const wxAny &value ) = 0;
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-08-13 12:59:46 -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 ) = 0;
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// end of writing a complex property into the stream
|
|
|
|
virtual void DoEndWriteProperty( const wxPropertyInfo *propInfo ) = 0;
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoBeginWriteElement() = 0;
|
|
|
|
virtual void DoEndWriteElement() = 0;
|
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 ) = 0;
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-08-13 12:59:46 -04:00
|
|
|
// insert a null reference
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void DoWriteNullObject() = 0;
|
2003-08-08 16:35:19 -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 ) = 0;
|
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
void WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
|
|
|
wxObjectWriterCallback *writercallback, bool isEmbedded, const wxStringToAnyHashMap &metadata );
|
|
|
|
|
|
|
|
protected:
|
2011-01-04 03:31:53 -05:00
|
|
|
struct wxObjectWriterInternal;
|
|
|
|
wxObjectWriterInternal* m_data;
|
|
|
|
|
|
|
|
struct wxObjectWriterInternalPropertiesData;
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
void WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxObjectWriterCallback *writercallback,
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectWriterInternalPropertiesData * data );
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
void WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback,
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectWriterInternalPropertiesData *data );
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
|
|
|
|
void FindConnectEntry(const wxEvtHandler * evSource,
|
|
|
|
const wxEventSourceTypeInfo* dti, const wxObject* &sink,
|
|
|
|
const wxHandlerInfo *&handler);
|
|
|
|
};
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2003-07-28 16:44:57 -04:00
|
|
|
|
|
|
|
/*
|
2003-08-05 13:24:02 -04:00
|
|
|
Streaming callbacks for depersisting XML to code, or running objects
|
2003-07-28 16:44:57 -04:00
|
|
|
*/
|
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectReaderCallback;
|
2003-07-28 16:44:57 -04:00
|
|
|
|
|
|
|
/*
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObjectReader handles streaming in a class from a arbitrary format.
|
2011-01-07 12:22:59 -05:00
|
|
|
While walking through it issues calls out to interfaces to readercallback
|
2011-01-04 03:31:53 -05:00
|
|
|
the guts from the underlying storage format.
|
2003-07-28 16:44:57 -04:00
|
|
|
*/
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectReader: public wxObject
|
2003-07-28 16:44:57 -04:00
|
|
|
{
|
2011-01-04 03:31:53 -05:00
|
|
|
public:
|
|
|
|
wxObjectReader();
|
|
|
|
virtual ~wxObjectReader();
|
2003-08-08 16:35:19 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// the only thing wxObjectReader knows about is the class info by object ID
|
|
|
|
wxClassInfo *GetObjectClassInfo(int objectID);
|
|
|
|
bool HasObjectClassInfo( int objectID );
|
2003-08-05 13:24:02 -04:00
|
|
|
void SetObjectClassInfo(int objectID, wxClassInfo* classInfo);
|
|
|
|
|
2004-09-24 10:32:35 -04:00
|
|
|
// Reads the component the reader is pointed at from the underlying format.
|
2003-08-05 13:24:02 -04:00
|
|
|
// The return value is the root object ID, which can
|
|
|
|
// then be used to ask the depersister about that object
|
2003-09-04 12:18:07 -04:00
|
|
|
// if there was a problem you will get back wxInvalidObjectID and the current
|
|
|
|
// error log will carry the problems encoutered
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
private:
|
|
|
|
struct wxObjectReaderInternal;
|
|
|
|
wxObjectReaderInternal *m_data;
|
|
|
|
};
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// This abstract class matches the allocate-init/create model of creation of objects.
|
|
|
|
// At runtime, these will create actual instances, and manipulate them.
|
|
|
|
// When generating code, these will just create statements of C++
|
|
|
|
// code to create the objects.
|
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectReaderCallback
|
2003-07-28 16:44:57 -04:00
|
|
|
{
|
2011-01-04 03:31:53 -05:00
|
|
|
public:
|
2011-01-07 12:22:59 -05:00
|
|
|
virtual ~wxObjectReaderCallback() {}
|
2007-04-11 06:32:01 -04:00
|
|
|
|
2003-08-05 13:24:02 -04:00
|
|
|
// allocate the new object on the heap, that object will have the passed in ID
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2003-08-14 14:03:06 -04:00
|
|
|
// initialize the already allocated object having the ID objectID with the Create method
|
2003-08-05 13:24:02 -04:00
|
|
|
// creation parameters which are objects are having their Ids passed in objectIDValues
|
|
|
|
// having objectId <> wxInvalidObjectID
|
|
|
|
|
2003-08-14 14:03:06 -04:00
|
|
|
virtual void CreateObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxAny *VariantValues,
|
2011-01-04 03:31:53 -05:00
|
|
|
int *objectIDValues,
|
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// construct the new object on the heap, that object will have the passed in ID
|
|
|
|
// (for objects that don't support allocate-create type of creation)
|
|
|
|
// creation parameters which are objects are having their Ids passed in
|
|
|
|
// objectIDValues having objectId <> wxInvalidObjectID
|
2003-08-25 19:29:55 -04:00
|
|
|
|
|
|
|
virtual void ConstructObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxAny *VariantValues,
|
2011-01-04 03:31:53 -05:00
|
|
|
int *objectIDValues,
|
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata) = 0;
|
2011-01-04 03:31:53 -05:00
|
|
|
|
|
|
|
// destroy the heap-allocated object having the ID objectID, this may be used
|
|
|
|
// if an object is embedded in another object and set via value semantics,
|
|
|
|
// so the intermediate object can be destroyed after safely
|
2003-08-14 14:03:06 -04:00
|
|
|
virtual void DestroyObject(int objectID, wxClassInfo *classInfo) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// set the corresponding property
|
2003-08-14 14:03:06 -04:00
|
|
|
virtual void SetProperty(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAny &VariantValue) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
2003-08-14 14:03:06 -04:00
|
|
|
virtual void SetPropertyAsObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2003-08-05 13:24:02 -04:00
|
|
|
int valueObjectId) = 0;
|
|
|
|
|
2003-08-14 14:03:06 -04:00
|
|
|
// adds an element to a property collection
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void AddToPropertyCollection( int objectID,
|
2003-08-14 14:03:06 -04:00
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAny &VariantValue) = 0;
|
2003-08-14 14:03:06 -04:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
|
|
|
virtual void AddToPropertyCollectionAsObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2003-08-14 14:03:06 -04:00
|
|
|
int valueObjectId) = 0;
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// sets the corresponding event handler
|
2003-07-28 16:44:57 -04:00
|
|
|
virtual void SetConnect(int EventSourceObjectID,
|
2003-08-05 13:24:02 -04:00
|
|
|
const wxClassInfo *EventSourceClassInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo *delegateInfo,
|
|
|
|
const wxClassInfo *EventSinkClassInfo,
|
|
|
|
const wxHandlerInfo* handlerInfo,
|
2003-08-05 13:24:02 -04:00
|
|
|
int EventSinkObjectID ) = 0;
|
2003-07-28 16:44:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2011-01-07 12:22:59 -05:00
|
|
|
wxObjectRuntimeReaderCallback implements the callbacks that will bring back
|
|
|
|
an object into a life memory instance
|
2003-07-28 16:44:57 -04:00
|
|
|
*/
|
2003-08-24 11:22:07 -04:00
|
|
|
|
2011-01-07 12:22:59 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectReaderCallback
|
2003-07-28 16:44:57 -04:00
|
|
|
{
|
2011-01-04 03:31:53 -05:00
|
|
|
struct wxObjectRuntimeReaderCallbackInternal;
|
|
|
|
wxObjectRuntimeReaderCallbackInternal * m_data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxObjectRuntimeReaderCallback();
|
|
|
|
virtual ~wxObjectRuntimeReaderCallback();
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2004-09-24 10:32:35 -04:00
|
|
|
// returns the object having the corresponding ID fully constructed
|
2011-01-04 03:31:53 -05:00
|
|
|
wxObject *GetObject(int objectID);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// allocate the new object on the heap, that object will have the passed in ID
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// initialize the already allocated object having the ID objectID with
|
|
|
|
// the Create method creation parameters which are objects are having
|
|
|
|
// their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2003-08-14 14:03:06 -04:00
|
|
|
virtual void CreateObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxAny *VariantValues,
|
2003-08-05 13:24:02 -04:00
|
|
|
int *objectIDValues,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata
|
2011-01-04 03:31:53 -05:00
|
|
|
);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// construct the new object on the heap, that object will have the
|
|
|
|
// passed in ID (for objects that don't support allocate-create type of
|
|
|
|
// creation) creation parameters which are objects are having their Ids
|
|
|
|
// passed in objectIDValues having objectId <> wxInvalidObjectID
|
2003-08-25 19:29:55 -04:00
|
|
|
|
|
|
|
virtual void ConstructObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxAny *VariantValues,
|
2003-08-05 13:24:02 -04:00
|
|
|
int *objectIDValues,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 12:22:59 -05:00
|
|
|
wxStringToAnyHashMap &metadata);
|
2003-08-25 19:29:55 -04:00
|
|
|
|
2011-01-04 03:31:53 -05:00
|
|
|
// destroy the heap-allocated object having the ID objectID, this may be
|
|
|
|
// used if an object is embedded in another object and set via value semantics,
|
|
|
|
// so the intermediate object can be destroyed after safely
|
|
|
|
virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// set the corresponding property
|
|
|
|
virtual void SetProperty(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAny &variantValue);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
|
|
|
virtual void SetPropertyAsObject(int objectId,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
|
|
|
int valueObjectId);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
2003-08-14 14:03:06 -04:00
|
|
|
// adds an element to a property collection
|
2011-01-04 03:31:53 -05:00
|
|
|
virtual void AddToPropertyCollection( int objectID,
|
2003-08-14 14:03:06 -04:00
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 12:22:59 -05:00
|
|
|
const wxAny &VariantValue);
|
2003-08-14 14:03:06 -04:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
|
|
|
virtual void AddToPropertyCollectionAsObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo* propertyInfo,
|
|
|
|
int valueObjectId);
|
2003-08-05 13:24:02 -04:00
|
|
|
|
|
|
|
// sets the corresponding event handler
|
|
|
|
virtual void SetConnect(int eventSourceObjectID,
|
|
|
|
const wxClassInfo *eventSourceClassInfo,
|
2011-01-04 03:31:53 -05:00
|
|
|
const wxPropertyInfo *delegateInfo,
|
|
|
|
const wxClassInfo *eventSinkClassInfo,
|
|
|
|
const wxHandlerInfo* handlerInfo,
|
|
|
|
int eventSinkObjectID );
|
2003-07-28 16:44:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_EXTENDED_RTTI
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#endif
|