From 8e8a4e8587b7642018f18b96adf04a7f69d0a829 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 28 Jul 2006 07:14:14 +0000 Subject: [PATCH] reverted the change to not use wxList until dynarray.h is fixed to provide operator* in both STL and non-STL modes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/xrc/xmlres.h | 7 ++----- src/xrc/xmlres.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index 73076ea62b..2644c6e86a 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -18,6 +18,7 @@ #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" @@ -87,10 +88,6 @@ 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, @@ -277,7 +274,7 @@ private: long m_version; int m_flags; - wxXmlResourceHandlers m_handlers; + wxList m_handlers; wxXmlResourceDataRecords m_data; #if wxUSE_FILESYSTEM wxFileSystem m_curFileSystem; diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 040951fc11..96a7cd6b5a 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.Add(handler); + m_handlers.Append(handler); handler->SetParentResource(this); } void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler) { - m_handlers.Insert(handler, 0); + m_handlers.Insert(handler); handler->SetParentResource(this); } @@ -229,7 +229,7 @@ void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler) void wxXmlResource::ClearHandlers() { - WX_CLEAR_ARRAY(m_handlers); + WX_CLEAR_LIST(wxList, m_handlers); } @@ -672,19 +672,26 @@ 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")) { - for ( wxXmlResourceHandlers::iterator i = m_handlers.begin(); - i != m_handlers.end(); ++i ) + wxList::compatibility_iterator ND = m_handlers.GetFirst(); + while (ND) { - wxXmlResourceHandler *handler = *i; + handler = (wxXmlResourceHandler*)ND->GetData(); if (handler->CanHandle(node)) + { return handler->CreateResource(node, parent, instance); + } + ND = ND->GetNext(); } } -- 2.45.2