return false;
}
+#if wxUSE_EXTENDED_RTTI
+ virtual const wxTypeInfo* GetTypeInfo() const
+ {
+ wxFAIL_MSG("Null Type Info not available");
+ return NULL;
+ }
+#endif
+
private:
};
IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT)
#endif
+#if wxUSE_EXTENDED_RTTI
+//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxBitmap>)
+//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxIcon>)
+#endif
+
// ----------------------------------------------------------------------------
// wxBitmapBase
// ----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour, wxObject, \
"wx/colour.h", &wxTO_STRING( wxColour ), &wxFROM_STRING( wxColour ))
-
+//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxColour>)
wxBEGIN_PROPERTIES_TABLE(wxColour)
wxREADONLY_PROPERTY( Red, unsigned char, Red, wxEMPTY_PARAMETER_VALUE, \
0 /*flags*/, wxT("Helpstring"), wxT("group"))
// ----------------------------------------------------------------------------
wxBEGIN_ENUM( wxFontFamily )
-wxENUM_MEMBER( wxDEFAULT )
-wxENUM_MEMBER( wxDECORATIVE )
-wxENUM_MEMBER( wxROMAN )
-wxENUM_MEMBER( wxSCRIPT )
-wxENUM_MEMBER( wxSWISS )
-wxENUM_MEMBER( wxMODERN )
-wxENUM_MEMBER( wxTELETYPE )
+wxENUM_MEMBER( wxFONTFAMILY_DEFAULT )
+wxENUM_MEMBER( wxFONTFAMILY_DECORATIVE )
+wxENUM_MEMBER( wxFONTFAMILY_ROMAN )
+wxENUM_MEMBER( wxFONTFAMILY_SCRIPT )
+wxENUM_MEMBER( wxFONTFAMILY_SWISS )
+wxENUM_MEMBER( wxFONTFAMILY_MODERN )
+wxENUM_MEMBER( wxFONTFAMILY_TELETYPE )
wxEND_ENUM( wxFontFamily )
wxBEGIN_ENUM( wxFontStyle )
-wxENUM_MEMBER( wxNORMAL )
-wxENUM_MEMBER( wxITALIC )
-wxENUM_MEMBER( wxSLANT )
+wxENUM_MEMBER( wxFONTSTYLE_NORMAL )
+wxENUM_MEMBER( wxFONTSTYLE_ITALIC )
+wxENUM_MEMBER( wxFONTSTYLE_SLANT )
wxEND_ENUM( wxFontStyle )
wxBEGIN_ENUM( wxFontWeight )
-wxENUM_MEMBER( wxNORMAL )
-wxENUM_MEMBER( wxLIGHT )
-wxENUM_MEMBER( wxBOLD )
+wxENUM_MEMBER( wxFONTWEIGHT_NORMAL )
+wxENUM_MEMBER( wxFONTWEIGHT_LIGHT )
+wxENUM_MEMBER( wxFONTWEIGHT_BOLD )
wxEND_ENUM( wxFontWeight )
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject, "wx/font.h")
+//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxFont>)
+
wxBEGIN_PROPERTIES_TABLE(wxFont)
wxPROPERTY( Size,int, SetPointSize, GetPointSize, 12, 0 /*flags*/, \
wxT("Helpstring"), wxT("group"))
-wxPROPERTY( Family, int , SetFamily, GetFamily, (int)wxDEFAULT, \
+wxPROPERTY( Family, wxFontFamily , SetFamily, GetFamily, (wxFontFamily)wxDEFAULT, \
0 /*flags*/, wxT("Helpstring"), wxT("group")) // wxFontFamily
-wxPROPERTY( Style, int, SetStyle, GetStyle, (int)wxNORMAL, 0 /*flags*/, \
+wxPROPERTY( Style, wxFontStyle, SetStyle, GetStyle, (wxFontStyle)wxNORMAL, 0 /*flags*/, \
wxT("Helpstring"), wxT("group")) // wxFontStyle
-wxPROPERTY( Weight, int, SetWeight, GetWeight, (int)wxNORMAL, 0 /*flags*/, \
+wxPROPERTY( Weight, wxFontWeight, SetWeight, GetWeight, (wxFontWeight)wxNORMAL, 0 /*flags*/, \
wxT("Helpstring"), wxT("group")) // wxFontWeight
wxPROPERTY( Underlined, bool, SetUnderlined, GetUnderlined, false, 0 /*flags*/, \
wxT("Helpstring"), wxT("group"))
wxFONTENCODING_DEFAULT, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
wxEND_PROPERTIES_TABLE()
-wxCONSTRUCTOR_6( wxFont, int, Size, int, Family, int, Style, int, Weight, \
+wxCONSTRUCTOR_6( wxFont, int, Size, wxFontFamily, Family, wxFontStyle, Style, wxFontWeight, Weight, \
bool, Underlined, wxString, Face )
wxEMPTY_HANDLERS_TABLE(wxFont)
#include "wx/ipcbase.h"
-IMPLEMENT_CLASS(wxServerBase, wxObject)
-IMPLEMENT_CLASS(wxClientBase, wxObject)
-IMPLEMENT_CLASS(wxConnectionBase, wxObject)
+wxIMPLEMENT_ABSTRACT_CLASS(wxServerBase, wxObject)
+wxIMPLEMENT_ABSTRACT_CLASS(wxClientBase, wxObject)
+wxIMPLEMENT_ABSTRACT_CLASS(wxConnectionBase, wxObject)
wxConnectionBase::wxConnectionBase(void *buffer, size_t bytes)
: m_buffer((char *)buffer),
wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ;
template<> void wxCollectionToVariantArray( wxMenuItemList const &theList,
- wxVariantBaseArray &value)
+ wxAnyList &value)
{
- wxListCollectionToVariantArray<wxMenuItemList::compatibility_iterator>( theList, value ) ;
+ wxListCollectionToAnyList<wxMenuItemList::compatibility_iterator>( theList, value ) ;
}
wxBEGIN_PROPERTIES_TABLE(wxMenu)
// the negative id would lead the window (its superclass !) to
// vetoe streaming out otherwise
bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxObjectWriter *,
- wxObjectReaderCallback *, wxVariantBaseArray & )
+ wxObjectWriterCallback *, const wxStringToAnyHashMap & )
{
return true;
}
wxCOLLECTION_TYPE_INFO( wxMenuInfo *, wxMenuInfoList ) ;
template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList,
- wxVariantBaseArray &value)
+ wxAnyList &value)
{
- wxListCollectionToVariantArray<wxMenuInfoList::compatibility_iterator>( theList, value ) ;
+ wxListCollectionToAnyList<wxMenuInfoList::compatibility_iterator>( theList, value ) ;
}
wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
wxCONSTRUCTOR_DUMMY( wxMenuBar )
+const wxMenuInfoList& wxMenuBarBase::GetMenuInfos() const
+{
+ wxMenuInfoList* list = const_cast< wxMenuInfoList* > (& m_menuInfos);
+ WX_CLEAR_LIST( wxMenuInfoList, *list);
+ for (size_t i = 0 ; i < GetMenuCount(); ++i)
+ {
+ wxMenuInfo* info = new wxMenuInfo();
+ info->Create( GetMenu(i), GetMenuLabel(i));
+ list->Append(info);
+ }
+ return m_menuInfos;
+}
+
+/*
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenu**>)
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuItem**>)
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuBar**>)
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuInfo**>)
+*/
#else
// IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
// IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
#if wxUSE_EXTENDED_RTTI
bool wxMenuItemStreamingCallback( const wxObject *object, wxObjectWriter *,
- wxObjectReaderCallback *, wxVariantBaseArray & )
+ wxObjectWriterCallback *, const wxStringToAnyHashMap & )
{
const wxMenuItem * mitem = wx_dynamic_cast(const wxMenuItem*, object);
if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().empty() )
return true;
}
+#endif
+
wxBEGIN_ENUM( wxItemKind )
wxENUM_MEMBER( wxITEM_SEPARATOR )
wxENUM_MEMBER( wxITEM_NORMAL )
0 /*flags*/, wxT("Helpstring"), wxT("group") )
wxPROPERTY( Id, int, SetId, GetId, wxEMPTY_PARAMETER_VALUE, \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
-wxPROPERTY( Text, wxString, SetText, GetText, wxString(), \
+wxPROPERTY( ItemLabel, wxString, SetItemLabel, GetItemLabel, wxString(), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
wxPROPERTY( Help, wxString, SetHelp, GetHelp, wxString(), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
0 /*flags*/, wxT("Helpstring"), wxT("group") )
wxPROPERTY( SubMenu, wxMenu*, SetSubMenu, GetSubMenu, wxEMPTY_PARAMETER_VALUE, \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
-wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxVariantBase((bool)true), \
+wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxAny((bool)true), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
-wxPROPERTY( Checked, bool, Check, IsChecked, wxVariantBase((bool)false), \
+wxPROPERTY( Checked, bool, Check, IsChecked, wxAny((bool)false), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
-wxPROPERTY( Checkable, bool, SetCheckable, IsCheckable, wxVariantBase((bool)false), \
+wxPROPERTY( Checkable, bool, SetCheckable, IsCheckable, wxAny((bool)false), \
0 /*flags*/, wxT("Helpstring"), wxT("group") )
wxEND_PROPERTIES_TABLE()
wxDIRECT_CONSTRUCTOR_6( wxMenuItem, wxMenu*, Parent, int, Id, wxString, \
Text, wxString, Help, wxItemKind, Kind, wxMenu*, SubMenu )
-#else
-//IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-#endif
// ----------------------------------------------------------------------------
// wxMenuItemBase
WX_DEFINE_LIST(wxModuleList)
-IMPLEMENT_CLASS(wxModule, wxObject)
+wxIMPLEMENT_ABSTRACT_CLASS(wxModule, wxObject)
wxModuleList wxModule::m_modules;
wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo *, wxNotebookPageInfoList );
-#if wxUSE_EXTENDED_RTTI
template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList,
- wxVariantBaseArray &value)
+ wxAnyList &value)
{
- wxListCollectionToVariantArray<wxNotebookPageInfoList::compatibility_iterator>( theList, value );
+ wxListCollectionToAnyList<wxNotebookPageInfoList::compatibility_iterator>( theList, value );
}
-#endif
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
wxEVENT_PROPERTY( PageChanging, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEvent )
wxCONSTRUCTOR_4( wxNotebookPageInfo, wxNotebookPage*, Page, \
wxString, Text, bool, Selected, int, ImageId )
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxNotebookPageInfo**>)
// XTI accessors:
void wxNotebookBase::AddPageInfo( wxNotebookPageInfo* info )
#if wxUSE_EXTENDED_RTTI
const wxClassInfo* wxObject::ms_classParents[] = { NULL } ;
- wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data )
-{ return data.wxTEMPLATED_MEMBER_CALL(Get , wxObject*) ; }
- wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data )
-{ return &data.wxTEMPLATED_MEMBER_CALL(Get , wxObject) ; }
- wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
- { return wxxVariant( dynamic_cast<wxObject*> (data) ) ; }
+wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data )
+{ return wxANY_AS(data, wxObject*); }
+ wxAny wxObjectToVariantConverterwxObject ( wxObject *data )
+ { return wxAny( dynamic_cast<wxObject*> (data) ) ; }
+
wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"),
(int) sizeof(wxObject), \
(wxObjectConstructorFn) 0 ,
NULL,NULL,0 , 0 ,
- 0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
- template<> void wxStringReadValue(const wxString & , wxObject * & ){ wxFAIL_MSG("unreachable"); }
+ 0 , wxVariantOfPtrToObjectConverterwxObject , 0 , wxObjectToVariantConverterwxObject);
+
template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); }
- template<> void wxStringReadValue(const wxString & , wxObject & ){ wxFAIL_MSG("unreachable"); }
template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); }
+
wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ;
wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ;
#else
wxFLAGS_MEMBER(wxSP_WRAP)
wxEND_FLAGS( wxSpinCtrlStyle )
-wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinbut.h")
+wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h")
wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
// separately otherwise chaos occurs. Right now easiest is to test for negative ids,
// as windows with negative ids never can be recreated anyway
+
bool wxWindowStreamingCallback( const wxObject *object, wxObjectWriter *,
- wxObjectReaderCallback *, wxVariantBaseArray & )
+ wxObjectWriterCallback *, const wxStringToAnyHashMap & )
{
const wxWindow * win = wx_dynamic_cast(const wxWindow*, object);
if ( win && win->GetId() < 0 )
wxCOLLECTION_TYPE_INFO( wxWindow*, wxWindowList );
template<> void wxCollectionToVariantArray( wxWindowList const &theList,
- wxVariantBaseArray &value)
+ wxAnyList &value)
{
- wxListCollectionToVariantArray<wxWindowList::compatibility_iterator>( theList, value );
+ wxListCollectionToAnyList<wxWindowList::compatibility_iterator>( theList, value );
}
wxDEFINE_FLAGS( wxWindowStyle )
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // bg
wxPROPERTY( ForegroundColour, wxColour, SetForegroundColour, GetForegroundColour, \
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // fg
-wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxVariantBase((bool)true), 0 /*flags*/, \
+wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxAny((bool)true), 0 /*flags*/, \
wxT("Helpstring"), wxT("group"))
-wxPROPERTY( Shown, bool, Show, IsShown, wxVariantBase((bool)true), 0 /*flags*/, \
+wxPROPERTY( Shown, bool, Show, IsShown, wxAny((bool)true), 0 /*flags*/, \
wxT("Helpstring"), wxT("group"))
#if 0
#include "wx/xti.h"
#include "wx/xml/xml.h"
#include "wx/tokenzr.h"
+#include "wx/range.h"
+
#include <string.h>
#include "wx/beforestd.h"
s = wxString::Format(_T("%ld"), data );
}
+#ifdef wxLongLong_t
+template<> void wxStringReadValue(const wxString &s, wxLongLong_t &data )
+{
+ wxSscanf(s, _T("%lld"), &data );
+}
+
+template<> void wxStringWriteValue(wxString &s, const wxLongLong_t &data )
+{
+ s = wxString::Format(_T("%lld"), data );
+}
+
+template<> void wxStringReadValue(const wxString &s, wxULongLong_t &data )
+{
+ wxSscanf(s, _T("%lld"), &data );
+}
+
+template<> void wxStringWriteValue(wxString &s, const wxULongLong_t &data )
+{
+ s = wxString::Format(_T("%lld"), data );
+}
+#endif
// float
template<> void wxStringReadValue(const wxString &s, float &data )
&wxFromStringConverter<type>, typeid(type).name());
#else
#define wxBUILTIN_TYPE_INFO( element, type ) \
- void _toString##element( const wxVariantBase& data, wxString &result ) \
+ void _toString##element( const wxAny& data, wxString &result ) \
{ wxToStringConverter<type, data, result); } \
- void _fromString##element( const wxString& data, wxVariantBase &result ) \
+ void _fromString##element( const wxString& data, wxAny &result ) \
{ wxFromStringConverter<type, data, result); } \
wxBuiltInTypeInfo s_typeInfo##type(element, &_toString##element, \
&_fromString##element, typeid(type).name());
wxBUILTIN_TYPE_INFO( wxT_DOUBLE, double);
wxBUILTIN_TYPE_INFO( wxT_STRING, wxString);
+#ifdef wxLongLong_t
+wxBUILTIN_TYPE_INFO(wxT_LONGLONG, wxLongLong_t)
+wxBUILTIN_TYPE_INFO(wxT_ULONGLONG, wxULongLong_t)
+#endif
// this are compiler induced specialization which are never used anywhere
wxILLEGAL_TYPE_SPECIALIZATION( long * )
wxILLEGAL_TYPE_SPECIALIZATION( wxString * )
+// wxRange
+
+template<> void wxStringReadValue(const wxString &s , wxRange &data)
+{
+ int minValue, maxValue;
+ wxSscanf(s, wxT("%d,%d"), &minValue , &maxValue);
+ data = wxRange(minValue, maxValue);
+}
+
+template<> void wxStringWriteValue(wxString &s , const wxRange &data)
+{
+ s = wxString::Format(wxT("%d,%d"), data.GetMin() , data.GetMax());
+}
+
+wxCUSTOM_TYPE_INFO(wxRange, wxToStringConverter<wxRange> , wxFromStringConverter<wxRange>)
+
+// other types
+
wxCOLLECTION_TYPE_INFO( wxString, wxArrayString );
template<> void wxCollectionToVariantArray( wxArrayString const &theArray,
- wxVariantBaseArray &value)
+ wxAnyList &value)
{
wxArrayCollectionToVariantArray( theArray, value );
}
wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL;
-wxTypeInfo *wxTypeInfo::FindType(const wxChar *typeName)
+wxTypeInfo *wxTypeInfo::FindType(const wxString& typeName)
{
wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName);
info = info->m_next;
}
}
+
}
// ----------------------------------------------------------------------------
// wxClassInfo
// ----------------------------------------------------------------------------
-bool wxClassInfo::Create(wxObject *object, int ParamCount, wxVariantBase *Params) const
+bool wxClassInfo::Create(wxObject *object, int ParamCount, wxAny *Params) const
{
if ( ParamCount != m_constructorPropertiesCount )
{
return m_constructor->Create( object, Params );
}
-wxObject *wxClassInfo::ConstructObject(int ParamCount, wxVariantBase *Params) const
+wxObject *wxClassInfo::ConstructObject(int ParamCount, wxAny *Params) const
{
if ( ParamCount != m_constructorPropertiesCount )
{
wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const
{
- wxPropertyInfo* info = m_firstProperty;
+ wxPropertyInfo* info = GetFirstProperty();
while( info )
{
wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyName) const
{
- wxHandlerInfo* info = m_firstHandler;
+ wxHandlerInfo* info = GetFirstHandler();
while( info )
{
}
bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer,
- wxObjectReaderCallback *persister, wxVariantBaseArray &metadata) const
+ wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const
{
wxObjectStreamingCallback sb = GetStreamingCallback();
if ( sb )
- return (*sb)(obj, streamer, persister, metadata );
+ return (*sb)(obj, streamer, writercallback, metadata );
return true;
}
void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName,
- const wxVariantBase &value) const
+ const wxAny &value) const
{
const wxPropertyAccessor *accessor;
accessor->SetProperty( object, value );
}
-wxVariantBase wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
+wxAny wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
{
const wxPropertyAccessor *accessor;
accessor = FindAccessor(propertyName);
wxASSERT(accessor->HasGetter());
- wxVariantBase result;
+ wxAny result;
accessor->GetProperty(object,result);
return result;
}
-wxVariantBaseArray wxClassInfo::GetPropertyCollection(wxObject *object,
+wxAnyList wxClassInfo::GetPropertyCollection(wxObject *object,
const wxChar *propertyName) const
{
const wxPropertyAccessor *accessor;
accessor = FindAccessor(propertyName);
wxASSERT(accessor->HasGetter());
- wxVariantBaseArray result;
+ wxAnyList result;
accessor->GetPropertyCollection(object,result);
return result;
}
void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName,
- const wxVariantBase& value) const
+ const wxAny& value) const
{
const wxPropertyAccessor *accessor;
}
}
+wxObject* wxClassInfo::AnyToObjectPtr( const wxAny &data) const
+{
+ return m_variantOfPtrToObjectConverter(data);
+}
+
+void wxClassInfo::CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const
+{
+ if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT )
+ return m_variantToObjectConverter(data, functor);
+ else
+ return (*functor)(m_variantOfPtrToObjectConverter(data));
+}
+
+wxAny wxClassInfo::ObjectPtrToAny( wxObject* obj) const
+{
+ return m_objectToVariantConverter(obj);
+}
// ----------------------------------------------------------------------------
// wxDynamicObject support
{
wxDynamicObjectInternal() {}
-#if wxUSE_UNICODE
- map<wstring,wxVariantBase> m_properties;
-#else
- map<string,wxVariantBase> m_properties;
-#endif
+ wxStringToAnyHashMap m_properties;
};
typedef list< wxDynamicObject* > wxDynamicObjectList;
delete m_superClassInstance;
}
-void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxVariantBase &value)
+void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxAny &value)
{
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
wxT("Accessing Unknown Property in a Dynamic Object") );
m_data->m_properties[propertyName] = value;
}
-wxVariantBase wxDynamicObject::GetProperty (const wxChar *propertyName) const
+wxAny wxDynamicObject::GetProperty (const wxChar *propertyName) const
{
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
wxT("Accessing Unknown Property in a Dynamic Object") );
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),
wxT("Renaming Unknown Property in a Dynamic Object") );
- wxVariantBase value = m_data->m_properties[oldPropertyName];
+ wxAny value = m_data->m_properties[oldPropertyName];
m_data->m_properties.erase( oldPropertyName );
m_data->m_properties[newPropertyName] = value;
}
return obj;
}
-bool wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxVariantBase *params) const
+bool wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxAny *params) const
{
wxDynamicObject *dynobj = wx_dynamic_cast( wxDynamicObject *, object );
wxASSERT_MSG( dynobj,
return GetParents()[0]->GetCreateParamName( i );
}
-void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxVariantBase &value) const
+void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxAny &value) const
{
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance(), propertyName, value );
}
-wxVariantBase wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
+wxAny wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
{
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
void wxDynamicClassInfo::AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo )
{
- new wxPropertyInfo( m_firstProperty, this, propertyName, typeInfo->GetTypeName(), new wxGenericPropertyAccessor( propertyName ), wxVariantBase() );
+ EnsureInfosInited();
+ new wxPropertyInfo( m_firstProperty, this, propertyName, typeInfo->GetTypeName(), new wxGenericPropertyAccessor( propertyName ), wxAny() );
}
void wxDynamicClassInfo::AddHandler( const wxChar *handlerName, wxObjectEventFunction address, const wxClassInfo* eventClassInfo )
{
+ EnsureInfosInited();
new wxHandlerInfo( m_firstHandler, this, handlerName, address, eventClassInfo );
}
delete m_data;
}
-void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxVariantBase &value) const
+void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxAny &value) const
{
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
dynobj->SetProperty(m_propertyName, value );
}
-void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxVariantBase& value) const
+void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxAny& value) const
{
const wxDynamicObject* dynobj = wx_dynamic_cast( const wxDynamicObject * , object );
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
value = dynobj->GetProperty( m_propertyName );
}
+// ----------------------------------------------------------------------------
+// wxGenericPropertyAccessor
+// ----------------------------------------------------------------------------
+
+wxString wxAnyGetAsString( const wxAny& data)
+{
+ if ( data.IsNull() || data.GetTypeInfo()==NULL )
+ return wxEmptyString;
+
+ wxString s;
+ data.GetTypeInfo()->ConvertToString(data,s);
+ return s;
+}
+
+const wxObject* wxAnyGetAsObjectPtr( const wxAny& data)
+{
+ if ( !data.IsNull() )
+ {
+ const wxClassTypeInfo* ti = wx_dynamic_cast(const wxClassTypeInfo*, data.GetTypeInfo());
+ if( ti )
+ return ti->GetClassInfo()->AnyToObjectPtr(data);
+ }
+ return NULL;
+}
+
+wxObjectFunctor::~wxObjectFunctor()
+{};
+
#endif // wxUSE_EXTENDED_RTTI
}
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
- wxObjectReaderCallback *persister, const wxString &name,
- wxVariantBaseArray &metadata )
+ wxObjectWriterCallback *writercallback, const wxString &name,
+ const wxStringToAnyHashMap &metadata )
{
DoBeginWriteTopLevelEntry( name );
- WriteObject( object, classInfo, persister, false, metadata);
+ WriteObject( object, classInfo, writercallback, false, metadata);
DoEndWriteTopLevelEntry( name );
}
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
- wxObjectReaderCallback *persister, bool isEmbedded,
- wxVariantBaseArray &metadata )
+ wxObjectWriterCallback *writercallback, bool isEmbedded,
+ const wxStringToAnyHashMap &metadata )
{
- if ( !classInfo->BeforeWriteObject( object, this, persister, metadata) )
+ if ( !classInfo->BeforeWriteObject( object, this, writercallback, metadata) )
return;
- if ( persister->BeforeWriteObject( this, object, classInfo, metadata) )
+ if ( writercallback->BeforeWriteObject( this, object, classInfo, metadata) )
{
if ( object == NULL )
DoWriteNullObject();
DoBeginWriteObject( object, classInfo, oid, metadata );
wxObjectWriterInternalPropertiesData data;
- WriteAllProperties( object, classInfo, persister, &data );
+ WriteAllProperties( object, classInfo, writercallback, &data );
DoEndWriteObject( object, classInfo, oid );
}
- persister->AfterWriteObject( this,object, classInfo );
+ writercallback->AfterWriteObject( this,object, classInfo );
}
}
if ( dynamicEvents )
{
- wxList::compatibility_iterator node = dynamicEvents->GetFirst();
- while (node)
+ for ( wxList::const_iterator node = dynamicEvents->begin(); node != dynamicEvents->end(); ++node )
{
- wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
+ wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)(*node);
// find the match
if ( entry->m_fn &&
(dti->GetEventType() == entry->m_eventType) &&
(entry->m_id == -1 ) &&
- (entry->m_eventSink != NULL ) )
+ (entry->m_fn->GetEvtHandler() != NULL ) )
{
- sink = entry->m_eventSink;
+ sink = entry->m_fn->GetEvtHandler();
const wxClassInfo* sinkClassInfo = sink->GetClassInfo();
const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler();
while ( sinkHandler )
{
- if ( sinkHandler->GetEventFunction() == entry->m_fn )
+ if ( sinkHandler->GetEventFunction() == entry->m_fn->GetEvtMethod() )
{
handler = sinkHandler;
break;
}
break;
}
- node = node->GetNext();
}
}
}
void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
- wxObjectReaderCallback *persister,
+ wxObjectWriterCallback *writercallback,
wxObjectWriterInternalPropertiesData * data )
{
wxPropertyInfoMap map;
const wxPropertyInfo* prop = iter == map.end() ? NULL : iter->second;
if ( prop )
{
- WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
+ WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
}
else
{
const wxPropertyInfo* prop = iter->second;
if ( prop->GetFlags() & wxPROP_OBJECT_GRAPH )
{
- WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
+ WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
}
}
}
const wxPropertyInfo* prop = iter->second;
if ( !(prop->GetFlags() & wxPROP_OBJECT_GRAPH) )
{
- WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
+ WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
}
}
}
}
+class WXDLLIMPEXP_BASE wxObjectPropertyWriter: public wxObjectWriterFunctor
+{
+public:
+ wxObjectPropertyWriter(const wxClassTypeInfo* cti,
+ wxObjectWriterCallback *writercallback,
+ wxObjectWriter* writer,
+ wxStringToAnyHashMap &props) :
+ m_cti(cti),m_persister(writercallback),m_writer(writer),m_props(props)
+ {}
+
+ virtual void operator()(const wxObject *vobj)
+ {
+ m_writer->WriteObject( vobj, (vobj ? vobj->GetClassInfo() : m_cti->GetClassInfo() ),
+ m_persister, m_cti->GetKind()== wxT_OBJECT, m_props );
+ }
+private:
+ const wxClassTypeInfo* m_cti;
+ wxObjectWriterCallback *m_persister;
+ wxObjectWriter* m_writer;
+ wxStringToAnyHashMap& m_props;
+};
+
void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
- const wxPropertyInfo* pi, wxObjectReaderCallback *persister,
+ const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback,
wxObjectWriterInternalPropertiesData *WXUNUSED(data) )
{
if ( pi->GetFlags() & wxPROP_DONT_STREAM )
if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION )
{
- wxVariantBaseArray data;
+ wxAnyList data;
pi->GetAccessor()->GetPropertyCollection(obj, data);
const wxTypeInfo * elementType =
wx_dynamic_cast( const wxCollectionTypeInfo*, pi->GetTypeInfo() )->GetElementType();
- for ( size_t i = 0; i < data.GetCount(); ++i )
+ if ( !data.empty() )
{
- if ( i == 0 )
- DoBeginWriteProperty( pi );
-
- DoBeginWriteElement();
- wxVariantBase value = data[i];
- if ( persister->BeforeWriteProperty( this, obj, pi, value ) )
+ DoBeginWriteProperty( pi );
+ for ( wxAnyList::const_iterator iter = data.begin(); iter != data.end(); ++iter )
{
- const wxClassTypeInfo* cti =
- wx_dynamic_cast( const wxClassTypeInfo*, elementType );
- if ( cti )
- {
- const wxClassInfo* pci = cti->GetClassInfo();
- wxObject *vobj = pci->VariantToInstance( value );
- wxVariantBaseArray md;
- WriteObject( vobj, (vobj ? vobj->GetClassInfo() : pci ),
- persister, cti->GetKind()== wxT_OBJECT, md );
- }
- else
+ DoBeginWriteElement();
+ const wxAny* valptr = *iter;
+ if ( writercallback->BeforeWriteProperty( this, obj, pi, *valptr ) )
{
- DoWriteSimpleType( value );
+ const wxClassTypeInfo* cti =
+ wx_dynamic_cast( const wxClassTypeInfo*, elementType );
+ if ( cti )
+ {
+ wxStringToAnyHashMap md;
+ wxObjectPropertyWriter pw(cti,writercallback,this, md);
+
+ const wxClassInfo* pci = cti->GetClassInfo();
+ pci->CallOnAny( *valptr, &pw);
+ }
+ else
+ {
+ DoWriteSimpleType( *valptr );
+ }
}
+ DoEndWriteElement();
}
- DoEndWriteElement();
- if ( i == data.GetCount() - 1 )
- DoEndWriteProperty( pi );
- }
- }
+ DoEndWriteProperty( pi );
+ }
+ }
else
{
const wxEventSourceTypeInfo* dti =
if ( evSource )
{
FindConnectEntry( evSource, dti, sink, handler );
- if ( persister->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) )
+ if ( writercallback->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) )
{
if ( sink != NULL && handler != NULL )
{
}
else
{
- wxVariantBase value;
+ wxAny value;
pi->GetAccessor()->GetProperty(obj, value);
// avoid streaming out void objects
- if( value.IsEmpty() )
+ // TODO Verify
+ if( value.IsNull() )
return;
if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
wx_dynamic_cast(const wxEnumTypeInfo*, pi->GetTypeInfo() );
if ( eti )
{
- eti->ConvertFromLong( value.wxTEMPLATED_MEMBER_CALL(Get, long), value );
+ eti->ConvertFromLong( wxANY_AS(value, long ), value );
}
else
{
// avoid streaming out default values
if ( pi->GetTypeInfo()->HasStringConverters() &&
- !pi->GetDefaultValue().IsEmpty() )
+ !pi->GetDefaultValue().IsNull() ) // TODO Verify
{
- if ( value.GetAsString() == pi->GetDefaultValue().GetAsString() )
+ if ( wxAnyGetAsString(value) == wxAnyGetAsString(pi->GetDefaultValue()) )
return;
}
const wxClassTypeInfo* cti =
wx_dynamic_cast( const wxClassTypeInfo* , pi->GetTypeInfo() );
- if ( cti && value.GetAsObject() == NULL )
+ if ( cti && cti->GetKind() == wxT_OBJECT_PTR && wxAnyGetAsObjectPtr(value) == NULL )
return;
- if ( persister->BeforeWriteProperty( this, obj, pi, value ) )
+ if ( writercallback->BeforeWriteProperty( this, obj, pi, value ) )
{
DoBeginWriteProperty( pi );
if ( cti )
{
- const wxClassInfo* pci = cti->GetClassInfo();
- wxObject *vobj = pci->VariantToInstance( value );
- if ( vobj && pi->GetTypeInfo()->HasStringConverters() )
+ if ( cti->HasStringConverters() )
{
wxString stringValue;
cti->ConvertToString( value, stringValue );
- wxVariantBase convertedValue(stringValue);
+ wxAny convertedValue(stringValue);
DoWriteSimpleType( convertedValue );
}
else
{
- wxVariantBaseArray md;
- WriteObject( vobj, (vobj ? vobj->GetClassInfo() : pci ),
- persister, cti->GetKind()== wxT_OBJECT, md);
+ wxStringToAnyHashMap md;
+ wxObjectPropertyWriter pw(cti,writercallback,this, md);
+
+ const wxClassInfo* pci = cti->GetClassInfo();
+ pci->CallOnAny(value, &pw);
}
}
else
}
void wxObjectRuntimeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
- wxVariantBaseArray &WXUNUSED(metadata))
+ wxStringToAnyHashMap &WXUNUSED(metadata))
{
wxObject *O;
O = classInfo->CreateObject();
void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
- wxVariantBase *params,
+ wxAny *params,
int *objectIdValues,
const wxClassInfo **objectClassInfos,
- wxVariantBaseArray &WXUNUSED(metadata))
+ wxStringToAnyHashMap &WXUNUSED(metadata))
{
wxObject *o;
o = m_data->GetObject(objectID);
{
o = dyno->GetSuperClassInstance();
}
- params[i] = objectClassInfos[i]->InstanceToVariant(o);
+ params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
}
}
classInfo->Create(o, paramCount, params);
void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
const wxClassInfo *classInfo,
int paramCount,
- wxVariantBase *params,
+ wxAny *params,
int *objectIdValues,
const wxClassInfo **objectClassInfos,
- wxVariantBaseArray &WXUNUSED(metadata))
+ wxStringToAnyHashMap &WXUNUSED(metadata))
{
wxObject *o;
for ( int i = 0; i < paramCount; ++i )
{
o = dyno->GetSuperClassInstance();
}
- params[i] = objectClassInfos[i]->InstanceToVariant(o);
+ params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
}
}
o = classInfo->ConstructObject(paramCount, params);
void wxObjectRuntimeReaderCallback::SetProperty(int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
- const wxVariantBase &value)
+ const wxAny &value)
{
wxObject *o;
o = m_data->GetObject(objectID);
}
classInfo->SetProperty( o, propertyInfo->GetName(),
- valClassInfo->InstanceToVariant(valo) );
+ valClassInfo->ObjectPtrToAny(valo) );
}
void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID,
void wxObjectRuntimeReaderCallback::AddToPropertyCollection( int objectID,
const wxClassInfo *classInfo,
const wxPropertyInfo* propertyInfo,
- const wxVariantBase &value)
+ const wxAny &value)
{
wxObject *o;
o = m_data->GetObject(objectID);
}
classInfo->AddToPropertyCollection( o, propertyInfo->GetName(),
- valClassInfo->InstanceToVariant(valo) );
+ valClassInfo->ObjectPtrToAny(valo) );
}
-#if TEST_XVARIANT
-#include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(wxVariantBaseArray);
-#endif
-
#endif // wxUSE_EXTENDED_RTTI
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+#pragma hdrstop
#endif
#if wxUSE_EXTENDED_RTTI
-#include "wx/xtixml.h"
+#include "wx/xtistrm.h"
#ifndef WX_PRECOMP
#include "wx/object.h"
#include "wx/tokenzr.h"
#include "wx/txtstrm.h"
#include "wx/xtistrm.h"
+#include "wx/xtixml.h"
// STL headers
void wxObjectXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object),
const wxClassInfo *classInfo,
- int objectID, wxVariantBaseArray &metadata )
+ int objectID, const wxStringToAnyHashMap &metadata )
{
wxXmlNode *pnode;
pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
pnode->AddProperty(wxT("class"), wxString(classInfo->GetClassName()));
pnode->AddProperty(wxT("id"), wxString::Format( wxT("%d"), objectID ) );
- for ( size_t i = 0; i < metadata.GetCount(); ++i )
+ wxStringToAnyHashMap::const_iterator it, en;
+ for( it = metadata.begin(), en = metadata.end(); it != en; ++it )
{
- pnode->AddProperty( metadata[i].GetName(), metadata[i].GetAsString() );
+ pnode->AddProperty( it->first, wxAnyGetAsString(it->second) );
}
+
m_data->m_current->AddChild(pnode);
m_data->Push( pnode );
}
m_data->Pop();
}
-void wxObjectXmlWriter::DoWriteSimpleType( wxVariantBase &value )
+void wxObjectXmlWriter::DoWriteSimpleType( const wxAny &value )
{
- wxXmlAddContentToNode( m_data->m_current,value.GetAsString() );
+ wxXmlAddContentToNode( m_data->m_current,wxAnyGetAsString(value) );
}
void wxObjectXmlWriter::DoBeginWriteElement()
and create params are always toplevel class only
*/
-int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *callbacks)
+int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *callbacks)
{
wxASSERT_MSG( callbacks, wxT("Does not support reading without a Depersistor") );
wxString className;
wxClassInfo *classInfo;
- wxVariantBase *createParams;
+ wxAny *createParams;
int *createParamOids;
const wxClassInfo** createClassInfos;
wxXmlNode *children;
if (!children)
{
// check for a null object or href
- if (node->GetPropVal(wxT("href"), &ObjectIdString ) )
+ if (node->GetAttribute(wxT("href"), &ObjectIdString ) )
{
objectID = atoi( ObjectIdString.ToAscii() );
if ( HasObjectClassInfo( objectID ) )
return wxInvalidObjectID;
}
}
- if ( !node->GetPropVal(wxT("id"), &ObjectIdString ) )
+ if ( !node->GetAttribute(wxT("id"), &ObjectIdString ) )
{
return wxNullObjectID;
}
}
- if (!node->GetPropVal(wxT("class"), &className))
+ if (!node->GetAttribute(wxT("class"), &className))
{
// No class name. Eek. FIXME: error handling
return wxInvalidObjectID;
wxLogError(_("objects cannot have XML Text Nodes") );
return wxInvalidObjectID;
}
- if (!node->GetPropVal(wxT("id"), &ObjectIdString))
+ if (!node->GetAttribute(wxT("id"), &ObjectIdString))
{
wxLogError(_("Objects must have an id attribute") );
// No object id. Eek. FIXME: error handling
// first make the object know to our internal registry
SetObjectClassInfo( objectID, classInfo );
- wxVariantBaseArray metadata;
- wxXmlProperty *xp = node->GetProperties();
+ wxStringToAnyHashMap metadata;
+ wxXmlProperty *xp = node->GetAttributes();
while ( xp )
{
if ( xp->GetName() != wxString(wxT("class")) &&
xp->GetName() != wxString(wxT("id")) )
{
- metadata.Add( new wxVariantBase( xp->GetValue(), xp->GetName() ) );
+ metadata[xp->GetName()] = wxAny( xp->GetValue() );
}
xp = xp->GetNext();
}
//
// stream back the Create parameters first
- createParams = new wxVariantBase[ classInfo->GetCreateParamCount() ];
+ createParams = new wxAny[ classInfo->GetCreateParamCount() ];
createParamOids = new int[classInfo->GetCreateParamCount() ];
createClassInfos = new const wxClassInfo*[classInfo->GetCreateParamCount() ];
while( children )
{
wxString name;
- children->GetPropVal( wxT("name"), &name );
+ children->GetAttribute( wxT("name"), &name );
propertyNames.push_back( (const wxChar*)name.c_str() );
propertyNodes[(const wxChar*)name.c_str()] = children->GetChildren();
children = children->GetNext();
{
long realval;
eti->ConvertToLong( createParams[i], realval );
- createParams[i] = wxVariantBase( realval );
+ createParams[i] = wxAny( realval );
}
else
{
}
else
{
- wxVariantBase elementValue = ReadValue( elementContent, elementType );
+ wxAny elementValue = ReadValue( elementContent, elementType );
if ( pi->GetAccessor()->HasAdder() )
callbacks->AddToPropertyCollection( objectID, classInfo,pi, elementValue );
}
else
{
wxASSERT( pi->GetTypeInfo()->HasStringConverters() );
- wxVariantBase nodeval = ReadValue( prop, pi->GetTypeInfo() );
+ wxAny nodeval = ReadValue( prop, pi->GetTypeInfo() );
callbacks->SetProperty( objectID, classInfo,pi, nodeval );
}
}
}
else
{
- wxVariantBase nodeval = ReadValue( prop, pi->GetTypeInfo() );
+ wxAny nodeval = ReadValue( prop, pi->GetTypeInfo() );
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
{
const wxEnumTypeInfo *eti =
{
long realval;
eti->ConvertToLong( nodeval, realval );
- nodeval = wxVariantBase( realval );
+ nodeval = wxAny( realval );
}
else
{
return objectID;
}
-wxVariantBase wxObjectXmlReader::ReadValue(wxXmlNode *node,
+wxAny wxObjectXmlReader::ReadValue(wxXmlNode *node,
const wxTypeInfo *type )
{
wxString content;
if ( node )
content = node->GetContent();
- wxVariantBase result;
+ wxAny result;
type->ConvertFromString( content, result );
return result;
}
-int wxObjectXmlReader::ReadObject( const wxString &name, wxObjectWriterCallback *callbacks)
+int wxObjectXmlReader::ReadObject( const wxString &name, wxObjectReaderCallback *callbacks)
{
wxXmlNode *iter = m_parent->GetChildren();
while ( iter )
{
wxString entryName;
- if ( iter->GetPropVal(wxT("name"), &entryName) )
+ if ( iter->GetAttribute(wxT("name"), &entryName) )
{
if ( entryName == name )
return ReadComponent( iter->GetChildren(), callbacks );