]> git.saurik.com Git - wxWidgets.git/commitdiff
gcc /vc6 workarounds
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 24 Aug 2003 12:22:08 +0000 (12:22 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 24 Aug 2003 12:22:08 +0000 (12:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23161 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/xti.h
include/wx/xtistrm.h
src/common/xti.cpp
src/common/xtistrm.cpp
src/common/xtixml.cpp

index 35c6a4b20cb01168f39d4d43d7be7d42dd2a7ae7..e86bb790b4f116e37eebea0df670b47618950f3a 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        wx/xti.h
+// Name:        wx/xti.hG
 // Purpose:     runtime metadata information (extended class info)
 // Author:      Stefan Csomor
 // Modified by:
 #include "wx/arrstr.h"
 #include "wx/hashmap.h"
 
+// we will move this later to defs.h
+
+#if !wxCHECK_GCC_VERSION( 3 , 4 )
+#  define wxUSE_MEMBER_TEMPLATES 0
+#endif
+
+#ifdef _MSC_VER
+#  if _MSC_VER <= 1200
+#    define wxUSE_MEMBER_TEMPLATES 0
+#  endif
+#endif
+
+#ifndef wxUSE_MEMBER_TEMPLATES
+#define wxUSE_MEMBER_TEMPLATES 1
+#endif
+
+#if wxUSE_MEMBER_TEMPLATES
+#define WX_TEMPLATED_MEMBER_CALL( method , type ) method<type>()
+#define WX_TEMPLATED_MEMBER_FIX( type )
+#else
+#define WX_TEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL)
+#define WX_TEMPLATED_MEMBER_FIX( type ) type* =NULL
+#endif
+
 class WXDLLIMPEXP_BASE wxObject;
 class WXDLLIMPEXP_BASE wxClassInfo;
 class WXDLLIMPEXP_BASE wxHashTable;
@@ -217,10 +241,10 @@ void wxSetToString( wxString &s , const wxBitset<e> &data )
 } \
     void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \
     void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.Get<SetName>().to_ulong() ;} \
-template<> const wxTypeInfo* wxGetTypeInfo( SetName * ) \
+    template<> const wxTypeInfo* wxGetTypeInfo( SetName * ) \
 { \
     static wxEnumTypeInfo s_typeInfo(wxT_SET , &s_enumData##e , &wxToStringConverter<SetName> , &wxFromStringConverter<SetName> , &ToLong##SetName , &FromLong##SetName, #SetName ) ; return &s_typeInfo ; \
-} 
+}
 
 template<typename e>
 void wxFlagsFromString(const wxString &s , e &data )
@@ -284,10 +308,10 @@ void wxFlagsToString( wxString &s , const e& data )
 } \
     void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \
     void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.Get<e>().m_data ;} \
-template<> const wxTypeInfo* wxGetTypeInfo( e * ) \
+    template<> const wxTypeInfo* wxGetTypeInfo( e * ) \
 { \
     static wxEnumTypeInfo s_typeInfo(wxT_SET , &s_enumData##e , &wxToStringConverter<e> , &wxFromStringConverter<e> , &ToLong##e , &FromLong##e, #e ) ; return &s_typeInfo ; \
-} 
+}
 
 // ----------------------------------------------------------------------------
 // Type Information
@@ -336,48 +360,48 @@ WX_DECLARE_EXPORTED_STRING_HASH_MAP( wxTypeInfo* , wxTypeInfoMap ) ;
 class WXDLLIMPEXP_BASE wxTypeInfo
 {
 public :
-       typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ;
-       typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ;
+    typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ;
+    typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ;
 
-        wxTypeInfo(wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from= NULL, const wxString &name = wxEmptyString ) : 
-            m_kind( kind) , m_toString(to) , m_fromString(from) , m_name(name) 
-        {
-           Register() ;
-        }
+    wxTypeInfo(wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from= NULL, const wxString &name = wxEmptyString ) :
+    m_kind( kind) , m_toString(to) , m_fromString(from) , m_name(name)
+    {
+        Register() ;
+    }
 
-       virtual ~wxTypeInfo() 
-       {
-           Unregister() ;
-       }
+    virtual ~wxTypeInfo()
+    {
+        Unregister() ;
+    }
 
-       // return the kind of this type (wxT_... constants)
-       wxTypeKind GetKind() const { return m_kind ; }
+    // return the kind of this type (wxT_... constants)
+    wxTypeKind GetKind() const { return m_kind ; }
 
-       // returns the unique name of this type
-       const wxString& GetTypeName() const { return m_name ; }
+    // returns the unique name of this type
+    const wxString& GetTypeName() const { return m_name ; }
 
-       // is this type a delegate type
-       bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; }
+    // is this type a delegate type
+    bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; }
 
-       // is this type a custom type
-       bool IsCustomType() const { return m_kind == wxT_CUSTOM ; }
+    // is this type a custom type
+    bool IsCustomType() const { return m_kind == wxT_CUSTOM ; }
 
-       // is this type an object type 
-       bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; }
+    // is this type an object type
+    bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; }
 
-       // can the content of this type be converted to and from strings ?
-       bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; }
+    // can the content of this type be converted to and from strings ?
+    bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; }
 
-       // convert a wxxVariant holding data of this type into a string
-       void ConvertToString( const wxxVariant& data , wxString &result ) const
+    // convert a wxxVariant holding data of this type into a string
+    void ConvertToString( const wxxVariant& data , wxString &result ) const
 
-       { wxASSERT_MSG( m_toString , wxT("String conversions not supported") ) ; (*m_toString)( data , result ) ; }
+    { wxASSERT_MSG( m_toString , wxT("String conversions not supported") ) ; (*m_toString)( data , result ) ; }
 
-       // convert a string into a wxxVariant holding the corresponding data in this type
-       void ConvertFromString( const wxString& data , wxxVariant &result ) const
-       { wxASSERT_MSG( m_fromString , wxT("String conversions not supported") ) ; (*m_fromString)( data , result ) ; }
+    // convert a string into a wxxVariant holding the corresponding data in this type
+    void ConvertFromString( const wxString& data , wxxVariant &result ) const
+    { wxASSERT_MSG( m_fromString , wxT("String conversions not supported") ) ; (*m_fromString)( data , result ) ; }
 
-       static wxTypeInfo        *FindType(const wxChar *typeName);
+    static wxTypeInfo        *FindType(const wxChar *typeName);
 
 private :
 
@@ -415,20 +439,20 @@ public :
     typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ;
     typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ;
 
-    wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , 
+    wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from ,
         converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name  ) :
-       wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong )
-       { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;}
-       const wxEnumData* GetEnumData() const { return m_enumInfo ; }
+    wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong )
+    { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;}
+    const wxEnumData* GetEnumData() const { return m_enumInfo ; }
 
