]> git.saurik.com Git - wxWidgets.git/blob - include/wx/tokenzr.h
1. wxBase compiles under BeOS
[wxWidgets.git] / include / wx / tokenzr.h
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"
21 #include "wx/filefn.h"
22
23 class WXDLLEXPORT wxStringTokenizer : public wxObject
24 {
25 public:
26 wxStringTokenizer(const wxString& to_tokenize,
27 const wxString& delims = " \t\r\n",
28 bool ret_delim = FALSE);
29 wxStringTokenizer() { m_retdelims = FALSE;}
30 virtual ~wxStringTokenizer();
31
32 int CountTokens() const;
33 bool HasMoreTokens();
34
35 wxString NextToken();
36 wxString GetNextToken() { return NextToken(); };
37
38 wxString GetString() const { return m_string; }
39
40 void SetString(const wxString& to_tokenize,
41 const wxString& delims = " \t\r\n",
42 bool ret_delim = FALSE)
43 {
44 m_string = to_tokenize;
45 m_delims = delims;
46 m_retdelims = ret_delim;
47 }
48
49 protected:
50 off_t FindDelims(const wxString& str, const wxString& delims) const;
51 void EatLeadingDelims();
52
53 wxString m_string, m_delims;
54 bool m_retdelims;
55 };
56
57 #endif // _WX_TOKENZRH