use wxString argument and not wxChar* in wxHtmlParser::AddText(), for compatibility with STL build without implicit wxString conversions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -69,6 +69,8 @@ Changes in behaviour which may result in compilation errors
|
||||
This can be worked around by explicitly casting to bool:
|
||||
for ( wxString::const_iterator p = s.begin(); (bool)*p; ++p )
|
||||
|
||||
- virtual wxHtmlParser::AddText() takes wxString, not wxChar*, argument now.
|
||||
|
||||
Deprecated methods and their replacements
|
||||
-----------------------------------------
|
||||
|
||||
|
@@ -74,7 +74,7 @@ All handlers are deleted on object deletion.
|
||||
|
||||
\membersection{wxHtmlParser::AddText}\label{wxhtmlparseraddword}
|
||||
|
||||
\func{virtual void}{AddWord}{\param{const char* }{txt}}
|
||||
\func{virtual void}{AddWord}{\param{const wxString\& }{txt}}
|
||||
|
||||
Must be overwritten in derived class.
|
||||
|
||||
|
@@ -145,10 +145,9 @@ protected:
|
||||
|
||||
// Adds text to the output.
|
||||
// This is called from Parse() and must be overriden in derived classes.
|
||||
// txt is not guaranteed to be only one word. It is largest continuous part of text
|
||||
// (= not broken by tags)
|
||||
// NOTE : using char* because of speed improvements
|
||||
virtual void AddText(const wxChar* txt) = 0;
|
||||
// txt is not guaranteed to be only one word. It is largest continuous part
|
||||
// of text (= not broken by tags)
|
||||
virtual void AddText(const wxString& txt) = 0;
|
||||
|
||||
// Adds tag and proceeds it. Parse() may (and usually is) called from this method.
|
||||
// This is called from Parse() and may be overriden.
|
||||
|
@@ -146,7 +146,7 @@ public:
|
||||
virtual wxFont* CreateCurrentFont();
|
||||
|
||||
protected:
|
||||
virtual void AddText(const wxChar* txt);
|
||||
virtual void AddText(const wxString& txt);
|
||||
|
||||
private:
|
||||
void DoAddText(wxChar *temp, int& templen, wxChar nbsp);
|
||||
|
@@ -125,7 +125,7 @@ public:
|
||||
wxObject* GetProduct() { return NULL; }
|
||||
|
||||
protected:
|
||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
||||
virtual void AddText(const wxString& WXUNUSED(txt)) {}
|
||||
|
||||
DECLARE_NO_COPY_CLASS(HP_Parser)
|
||||
};
|
||||
|
@@ -888,7 +888,7 @@ public:
|
||||
wxObject* GetProduct() { return NULL; }
|
||||
|
||||
protected:
|
||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
||||
virtual void AddText(const wxString& WXUNUSED(txt)) {}
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxMetaTagParser)
|
||||
};
|
||||
|
@@ -342,15 +342,13 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
|
||||
return GetFS()->OpenFile(myurl, flags);
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
void wxHtmlWinParser::AddText(const wxString& txt)
|
||||
{
|
||||
size_t i = 0,
|
||||
x,
|
||||
lng = wxStrlen(txt);
|
||||
register wxChar d;
|
||||
int templen = 0;
|
||||
wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
|
||||
|
||||
size_t lng = txt.length();
|
||||
if (lng+1 > m_tmpStrBufSize)
|
||||
{
|
||||
delete[] m_tmpStrBuf;
|
||||
@@ -359,24 +357,36 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
}
|
||||
wxChar *temp = m_tmpStrBuf;
|
||||
|
||||
wxString::const_iterator i = txt.begin();
|
||||
wxString::const_iterator end = txt.end();
|
||||
|
||||
if (m_tmpLastWasSpace)
|
||||
{
|
||||
while ((i < lng) &&
|
||||
((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
|
||||
(txt[i] == wxT('\t')))) i++;
|
||||
while ( (i < end) &&
|
||||
(*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') ||
|
||||
*i == wxT('\t')) )
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
while (i < lng)
|
||||
while (i < end)
|
||||
{
|
||||
x = 0;
|
||||
d = temp[templen++] = txt[i];
|
||||
size_t x = 0;
|
||||
d = temp[templen++] = *i;
|
||||
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
|
||||
{
|
||||
i++, x++;
|
||||
while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
|
||||
(txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
|
||||
++i, ++x;
|
||||
while ( (i < end) &&
|
||||
(*i == wxT('\n') || *i == wxT('\r') ||
|
||||
*i == wxT(' ')) || *i == wxT('\t') )
|
||||
{
|
||||
++i;
|
||||
++x;
|
||||
}
|
||||
else i++;
|
||||
}
|
||||
else
|
||||
++i;
|
||||
|
||||
if (x)
|
||||
{
|
||||
|
Reference in New Issue
Block a user