-       // convert a wxxVariant holding data of this type into a long
-       void ConvertToLong( const wxxVariant& data , long &result ) const
+    // convert a wxxVariant holding data of this type into a long
+    void ConvertToLong( const wxxVariant& data , long &result ) const
 
-       { wxASSERT_MSG( m_toLong , wxT("Long conversions not supported") ) ; (*m_toLong)( data , result ) ; }
+    { wxASSERT_MSG( m_toLong , wxT("Long conversions not supported") ) ; (*m_toLong)( data , result ) ; }
 
-       // convert a long into a wxxVariant holding the corresponding data in this type
-       void ConvertFromLong( long data , wxxVariant &result ) const
-       { wxASSERT_MSG( m_fromLong , wxT("Long conversions not supported") ) ; (*m_fromLong)( data , result ) ; }
+    // convert a long into a wxxVariant holding the corresponding data in this type
+    void ConvertFromLong( long data , wxxVariant &result ) const
+    { wxASSERT_MSG( m_fromLong , wxT("Long conversions not supported") ) ; (*m_fromLong)( data , result ) ; }
 
 private :
     converterToLong_t m_toLong ;
@@ -441,7 +465,7 @@ class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo
 {
 public :
     wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL ) ;
-       const wxClassInfo *GetClassInfo() const { return m_classInfo ; }
+    const wxClassInfo *GetClassInfo() const { return m_classInfo ; }
 private :
     wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL
 } ;
@@ -479,27 +503,12 @@ template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) ;
     template<> const wxTypeInfo* wxGetTypeInfo( e * ){ static wxCustomTypeInfo s_typeInfo(#e, &wxToStringConverter<e> , &wxFromStringConverter<e>) ; return &s_typeInfo ; }
 
 #define WX_COLLECTION_TYPE_INFO( element , collection ) \
-template<> const wxTypeInfo* wxGetTypeInfo( collection * ) \
+    template<> const wxTypeInfo* wxGetTypeInfo( collection * ) \
 { \
     static wxCollectionTypeInfo s_typeInfo( (wxTypeInfo*) wxGetTypeInfo( (element *) NULL) , NULL , NULL , #collection ) ; \
     return &s_typeInfo ; \
 } \
 
-
-// templated streaming, every type must have their specialization for these methods
-
-template<typename T>
-void wxStringReadValue( const wxString &s , T &data );
-
-template<typename T>
-void wxStringWriteValue( wxString &s , const T &data);
-
-template<typename T>
-void wxToStringConverter( const wxxVariant &v, wxString &s) { wxStringWriteValue( s , v.Get<T>() ) ; }
-
-template<typename T>
-void wxFromStringConverter( const wxString &s, wxxVariant &v) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } \
-
 // sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs
 
 #define WX_ILLEGAL_TYPE_SPECIALIZATION( a ) \
@@ -561,7 +570,7 @@ public :
     ~wxxVariant() { delete m_data ; }
 
     // get a ref to the stored data
-    template<typename T> T& Get()
+    template<typename T> T& Get(WX_TEMPLATED_MEMBER_FIX(T))
     {
         wxxVariantDataT<T> *dataptr = dynamic_cast<wxxVariantDataT<T>*> (m_data) ;
         wxASSERT_MSG( dataptr , wxT("Cast not possible") ) ;
@@ -569,7 +578,7 @@ public :
     }
 
     // get a ref to the stored data
-    template<typename T> const T& Get() const
+    template<typename T> const T& Get(WX_TEMPLATED_MEMBER_FIX(T)) const
     {
         const wxxVariantDataT<T> *dataptr = dynamic_cast<const wxxVariantDataT<T>*> (m_data) ;
         wxASSERT_MSG( dataptr , wxT("Cast not possible") ) ;
@@ -619,6 +628,20 @@ private :
 
 WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE);
 
+// templated streaming, every type must have their specialization for these methods
+
+template<typename T>
+void wxStringReadValue( const wxString &s , T &data );
+
+template<typename T>
+void wxStringWriteValue( wxString &s , const T &data);
+
+template<typename T>
+void wxToStringConverter( const wxxVariant &v, wxString &s) { wxStringWriteValue( s , v.WX_TEMPLATED_MEMBER_CALL(Get , T) ) ; }
+
+template<typename T>
+void wxFromStringConverter( const wxString &s, wxxVariant &v) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } \
+
 // ----------------------------------------------------------------------------
 // Property Support
 //
@@ -1069,7 +1092,7 @@ struct wxConstructorBridge_1 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0)
             );
     }
 };
@@ -1090,8 +1113,8 @@ struct wxConstructorBridge_2 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1)
             );
     }
 };
@@ -1112,9 +1135,9 @@ struct wxConstructorBridge_3 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2)
             );
     }
 };
@@ -1135,10 +1158,10 @@ struct wxConstructorBridge_4 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>() ,
-            args[3].Get<T3>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3)
             );
     }
 };
@@ -1159,11 +1182,11 @@ struct wxConstructorBridge_5 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>() ,
-            args[3].Get<T3>() ,
-            args[4].Get<T4>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) ,
+            args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4)
             );
     }
 };
@@ -1184,16 +1207,39 @@ struct wxConstructorBridge_6 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>() ,
-            args[3].Get<T3>() ,
-            args[4].Get<T4>() ,
-            args[5].Get<T5>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) ,
+            args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) ,
+            args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5)
             );
     }
 };
 
+template<typename Class,
+typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
+struct wxDirectConstructorBridge_6 : public wxConstructorBridge
+{
+    void Create(wxObject *o, wxxVariant *args)
+    {
+        Class *obj = new Class(
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) ,
+            args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) ,
+            args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5)
+            );
+    }
+};
+
+#define WX_DIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
+    wxDirectConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass ; \
+    wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
+    const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 , #v2 , #v3 , #v4 , #v5 } ; \
+    const int klass::sm_constructorPropertiesCount##klass = 6;
+
 #define WX_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
     wxConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass ; \
     wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
@@ -1210,13 +1256,13 @@ struct wxConstructorBridge_7 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>() ,
-            args[3].Get<T3>() ,
-            args[4].Get<T4>() ,
-            args[5].Get<T5>() ,
-            args[6].Get<T6>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) ,
+            args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) ,
+            args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) ,
+            args[6].WX_TEMPLATED_MEMBER_CALL(Get , T6)
             );
     }
 };
