|
OpenTTD
|
Class for iterating over different kind of parts of a string. More...
#include <string_base.h>
Public Types | |
| enum | IterType { ITER_CHARACTER, ITER_WORD } |
| Type of the iterator. More... | |
Public Member Functions | |
| virtual void | SetString (const char *s)=0 |
| Set a new iteration string. | |
| virtual size_t | SetCurPosition (size_t pos)=0 |
| Change the current string cursor. | |
| virtual size_t | Next (IterType what=ITER_CHARACTER)=0 |
| Advance the cursor by one iteration unit. | |
| virtual size_t | Prev (IterType what=ITER_CHARACTER)=0 |
| Move the cursor back by one iteration unit. | |
Static Public Member Functions | |
| static StringIterator * | Create () |
| Create a new iterator instance. | |
Static Public Attributes | |
| static const size_t | END = SIZE_MAX |
| Sentinel to indicate end-of-iteration. | |
Class for iterating over different kind of parts of a string.
Definition at line 16 of file string_base.h.
Type of the iterator.
| ITER_CHARACTER |
Iterate over characters (or more exactly grapheme clusters). |
| ITER_WORD |
Iterate over words. |
Definition at line 19 of file string_base.h.
|
static |
Create a new iterator instance.
Definition at line 739 of file string.cpp.
Referenced by Textbuf::Textbuf().
|
pure virtual |
Advance the cursor by one iteration unit.
Implemented in IcuStringIterator.
Referenced by Textbuf::DeleteChar(), and Textbuf::MovePos().
|
pure virtual |
Move the cursor back by one iteration unit.
Implemented in IcuStringIterator.
Referenced by Textbuf::DeleteChar(), and Textbuf::MovePos().
|
pure virtual |
Change the current string cursor.
| p | New cursor position. |
Implemented in IcuStringIterator.
Referenced by Textbuf::MovePos(), and Textbuf::UpdateStringIter().
|
pure virtual |
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. |
Implemented in IcuStringIterator.
Referenced by Textbuf::UpdateStringIter().
|
static |
Sentinel to indicate end-of-iteration.
Definition at line 25 of file string_base.h.
Referenced by Textbuf::MovePos(), IcuStringIterator::Next(), IcuStringIterator::Prev(), and Textbuf::UpdateStringIter().
1.8.1.2