X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e7feeafa568d3c01ddf4d6466c4724dbe06c18eb..a5de860f0b8994b2d87d0a0d3c3dedf750fa7ddb:/src/html/htmlpars.cpp diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index ea7f38d865..c51181a3fa 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: htmlpars.cpp +// Name: src/html/htmlpars.cpp // Purpose: wxHtmlParser class (generic parser) // Author: Vaclav Slavik // RCS-ID: $Id$ @@ -9,16 +9,18 @@ #include "wx/wxprec.h" -#include "wx/defs.h" -#if wxUSE_HTML && wxUSE_STREAMS - #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#ifndef WXPRECOMP +#if wxUSE_HTML && wxUSE_STREAMS + +#ifndef WX_PRECOMP + #include "wx/dynarray.h" #include "wx/log.h" #include "wx/intl.h" + #include "wx/app.h" + #include "wx/wxcrtvararg.h" #endif #include "wx/tokenzr.h" @@ -27,15 +29,13 @@ #include "wx/fontmap.h" #include "wx/html/htmldefs.h" #include "wx/html/htmlpars.h" -#include "wx/dynarray.h" -#include "wx/arrimpl.cpp" +#include "wx/vector.h" #ifdef __WXWINCE__ #include "wx/msw/wince/missing.h" // for bsearch() #endif // DLL options compatibility check: -#include "wx/app.h" WX_CHECK_BUILD_OPTIONS("wxHTML") const wxChar *wxTRACE_HTML_DEBUG = _T("htmldebug"); @@ -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 { @@ -135,7 +138,7 @@ void wxHtmlParser::CreateDOMTree() { wxHtmlTagsCache cache(m_Source); m_TextPieces = new wxHtmlTextPieces; - CreateDOMSubTree(NULL, 0, m_Source.Length(), &cache); + CreateDOMSubTree(NULL, 0, m_Source.length(), &cache); m_CurTextPiece = 0; } @@ -168,33 +171,15 @@ 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: - if (i < end_pos-6 && m_Source.GetChar(i+1) == wxT('!') && - m_Source.GetChar(i+2) == wxT('-') && - m_Source.GetChar(i+3) == wxT('-')) + wxString::const_iterator iter = m_Source.begin() + i; + if ( SkipCommentTag(iter, m_Source.end()) ) { - // Comments begin with "