X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/289532452089421ddadbd4726a8469511a19ab76..661698e54f2bc599dc1a961ffbae08ccdd6b9b97:/include/wx/xtistrm.h diff --git a/include/wx/xtistrm.h b/include/wx/xtistrm.h index acfce43942..0876b9d5f9 100644 --- a/include/wx/xtistrm.h +++ b/include/wx/xtistrm.h @@ -16,7 +16,6 @@ #if wxUSE_EXTENDED_RTTI -#include "wx/string.h" #include "wx/object.h" const int wxInvalidObjectID = -2; @@ -26,38 +25,40 @@ const int wxNullObjectID = -3; // 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 -// in memory. This distincation can be confusing, and should be kept +// in memory. This distinction can be confusing, and should be kept // in mind when looking at the property streamers and callback interfaces // listed below. // ---------------------------------------------------------------------------- -// wxObjectReaderCallback +// wxObjectWriterCallback // // 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. // ---------------------------------------------------------------------------- +/* + class WXDLLIMPEXP_BASE wxClassInfo; + class WXDLLIMPEXP_BASE wxAnyList; + class WXDLLIMPEXP_BASE wxPropertyInfo; + class WXDLLIMPEXP_BASE wxAny; + class WXDLLIMPEXP_BASE wxHandlerInfo; + */ + class WXDLLIMPEXP_BASE wxObjectWriter; class WXDLLIMPEXP_BASE wxObjectReader; -class WXDLLIMPEXP_BASE wxClassInfo; -class WXDLLIMPEXP_BASE wxVariantBaseArray; -class WXDLLIMPEXP_BASE wxPropertyInfo; -class WXDLLIMPEXP_BASE wxVariantBase; -class WXDLLIMPEXP_BASE wxObjectWriter; -class WXDLLIMPEXP_BASE wxHandlerInfo; -class WXDLLIMPEXP_BASE wxObjectReaderCallback +class WXDLLIMPEXP_BASE wxObjectWriterCallback { public: - virtual ~wxObjectReaderCallback() {} + virtual ~wxObjectWriterCallback() {} // will be called before an object is written, may veto by returning false virtual bool BeforeWriteObject( wxObjectWriter *WXUNUSED(writer), const wxObject *WXUNUSED(object), const wxClassInfo *WXUNUSED(classInfo), - wxVariantBaseArray &WXUNUSED(metadata)) + const wxStringToAnyHashMap &WXUNUSED(metadata)) { return true; } // will be called after this object has been written, may be @@ -73,7 +74,7 @@ public: virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer), const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo), - wxVariantBase &WXUNUSED(value) ) + const wxAny &WXUNUSED(value) ) { return true; } // will be called before a property gets written, may change the value, @@ -82,7 +83,7 @@ public: virtual bool BeforeWriteProperty( wxObjectWriter *WXUNUSED(writer), const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo), - wxVariantBaseArray &WXUNUSED(value) ) + const wxAnyList &WXUNUSED(value) ) { return true; } // will be called after a property has been written out, may be needed @@ -109,16 +110,21 @@ public: { } }; +class WXDLLIMPEXP_BASE wxObjectWriterFunctor: public wxObjectFunctor +{ +}; + class WXDLLIMPEXP_BASE wxObjectWriter: public wxObject { + friend class wxObjectWriterFunctor; public: wxObjectWriter(); virtual ~wxObjectWriter(); // with this call you start writing out a new top-level object void WriteObject(const wxObject *object, const wxClassInfo *classInfo, - wxObjectReaderCallback *persister, const wxString &name, - wxVariantBaseArray &WXUNUSED(metadata)); + wxObjectWriterCallback *writercallback, const wxString &name, + const wxStringToAnyHashMap &metadata); // Managing the object identity table a.k.a context // @@ -147,7 +153,7 @@ public: // start of writing an object having the passed in ID virtual void DoBeginWriteObject(const wxObject *object, const wxClassInfo *classInfo, - int objectID, wxVariantBaseArray &metadata ) = 0; + int objectID, const wxStringToAnyHashMap &metadata ) = 0; // end of writing an toplevel object name param is used for unique // identification within the container @@ -155,7 +161,7 @@ public: const wxClassInfo *classInfo, int objectID ) = 0; // writes a simple property in the stream format - virtual void DoWriteSimpleType( wxVariantBase &value ) = 0; + virtual void DoWriteSimpleType( const wxAny &value ) = 0; // start of writing a complex property into the stream ( virtual void DoBeginWriteProperty( const wxPropertyInfo *propInfo ) = 0; @@ -177,22 +183,23 @@ public: int sinkObjectID, const wxClassInfo* eventSinkClassInfo, const wxHandlerInfo* handlerIndo ) = 0; -private: + void WriteObject(const wxObject *object, const wxClassInfo *classInfo, + wxObjectWriterCallback *writercallback, bool isEmbedded, const wxStringToAnyHashMap &metadata ); + +protected: struct wxObjectWriterInternal; wxObjectWriterInternal* m_data; struct wxObjectWriterInternalPropertiesData; void WriteAllProperties( const wxObject * obj, const wxClassInfo* ci, - wxObjectReaderCallback *persister, + wxObjectWriterCallback *writercallback, wxObjectWriterInternalPropertiesData * data ); void WriteOneProperty( const wxObject *obj, const wxClassInfo* ci, - const wxPropertyInfo* pi, wxObjectReaderCallback *persister, + const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback, wxObjectWriterInternalPropertiesData *data ); - void WriteObject(const wxObject *object, const wxClassInfo *classInfo, - wxObjectReaderCallback *persister, bool isEmbedded, wxVariantBaseArray &metadata ); void FindConnectEntry(const wxEvtHandler * evSource, const wxEventSourceTypeInfo* dti, const wxObject* &sink, @@ -204,11 +211,11 @@ private: Streaming callbacks for depersisting XML to code, or running objects */ -class WXDLLIMPEXP_BASE wxObjectWriterCallback; +class WXDLLIMPEXP_BASE wxObjectReaderCallback; /* wxObjectReader handles streaming in a class from a arbitrary format. -While walking through it issues calls out to interfaces to depersist +While walking through it issues calls out to interfaces to readercallback the guts from the underlying storage format. */ @@ -228,7 +235,7 @@ public: // then be used to ask the depersister about that object // if there was a problem you will get back wxInvalidObjectID and the current // error log will carry the problems encoutered - virtual int ReadObject( const wxString &name, wxObjectWriterCallback *depersist ) = 0; + virtual int ReadObject( const wxString &name, wxObjectReaderCallback *readercallback ) = 0; private: struct wxObjectReaderInternal; @@ -240,14 +247,14 @@ private: // When generating code, these will just create statements of C++ // code to create the objects. -class WXDLLIMPEXP_BASE wxObjectWriterCallback +class WXDLLIMPEXP_BASE wxObjectReaderCallback { public: - virtual ~wxObjectWriterCallback() {} + virtual ~wxObjectReaderCallback() {} // allocate the new object on the heap, that object will have the passed in ID virtual void AllocateObject(int objectID, wxClassInfo *classInfo, - wxVariantBaseArray &metadata) = 0; + wxStringToAnyHashMap &metadata) = 0; // 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 @@ -256,10 +263,10 @@ public: virtual void CreateObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxVariantBase *VariantValues, + wxAny *VariantValues, int *objectIDValues, const wxClassInfo **objectClassInfos, - wxVariantBaseArray &metadata) = 0; + wxStringToAnyHashMap &metadata) = 0; // 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) @@ -269,10 +276,10 @@ public: virtual void ConstructObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxVariantBase *VariantValues, + wxAny *VariantValues, int *objectIDValues, const wxClassInfo **objectClassInfos, - wxVariantBaseArray &metadata) = 0; + wxStringToAnyHashMap &metadata) = 0; // 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, @@ -283,7 +290,7 @@ public: virtual void SetProperty(int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, - const wxVariantBase &VariantValue) = 0; + const wxAny &VariantValue) = 0; // sets the corresponding property (value is an object) virtual void SetPropertyAsObject(int objectID, @@ -295,7 +302,7 @@ public: virtual void AddToPropertyCollection( int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, - const wxVariantBase &VariantValue) = 0; + const wxAny &VariantValue) = 0; // sets the corresponding property (value is an object) virtual void AddToPropertyCollectionAsObject(int objectID, @@ -313,12 +320,11 @@ public: }; /* -wxObjectRuntimeReaderCallback implements the callbacks that will depersist -an object into a running memory image, as opposed to writing -C++ initialization code to bring the object to life. +wxObjectRuntimeReaderCallback implements the callbacks that will bring back +an object into a life memory instance */ -class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectWriterCallback +class WXDLLIMPEXP_BASE wxObjectRuntimeReaderCallback: public wxObjectReaderCallback { struct wxObjectRuntimeReaderCallbackInternal; wxObjectRuntimeReaderCallbackInternal * m_data; @@ -332,7 +338,7 @@ public: // allocate the new object on the heap, that object will have the passed in ID virtual void AllocateObject(int objectID, wxClassInfo *classInfo, - wxVariantBaseArray &metadata); + wxStringToAnyHashMap &metadata); // initialize the already allocated object having the ID objectID with // the Create method creation parameters which are objects are having @@ -341,10 +347,10 @@ public: virtual void CreateObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxVariantBase *VariantValues, + wxAny *VariantValues, int *objectIDValues, const wxClassInfo **objectClassInfos, - wxVariantBaseArray &metadata + wxStringToAnyHashMap &metadata ); // construct the new object on the heap, that object will have the @@ -355,10 +361,10 @@ public: virtual void ConstructObject(int objectID, const wxClassInfo *classInfo, int paramCount, - wxVariantBase *VariantValues, + wxAny *VariantValues, int *objectIDValues, const wxClassInfo **objectClassInfos, - wxVariantBaseArray &metadata); + wxStringToAnyHashMap &metadata); // 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, @@ -369,7 +375,7 @@ public: virtual void SetProperty(int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, - const wxVariantBase &variantValue); + const wxAny &variantValue); // sets the corresponding property (value is an object) virtual void SetPropertyAsObject(int objectId, @@ -381,7 +387,7 @@ public: virtual void AddToPropertyCollection( int objectID, const wxClassInfo *classInfo, const wxPropertyInfo* propertyInfo, - const wxVariantBase &VariantValue); + const wxAny &VariantValue); // sets the corresponding property (value is an object) virtual void AddToPropertyCollectionAsObject(int objectID,