@@ -1237,14 +1283,14 @@ struct wxConstructorBridge_8 : public wxConstructorBridge
     {
         Class *obj = dynamic_cast<Class*>(o);
         obj->Create(
-            args[0].Get<T0>() ,
-            args[1].Get<T1>() ,
-            args[2].Get<T2>() ,
-            args[3].Get<T3>() ,
-            args[4].Get<T4>() ,
-            args[5].Get<T5>() ,
-            args[6].Get<T6>() ,
-            args[7].Get<T7>()
+            args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) ,
+            args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) ,
+            args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) ,
+            args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) ,
+            args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) ,
+            args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) ,
+            args[6].WX_TEMPLATED_MEMBER_CALL(Get , T6) ,
+            args[7].WX_TEMPLATED_MEMBER_CALL(Get , T7)
             );
     }
 };
@@ -1285,8 +1331,8 @@ public:
         ) : m_parents(_Parents) , m_unitName(_UnitName) ,m_className(_ClassName),
         m_objectSize(size), m_objectConstructor(ctor) , m_firstProperty(_Props ) , m_firstHandler(_Handlers ) , m_constructor( _Constructor ) ,
         m_constructorProperties(_ConstructorProperties) , m_constructorPropertiesCount(_ConstructorPropertiesCount),
-        m_variantOfPtrToObjectConverter( _PtrConverter1 ) , m_variantToObjectConverter( _Converter2 ) , m_objectToVariantConverter( _Converter3 ) , 
-        m_next(sm_first) , m_streamingCallback( _streamingCallback ) 
+        m_variantOfPtrToObjectConverter( _PtrConverter1 ) , m_variantToObjectConverter( _Converter2 ) , m_objectToVariantConverter( _Converter3 ) ,
+        m_next(sm_first) , m_streamingCallback( _streamingCallback )
     {
         sm_first = this;
         Register() ;
@@ -1294,7 +1340,7 @@ public:
 
     wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, const wxClassInfo **_Parents) : m_parents(_Parents) , m_unitName(_UnitName) ,m_className(_ClassName),
         m_objectSize(0), m_objectConstructor(NULL) , m_firstProperty(NULL ) , m_firstHandler(NULL ) , m_constructor( NULL ) ,
-        m_constructorProperties(NULL) , m_constructorPropertiesCount(NULL),
+        m_constructorProperties(NULL) , m_constructorPropertiesCount(0),
         m_variantOfPtrToObjectConverter( NULL ) , m_variantToObjectConverter( NULL ) , m_objectToVariantConverter( NULL ) , m_next(sm_first) ,
         m_streamingCallback( NULL )
     {
@@ -1484,8 +1530,17 @@ public :
     virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ;
     virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ;
 
+    // adds a property to this class at runtime
     void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ;
+
+    // removes an existing runtime-property
+    void RemoveProperty( const wxChar *propertyName ) ;
+
+    // as a handler to this class at runtime
     void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ;
+
+    // removes an existing runtime-handler
+    void RemoveHandler( const wxChar *handlerName ) ;
 } ;
 
 // ----------------------------------------------------------------------------
