- pos = m_string.find_first_of(m_delims, pos);
- if ( pos == wxString::npos )
+ // there are non delimiter characters left, so we do have more tokens
+ return true;
+ }
+
+ switch ( m_mode )
+ {
+ case wxTOKEN_RET_EMPTY:
+ case wxTOKEN_RET_DELIMS:
+ // special hack for wxTOKEN_RET_EMPTY: we should return the initial
+ // empty token even if there are only delimiters after it
+ return m_pos == 0 && !m_string.empty();
+
+ case wxTOKEN_RET_EMPTY_ALL:
+ // special hack for wxTOKEN_RET_EMPTY_ALL: we can know if we had
+ // already returned the trailing empty token after the last
+ // delimiter by examining m_lastDelim: it is set to NUL if we run
+ // up to the end of the string in GetNextToken(), but if it is not
+ // NUL yet we still have this last token to return even if m_pos is
+ // already at m_string.length()
+ return m_pos < m_string.length() || m_lastDelim != _T('\0');
+
+ case wxTOKEN_INVALID:
+ case wxTOKEN_DEFAULT:
+ wxFAIL_MSG( _T("unexpected tokenizer mode") );
+ // fall through
+
+ case wxTOKEN_STRTOK:
+ // never return empty delimiters