* Added a fix from Allen to wxStringTokenizer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2524 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
326f9654d2
commit
dab58492b2
@ -47,6 +47,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
off_t FindDelims(const wxString& str, const wxString& delims);
|
off_t FindDelims(const wxString& str, const wxString& delims);
|
||||||
|
void EatLeadingDelims(); // AVS - added to fix leading whitespace /
|
||||||
|
// mult. delims bugs
|
||||||
protected:
|
protected:
|
||||||
wxString m_string, m_delims;
|
wxString m_string, m_delims;
|
||||||
bool m_retdelims;
|
bool m_retdelims;
|
||||||
|
@ -82,6 +82,16 @@ bool wxStringTokenizer::HasMoreToken()
|
|||||||
return (m_string.Length() != 0);
|
return (m_string.Length() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AVS - added to fix leading whitespace / mult. delims bugs
|
||||||
|
void wxStringTokenizer::EatLeadingDelims()
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
while ((pos=FindDelims(m_string, m_delims))==0) { // while leading delims
|
||||||
|
m_string = m_string.Mid((size_t)1); // trim 'em from the left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxString wxStringTokenizer::NextToken()
|
wxString wxStringTokenizer::NextToken()
|
||||||
{
|
{
|
||||||
register off_t pos, pos2;
|
register off_t pos, pos2;
|
||||||
@ -90,6 +100,10 @@ wxString wxStringTokenizer::NextToken()
|
|||||||
if (m_string.IsNull())
|
if (m_string.IsNull())
|
||||||
return m_string;
|
return m_string;
|
||||||
|
|
||||||
|
if (!m_retdelims)
|
||||||
|
EatLeadingDelims(); // AVS - added to fix leading whitespace /
|
||||||
|
// mult. delims bugs
|
||||||
|
|
||||||
pos = FindDelims(m_string, m_delims);
|
pos = FindDelims(m_string, m_delims);
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
r_string = m_string;
|
r_string = m_string;
|
||||||
|
Loading…
Reference in New Issue
Block a user