X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f4ada568223b79c8a5769cc351c36a8e2ccd7841..34636400a0018eba4a1f63dda18cf32e944b959e:/src/common/tokenzr.cpp?ds=sidebyside diff --git a/src/common/tokenzr.cpp b/src/common/tokenzr.cpp index eb99237711..19ae5e0f29 100644 --- a/src/common/tokenzr.cpp +++ b/src/common/tokenzr.cpp @@ -13,6 +13,16 @@ #pragma implementation "tokenzr.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + #include "wx/object.h" #include "wx/string.h" #include "wx/tokenzr.h" @@ -72,6 +82,16 @@ bool wxStringTokenizer::HasMoreToken() 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() { register off_t pos, pos2; @@ -80,10 +100,14 @@ wxString wxStringTokenizer::NextToken() if (m_string.IsNull()) return m_string; + if (!m_retdelims) + EatLeadingDelims(); // AVS - added to fix leading whitespace / + // mult. delims bugs + pos = FindDelims(m_string, m_delims); if (pos == -1) { r_string = m_string; - m_string = (char *)NULL; + m_string = wxEmptyString; return r_string; }