OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

string_base.h
1 /* $Id: string_base.h 25653 2013-08-05 20:35:31Z michi_cc $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
10 #ifndef STRING_BASE_H
11 #define STRING_BASE_H
12
13 #include "string_type.h"
14
16 class StringIterator {
17 public:
19 enum IterType {
20 ITER_CHARACTER,
21 ITER_WORD,
22 };
23
25 static const size_t END = SIZE_MAX;
26
31 static StringIterator *Create();
32
33 virtual ~StringIterator() {}
34
40 virtual void SetString(const char *s) = 0;
41
48 virtual size_t SetCurPosition(size_t pos) = 0;
49
54 virtual size_t Next(IterType what = ITER_CHARACTER) = 0;
55
60 virtual size_t Prev(IterType what = ITER_CHARACTER) = 0;
61
62 protected:
63 StringIterator() {}
64 };
65
66 #endif /* STRING_BASE_H */