From: Václav Slavík Date: Thu, 27 Jul 2006 14:03:02 +0000 (+0000) Subject: don't use untyped wxList in wxXmlResource X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/67868c1e6c5a600fa6752e0abff13b732c8e689f?ds=inline don't use untyped wxList in wxXmlResource git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 2644c6e86a..73076ea62b 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -18,7 +18,6 @@ #include "wx/string.h" #include "wx/dynarray.h" #include "wx/datetime.h" -#include "wx/list.h" #include "wx/gdicmn.h" #include "wx/filesys.h" #include "wx/bitmap.h" @@ -88,6 +87,10 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxXmlResourceDataRecord, wxXmlResourceDataRecords, WXDLLIMPEXP_XRC); +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxXmlResourceHandler*, + wxXmlResourceHandlers, + class WXDLLIMPEXP_XRC); + enum wxXmlResourceFlags { wxXRC_USE_LOCALE = 1, @@ -274,7 +277,7 @@ private: long m_version; int m_flags; - wxList m_handlers; + wxXmlResourceHandlers m_handlers; wxXmlResourceDataRecords m_data; #if wxUSE_FILESYSTEM wxFileSystem m_curFileSystem; diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 96a7cd6b5a..040951fc11 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -215,13 +215,13 @@ IMPLEMENT_ABSTRACT_CLASS(wxXmlResourceHandler, wxObject) void wxXmlResource::AddHandler(wxXmlResourceHandler *handler) { - m_handlers.Append(handler); + m_handlers.Add(handler); handler->SetParentResource(this); } void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler) { - m_handlers.Insert(handler); + m_handlers.Insert(handler, 0); handler->SetParentResource(this); } @@ -229,7 +229,7 @@ void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler) void wxXmlResource::ClearHandlers() { - WX_CLEAR_LIST(wxList, m_handlers); + WX_CLEAR_ARRAY(m_handlers); } @@ -672,26 +672,19 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, return CreateResFromNode(©, parent, instance); } - wxXmlResourceHandler *handler; - if (handlerToUse) { if (handlerToUse->CanHandle(node)) - { return handlerToUse->CreateResource(node, parent, instance); - } } else if (node->GetName() == wxT("object")) { - wxList::compatibility_iterator ND = m_handlers.GetFirst(); - while (ND) + for ( wxXmlResourceHandlers::iterator i = m_handlers.begin(); + i != m_handlers.end(); ++i ) { - handler = (wxXmlResourceHandler*)ND->GetData(); + wxXmlResourceHandler *handler = *i; if (handler->CanHandle(node)) - { return handler->CreateResource(node, parent, instance); - } - ND = ND->GetNext(); } }