+
+ // empty string doesn't have any tokens
+ m_hasMore = !m_string.empty();
+}
+
+// ----------------------------------------------------------------------------
+// access to the tokens
+// ----------------------------------------------------------------------------
+
+// do we have more of them?
+bool wxStringTokenizer::HasMoreTokens() const
+{
+ wxCHECK_MSG( IsOk(), FALSE, _T("you should call SetString() first") );
+
+ if ( m_string.find_first_not_of(m_delims) == wxString::npos )
+ {
+ // no non empty tokens left, but in 2 cases we still may return TRUE if
+ // GetNextToken() wasn't called yet for this empty token:
+ //
+ // a) in wxTOKEN_RET_EMPTY_ALL mode we always do it
+ // b) in wxTOKEN_RET_EMPTY mode we do it in the special case of a
+ // string containing only the delimiter: then there is an empty
+ // token just before it
+ return (m_mode == wxTOKEN_RET_EMPTY_ALL) ||
+ (m_mode == wxTOKEN_RET_EMPTY && m_pos == 0)
+ ? m_hasMore : FALSE;
+ }
+ else
+ {
+ // there are non delimiter characters left, hence we do have more
+ // tokens
+ return TRUE;
+ }