OpenTTD
|
Fallback simple string iterator. More...
Public Member Functions | |
virtual void | SetString (const char *s) |
Set a new iteration string. | |
virtual size_t | SetCurPosition (size_t pos) |
Change the current string cursor. | |
virtual size_t | Next (IterType what) |
Advance the cursor by one iteration unit. | |
virtual size_t | Prev (IterType what) |
Move the cursor back by one iteration unit. |
Private Attributes | |
const char * | string |
Current string. | |
size_t | len |
String length. | |
size_t | cur_pos |
Current iteration position. |
Additional Inherited Members | |
![]() | |
enum | IterType { ITER_CHARACTER, ITER_WORD } |
Type of the iterator. More... | |
![]() | |
static StringIterator * | Create () |
Create a new iterator instance. | |
![]() | |
static const size_t | END = SIZE_MAX |
Sentinel to indicate end-of-iteration. |
Fallback simple string iterator.
Definition at line 747 of file string.cpp.
|
inlinevirtual |
Advance the cursor by one iteration unit.
Implements StringIterator.
Definition at line 773 of file string.cpp.
References cur_pos, StringIterator::END, IsWhitespace(), StringIterator::ITER_CHARACTER, StringIterator::ITER_WORD, len, and Utf8Decode().
|
inlinevirtual |
Move the cursor back by one iteration unit.
Implements StringIterator.
Definition at line 811 of file string.cpp.
References cur_pos, StringIterator::END, IsWhitespace(), StringIterator::ITER_CHARACTER, StringIterator::ITER_WORD, string, Utf8Decode(), and Utf8PrevChar().
|
inlinevirtual |
Change the current string cursor.
p | New cursor position. |
Implements StringIterator.
Definition at line 765 of file string.cpp.
|
inlinevirtual |
Set a new iteration string.
Must also be called if the string contents changed. The cursor is reset to the start of the string.
s | New string. |
Implements StringIterator.
Definition at line 758 of file string.cpp.