+wxString wxStringTokenizer::GetNextToken()
+{
+ wxString token;
+ do
+ {
+ if ( !HasMoreTokens() )
+ {
+ break;
+ }
+
+ // find the end of this token
+ size_t pos = m_string.find_first_of(m_delims, m_pos);
+
+ // and the start of the next one
+ if ( pos == wxString::npos )
+ {
+ // no more delimiters, the token is everything till the end of
+ // string
+ token.assign(m_string, m_pos, wxString::npos);
+
+ // skip the token
+ m_pos = m_string.length();
+
+ // it wasn't terminated
+ m_lastDelim = _T('\0');
+ }
+ else // we found a delimiter at pos
+ {
+ // in wxTOKEN_RET_DELIMS mode we return the delimiter character
+ // with token, otherwise leave it out
+ size_t len = pos - m_pos;
+ if ( m_mode == wxTOKEN_RET_DELIMS )
+ len++;
+
+ token.assign(m_string, m_pos, len);
+
+ // skip the token and the trailing delimiter
+ m_pos = pos + 1;
+
+ m_lastDelim = m_string[pos];
+ }
+ }
+ while ( !AllowEmpty() && token.empty() );
+
+ return token;