@@ -1500,7 +1555,7 @@ public :
  static wxHandlerInfo* GetHandlersStatic() ; \
  static wxClassInfo *GetClassInfoStatic()   \
 { return &name::sm_class##name; } \
- virtual wxClassInfo *GetClassInfo() const   \
   virtual wxClassInfo *GetClassInfo() const   \
 { return &name::sm_class##name; }
 
 #define DECLARE_DYNAMIC_CLASS(name)           \
@@ -1698,9 +1753,9 @@ public :
 // Collection Support
 // --------------------------------------------------------------------------
 
-template<typename collection_t> void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value )
+template<typename iter , typename collection_t > void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value )
 {
-    collection_t::compatibility_iterator current = coll.GetFirst() ;
+    iter current = coll.GetFirst() ;
     while (current)
     {
         value.Add( new wxxVariant(current->GetData()) ) ;
index 876f6ab0c4c384f5212ca980471d686f79e25c51..05205969c1ec267ce048da127d277fd7ee3f9446 100644 (file)
@@ -70,8 +70,8 @@ public :
     virtual bool BeforeWriteDelegate( wxWriter *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( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object),  const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , 
-        const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { } 
+        virtual void AfterWriteDelegate( wxWriter *WXUNUSED(writer) , const wxObject *WXUNUSED(object),  const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(propInfo) , 
+            const wxObject *&WXUNUSED(eventSink) , const wxHandlerInfo* &WXUNUSED(handlerInfo) ) { } 
 } ;
 
 class wxWriter : public wxObject
@@ -90,7 +90,7 @@ public :
     // made without wanting to have duplicate objects written, the object identity table will be reset manually
 
     virtual void ClearObjectContext() ;
-    
+
     // gets the object Id for a passed in object in the context
     int GetObjectID(const wxObject *obj) ;
 
index 057ca0152ed8ab96b464900ad6e317a840eb8045..d13145357413a7843f495894987921801031110f 100644 (file)
@@ -22,9 +22,9 @@
 #endif
 
 #ifndef WX_PRECOMP
-    #include "wx/hash.h"
-    #include "wx/object.h"
-    #include "wx/xti.h"
+#include "wx/hash.h"
+#include "wx/object.h"
+#include "wx/xti.h"
 #endif
 
 #include "wx/xml/xml.h"
@@ -47,36 +47,36 @@ using namespace std ;
 
 wxEnumData::wxEnumData( wxEnumMemberData* data )
 {
-       m_members = data ;
+    m_members = data ;
     for ( m_count = 0; m_members[m_count].m_name ; m_count++)
-               {} ;
+    {} ;
 }
 
 bool wxEnumData::HasEnumMemberValue(const wxChar *name, int *value)
 {
     int i;
     for (i = 0; m_members[i].m_name ; i++ )
-       {
-               if (!strcmp(name, m_members[i].m_name))
-               {
-                       if ( value )
-                               *value = m_members[i].m_value;
-                       return true ;
-               }
-       }
-       return false ;
+    {
+        if (!strcmp(name, m_members[i].m_name))
+        {
+            if ( value )
+                *value = m_members[i].m_value;
+            return true ;
+        }
+    }
+    return false ;
 }
 
 int wxEnumData::GetEnumMemberValue(const wxChar *name)
 {
     int i;
     for (i = 0; m_members[i].m_name ; i++ )
-       {
-               if (!strcmp(name, m_members[i].m_name))
-               {
-                       return m_members[i].m_value;
-               }
-       }
+    {
+        if (!strcmp(name, m_members[i].m_name))
+        {
+            return m_members[i].m_value;
+        }
+    }
     return 0 ;
 }
 
@@ -84,22 +84,22 @@ const wxChar *wxEnumData::GetEnumMemberName(int value)
 {
     int i;
     for (i = 0; m_members[i].m_name ; i++)
-               if (value == m_members[i].m_value)
-                       return m_members[i].m_name;
+        if (value == m_members[i].m_value)
+            return m_members[i].m_name;
 
-       return wxT("") ;
+    return wxT("") ;
 }
 
 int wxEnumData::GetEnumMemberValueByIndex( int idx )
 {
-       // we should cache the count in order to avoid out-of-bounds errors
-       return m_members[idx].m_value ;
+    // we should cache the count in order to avoid out-of-bounds errors
+    return m_members[idx].m_value ;
 }
 
 const char * wxEnumData::GetEnumMemberNameByIndex( int idx )
 {
-       // we should cache the count in order to avoid out-of-bounds errors
-       return m_members[idx].m_name ;
+    // we should cache the count in order to avoid out-of-bounds errors
+    return m_members[idx].m_name ;
 }
 
 // ----------------------------------------------------------------------------
@@ -116,126 +116,126 @@ const char * wxEnumData::GetEnumMemberNameByIndex( int idx )
 
 template<> void wxStringReadValue(const wxString &s , bool &data )
 {
-       int intdata ;
-       wxSscanf(s, _T("%d"), &intdata ) ;
-       data = bool(intdata) ;
+    int intdata ;
+    wxSscanf(s, _T("%d"), &intdata ) ;
+    data = bool(intdata) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const bool &data )
 {
-       s = wxString::Format("%d", data ) ;
+    s = wxString::Format("%d", data ) ;
 }
 
 // char
 
 template<> void wxStringReadValue(const wxString &s , char &data )
 {
-       int intdata ;
-       wxSscanf(s, _T("%d"), &intdata ) ;
-       data = char(intdata) ;
+    int intdata ;
+    wxSscanf(s, _T("%d"), &intdata ) ;
+    data = char(intdata) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const char &data )
 {
-       s = wxString::Format("%d", data ) ;
+    s = wxString::Format("%d", data ) ;
 }
 
 // unsigned char
 
 template<> void wxStringReadValue(const wxString &s , unsigned char &data )
 {
-       int intdata ;
-       wxSscanf(s, _T("%d"), &intdata ) ;
-       data = (unsigned char)(intdata) ;
+    int intdata ;
+    wxSscanf(s, _T("%d"), &intdata ) ;
+    data = (unsigned char)(intdata) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const unsigned char &data )
 {
-       s = wxString::Format("%d", data ) ;
+    s = wxString::Format("%d", data ) ;
 }
 
 // int
 
 template<> void wxStringReadValue(const wxString &s , int &data )
 {
-       wxSscanf(s, _T("%d"), &data ) ;
+    wxSscanf(s, _T("%d"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const int &data )
 {
-       s = wxString::Format("%d", data ) ;
+    s = wxString::Format("%d", data ) ;
 }
 
 // unsigned int
 
 template<> void wxStringReadValue(const wxString &s , unsigned int &data )
 {
-       wxSscanf(s, _T("%d"), &data ) ;
+    wxSscanf(s, _T("%d"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const unsigned int &data )
 {
-       s = wxString::Format("%d", data ) ;
+    s = wxString::Format("%d", data ) ;
 }
 
 // long
 
 template<> void wxStringReadValue(const wxString &s , long &data )
 {
-       wxSscanf(s, _T("%ld"), &data ) ;
+    wxSscanf(s, _T("%ld"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const long &data )
 {
-       s = wxString::Format("%ld", data ) ;
+    s = wxString::Format("%ld", data ) ;
 }
 
 // unsigned long
 
 template<> void wxStringReadValue(const wxString &s , unsigned long &data )
 {
-       wxSscanf(s, _T("%ld"), &data ) ;
+    wxSscanf(s, _T("%ld"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const unsigned long &data )
 {
-       s = wxString::Format("%ld", data ) ;
+    s = wxString::Format("%ld", data ) ;
 }
 
 // float
 
 template<> void wxStringReadValue(const wxString &s , float &data )
 {
-       wxSscanf(s, _T("%f"), &data ) ;
+    wxSscanf(s, _T("%f"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const float &data )
 {
-       s = wxString::Format("%f", data ) ;
+    s = wxString::Format("%f", data ) ;
 }
 
 // double
 
 template<> void wxStringReadValue(const wxString &s , double &data )
 {
-       wxSscanf(s, _T("%lf"), &data ) ;
+    wxSscanf(s, _T("%lf"), &data ) ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const double &data )
 {
-       s = wxString::Format("%lf", data ) ;
+    s = wxString::Format("%lf", data ) ;
 }
 
 // wxString
 
 template<> void wxStringReadValue(const wxString &s , wxString &data )
 {
-       data = s ;
+    data = s ;
 }
 
 template<> void wxStringWriteValue(wxString &s , const wxString &data )
 {
-       s = data ;
+    s = data ;
 }
 
 // built-ins
@@ -243,68 +243,68 @@ template<> void wxStringWriteValue(wxString &s , const wxString &data )
 
 template<> const wxTypeInfo* wxGetTypeInfo( void * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( bool * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_BOOL , &wxToStringConverter<bool> , &wxFromStringConverter<bool>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_BOOL , &wxToStringConverter<bool> , &wxFromStringConverter<bool>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( char * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_CHAR , &wxToStringConverter<char> , &wxFromStringConverter<char>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_CHAR , &wxToStringConverter<char> , &wxFromStringConverter<char>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( unsigned char * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_UCHAR , &wxToStringConverter< unsigned char > , &wxFromStringConverter<unsigned char>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_UCHAR , &wxToStringConverter< unsigned char > , &wxFromStringConverter<unsigned char>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( int * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_CHAR , &wxToStringConverter<int> , &wxFromStringConverter<int>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_CHAR , &wxToStringConverter<int> , &wxFromStringConverter<int>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( unsigned int * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_UCHAR , &wxToStringConverter<unsigned int> , &wxFromStringConverter<unsigned int>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_UCHAR , &wxToStringConverter<unsigned int> , &wxFromStringConverter<unsigned int>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( long * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_LONG , &wxToStringConverter<long> , &wxFromStringConverter<long>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_LONG , &wxToStringConverter<long> , &wxFromStringConverter<long>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( unsigned long * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_ULONG , &wxToStringConverter<unsigned long> , &wxFromStringConverter<unsigned long>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_ULONG , &wxToStringConverter<unsigned long> , &wxFromStringConverter<unsigned long>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( float * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_FLOAT , &wxToStringConverter<float> , &wxFromStringConverter<float>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_FLOAT , &wxToStringConverter<float> , &wxFromStringConverter<float>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( double * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_DOUBLE , &wxToStringConverter<double> , &wxFromStringConverter<double>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_DOUBLE , &wxToStringConverter<double> , &wxFromStringConverter<double>) ;
+    return &s_typeInfo ;
 }
 
 template<> const wxTypeInfo* wxGetTypeInfo( wxString * )
 {
-       static wxBuiltInTypeInfo s_typeInfo( wxT_STRING , &wxToStringConverter<wxString> , &wxFromStringConverter<wxString>) ;
-       return &s_typeInfo ;
+    static wxBuiltInTypeInfo s_typeInfo( wxT_STRING , &wxToStringConverter<wxString> , &wxFromStringConverter<wxString>) ;
+    return &s_typeInfo ;
 }
 
 // this are compiler induced specialization which are never used anywhere
@@ -336,8 +336,8 @@ wxTypeInfo( kind , to , from , classInfo->GetClassName() )
 { wxASSERT_MSG( kind == wxT_OBJECT_PTR || kind == wxT_OBJECT , wxT("Illegal Kind for Enum Type")) ; m_classInfo = classInfo ;}
 
 wxDelegateTypeInfo::wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to , converterFromString_t from ) :
-        wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString )
-    { m_eventClass = eventClass ; m_eventType = eventType ;}
+wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString )
+{ m_eventClass = eventClass ; m_eventType = eventType ;}
 
 void wxTypeInfo::Register()
 {    
@@ -352,7 +352,7 @@ void wxTypeInfo::Unregister()
 {
     if( !m_name.IsEmpty() )
         sm_typeTable->erase(m_name);
- }
+}
 
 // removing header dependancy on string tokenizer
 
@@ -360,11 +360,11 @@ void wxSetStringToArray( const wxString &s , wxArrayString &array )
 {
     wxStringTokenizer tokenizer(s, wxT("| \t\n"), wxTOKEN_STRTOK);
     wxString flag;
-       array.Clear() ;
+    array.Clear() ;
     while (tokenizer.HasMoreTokens())
     {
-               array.Add(tokenizer.GetNextToken()) ;
-       }
+        array.Add(tokenizer.GetNextToken()) ;
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -375,69 +375,69 @@ const wxPropertyAccessor *wxClassInfo::FindAccessor(const char *PropertyName) co
 {
     const wxPropertyInfo* info = FindPropertyInfo( PropertyName ) ;
 
-       if ( info )
-               return info->GetAccessor() ;
+    if ( info )
+        return info->GetAccessor() ;
 
-       return NULL ;
+    return NULL ;
 }
 
 const wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const char *PropertyName) const
 {
-       const wxPropertyInfo* info = GetFirstProperty() ;
+    const wxPropertyInfo* info = GetFirstProperty() ;
 
-       while( info )
-       {
-               if ( strcmp( info->GetName() , PropertyName ) == 0 )
-                       return info ;
-               info = info->GetNext() ;
-       }
+    while( info )
+    {
+        if ( strcmp( info->GetName() , PropertyName ) == 0 )
+            return info ;
+        info = info->GetNext() ;
+    }
 
     return 0;
 }
 
 const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const char *PropertyName) const
 {
-       const wxPropertyInfo* info = FindPropertyInfoInThisClass( PropertyName ) ;
+    const wxPropertyInfo* info = FindPropertyInfoInThisClass( PropertyName ) ;
     if ( info )
         return info ;
 
-       const wxClassInfo** parents = GetParents() ;
-       for ( int i = 0 ; parents[i] ; ++ i )
-       {
-               if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != NULL )
-                       return info ;
-       }
+    const wxClassInfo** parents = GetParents() ;
+    for ( int i = 0 ; parents[i] ; ++ i )
+    {
+        if ( ( info = parents[i]->FindPropertyInfo( PropertyName ) ) != NULL )
+            return info ;
+    }
 
     return 0;
 }
 
 const wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const char *PropertyName) const
 {
-       const wxHandlerInfo* info = GetFirstHandler() ;
+    const wxHandlerInfo* info = GetFirstHandler() ;
 
-       while( info )
-       {
-               if ( strcmp( info->GetName() , PropertyName ) == 0 )
-                       return info ;
-               info = info->GetNext() ;
-       }
+    while( info )
+    {
+        if ( strcmp( info->GetName() , PropertyName ) == 0 )
+            return info ;
+        info = info->GetNext() ;
+    }
 
     return 0;
 }
 
 const wxHandlerInfo *wxClassInfo::FindHandlerInfo (const char *PropertyName) const
 {
-       const wxHandlerInfo* info = FindHandlerInfoInThisClass( PropertyName ) ;
+    const wxHandlerInfo* info = FindHandlerInfoInThisClass( PropertyName ) ;
 
     if ( info )
         return info ;
 
-       const wxClassInfo** parents = GetParents() ;
-       for ( int i = 0 ; parents[i] ; ++ i )
-       {
-               if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != NULL )
-                       return info ;
-       }
+    const wxClassInfo** parents = GetParents() ;
+    for ( int i = 0 ; parents[i] ; ++ i )
+    {
+        if ( ( info = parents[i]->FindHandlerInfo( PropertyName ) ) != NULL )
+            return info ;
+    }
 
     return 0;
 }
@@ -448,11 +448,11 @@ wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const
         return m_streamingCallback ;
 
     wxObjectStreamingCallback retval = NULL ;
-       const wxClassInfo** parents = GetParents() ;
+    const wxClassInfo** parents = GetParents() ;
     for ( int i = 0 ; parents[i] && retval == NULL ; ++ i )
-       {
+    {
         retval = parents[i]->GetStreamingCallback() ;
-       }
+    }
     return retval ;
 }
 
@@ -471,7 +471,7 @@ void wxClassInfo::SetProperty(wxObject *object, const char *propertyName, const
 
     accessor = FindAccessor(propertyName);
     wxASSERT(accessor->HasSetter());
-       accessor->SetProperty( object , value ) ;
+    accessor->SetProperty( object , value ) ;
 }
 
 wxxVariant wxClassInfo::GetProperty(wxObject *object, const char *propertyName) const
@@ -529,11 +529,11 @@ VARIANT TO OBJECT
 
 wxObject* wxxVariant::GetAsObject()
 {
-       const wxClassTypeInfo *ti = dynamic_cast<const wxClassTypeInfo*>( m_data->GetTypeInfo() ) ;
-       if ( ti )
-               return ti->GetClassInfo()->VariantToInstance(*this) ;
-       else
-               return NULL ;
+    const wxClassTypeInfo *ti = dynamic_cast<const wxClassTypeInfo*>( m_data->GetTypeInfo() ) ;
+    if ( ti )
+        return ti->GetClassInfo()->VariantToInstance(*this) ;
+    else
+        return NULL ;
 }
 
 // ----------------------------------------------------------------------------
@@ -571,8 +571,8 @@ void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant
 
 wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const
 {
-   wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
-   return m_data->m_properties[propertyName] ;
+    wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
+    return m_data->m_properties[propertyName] ;
 }
 
 // ----------------------------------------------------------------------------
@@ -580,7 +580,7 @@ wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const
 // ----------------------------------------------------------------------------
 
 wxDynamicClassInfo::wxDynamicClassInfo( const wxChar *unitName, const wxChar *className , const wxClassInfo* superClass ) :
-    wxClassInfo( unitName, className , new const wxClassInfo*[2])
+wxClassInfo( unitName, className , new const wxClassInfo*[2])
 {
     GetParents()[0] = superClass ;
     GetParents()[1] = NULL ;
@@ -646,6 +646,16 @@ void wxDynamicClassInfo::AddHandler( const wxChar *handlerName , wxObjectEventFu
     new wxHandlerInfo( m_firstHandler , handlerName , address , eventClassInfo ) ;
 }
 
+// removes an existing runtime-property
+void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) 
+{
+}
+
+// removes an existing runtime-handler
+void wxDynamicClassInfo::RemoveHandler( const wxChar *handlerName ) 
+{
+}
+
 // ----------------------------------------------------------------------------
 // wxGenericPropertyAccessor
 // ----------------------------------------------------------------------------
index bdd76724bd2831109fcd199dc7b97404a11b404e..490c1493bd64d2f81ed6928580e0d912b5c36fcb 100644 (file)
@@ -1,8 +1,8 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/common/xtistrm.cpp
-// Purpose:     streaming runtime metadata information 
+// Purpose:     streaming runtime metadata information
 // Author:      Stefan Csomor
-// Modified by: 
+// Modified by:
 // Created:     27/07/03
 // RCS-ID:      $Id$
 // Copyright:   (c) 2003 Stefan Csomor
@@ -120,7 +120,7 @@ void wxWriter::FindConnectEntry(const wxEvtHandler * evSource,const wxDelegateTy
             wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
 
             // find the match
-            if ( entry->m_fn && 
+            if ( entry->m_fn &&
                 (dti->GetEventType() == entry->m_eventType) &&
                 (entry->m_id == -1 ) &&
                 (entry->m_eventSink != NULL ) )
@@ -175,7 +175,7 @@ void wxWriter::WriteAllProperties( const wxObject * obj , const wxClassInfo* ci
     }
 }
 
-void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *WXUNUSED(data) ) 
+void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *WXUNUSED(data) )
 {
     if ( pi->GetFlags() & wxPROP_DONT_STREAM )
         return ;
@@ -207,7 +207,7 @@ void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , c
                 }
                 else
                 {
-                     DoWriteSimpleType( value ) ;
+                    DoWriteSimpleType( value ) ;
                 }
             }
             DoEndWriteElement() ;
@@ -249,7 +249,7 @@ void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , c
                     WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md) ;
                 }
                 else
-                {                        
+                {
                     if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
                     {
                         const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
@@ -264,7 +264,7 @@ void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , c
     DoEndWriteProperty( pi ) ;
 }
 
-int wxWriter::GetObjectID(const wxObject *obj) 
+int wxWriter::GetObjectID(const wxObject *obj)
 {
     if ( !IsObjectKnown( obj ) )
         return wxInvalidObjectID ;
@@ -272,14 +272,14 @@ int wxWriter::GetObjectID(const wxObject *obj)
     return m_data->m_writtenObjects[obj] ;
 }
 
-bool wxWriter::IsObjectKnown( const wxObject *obj ) 
+bool wxWriter::IsObjectKnown( const wxObject *obj )
 {
     return m_data->m_writtenObjects.find( obj ) != m_data->m_writtenObjects.end() ;
 }
 
 
 // ----------------------------------------------------------------------------
-// reading objects in 
+// reading objects in
 // ----------------------------------------------------------------------------
 
 struct wxReader::wxReaderInternal
@@ -287,7 +287,7 @@ struct wxReader::wxReaderInternal
     map<int,wxClassInfo*> m_classInfos;
 };
 
-wxReader::wxReader() 
+wxReader::wxReader()
 {
     m_data = new wxReaderInternal;
 }
@@ -309,17 +309,17 @@ void wxReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo )
     m_data->m_classInfos[objectID] = classInfo ;
 }
 
-bool wxReader::HasObjectClassInfo( int objectID ) 
+bool wxReader::HasObjectClassInfo( int objectID )
 {
     return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ;
 }
 
 
 // ----------------------------------------------------------------------------
-// reading xml in 
+// reading xml in
 // ----------------------------------------------------------------------------
 
-/* 
+/*
 Reading components has not to be extended for components
 as properties are always sought by typeinfo over all levels
 and create params are always toplevel class only
@@ -327,7 +327,7 @@ and create params are always toplevel class only
 
 
 // ----------------------------------------------------------------------------
-// depersisting to memory 
+// depersisting to memory
 // ----------------------------------------------------------------------------
 
 struct wxRuntimeDepersister::wxRuntimeDepersisterInternal
@@ -396,7 +396,7 @@ void wxRuntimeDepersister::CreateObject(int objectID,
     classInfo->Create(o, paramCount, params);
 }
 
-void wxRuntimeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) 
+void wxRuntimeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
 {
     wxObject *o;
     o = m_data->GetObject(objectID);
@@ -445,8 +445,8 @@ void wxRuntimeDepersister::SetConnect(int eventSourceObjectID,
 
     if ( ehsource && ehsink )
     {
-        ehsource->Connect( -1 , delegateInfo->GetEventType() , 
-            handlerInfo->GetEventFunction() , NULL /*user data*/ , 
+        ehsource->Connect( -1 , delegateInfo->GetEventType() ,
+            handlerInfo->GetEventFunction() , NULL /*user data*/ ,
             ehsink ) ;
     }
 }
@@ -460,7 +460,7 @@ wxObject *wxRuntimeDepersister::GetObject(int objectID)
 void wxRuntimeDepersister::AddToPropertyCollection( int objectID ,
                                                    const wxClassInfo *classInfo,
                                                    const wxPropertyInfo* propertyInfo ,
-                                                   const wxxVariant &value) 
+                                                   const wxxVariant &value)
 {
     wxObject *o;
     o = m_data->GetObject(objectID);
@@ -471,7 +471,7 @@ void wxRuntimeDepersister::AddToPropertyCollection( int objectID ,
 void wxRuntimeDepersister::AddToPropertyCollectionAsObject(int objectID,
                                                            const wxClassInfo *classInfo,
                                                            const wxPropertyInfo* propertyInfo ,
-                                                           int valueObjectId) 
+                                                           int valueObjectId)
 {
     wxObject *o, *valo;
     o = m_data->GetObject(objectID);
@@ -490,7 +490,7 @@ void wxRuntimeDepersister::AddToPropertyCollectionAsObject(int objectID,
 }
 
 // ----------------------------------------------------------------------------
-// depersisting to code 
+// depersisting to code
 // ----------------------------------------------------------------------------
 
 struct wxCodeDepersister::wxCodeDepersisterInternal
@@ -512,7 +512,7 @@ struct wxCodeDepersister::wxCodeDepersisterInternal
     }
 } ;
 
-wxCodeDepersister::wxCodeDepersister(wxTextOutputStream *out) 
+wxCodeDepersister::wxCodeDepersister(wxTextOutputStream *out)
 : m_fp(out)
 {
     m_data = new wxCodeDepersisterInternal ;
@@ -529,15 +529,15 @@ void wxCodeDepersister::AllocateObject(int objectID, wxClassInfo *classInfo ,
     wxString objectName = wxString::Format( "LocalObject_%d" , objectID ) ;
     m_fp->WriteString( wxString::Format( "\t%s *%s = new %s;\n",
         classInfo->GetClassName(),
-        objectName,
+        objectName.c_str(),
         classInfo->GetClassName()) );
     m_data->SetObjectName( objectID , objectName ) ;
 }
 
-void wxCodeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) 
+void wxCodeDepersister::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
 {
     m_fp->WriteString( wxString::Format( "\tdelete %s;\n",
-        m_data->GetObjectName( objectID) ) );
+        m_data->GetObjectName( objectID).c_str() ) );
 }
 
 wxString wxCodeDepersister::ValueAsCode( const wxxVariant &param )
@@ -548,15 +548,15 @@ wxString wxCodeDepersister::ValueAsCode( const wxxVariant &param )
     {
         const wxCustomTypeInfo* cti = dynamic_cast<const wxCustomTypeInfo*>(type) ;
         wxASSERT_MSG( cti , wxT("Internal error, illegal wxCustomTypeInfo") ) ;
-        value.Printf( "%s(%s)",cti->GetTypeName(),param.GetAsString() );
+        value.Printf( "%s(%s)",cti->GetTypeName().c_str(),param.GetAsString().c_str() );
     }
     else if ( type->GetKind() == wxT_STRING )
     {
-        value.Printf( "\"%s\"",param.GetAsString() );
+        value.Printf( "\"%s\"",param.GetAsString().c_str() );
     }
     else
     {
-        value.Printf( "%s", param.GetAsString() );
+        value.Printf( "%s", param.GetAsString().c_str() );
     }
     return value ;
 }
@@ -571,14 +571,14 @@ void wxCodeDepersister::CreateObject(int objectID,
                                      )
 {
     int i;
-    m_fp->WriteString( wxString::Format( "\t%s->Create(", m_data->GetObjectName(objectID) ) );
+    m_fp->WriteString( wxString::Format( "\t%s->Create(", m_data->GetObjectName(objectID).c_str() ) );
     for (i = 0; i < paramCount; i++)
     {
         if ( objectIDValues[i] != wxInvalidObjectID )
-            m_fp->WriteString( wxString::Format( "%s", m_data->GetObjectName( objectIDValues[i] ) ) );
+            m_fp->WriteString( wxString::Format( "%s", m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
         else
         {
-            m_fp->WriteString( wxString::Format( "%s", ValueAsCode(params[i]) ) );
+            m_fp->WriteString( wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
         }
         if (i < paramCount - 1)
             m_fp->WriteString( ", ");
@@ -592,9 +592,9 @@ void wxCodeDepersister::SetProperty(int objectID,
                                     const wxxVariant &value)
 {
     m_fp->WriteString( wxString::Format( "\t%s->%s(%s);\n",
-        m_data->GetObjectName(objectID),
-        propertyInfo->GetAccessor()->GetSetterName(),
-        ValueAsCode(value)) );
+        m_data->GetObjectName(objectID).c_str(),
+        propertyInfo->GetAccessor()->GetSetterName().c_str(),
+        ValueAsCode(value).c_str()) );
 }
 
 void wxCodeDepersister::SetPropertyAsObject(int objectID,
@@ -604,32 +604,32 @@ void wxCodeDepersister::SetPropertyAsObject(int objectID,
 {
     if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
         m_fp->WriteString( wxString::Format( "\t%s->%s(*%s);\n",
-        m_data->GetObjectName(objectID),
-        propertyInfo->GetAccessor()->GetSetterName(),
-        m_data->GetObjectName( valueObjectId) ) );
+        m_data->GetObjectName(objectID).c_str(),
+        propertyInfo->GetAccessor()->GetSetterName().c_str(),
+        m_data->GetObjectName( valueObjectId).c_str() ) );
     else
         m_fp->WriteString( wxString::Format( "\t%s->%s(%s);\n",
-        m_data->GetObjectName(objectID),
-        propertyInfo->GetAccessor()->GetSetterName(),
-        m_data->GetObjectName( valueObjectId) ) );
+        m_data->GetObjectName(objectID).c_str(),
+        propertyInfo->GetAccessor()->GetSetterName().c_str(),
+        m_data->GetObjectName( valueObjectId).c_str() ) );
 }
 
 void wxCodeDepersister::AddToPropertyCollection( int objectID ,
                                                 const wxClassInfo *WXUNUSED(classInfo),
                                                 const wxPropertyInfo* propertyInfo ,
-                                                const wxxVariant &value) 
+                                                const wxxVariant &value)
 {
     m_fp->WriteString( wxString::Format( "\t%s->%s(%s);\n",
-        m_data->GetObjectName(objectID),
-        propertyInfo->GetAccessor()->GetAdderName(),
-        ValueAsCode(value)) );
+        m_data->GetObjectName(objectID).c_str(),
+        propertyInfo->GetAccessor()->GetAdderName().c_str(),
+        ValueAsCode(value).c_str()) );
 }
 
 // sets the corresponding property (value is an object)
 void wxCodeDepersister::AddToPropertyCollectionAsObject(int WXUNUSED(objectID),
                                                         const wxClassInfo *WXUNUSED(classInfo),
                                                         const wxPropertyInfo* WXUNUSED(propertyInfo) ,
-                                                        int WXUNUSED(valueObjectId)) 
+                                                        int WXUNUSED(valueObjectId))
 {
     // TODO
 }
