]> git.saurik.com Git - wxWidgets.git/blob - include/wx/tokenzr.h
Used old name SelectCell instead of new name SetCurrentCell
[wxWidgets.git] / include / wx / tokenzr.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tokenzr.h
3 // Purpose: String tokenizer
4 // Author: Guilhem Lavaux
5 // Modified by: Vadim Zeitlin
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 "tokenzr.h"
17 #endif
18
19 #include "wx/object.h"
20 #include "wx/string.h"
21
22 // default: delimiters are usual white space characters
23 #define wxDEFAULT_DELIMITERS (_T(" \t\r\n"))
24
25 class WXDLLEXPORT wxStringTokenizer : public wxObject
26 {
27 public:
28 // ctors and such
29 wxStringTokenizer() { m_retdelims = FALSE; m_pos = 0; }
30 wxStringTokenizer(const wxString& to_tokenize,
31 const wxString& delims = wxDEFAULT_DELIMITERS,
32 bool ret_delim = FALSE);
33 void SetString(const wxString& to_tokenize,
34 const wxString& delims = wxDEFAULT_DELIMITERS,
35 bool ret_delim = FALSE);
36 virtual ~wxStringTokenizer();
37
38 // count tokens/get next token
39 size_t CountTokens() const;
40 bool HasMoreTokens() { return m_hasMore; }
41 wxString GetNextToken();
42
43 // One note about GetString -- it returns the string
44 // remaining after the previous tokens have been removed,
45 // not the original string
46 wxString GetString() const { return m_string; }
47
48 // returns the current position (i.e. one index after the last returned
49 // token or 0 if GetNextToken() has never been called) in the original
50 // string
51 size_t GetPosition() const { return m_pos; }
52
53 // for compatibility only, use GetNextToken() instead
54 wxString NextToken() { return GetNextToken(); }
55
56 protected:
57 wxString m_string, // the (rest of) string to tokenize
58 m_delims; // all delimiters
59
60 size_t m_pos; // the position in the original string
61
62 bool m_retdelims; // if TRUE, return delims with tokens
63 bool m_hasMore; // do we have more tokens?
64 };
65
66 #endif // _WX_TOKENZRH