From f0b7eadf889c2882e81470ec8e629d831858acb1 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 5 Aug 2003 21:25:58 +0000 Subject: [PATCH] added more specializations for bcc32 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/xti.h | 53 +++++++++++++++++---- src/common/xti.cpp | 116 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 10 deletions(-) diff --git a/include/wx/xti.h b/include/wx/xti.h index 002d4ce639..0fa7e7e692 100644 --- a/include/wx/xti.h +++ b/include/wx/xti.h @@ -117,6 +117,15 @@ private : template<> void wxStringWriteValue(wxString &s , const e &data ) \ { \ s = s_enumData##e.GetEnumMemberName((int)data) ; \ + } \ + template<> const wxTypeInfo* wxGetTypeInfo( e ** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; assert(0) ; return &s_typeInfo ; } \ + template<> void wxStringReadValue(const wxString& , e* & ) \ + { \ + assert(0) ; \ + } \ + template<> void wxStringWriteValue(wxString &s , e* const & ) \ + { \ + assert(0) ; \ } // ---------------------------------------------------------------------------- @@ -304,7 +313,8 @@ template const wxTypeInfo* wxGetTypeInfo( wxSet * ) // this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type #define WX_CUSTOM_TYPE_INFO( e ) \ - template<> const wxTypeInfo* wxGetTypeInfo( e * ){ static wxCustomTypeInfo s_typeInfo(#e) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( e ** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID) ; assert(0) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( e * ){ static wxCustomTypeInfo s_typeInfo(#e) ; return &s_typeInfo ; } // ---------------------------------------------------------------------------- // value streaming @@ -322,10 +332,10 @@ wxString wxXmlGetContentFromNode( wxXmlNode *node ) ; // templated streaming, every type must have their specialization for these methods template -void wxStringReadValue( const wxString &s , T &data ) ; +void wxStringReadValue( const wxString &s , T &data ); template -void wxStringWriteValue( wxString &s , const T &data) ; +void wxStringWriteValue( wxString &s , const T &data); // for simple types this default implementation is ok, composited structures will have to // loop through their properties @@ -1080,9 +1090,9 @@ public: virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName); // we must be able to cast variants to wxObject pointers, templates seem not to be suitable - wxObject* VariantToInstance( wxxVariant &data ) const + wxObject* VariantToInstance( wxxVariant &data ) const { if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) - return m_variantToObjectConverter( data ) ; + return m_variantToObjectConverter( data ) ; else return m_variantOfPtrToObjectConverter( data ) ; } @@ -1152,10 +1162,10 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); { return &name::sm_class##name; } #define DECLARE_DYNAMIC_CLASS(name) \ - _DECLARE_DYNAMIC_CLASS(name) \ - static wxConstructorBridge* sm_constructor##name ; \ - static const wxChar * sm_constructorProperties##name[] ; \ - static const int sm_constructorPropertiesCount##name ; +static wxConstructorBridge* sm_constructor##name ; \ +static const wxChar * sm_constructorProperties##name[] ; \ +static const int sm_constructorPropertiesCount##name ; \ + _DECLARE_DYNAMIC_CLASS(name) #define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ DECLARE_NO_ASSIGN_CLASS(name) \ @@ -1189,6 +1199,9 @@ wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVaria template<> void wxStringWriteValue(wxString & , name const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } @@ -1208,6 +1221,9 @@ wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVaria template<> void wxStringWriteValue(wxString & , name const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } @@ -1240,6 +1256,10 @@ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit ) 0 , 0 , 0 ); \ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } // this is for subclasses that still do not derive from wxobject @@ -1253,8 +1273,13 @@ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit ) 0 , 0 , 0 ); \ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } + // Multiple inheritance with two base classes #define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ @@ -1270,6 +1295,10 @@ _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit ) name::sm_constructorPropertiesCount##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } #define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ @@ -1299,7 +1328,11 @@ wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVaria 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ - template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } + template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\ + template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } \ + template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID) ; assert(0) ; return &s_typeInfo ; } #define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ diff --git a/src/common/xti.cpp b/src/common/xti.cpp index 142d4dcca1..acaa9b56a9 100644 --- a/src/common/xti.cpp +++ b/src/common/xti.cpp @@ -204,6 +204,102 @@ template<> void wxStringWriteValue(wxString & , char * const & ) assert(0) ; } +// unsigned char * + +template<> const wxTypeInfo* wxGetTypeInfo( unsigned char ** ) +{ + assert(0) ; + static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; + return &s_typeInfo ; +} + +template<> void wxStringReadValue(const wxString & , unsigned char* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , unsigned char * const & ) +{ + assert(0) ; +} + +// int * + +template<> const wxTypeInfo* wxGetTypeInfo( int ** ) +{ + assert(0) ; + static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; + return &s_typeInfo ; +} + +template<> void wxStringReadValue(const wxString & , int* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , int * const & ) +{ + assert(0) ; +} + +// bool * + +template<> const wxTypeInfo* wxGetTypeInfo( bool ** ) +{ + assert(0) ; + static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; + return &s_typeInfo ; +} + +template<> void wxStringReadValue(const wxString & , bool* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , bool * const & ) +{ + assert(0) ; +} + +// long * + +template<> const wxTypeInfo* wxGetTypeInfo( long ** ) +{ + assert(0) ; + static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; + return &s_typeInfo ; +} + +template<> void wxStringReadValue(const wxString & , long* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , long * const & ) +{ + assert(0) ; +} + +// wxString * + +template<> const wxTypeInfo* wxGetTypeInfo( wxString ** ) +{ + assert(0) ; + static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; + return &s_typeInfo ; +} + +template<> void wxStringReadValue(const wxString & , wxString* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , wxString * const & ) +{ + assert(0) ; +} + + // ---------------------------------------------------------------------------- // value streaming // ---------------------------------------------------------------------------- @@ -370,6 +466,16 @@ template<> void wxStringWriteValue(wxString &s , const wxPoint &data ) s = wxString::Format("%d,%d", data.x , data.y ) ; } +template<> void wxStringReadValue(const wxString & , wxPoint* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , wxPoint* const & ) +{ + assert(0) ; +} + WX_CUSTOM_TYPE_INFO(wxPoint) template<> void wxStringReadValue(const wxString &s , wxSize &data ) @@ -382,6 +488,16 @@ template<> void wxStringWriteValue(wxString &s , const wxSize &data ) s = wxString::Format("%d,%d", data.x , data.y ) ; } +template<> void wxStringReadValue(const wxString & , wxSize* & ) +{ + assert(0) ; +} + +template<> void wxStringWriteValue(wxString & , wxSize * const & ) +{ + assert(0) ; +} + WX_CUSTOM_TYPE_INFO(wxSize) /* -- 2.45.2