@@ -647,8 +647,8 @@ void wxCodeDepersister::SetConnect(int eventSourceObjectID,
     int eventType = delegateInfo->GetEventType() ;
     wxString handlerName = handlerInfo->GetName() ;
 
-    m_fp->WriteString( wxString::Format(  "\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;" , 
-        ehsource , ehsource , eventType , ehsinkClass , handlerName , ehsink ) );
+    m_fp->WriteString( wxString::Format(  "\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;" ,
+        ehsource.c_str() , ehsource.c_str() , eventType , ehsinkClass.c_str() , handlerName.c_str() , ehsink.c_str() ) );
 }
 
 #include <wx/arrimpl.cpp>
index 94dcc08ebee97e1aad517069fb31f4a3d09c4dcd..93676aafeffc314cbd2a384f5097df4aa156b00a 100644 (file)
@@ -1,8 +1,8 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/common/xtistrm.cpp
-// Purpose:     streaming runtime metadata information 
+// Purpose:     streaming runtime metadata information
 // Author:      Stefan Csomor
-// Modified by: 
+// Modified by:
 // Created:     27/07/03
 // RCS-ID:      $Id$
 // Copyright:   (c) 2003 Stefan Csomor
@@ -44,7 +44,7 @@ using namespace std ;
 
 //
 // XML Streaming
