ICU 50.1.2
50.1.2
|
Light-weight, non-const reader class for a UCharsTrie. More...
#include <ucharstrie.h>
Data Structures | |
class | Iterator |
Iterator for all of the (string, value) pairs in a UCharsTrie. More... | |
class | State |
UCharsTrie state object, for saving a trie's current state and resetting the trie back to this state later. More... | |
Public Member Functions | |
UCharsTrie (const UChar *trieUChars) | |
Constructs a UCharsTrie reader instance. More... | |
~UCharsTrie () | |
Destructor. More... | |
UCharsTrie (const UCharsTrie &other) | |
Copy constructor, copies the other trie reader object and its state, but not the UChar array which will be shared. More... | |
UCharsTrie & | reset () |
Resets this trie to its initial state. More... | |
const UCharsTrie & | saveState (State &state) const |
Saves the state of this trie. More... | |
UCharsTrie & | resetToState (const State &state) |
Resets this trie to the saved state. More... | |
UStringTrieResult | current () const |
Determines whether the string so far matches, whether it has a value, and whether another input UChar can continue a matching string. More... | |
UStringTrieResult | first (int32_t uchar) |
Traverses the trie from the initial state for this input UChar. More... | |
UStringTrieResult | firstForCodePoint (UChar32 cp) |
Traverses the trie from the initial state for the one or two UTF-16 code units for this input code point. More... | |
UStringTrieResult | next (int32_t uchar) |
Traverses the trie from the current state for this input UChar. More... | |
UStringTrieResult | nextForCodePoint (UChar32 cp) |
Traverses the trie from the current state for the one or two UTF-16 code units for this input code point. More... | |
UStringTrieResult | next (const UChar *s, int32_t length) |
Traverses the trie from the current state for this string. More... | |
int32_t | getValue () const |
Returns a matching string's value if called immediately after current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE. More... | |
UBool | hasUniqueValue (int32_t &uniqueValue) const |
Determines whether all strings reachable from the current state map to the same value. More... | |
int32_t | getNextUChars (Appendable &out) const |
Finds each UChar which continues the string from the current state. More... | |
Friends | |
class | UCharsTrieBuilder |
Light-weight, non-const reader class for a UCharsTrie.
Traverses a UChar-serialized data structure with minimal state, for mapping strings (16-bit-unit sequences) to non-negative integer values.
This class owns the serialized trie data only if it was constructed by the builder's build() method. The public constructor and the copy constructor only alias the data (only copy the pointer). There is no assignment operator.
This class is not intended for public subclassing.
Definition at line 48 of file ucharstrie.h.
|
inline |
Constructs a UCharsTrie reader instance.
The trieUChars must contain a copy of a UChar sequence from the UCharsTrieBuilder, starting with the first UChar of that sequence. The UCharsTrie object will not read more UChars than the UCharsTrieBuilder generated in the corresponding build() call.
The array is not copied/cloned and must not be modified while the UCharsTrie object is in use.
trieUChars | The UChar array that contains the serialized trie. |
Definition at line 64 of file ucharstrie.h.
icu::UCharsTrie::~UCharsTrie | ( | ) |
Destructor.
|
inline |
Copy constructor, copies the other trie reader object and its state, but not the UChar array which will be shared.
(Shallow copy.)
other | Another UCharsTrie object. |
Definition at line 80 of file ucharstrie.h.
UStringTrieResult icu::UCharsTrie::current | ( | ) | const |
Determines whether the string so far matches, whether it has a value, and whether another input UChar can continue a matching string.
|
inline |
Traverses the trie from the initial state for this input UChar.
Equivalent to reset().next(uchar).
uchar | Input char value. Values below 0 and above 0xffff will never match. |
Definition at line 162 of file ucharstrie.h.
UStringTrieResult icu::UCharsTrie::firstForCodePoint | ( | UChar32 | cp | ) |
int32_t icu::UCharsTrie::getNextUChars | ( | Appendable & | out | ) | const |
Finds each UChar which continues the string from the current state.
That is, each UChar c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now.
out | Each next UChar is appended to this object. |
|
inline |
Returns a matching string's value if called immediately after current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE.
getValue() can be called multiple times.
Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE!
Definition at line 220 of file ucharstrie.h.
|
inline |
Determines whether all strings reachable from the current state map to the same value.
uniqueValue | Receives the unique value, if this function returns TRUE. (output-only) |
Definition at line 237 of file ucharstrie.h.
UStringTrieResult icu::UCharsTrie::next | ( | int32_t | uchar | ) |
Traverses the trie from the current state for this input UChar.
uchar | Input char value. Values below 0 and above 0xffff will never match. |
UStringTrieResult icu::UCharsTrie::next | ( | const UChar * | s, |
int32_t | length | ||
) |
Traverses the trie from the current state for this string.
Equivalent to
s | A string. Can be NULL if length is 0. |
length | The length of the string. Can be -1 if NUL-terminated. |
UStringTrieResult icu::UCharsTrie::nextForCodePoint | ( | UChar32 | cp | ) |
Traverses the trie from the current state for the one or two UTF-16 code units for this input code point.
cp | A Unicode code point 0..0x10ffff. |
|
inline |
Resets this trie to its initial state.
Definition at line 89 of file ucharstrie.h.
|
inline |
Resets this trie to the saved state.
If the state object contains no state, or the state of a different trie, then this trie remains unchanged.
state | The State object which holds a saved trie state. |
Definition at line 139 of file ucharstrie.h.
References NULL.
|
inline |
Saves the state of this trie.
state | The State object to hold the trie's state. |
Definition at line 122 of file ucharstrie.h.