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
This commit is contained in:
Václav Slavík
2006-07-28 07:14:14 +00:00
parent 122ff921f0
commit 8e8a4e8587
2 changed files with 15 additions and 11 deletions

View File

@@ -18,6 +18,7 @@
#include "wx/string.h" #include "wx/string.h"
#include "wx/dynarray.h" #include "wx/dynarray.h"
#include "wx/datetime.h" #include "wx/datetime.h"
#include "wx/list.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/filesys.h" #include "wx/filesys.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
@@ -87,10 +88,6 @@ WX_DECLARE_USER_EXPORTED_OBJARRAY(wxXmlResourceDataRecord,
wxXmlResourceDataRecords, wxXmlResourceDataRecords,
WXDLLIMPEXP_XRC); WXDLLIMPEXP_XRC);
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxXmlResourceHandler*,
wxXmlResourceHandlers,
class WXDLLIMPEXP_XRC);
enum wxXmlResourceFlags enum wxXmlResourceFlags
{ {
wxXRC_USE_LOCALE = 1, wxXRC_USE_LOCALE = 1,
@@ -277,7 +274,7 @@ private:
long m_version; long m_version;
int m_flags; int m_flags;
wxXmlResourceHandlers m_handlers; wxList m_handlers;
wxXmlResourceDataRecords m_data; wxXmlResourceDataRecords m_data;
#if wxUSE_FILESYSTEM #if wxUSE_FILESYSTEM
wxFileSystem m_curFileSystem; wxFileSystem m_curFileSystem;

View File

@@ -215,13 +215,13 @@ IMPLEMENT_ABSTRACT_CLASS(wxXmlResourceHandler, wxObject)
void wxXmlResource::AddHandler(wxXmlResourceHandler *handler) void wxXmlResource::AddHandler(wxXmlResourceHandler *handler)
{ {
m_handlers.Add(handler); m_handlers.Append(handler);
handler->SetParentResource(this); handler->SetParentResource(this);
} }
void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler) void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler)
{ {
m_handlers.Insert(handler, 0); m_handlers.Insert(handler);
handler->SetParentResource(this); handler->SetParentResource(this);
} }
@@ -229,7 +229,7 @@ void wxXmlResource::InsertHandler(wxXmlResourceHandler *handler)
void wxXmlResource::ClearHandlers() void wxXmlResource::ClearHandlers()
{ {
WX_CLEAR_ARRAY(m_handlers); WX_CLEAR_LIST(wxList, m_handlers);
} }
@@ -672,20 +672,27 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
return CreateResFromNode(&copy, parent, instance); return CreateResFromNode(&copy, parent, instance);
} }
wxXmlResourceHandler *handler;
if (handlerToUse) if (handlerToUse)
{ {
if (handlerToUse->CanHandle(node)) if (handlerToUse->CanHandle(node))
{
return handlerToUse->CreateResource(node, parent, instance); return handlerToUse->CreateResource(node, parent, instance);
} }
}
else if (node->GetName() == wxT("object")) else if (node->GetName() == wxT("object"))
{ {
for ( wxXmlResourceHandlers::iterator i = m_handlers.begin(); wxList::compatibility_iterator ND = m_handlers.GetFirst();
i != m_handlers.end(); ++i ) while (ND)
{ {
wxXmlResourceHandler *handler = *i; handler = (wxXmlResourceHandler*)ND->GetData();
if (handler->CanHandle(node)) if (handler->CanHandle(node))
{
return handler->CreateResource(node, parent, instance); return handler->CreateResource(node, parent, instance);
} }
ND = ND->GetNext();
}
} }
wxLogError(_("No handler found for XML node '%s', class '%s'!"), wxLogError(_("No handler found for XML node '%s', class '%s'!"),