X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af498247c5ea024a781d0ef8d30cbbfb44749641..b4c1fe36b9854cdb404906ba3a181a67f9247e0e:/src/common/xti.cpp diff --git a/src/common/xti.cpp b/src/common/xti.cpp index 4eb4a9fb31..a924d13fda 100644 --- a/src/common/xti.cpp +++ b/src/common/xti.cpp @@ -10,28 +10,24 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "xti.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#if wxUSE_EXTENDED_RTTI + #ifndef WX_PRECOMP -#include "wx/hash.h" -#include "wx/object.h" + #include "wx/object.h" + #include "wx/list.h" + #include "wx/hash.h" #endif -#if wxUSE_EXTENDED_RTTI - #include "wx/xti.h" #include "wx/xml/xml.h" #include "wx/tokenzr.h" -#include "wx/list.h" #include #include "wx/beforestd.h" @@ -88,7 +84,7 @@ const wxChar *wxEnumData::GetEnumMemberName(int value) const if (value == m_members[i].m_value) return m_members[i].m_name; - return wxT("") ; + return wxEmptyString ; } int wxEnumData::GetEnumMemberValueByIndex( int idx ) const @@ -118,13 +114,13 @@ const wxChar * wxEnumData::GetEnumMemberNameByIndex( int idx ) const template<> void wxStringReadValue(const wxString &s , bool &data ) { int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; + wxSscanf(s, wxT("%d"), &intdata ) ; data = (bool)intdata ; } template<> void wxStringWriteValue(wxString &s , const bool &data ) { - s = wxString::Format(_T("%d"), data ) ; + s = wxString::Format(wxT("%d"), data ) ; } // char @@ -132,13 +128,13 @@ template<> void wxStringWriteValue(wxString &s , const bool &data ) template<> void wxStringReadValue(const wxString &s , char &data ) { int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; + wxSscanf(s, wxT("%d"), &intdata ) ; data = char(intdata) ; } template<> void wxStringWriteValue(wxString &s , const char &data ) { - s = wxString::Format(_T("%d"), data ) ; + s = wxString::Format(wxT("%d"), data ) ; } // unsigned char @@ -146,85 +142,85 @@ template<> void wxStringWriteValue(wxString &s , const char &data ) template<> void wxStringReadValue(const wxString &s , unsigned char &data ) { int intdata ; - wxSscanf(s, _T("%d"), &intdata ) ; + wxSscanf(s, wxT("%d"), &intdata ) ; data = (unsigned char)(intdata) ; } template<> void wxStringWriteValue(wxString &s , const unsigned char &data ) { - s = wxString::Format(_T("%d"), data ) ; + s = wxString::Format(wxT("%d"), data ) ; } // int template<> void wxStringReadValue(const wxString &s , int &data ) { - wxSscanf(s, _T("%d"), &data ) ; + wxSscanf(s, wxT("%d"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const int &data ) { - s = wxString::Format(_T("%d"), data ) ; + s = wxString::Format(wxT("%d"), data ) ; } // unsigned int template<> void wxStringReadValue(const wxString &s , unsigned int &data ) { - wxSscanf(s, _T("%d"), &data ) ; + wxSscanf(s, wxT("%d"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const unsigned int &data ) { - s = wxString::Format(_T("%d"), data ) ; + s = wxString::Format(wxT("%d"), data ) ; } // long template<> void wxStringReadValue(const wxString &s , long &data ) { - wxSscanf(s, _T("%ld"), &data ) ; + wxSscanf(s, wxT("%ld"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const long &data ) { - s = wxString::Format(_T("%ld"), data ) ; + s = wxString::Format(wxT("%ld"), data ) ; } // unsigned long template<> void wxStringReadValue(const wxString &s , unsigned long &data ) { - wxSscanf(s, _T("%ld"), &data ) ; + wxSscanf(s, wxT("%ld"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const unsigned long &data ) { - s = wxString::Format(_T("%ld"), data ) ; + s = wxString::Format(wxT("%ld"), data ) ; } // float template<> void wxStringReadValue(const wxString &s , float &data ) { - wxSscanf(s, _T("%f"), &data ) ; + wxSscanf(s, wxT("%f"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const float &data ) { - s = wxString::Format(_T("%f"), data ) ; + s = wxString::Format(wxT("%f"), data ) ; } // double template<> void wxStringReadValue(const wxString &s , double &data ) { - wxSscanf(s, _T("%lf"), &data ) ; + wxSscanf(s, wxT("%lf"), &data ) ; } template<> void wxStringWriteValue(wxString &s , const double &data ) { - s = wxString::Format(_T("%lf"), data ) ; + s = wxString::Format(wxT("%lf"), data ) ; } // wxString @@ -314,17 +310,17 @@ wxTypeInfo ( wxT_DELEGATE , to , from , wxEmptyString ) { m_eventClass = eventClass ; m_eventType = eventType ; m_lastEventType = lastEventType; } void wxTypeInfo::Register() -{ +{ if ( ms_typeTable == NULL ) ms_typeTable = new wxTypeInfoMap() ; - if( !m_name.IsEmpty() ) + if( !m_name.empty() ) (*ms_typeTable)[m_name] = this ; } void wxTypeInfo::Unregister() { - if( !m_name.IsEmpty() ) + if( !m_name.empty() ) ms_typeTable->erase(m_name); } @@ -474,7 +470,7 @@ wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const return retval ; } -bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const +bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const { wxObjectStreamingCallback sb = GetStreamingCallback() ; if ( sb ) @@ -523,13 +519,13 @@ void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *proper accessor->AddToPropertyCollection( object , value ) ; } -// void wxClassInfo::GetProperties( wxPropertyInfoMap &map ) const +// void wxClassInfo::GetProperties( wxPropertyInfoMap &map ) const // The map parameter (the name map that is) seems something special // to MSVC and so we use a other name. -void wxClassInfo::GetProperties( wxPropertyInfoMap &infomap ) const +void wxClassInfo::GetProperties( wxPropertyInfoMap &infomap ) const { const wxPropertyInfo *pi = GetFirstProperty() ; - while( pi ) + while( pi ) { if ( infomap.find( pi->GetName() ) == infomap.end() ) infomap[pi->GetName()] = (wxPropertyInfo*) pi ; @@ -610,13 +606,13 @@ wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const return m_data->m_properties[propertyName] ; } -void wxDynamicObject::RemoveProperty( const wxChar *propertyName ) +void wxDynamicObject::RemoveProperty( const wxChar *propertyName ) { wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Removing Unknown Property in a Dynamic Object") ) ; m_data->m_properties.erase( propertyName ) ; } -void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) +void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) { wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),wxT("Renaming Unknown Property in a Dynamic Object") ) ; wxxVariant value = m_data->m_properties[oldPropertyName] ; @@ -701,7 +697,7 @@ void wxDynamicClassInfo::AddHandler( const wxChar *handlerName , wxObjectEventFu } // removes an existing runtime-property -void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) +void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) { for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter ) (*iter)->RemoveProperty( propertyName ) ; @@ -709,13 +705,13 @@ void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName ) } // removes an existing runtime-handler -void wxDynamicClassInfo::RemoveHandler( const wxChar *handlerName ) +void wxDynamicClassInfo::RemoveHandler( const wxChar *handlerName ) { delete FindHandlerInfoInThisClass(handlerName) ; } // renames an existing runtime-property -void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) +void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) { wxPropertyInfo* pi = FindPropertyInfoInThisClass(oldPropertyName) ; wxASSERT_MSG( pi ,wxT("not existing property") ) ; @@ -726,7 +722,7 @@ void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const w } // renames an existing runtime-handler -void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) +void wxDynamicClassInfo::RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) { wxASSERT_MSG(FindHandlerInfoInThisClass(oldHandlerName),wxT("not existing handler") ) ; FindHandlerInfoInThisClass(oldHandlerName)->m_name = newHandlerName ; @@ -767,4 +763,5 @@ void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxxVariant& wxASSERT_MSG( dynobj , wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") ) ; value = dynobj->GetProperty( m_propertyName ) ; } -#endif + +#endif // wxUSE_EXTENDED_RTTI