X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2abce5157d8bb5fb7f7e8712399b63ba603254bb..b6a20a20d010d643e52914f51aa0700df0da925f:/include/wx/xtistrm.h diff --git a/include/wx/xtistrm.h b/include/wx/xtistrm.h index 05205969c1..8289f676c9 100644 --- a/include/wx/xtistrm.h +++ b/include/wx/xtistrm.h @@ -21,7 +21,7 @@ #if wxUSE_EXTENDED_RTTI const int wxInvalidObjectID = -2 ; -const int wxNullObjectID = -1 ; +const int wxNullObjectID = -3 ; // Filer contains the interfaces for streaming objects in and out of XML, // rendering them either to objects in memory, or to code. Note: We @@ -43,10 +43,10 @@ Main interfaces for streaming out objects. // or modify the value before it is streamed-out. // ---------------------------------------------------------------------------- -class wxWriter ; -class wxReader ; +class WXDLLIMPEXP_BASE wxWriter ; +class WXDLLIMPEXP_BASE wxReader ; -class wxPersister +class WXDLLIMPEXP_BASE wxPersister { public : // will be called before an object is written, may veto by returning false @@ -57,11 +57,11 @@ public : // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( -1 , -1 ) or veto // writing that property at all by returning false - virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariant &WXUNUSED(value) ) { return true ; } + virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariant &WXUNUSED(value) ) { return true ; } // will be called before a property gets written, may change the value , eg replace a concrete wxSize by wxSize( -1 , -1 ) or veto // writing that property at all by returning false - virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariantArray &WXUNUSED(value) ) { return true ; } + virtual bool BeforeWriteProperty( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object), const wxPropertyInfo *WXUNUSED(propInfo) , wxxVariantArray &WXUNUSED(value) ) { return true ; } // will be called after a property has been written out, may be needed for adjusting stacks virtual void AfterWriteProperty( wxWriter *WXUNUSED(writer) , const wxPropertyInfo *WXUNUSED(propInfo) ) {} @@ -74,7 +74,7 @@ public : const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { } } ; -class wxWriter : public wxObject +class WXDLLIMPEXP_BASE wxWriter : public wxObject { public : wxWriter() ; @@ -152,14 +152,14 @@ private : Streaming callbacks for depersisting XML to code, or running objects */ -class wxDepersister ; +class WXDLLIMPEXP_BASE wxDepersister ; /* wxReader handles streaming in a class from a arbitrary format. While walking through it issues calls out to interfaces to depersist the guts from the underlying storage format. */ -class wxReader : public wxObject +class WXDLLIMPEXP_BASE wxReader : public wxObject { public : wxReader() ; @@ -173,6 +173,8 @@ public : // Reads the component the reader is pointed at from the underlying format. // The return value is the root object ID, which can // 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 , wxDepersister *depersist ) = 0 ; private : @@ -185,7 +187,7 @@ private : // When generating code, these will just create statements of C++ // code to create the objects. -class wxDepersister +class WXDLLIMPEXP_BASE wxDepersister { public : // allocate the new object on the heap, that object will have the passed in ID @@ -203,6 +205,19 @@ public : const wxClassInfo **objectClassInfos , wxxVariantArray &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) + // creation parameters which are objects are having their Ids passed in objectIDValues + // having objectId <> wxInvalidObjectID + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &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, so the intermediate // object can be destroyed after safely @@ -235,7 +250,7 @@ public : // sets the corresponding event handler virtual void SetConnect(int EventSourceObjectID, const wxClassInfo *EventSourceClassInfo, - const wxDelegateTypeInfo *delegateInfo , + const wxPropertyInfo *delegateInfo , const wxClassInfo *EventSinkClassInfo , const wxHandlerInfo* handlerInfo , int EventSinkObjectID ) = 0; @@ -246,13 +261,14 @@ wxRuntimeDepersister 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. */ -class wxRuntimeDepersister : public wxDepersister + +class WXDLLIMPEXP_BASE wxRuntimeDepersister : public wxDepersister { struct wxRuntimeDepersisterInternal ; wxRuntimeDepersisterInternal * m_data ; public : - wxRuntimeDepersister() ; - ~wxRuntimeDepersister() ; + wxRuntimeDepersister(); + virtual ~wxRuntimeDepersister(); // returns the object having the corresponding ID fully constructed wxObject *GetObject(int objectID) ; @@ -274,6 +290,19 @@ public : wxxVariantArray &metadata ) ; + // 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 + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &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, so the intermediate // object can be destroyed after safely @@ -306,7 +335,7 @@ public : // sets the corresponding event handler virtual void SetConnect(int eventSourceObjectID, const wxClassInfo *eventSourceClassInfo, - const wxDelegateTypeInfo *delegateInfo , + const wxPropertyInfo *delegateInfo , const wxClassInfo *eventSinkClassInfo , const wxHandlerInfo* handlerInfo , int eventSinkObjectID ) ; @@ -314,12 +343,13 @@ public : /* wxDepersisterCode implements the callbacks that will depersist -an object into a C++ initialization function. +an object into a C++ initialization function. this will move to +a utility lib soon */ -class wxTextOutputStream ; +class WXDLLIMPEXP_BASE wxTextOutputStream ; -class wxCodeDepersister : public wxDepersister +class WXDLLIMPEXP_BASE wxCodeDepersister : public wxDepersister { private : struct wxCodeDepersisterInternal ; @@ -327,8 +357,8 @@ private : wxTextOutputStream *m_fp; wxString ValueAsCode( const wxxVariant ¶m ) ; public: - wxCodeDepersister(wxTextOutputStream *out) ; - ~wxCodeDepersister() ; + wxCodeDepersister(wxTextOutputStream *out); + virtual ~wxCodeDepersister(); // allocate the new object on the heap, that object will have the passed in ID virtual void AllocateObject(int objectID, wxClassInfo *classInfo , @@ -347,6 +377,19 @@ public: wxxVariantArray &metadata ) ; + // 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 + + virtual void ConstructObject(int objectID, + const wxClassInfo *classInfo, + int paramCount, + wxxVariant *VariantValues , + int *objectIDValues , + const wxClassInfo **objectClassInfos , + wxxVariantArray &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, so the intermediate // object can be destroyed after safely @@ -379,7 +422,7 @@ public: // sets the corresponding event handler virtual void SetConnect(int eventSourceObjectID, const wxClassInfo *eventSourceClassInfo, - const wxDelegateTypeInfo *delegateInfo , + const wxPropertyInfo *delegateInfo , const wxClassInfo *eventSinkClassInfo , const wxHandlerInfo* handlerInfo , int eventSinkObjectID ) ;