From 3c47c04740b7c456823e0fd31edbdf1e6bfff43b Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 22 Aug 2007 15:21:46 +0000 Subject: [PATCH] use wxVector instead of OBJARRAY macros for wxHtmlTextPieces (slightly better performance) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48339 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/htmlpars.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 001e547fa2..c51181a3fa 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -29,7 +29,7 @@ #include "wx/fontmap.h" #include "wx/html/htmldefs.h" #include "wx/html/htmlpars.h" -#include "wx/arrimpl.cpp" +#include "wx/vector.h" #ifdef __WXWINCE__ #include "wx/msw/wince/missing.h" // for bsearch() @@ -47,12 +47,15 @@ const wxChar *wxTRACE_HTML_DEBUG = _T("htmldebug"); class wxHtmlTextPiece { public: + wxHtmlTextPiece() {} wxHtmlTextPiece(int pos, int lng) : m_pos(pos), m_lng(lng) {} int m_pos, m_lng; }; -WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces); -WX_DEFINE_OBJARRAY(wxHtmlTextPieces) +// NB: this is an empty class and not typedef because of forward declaration +class wxHtmlTextPieces : public wxVector +{ +}; class wxHtmlParserState { @@ -168,7 +171,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, { // add text to m_TextPieces: if (i - textBeginning > 0) - m_TextPieces->Add( + m_TextPieces->push_back( wxHtmlTextPiece(textBeginning, i - textBeginning)); // if it is a comment, skip it: @@ -230,7 +233,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, // add remaining text to m_TextPieces: if (end_pos - textBeginning > 0) - m_TextPieces->Add( + m_TextPieces->push_back( wxHtmlTextPiece(textBeginning, end_pos - textBeginning)); } @@ -262,7 +265,7 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos) if (end_pos <= begin_pos) return; wxHtmlTextPieces& pieces = *m_TextPieces; - size_t piecesCnt = pieces.GetCount(); + size_t piecesCnt = pieces.size(); while (begin_pos < end_pos) { -- 2.45.2