]>
Commit | Line | Data |
---|---|---|
f4ada568 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tokenzr.h | |
3 | // Purpose: String tokenizer | |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: 04/22/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Guilhem Lavaux | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TOKENZRH | |
13 | #define _WX_TOKENZRH | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface | |
17 | #endif | |
18 | ||
19 | #include "wx/object.h" | |
20 | #include "wx/string.h" | |
c058d771 | 21 | #include "wx/filefn.h" |
f4ada568 | 22 | |
dbdb39b2 | 23 | class wxStringTokenizer : public wxObject { |
f4ada568 GL |
24 | public: |
25 | wxStringTokenizer(const wxString& to_tokenize, | |
26 | const wxString& delims = " \t\r\n", | |
27 | bool ret_delim = FALSE); | |
dbdb39b2 | 28 | wxStringTokenizer() { m_string = ""; m_delims = ""; m_retdelims = FALSE;} |
f4ada568 GL |
29 | ~wxStringTokenizer(); |
30 | ||
31 | int CountTokens(); | |
32 | bool HasMoreToken(); | |
ad813b00 | 33 | inline bool HasMoreTokens() { return HasMoreToken(); }; |
f4ada568 | 34 | wxString NextToken(); |
ad813b00 JS |
35 | // A better name! |
36 | inline wxString GetNextToken() { return NextToken(); }; | |
f4ada568 | 37 | wxString GetString() { return m_string; } |
dbdb39b2 JS |
38 | |
39 | void SetString(const wxString& to_tokenize, | |
40 | const wxString& delims = " \t\r\n", | |
41 | bool ret_delim = FALSE) | |
42 | { | |
43 | m_string = to_tokenize; | |
44 | m_delims = delims; | |
45 | m_retdelims = ret_delim; | |
46 | } | |
47 | ||
f4ada568 GL |
48 | protected: |
49 | off_t FindDelims(const wxString& str, const wxString& delims); | |
dab58492 GL |
50 | void EatLeadingDelims(); // AVS - added to fix leading whitespace / |
51 | // mult. delims bugs | |
f4ada568 GL |
52 | protected: |
53 | wxString m_string, m_delims; | |
54 | bool m_retdelims; | |
55 | }; | |
56 | ||
57 | #endif |