1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: String tokenizer
4 // Author: Guilhem Lavaux
5 // Modified by: Gregory Pietsch
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "tokenzr.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/filefn.h"
23 class WXDLLEXPORT wxStringTokenizer
: public wxObject
26 wxStringTokenizer(const wxString
& to_tokenize
,
27 const wxString
& delims
= " \t\r\n",
28 bool ret_delim
= FALSE
);
29 wxStringTokenizer() { m_retdelims
= FALSE
; m_pos
= 0; }
30 virtual ~wxStringTokenizer();
32 int CountTokens() const;
36 wxString
GetNextToken() { return NextToken(); };
38 wxString
GetString() const { return m_string
; }
39 // One note about GetString -- it returns the string
40 // remaining after the previous tokens have been removed,
41 // not the original string
43 void SetString(const wxString
& to_tokenize
,
44 const wxString
& delims
= " \t\r\n",
45 bool ret_delim
= FALSE
)
47 m_string
= to_tokenize
;
49 m_retdelims
= ret_delim
;
53 // Here's the desired function. It returns the position
54 // of the next token in the original string by keeping track
55 // of everything that's been deleted by GetNextToken.
56 wxUint32
GetPosition() { return m_pos
; }
59 wxString m_string
, m_delims
;
61 wxUint32 m_pos
; // the position
64 #endif // _WX_TOKENZRH