ScummVM API documentation
tokenizer.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef COMMON_TOKENIZER_H
23 #define COMMON_TOKENIZER_H
24 
25 #include "common/scummsys.h"
26 #include "common/str-array.h"
27 
28 namespace Common {
29 
46 public:
53  StringTokenizer(const String &str, const String &delimiters = " \t\r\n\f\v");
54  void reset();
55  bool empty() const;
56  String nextToken();
57  StringArray split();
58 
61 
62 private:
63  const String _str;
64  const String _delimiters;
65  uint _tokenBegin;
66  uint _tokenEnd;
67 };
68 
77 public:
84  U32StringTokenizer(const U32String &str, const String &delimiters = " \t\r\n\f\v");
85  void reset();
86  bool empty() const;
89 
92 
93 private:
94  const U32String _str;
95  const String _delimiters;
96  U32String::const_iterator _tokenBegin;
97  U32String::const_iterator _tokenEnd;
98 };
99 
102 } // End of namespace Common
103 
104 #endif
Definition: str.h:59
StringTokenizer(const String &str, const String &delimiters=" \\\)
bool empty() const
Returns true if there are no more tokens left in the string, false otherwise.
Definition: tokenizer.h:76
Definition: tokenizer.h:45
Definition: ustr.h:57
Definition: algorithm.h:29
void reset()
Resets the tokenizer to its initial state.
StringArray split()
Returns StringArray with all tokens. Beware of the memory usage.
String nextToken()
Returns the next token from the string (Or an empty string if there are no more tokens) ...
String delimitersAtTokenBegin() const
Returns a String with all delimiters between the current and previous token.
String delimitersAtTokenEnd() const
Returns a String with all delimiters between the current and next token.