-// 
+//
 
 // convenience functions
 
@@ -80,19 +80,19 @@ struct wxXmlWriter::wxXmlWriterInternal
     }
 } ;
 
-wxXmlWriter::wxXmlWriter( wxXmlNode * rootnode ) 
+wxXmlWriter::wxXmlWriter( wxXmlNode * rootnode )
 {
     m_data = new wxXmlWriterInternal() ;
     m_data->m_root = rootnode ;
     m_data->m_current = rootnode ;
 }
 
-wxXmlWriter::~wxXmlWriter() 
+wxXmlWriter::~wxXmlWriter()
 {
     delete m_data ;
 }
 
-void wxXmlWriter::DoBeginWriteTopLevelEntry( const wxString &name ) 
+void wxXmlWriter::DoBeginWriteTopLevelEntry( const wxString &name )
 {
     wxXmlNode *pnode;
     pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("entry"));
@@ -106,7 +106,7 @@ void wxXmlWriter::DoEndWriteTopLevelEntry( const wxString &WXUNUSED(name) )
     m_data->Pop() ;
 }
 
-void wxXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object), const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata   ) 
+void wxXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object), const wxClassInfo *classInfo, int objectID , wxxVariantArray &metadata   )
 {
     wxXmlNode *pnode;
     pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
@@ -122,18 +122,18 @@ void wxXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object), const wxC
 }
 
 // end of writing the root object
