ICU 64.2  64.2
Public Member Functions
icu::UCharsTrie::Iterator Class Reference

Iterator for all of the (string, value) pairs in a UCharsTrie. More...

#include <ucharstrie.h>

Inheritance diagram for icu::UCharsTrie::Iterator:
icu::UMemory

Public Member Functions

 Iterator (ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode)
 Iterates from the root of a char16_t-serialized UCharsTrie. More...
 
 Iterator (const UCharsTrie &trie, int32_t maxStringLength, UErrorCode &errorCode)
 Iterates from the current state of the specified UCharsTrie. More...
 
 ~Iterator ()
 Destructor. More...
 
Iteratorreset ()
 Resets this iterator to its initial state. More...
 
UBool hasNext () const
 
UBool next (UErrorCode &errorCode)
 Finds the next (string, value) pair if there is one. More...
 
const UnicodeStringgetString () const
 
int32_t getValue () const
 

Detailed Description

Iterator for all of the (string, value) pairs in a UCharsTrie.

Stable:
ICU 4.8

Definition at line 258 of file ucharstrie.h.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

icu::UCharsTrie::Iterator::Iterator ( ConstChar16Ptr  trieUChars,
int32_t  maxStringLength,
UErrorCode errorCode 
)

Iterates from the root of a char16_t-serialized UCharsTrie.

Parameters
trieUCharsThe trie char16_ts.
maxStringLengthIf 0, the iterator returns full strings. Otherwise, the iterator returns strings with this maximum length.
errorCodeStandard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.)
Stable:
ICU 4.8

◆ Iterator() [2/2]

icu::UCharsTrie::Iterator::Iterator ( const UCharsTrie trie,
int32_t  maxStringLength,
UErrorCode errorCode 
)

Iterates from the current state of the specified UCharsTrie.

Parameters
trieThe trie whose state will be copied for iteration.
maxStringLengthIf 0, the iterator returns full strings. Otherwise, the iterator returns strings with this maximum length.
errorCodeStandard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.)
Stable:
ICU 4.8

◆ ~Iterator()

icu::UCharsTrie::Iterator::~Iterator ( )

Destructor.

Stable:
ICU 4.8

Member Function Documentation

◆ getString()

const UnicodeString& icu::UCharsTrie::Iterator::getString ( ) const
inline
Returns
The string for the last successful next().
Stable:
ICU 4.8

Definition at line 325 of file ucharstrie.h.

◆ getValue()

int32_t icu::UCharsTrie::Iterator::getValue ( ) const
inline
Returns
The value for the last successful next().
Stable:
ICU 4.8

Definition at line 330 of file ucharstrie.h.

References NULL, TRUE, U_NAMESPACE_END, and USTRINGTRIE_INTERMEDIATE_VALUE.

◆ hasNext()

UBool icu::UCharsTrie::Iterator::hasNext ( ) const
Returns
TRUE if there are more elements.
Stable:
ICU 4.8

◆ next()

UBool icu::UCharsTrie::Iterator::next ( UErrorCode errorCode)

Finds the next (string, value) pair if there is one.

If the string is truncated to the maximum length and does not have a real value, then the value is set to -1. In this case, this "not a real value" is indistinguishable from a real value of -1.

Parameters
errorCodeStandard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.)
Returns
TRUE if there is another element.
Stable:
ICU 4.8

◆ reset()

Iterator& icu::UCharsTrie::Iterator::reset ( )

Resets this iterator to its initial state.

Returns
*this
Stable:
ICU 4.8

The documentation for this class was generated from the following file: