first pass of wxUniv merge - nothing works, most parts don't even compile
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// Name: tokenzr.cpp
|
||||
// Purpose: String tokenizer
|
||||
// Author: Guilhem Lavaux
|
||||
// Modified by: Vadim Zeitlin
|
||||
// Modified by: Vadim Zeitlin (almost full rewrite)
|
||||
// Created: 04/22/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
@@ -105,10 +105,16 @@ bool wxStringTokenizer::HasMoreTokens() const
|
||||
|
||||
if ( m_string.find_first_not_of(m_delims) == wxString::npos )
|
||||
{
|
||||
// no non empty tokens left, but in wxTOKEN_RET_EMPTY_ALL mode we
|
||||
// still may return TRUE if GetNextToken() wasn't called yet for the
|
||||
// last trailing empty token
|
||||
return m_mode == wxTOKEN_RET_EMPTY_ALL ? m_hasMore : FALSE;
|
||||
// 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
|
||||
{
|
||||
@@ -196,3 +202,21 @@ wxString wxStringTokenizer::GetNextToken()
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// public functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxArrayString wxStringTokenize(const wxString& str,
|
||||
const wxString& delims,
|
||||
wxStringTokenizerMode mode)
|
||||
{
|
||||
wxArrayString tokens;
|
||||
wxStringTokenizer tk(str, delims, mode);
|
||||
while ( tk.HasMoreTokens() )
|
||||
{
|
||||
tokens.Add(tk.GetNextToken());
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
Reference in New Issue
Block a user