-void wxXmlWriter::DoEndWriteObject(const wxObject *WXUNUSED(object), const wxClassInfo *WXUNUSED(classInfo), int WXUNUSED(objectID) ) 
+void wxXmlWriter::DoEndWriteObject(const wxObject *WXUNUSED(object), const wxClassInfo *WXUNUSED(classInfo), int WXUNUSED(objectID) )
 {
     m_data->Pop() ;
 }
 
 // writes a property in the stream format
-void wxXmlWriter::DoWriteSimpleType( wxxVariant &value ) 
+void wxXmlWriter::DoWriteSimpleType( wxxVariant &value )
 {
     wxXmlAddContentToNode( m_data->m_current ,value.GetAsString() ) ;
 }
 
-void wxXmlWriter::DoBeginWriteElement() 
+void wxXmlWriter::DoBeginWriteElement()
 {
     wxXmlNode *pnode;
     pnode = new wxXmlNode(wxXML_ELEMENT_NODE, "element" );
@@ -141,7 +141,7 @@ void wxXmlWriter::DoBeginWriteElement()
     m_data->Push( pnode ) ;
 }
 
-void wxXmlWriter::DoEndWriteElement() 
+void wxXmlWriter::DoEndWriteElement()
 {
     m_data->Pop() ;
 }
