OpenTTD Source
20241121-master-g67a0fccfad
|
String iterator using ICU as a backend. More...
Public Member Functions | |
void | SetString (const char *s) override |
Set a new iteration string. More... | |
size_t | SetCurPosition (size_t pos) override |
Change the current string cursor. More... | |
size_t | Next (IterType what) override |
Advance the cursor by one iteration unit. More... | |
size_t | Prev (IterType what) override |
Move the cursor back by one iteration unit. More... | |
Private Attributes | |
icu::BreakIterator * | char_itr |
ICU iterator for characters. | |
icu::BreakIterator * | word_itr |
ICU iterator for words. | |
std::vector< UChar > | utf16_str |
UTF-16 copy of the string. | |
std::vector< size_t > | utf16_to_utf8 |
Mapping from UTF-16 code point position to index in the UTF-8 source string. | |
Additional Inherited Members | |
Public Types inherited from StringIterator | |
enum | IterType { ITER_CHARACTER , ITER_WORD } |
Type of the iterator. More... | |
Static Public Member Functions inherited from StringIterator | |
static std::unique_ptr< StringIterator > | Create () |
Create a new iterator instance. More... | |
Static Public Attributes inherited from StringIterator | |
static const size_t | END = SIZE_MAX |
Sentinel to indicate end-of-iteration. | |
String iterator using ICU as a backend.
Definition at line 772 of file string.cpp.
|
inlineoverridevirtual |
Advance the cursor by one iteration unit.
Implements StringIterator.
Definition at line 852 of file string.cpp.
References IsWhitespace(), StringIterator::ITER_CHARACTER, StringIterator::ITER_WORD, and Utf16DecodeChar().
|
inlineoverridevirtual |
Move the cursor back by one iteration unit.
Implements StringIterator.
Definition at line 884 of file string.cpp.
References IsWhitespace(), StringIterator::ITER_CHARACTER, StringIterator::ITER_WORD, and Utf16DecodeChar().
|
inlineoverridevirtual |
Change the current string cursor.
pos | New cursor position. |
Implements StringIterator.
Definition at line 834 of file string.cpp.
|
inlineoverridevirtual |
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 797 of file string.cpp.