From: Vadim Zeitlin Date: Tue, 21 Mar 2006 14:05:11 +0000 (+0000) Subject: Made wxList::compatibility_iterator a class in wxUSE_STL == 0 case too instead X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0cc70962a1771fb53c1208648ca46c6185699fd2 Made wxList::compatibility_iterator a class in wxUSE_STL == 0 case too instead of a simple typedef to "Node *" to be able to initialize it with NULL in ctor which makes the behaviour of the code with and without wxUSE_STL the same. The price to pay is that the code like wxList:compatibility_iterator ci; ci = cond ? list->GetFirst() : wxList::compatibility_iterator(); doesn't compile any more and has to be replaced with (more clear anyhow) wxList:compatibility_iterator ci; if ( cond ) ci = list->GetFirst(); git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/list.h b/include/wx/list.h index 00659a4f6b..acca225fca 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -680,7 +680,17 @@ private: { \ public: \ typedef nodetype Node; \ - typedef Node* compatibility_iterator; \ + class compatibility_iterator \ + { \ + public: \ + compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ + \ + Node *operator->() const { return m_ptr; } \ + operator Node *() const { return m_ptr; } \ + \ + private: \ + Node *m_ptr; \ + }; \ \ name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ { } \ diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index fc42f4cb5a..7d71dd82d7 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -274,8 +274,10 @@ bool wxHtmlWindow::DoSetPage(const wxString& source) wxHtmlProcessorList::compatibility_iterator nodeL, nodeG; int prL, prG; - nodeL = (m_Processors) ? m_Processors->GetFirst() : wxHtmlProcessorList::compatibility_iterator(); - nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : wxHtmlProcessorList::compatibility_iterator(); + if ( m_Processors ) + nodeL = m_Processors->GetFirst(); + if ( m_GlobalProcessors ) + nodeG = m_GlobalProcessors->GetFirst(); // VS: there are two lists, global and local, both of them sorted by // priority. Since we have to go through _both_ lists with diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 3e01cab6fd..1c63998124 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -567,7 +567,9 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl if (firstParagraph) { wxRichTextObjectList::compatibility_iterator firstNode = m_children.Find(firstParagraph); - wxRichTextObjectList::compatibility_iterator previousNode = firstNode ? firstNode->GetPrevious() : wxRichTextObjectList::compatibility_iterator(); + wxRichTextObjectList::compatibility_iterator previousNode; + if ( firstNode ) + previousNode = firstNode->GetPrevious(); if (firstNode && previousNode) { wxRichTextParagraph* previousParagraph = wxDynamicCast(previousNode->GetData(), wxRichTextParagraph);