@@ -163,7 +163,7 @@ void wxXmlWriter::DoEndWriteProperty(const wxPropertyInfo *WXUNUSED(propInfo) )
 
 
 // insert an object reference to an already written object
-void wxXmlWriter::DoWriteRepeatedObject( int objectID ) 
+void wxXmlWriter::DoWriteRepeatedObject( int objectID )
 {
     wxXmlNode *pnode;
     pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
@@ -172,7 +172,7 @@ void wxXmlWriter::DoWriteRepeatedObject( int objectID )
 }
 
 // insert a null reference
-void wxXmlWriter::DoWriteNullObject() 
+void wxXmlWriter::DoWriteNullObject()
 {
     wxXmlNode *pnode;
     pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
@@ -180,26 +180,26 @@ void wxXmlWriter::DoWriteNullObject()
 }
 
 // writes a delegate in the stream format
-void wxXmlWriter::DoWriteDelegate( const wxObject *WXUNUSED(object),  const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(pi) , 
-                                  const wxObject *eventSink, int sinkObjectID , const wxClassInfo* WXUNUSED(eventSinkClassInfo) , const wxHandlerInfo* handlerInfo ) 
+void wxXmlWriter::DoWriteDelegate( const wxObject *WXUNUSED(object),  const wxClassInfo* WXUNUSED(classInfo) , const wxPropertyInfo *WXUNUSED(pi) ,
+                                  const wxObject *eventSink, int sinkObjectID , const wxClassInfo* WXUNUSED(eventSinkClassInfo) , const wxHandlerInfo* handlerInfo )
 {
     if ( eventSink != NULL && handlerInfo != NULL )
     {
-        wxXmlAddContentToNode( m_data->m_current ,wxString::Format(wxT("%d.%s"), sinkObjectID , handlerInfo->GetName()) ) ;
+        wxXmlAddContentToNode( m_data->m_current ,wxString::Format(wxT("%d.%s"), sinkObjectID , handlerInfo->GetName().c_str()) ) ;
     }
 }
 
 // ----------------------------------------------------------------------------
-// reading objects in 
+// reading objects in
 // ----------------------------------------------------------------------------
 
 
 
 // ----------------------------------------------------------------------------
-// reading xml in 
+// reading xml in
 // ----------------------------------------------------------------------------
 
-/* 
+/*
 Reading components has not to be extended for components
 as properties are always sought by typeinfo over all levels
 and create params are always toplevel class only
@@ -267,7 +267,7 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
     }
     callbacks->AllocateObject(objectID, classInfo, metadata);
 
-    // 
+    //
     // stream back the Create parameters first
     createParams = new wxxVariant[ classInfo->GetCreateParamCount() ] ;
     createParamOids = new int[classInfo->GetCreateParamCount() ] ;
@@ -368,7 +368,7 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
                                 {
                                     if ( pi->GetAccessor()->HasAdder() )
                                         callbacks->AddToPropertyCollectionAsObject( objectID , classInfo , pi , valueId ) ;
-                                    // TODO for collections we must have a notation on taking over ownership or not 
+                                    // TODO for collections we must have a notation on taking over ownership or not
                                     if ( elementType->GetKind() == wxT_OBJECT && valueId != wxNullObjectID )
                                         callbacks->DestroyObject( valueId , GetObjectClassInfo( valueId ) ) ;
                                 }