X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c887ddefbca8c14451f22f4ab8b927e2e6b62e3..d642db66a5efc82d374b813022c72ba88bc50839:/include/wx/xtitypes.h diff --git a/include/wx/xtitypes.h b/include/wx/xtitypes.h index f13bb7f804..d3fd1432f8 100644 --- a/include/wx/xtitypes.h +++ b/include/wx/xtitypes.h @@ -83,17 +83,12 @@ private: #define wxENUM_MEMBER( v ) { wxT(#v), v }, -/* -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ -*/ - #define wxEND_ENUM( e ) \ { NULL, 0 } }; \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData *wxGetEnumData(e) { return &s_enumData##e; } \ template<> void wxStringReadValue(const wxString& s, e &data ) \ - { data = (e) s_enumData##e.GetEnumMemberValue(s); } \ + { data = (e) s_enumData##e.GetEnumMemberValue(s.c_str()); } \ template<> void wxStringWriteValue(wxString &s, const e &data ) \ { s = s_enumData##e.GetEnumMemberName((int)data); } \ void FromLong##e( long data, wxAny& result ) \ @@ -137,7 +132,6 @@ WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ // // ---------------------------------------------------------------------------- -// in order to remove dependancy on string tokenizer void WXDLLIMPEXP_BASE wxSetStringToArray( const wxString &s, wxArrayString &array ); template @@ -153,7 +147,7 @@ void wxSetFromString(const wxString &s, wxBitset &data ) { flag = array[i]; int ivalue; - if ( edata->HasEnumMemberValue( flag, &ivalue ) ) + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.set( (e) ivalue ); } @@ -208,7 +202,7 @@ void wxFlagsFromString(const wxString &s, e &data ) { flag = array[i]; int ivalue; - if ( edata->HasEnumMemberValue( flag, &ivalue ) ) + if ( edata->HasEnumMemberValue( flag.c_str(), &ivalue ) ) { data.m_data |= ivalue; } @@ -242,12 +236,7 @@ void wxFlagsToString( wxString &s, const e& data ) #define wxBEGIN_FLAGS( e ) \ wxEnumMemberData s_enumDataMembers##e[] = { -#define wxFLAGS_MEMBER( v ) { wxT(#v), v }, - -/* -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ -WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) \ -*/ +#define wxFLAGS_MEMBER( v ) { wxT(#v), static_cast(v) }, #define wxEND_FLAGS( e ) \ { NULL, 0 } }; \ @@ -326,7 +315,7 @@ public: { Register(); } -#if wxUSE_UNICODE +#if 0 // wxUSE_UNICODE wxTypeInfo(wxTypeKind kind, wxVariant2StringFnc to, wxString2VariantFnc from, const char *name): @@ -366,7 +355,7 @@ public: if ( m_toString ) (*m_toString)( data, result ); else - wxLogError( wxGetTranslation(_T("String conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // convert a string into a wxAny holding the corresponding data in this type @@ -375,27 +364,13 @@ public: if( m_fromString ) (*m_fromString)( data, result ); else - wxLogError( wxGetTranslation(_T("String conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("String conversions not supported")) ); } // statics: + // looks for the corresponding type, will return NULL if not found static wxTypeInfo *FindType( const wxString& typeName ); -#if 0 // TODO -#if wxUSE_UNICODE - static wxTypeInfo *FindType(const char *typeName) - { return FindType( wxString::FromAscii(typeName) ); } -#endif - static wxTypeInfo *FindType(const wxChar *typeName); - static wxTypeInfo *FindType(const wxString& typeName) - { -#if wxUSE_UNICODE - return FindType( typeName.wchar_str() ); -#else - return FindType( typeName.char_str() ); -#endif - } -#endif private: void Register(); void Unregister(); @@ -418,13 +393,6 @@ public: const wxString &name = wxEmptyString ) : wxTypeInfo( kind, to, from, name ) { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); } - -#if wxUSE_UNICODE - wxBuiltInTypeInfo( wxTypeKind kind, wxVariant2StringFnc to, - wxString2VariantFnc from , const char *name ) : - wxTypeInfo( kind, to, from, name ) - { wxASSERT_MSG( GetKind() < wxT_SET, wxT("Illegal Kind for Base Type") ); } -#endif }; class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo @@ -434,13 +402,6 @@ public: wxString2VariantFnc from ) : wxTypeInfo( wxT_CUSTOM, to, from, name ) {} - -#if wxUSE_UNICODE - wxCustomTypeInfo( const char *name , wxVariant2StringFnc to, - wxString2VariantFnc from ) : - wxTypeInfo( wxT_CUSTOM, to, from, name ) - {} -#endif }; class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo @@ -459,17 +420,6 @@ public: m_enumInfo = enumInfo; } -#if wxUSE_UNICODE - wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to, - wxString2VariantFnc from, converterToLong_t toLong, - converterFromLong_t fromLong, const char * 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; - } -#endif const wxEnumData* GetEnumData() const { return m_enumInfo; } // convert a wxAny holding data of this type into a long @@ -478,7 +428,7 @@ public: if( m_toLong ) (*m_toLong)( data, result ); else - wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } // convert a long into a wxAny holding the corresponding data in this type @@ -487,7 +437,7 @@ public: if( m_fromLong ) (*m_fromLong)( data, result ); else - wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ); + wxLogError( wxGetTranslation(wxT("Long Conversions not supported")) ); } private: @@ -504,11 +454,6 @@ public: wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, const wxString &name = wxEmptyString); -#if wxUSE_UNICODE - wxClassTypeInfo( wxTypeKind kind, wxClassInfo* classInfo, wxVariant2StringFnc to, - wxString2VariantFnc from , const char *name ); -#endif - const wxClassInfo *GetClassInfo() const { return m_classInfo; } private: @@ -523,13 +468,6 @@ public: wxTypeInfo( wxT_COLLECTION, to, from, name ) { m_elementTypeName = elementName; m_elementType = NULL; } -#if wxUSE_UNICODE - wxCollectionTypeInfo( const char *elementName, wxVariant2StringFnc to, - wxString2VariantFnc from , const char *name ) : - wxTypeInfo( wxT_COLLECTION, to, from, name ) - { m_elementTypeName = wxString::FromAscii( elementName ); m_elementType = NULL; } -#endif - const wxTypeInfo* GetElementType() const { if ( m_elementType == NULL )