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:
@@ -60,7 +60,7 @@ Changes in behaviour which may result in compilation errors
|
|||||||
wxLogError(_("error: %s"), !err.empty() ? (const wxChar*)err.c_str() : "")
|
wxLogError(_("error: %s"), !err.empty() ? (const wxChar*)err.c_str() : "")
|
||||||
|
|
||||||
- wxCtime() and wxAsctime() return char*; this is incompatible with Unicode
|
- wxCtime() and wxAsctime() return char*; this is incompatible with Unicode
|
||||||
build in wxWidgets 2.8 that returned wchar_t*.
|
build in wxWidgets 2.8 that returned wchar_t*.
|
||||||
|
|
||||||
- DigitalMars compiler has a bug that prevents it from using
|
- DigitalMars compiler has a bug that prevents it from using
|
||||||
wxUniChar::operator bool in conditions and it erroneously reports type
|
wxUniChar::operator bool in conditions and it erroneously reports type
|
||||||
@@ -69,6 +69,8 @@ Changes in behaviour which may result in compilation errors
|
|||||||
This can be worked around by explicitly casting to bool:
|
This can be worked around by explicitly casting to bool:
|
||||||
for ( wxString::const_iterator p = s.begin(); (bool)*p; ++p )
|
for ( wxString::const_iterator p = s.begin(); (bool)*p; ++p )
|
||||||
|
|
||||||
|
- virtual wxHtmlParser::AddText() takes wxString, not wxChar*, argument now.
|
||||||
|
|
||||||
Deprecated methods and their replacements
|
Deprecated methods and their replacements
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ All handlers are deleted on object deletion.
|
|||||||
|
|
||||||
\membersection{wxHtmlParser::AddText}\label{wxhtmlparseraddword}
|
\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.
|
Must be overwritten in derived class.
|
||||||
|
|
||||||
|
@@ -145,10 +145,9 @@ protected:
|
|||||||
|
|
||||||
// Adds text to the output.
|
// Adds text to the output.
|
||||||
// This is called from Parse() and must be overriden in derived classes.
|
// 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
|
// txt is not guaranteed to be only one word. It is largest continuous part
|
||||||
// (= not broken by tags)
|
// of text (= not broken by tags)
|
||||||
// NOTE : using char* because of speed improvements
|
virtual void AddText(const wxString& txt) = 0;
|
||||||
virtual void AddText(const wxChar* txt) = 0;
|
|
||||||
|
|
||||||
// Adds tag and proceeds it. Parse() may (and usually is) called from this method.
|
// Adds tag and proceeds it. Parse() may (and usually is) called from this method.
|
||||||
// This is called from Parse() and may be overriden.
|
// This is called from Parse() and may be overriden.
|
||||||
|
@@ -146,7 +146,7 @@ public:
|
|||||||
virtual wxFont* CreateCurrentFont();
|
virtual wxFont* CreateCurrentFont();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AddText(const wxChar* txt);
|
virtual void AddText(const wxString& txt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoAddText(wxChar *temp, int& templen, wxChar nbsp);
|
void DoAddText(wxChar *temp, int& templen, wxChar nbsp);
|
||||||
|
@@ -125,7 +125,7 @@ public:
|
|||||||
wxObject* GetProduct() { return NULL; }
|
wxObject* GetProduct() { return NULL; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
virtual void AddText(const wxString& WXUNUSED(txt)) {}
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(HP_Parser)
|
DECLARE_NO_COPY_CLASS(HP_Parser)
|
||||||
};
|
};
|
||||||
|
@@ -888,7 +888,7 @@ public:
|
|||||||
wxObject* GetProduct() { return NULL; }
|
wxObject* GetProduct() { return NULL; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AddText(const wxChar* WXUNUSED(txt)) {}
|
virtual void AddText(const wxString& WXUNUSED(txt)) {}
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxMetaTagParser)
|
DECLARE_NO_COPY_CLASS(wxMetaTagParser)
|
||||||
};
|
};
|
||||||
|
@@ -342,15 +342,13 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
|
|||||||
return GetFS()->OpenFile(myurl, flags);
|
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;
|
register wxChar d;
|
||||||
int templen = 0;
|
int templen = 0;
|
||||||
wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
|
wxChar nbsp = GetEntitiesParser()->GetCharForCode(160 /* nbsp */);
|
||||||
|
|
||||||
|
size_t lng = txt.length();
|
||||||
if (lng+1 > m_tmpStrBufSize)
|
if (lng+1 > m_tmpStrBufSize)
|
||||||
{
|
{
|
||||||
delete[] m_tmpStrBuf;
|
delete[] m_tmpStrBuf;
|
||||||
@@ -359,24 +357,36 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
|||||||
}
|
}
|
||||||
wxChar *temp = m_tmpStrBuf;
|
wxChar *temp = m_tmpStrBuf;
|
||||||
|
|
||||||
|
wxString::const_iterator i = txt.begin();
|
||||||
|
wxString::const_iterator end = txt.end();
|
||||||
|
|
||||||
if (m_tmpLastWasSpace)
|
if (m_tmpLastWasSpace)
|
||||||
{
|
{
|
||||||
while ((i < lng) &&
|
while ( (i < end) &&
|
||||||
((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) || (txt[i] == wxT(' ')) ||
|
(*i == wxT('\n') || *i == wxT('\r') || *i == wxT(' ') ||
|
||||||
(txt[i] == wxT('\t')))) i++;
|
*i == wxT('\t')) )
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < lng)
|
while (i < end)
|
||||||
{
|
{
|
||||||
x = 0;
|
size_t x = 0;
|
||||||
d = temp[templen++] = txt[i];
|
d = temp[templen++] = *i;
|
||||||
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
|
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
|
||||||
{
|
{
|
||||||
i++, x++;
|
++i, ++x;
|
||||||
while ((i < lng) && ((txt[i] == wxT('\n')) || (txt[i] == wxT('\r')) ||
|
while ( (i < end) &&
|
||||||
(txt[i] == wxT(' ')) || (txt[i] == wxT('\t')))) i++, x++;
|
(*i == wxT('\n') || *i == wxT('\r') ||
|
||||||
|
*i == wxT(' ')) || *i == wxT('\t') )
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
++x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else i++;
|
else
|
||||||
|
++i;
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user