2011-01-05 01:56:36 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/xtistrm.h
|
|
|
|
// Purpose: streaming runtime metadata information (extended class info)
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 27/07/03
|
|
|
|
// Copyright: (c) 2003 Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _CODEDEPERSISTER_
|
|
|
|
#define _CODEDEPERSISTER_
|
|
|
|
|
2017-07-19 18:20:25 -04:00
|
|
|
#if wxUSE_EXTENDED_RTTI
|
|
|
|
|
2011-01-05 01:56:36 -05:00
|
|
|
#include "wx/defs.h"
|
2011-01-07 13:14:45 -05:00
|
|
|
#include "wx/sstream.h"
|
2011-01-05 01:56:36 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
wxObjectCodeReaderCallback implements the callbacks that will depersist
|
|
|
|
an object into a C++ initialization function.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_BASE wxTextOutputStream;
|
|
|
|
|
2011-01-07 13:14:45 -05:00
|
|
|
class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback
|
2011-01-05 01:56:36 -05:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
struct wxObjectCodeReaderCallbackInternal;
|
|
|
|
wxObjectCodeReaderCallbackInternal * m_data;
|
2011-01-07 13:14:45 -05:00
|
|
|
wxString& m_headerincludes;
|
|
|
|
wxString& m_source;
|
2011-01-05 01:56:36 -05:00
|
|
|
|
|
|
|
public:
|
2011-01-07 13:14:45 -05:00
|
|
|
wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source);
|
2011-01-05 01:56:36 -05:00
|
|
|
virtual ~wxObjectCodeReaderCallback();
|
|
|
|
|
|
|
|
// allocate the new object on the heap, that object will have the passed in ID
|
|
|
|
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
2011-01-07 13:14:45 -05:00
|
|
|
wxStringToAnyHashMap &metadata);
|
2011-01-05 01:56:36 -05:00
|
|
|
|
2019-01-30 11:28:08 -05:00
|
|
|
// initialize the already allocated object having the ID objectID
|
|
|
|
// with the Create method creation parameters which are objects are
|
2011-01-05 01:56:36 -05:00
|
|
|
// having their Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
|
|
|
|
|
|
|
virtual void CreateObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 13:14:45 -05:00
|
|
|
wxAny *variantValues,
|
2011-01-05 01:56:36 -05:00
|
|
|
int *objectIDValues,
|
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 13:14:45 -05:00
|
|
|
wxStringToAnyHashMap &metadata
|
2011-01-05 01:56:36 -05:00
|
|
|
);
|
|
|
|
|
2019-01-30 11:28:08 -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
|
2011-01-05 01:56:36 -05:00
|
|
|
// Ids passed in objectIDValues having objectId <> wxInvalidObjectID
|
|
|
|
|
|
|
|
virtual void ConstructObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
int paramCount,
|
2011-01-07 13:14:45 -05:00
|
|
|
wxAny *VariantValues,
|
2011-01-05 01:56:36 -05:00
|
|
|
int *objectIDValues,
|
|
|
|
const wxClassInfo **objectClassInfos,
|
2011-01-07 13:14:45 -05:00
|
|
|
wxStringToAnyHashMap &metadata);
|
2011-01-05 01:56:36 -05:00
|
|
|
|
2019-01-30 11:28:08 -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
|
2011-01-05 01:56:36 -05:00
|
|
|
// semantics, so the intermediate object can be destroyed after safely
|
|
|
|
virtual void DestroyObject(int objectID, wxClassInfo *classInfo);
|
|
|
|
|
|
|
|
// set the corresponding property
|
|
|
|
virtual void SetProperty(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 13:14:45 -05:00
|
|
|
const wxAny &variantValue);
|
2011-01-05 01:56:36 -05:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
|
|
|
virtual void SetPropertyAsObject(int objectId,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
const wxPropertyInfo* propertyInfo,
|
|
|
|
int valueObjectId);
|
|
|
|
|
|
|
|
// adds an element to a property collection
|
|
|
|
virtual void AddToPropertyCollection( int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
const wxPropertyInfo* propertyInfo,
|
2011-01-07 13:14:45 -05:00
|
|
|
const wxAny &VariantValue);
|
2011-01-05 01:56:36 -05:00
|
|
|
|
|
|
|
// sets the corresponding property (value is an object)
|
|
|
|
virtual void AddToPropertyCollectionAsObject(int objectID,
|
|
|
|
const wxClassInfo *classInfo,
|
|
|
|
const wxPropertyInfo* propertyInfo,
|
|
|
|
int valueObjectId);
|
|
|
|
|
|
|
|
// sets the corresponding event handler
|
|
|
|
virtual void SetConnect(int eventSourceObjectID,
|
|
|
|
const wxClassInfo *eventSourceClassInfo,
|
|
|
|
const wxPropertyInfo *delegateInfo,
|
|
|
|
const wxClassInfo *eventSinkClassInfo,
|
|
|
|
const wxHandlerInfo* handlerInfo,
|
|
|
|
int eventSinkObjectID );
|
2011-01-07 13:14:45 -05:00
|
|
|
|
|
|
|
// utility function exposed for callbacks
|
|
|
|
wxString ValueAsCode( const wxAny ¶m );
|
2011-01-05 01:56:36 -05:00
|
|
|
};
|
|
|
|
|
2017-07-19 18:20:25 -04:00
|
|
|
#endif // wxUSE_EXTENDED_RTTI
|
|
|
|
|
2011-01-05 01:56:36 -05:00
|
|
|
#endif
|