fixed wxHTML parsing to run in O(n) even in UTF8 build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-08-26 10:04:11 +00:00
parent 4f33a4dd4c
commit b1a3a96499
5 changed files with 191 additions and 120 deletions

View File

@@ -73,7 +73,8 @@ public:
// Parses the m_Source from begin_pos to end_pos-1.
// (in noparams version it parses whole m_Source)
void DoParsing(int begin_pos, int end_pos);
void DoParsing(const wxString::const_iterator& begin_pos,
const wxString::const_iterator& end_pos);
void DoParsing();
// Returns pointer to the tag at parser's current position
@@ -104,7 +105,7 @@ public:
// Restores state before last call to PushTagHandler
void PopTagHandler();
wxString* GetSource() {return &m_Source;}
const wxString* GetSource() {return m_Source;}
void SetSource(const wxString& src);
// Sets HTML source and remembers current parser's state so that it can
@@ -140,7 +141,8 @@ protected:
void CreateDOMTree();
void DestroyDOMTree();
void CreateDOMSubTree(wxHtmlTag *cur,
int begin_pos, int end_pos,
const wxString::const_iterator& begin_pos,
const wxString::const_iterator& end_pos,
wxHtmlTagsCache *cache);
// Adds text to the output.
@@ -163,7 +165,7 @@ protected:
wxHtmlTextPieces *m_TextPieces;
size_t m_CurTextPiece;
wxString m_Source;
const wxString *m_Source;
wxHtmlParserState *m_SavedStates;
@@ -232,7 +234,7 @@ protected:
// parses input between beginning and ending tag.
// m_Parser must be set.
void ParseInner(const wxHtmlTag& tag)
{ m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); }
{ m_Parser->DoParsing(tag.GetBeginIter(), tag.GetEndIter1()); }
// Parses given source as if it was tag's inner code (see
// wxHtmlParser::GetInnerSource). Unlike ParseInner(), this method lets