ICU 70.1 70.1

Public Member Functions
icu::BytesTrie::Iterator Class Reference

Iterator for all of the (byte sequence, value) pairs in a BytesTrie. More...

`#include <bytestrie.h>`

Inheritance diagram for icu::BytesTrie::Iterator:

## Public Member Functions
| Iterator (const void *trieBytes, int32_t maxStringLength, UErrorCode &errorCode)
| Iterates from the root of a byte-serialized BytesTrie. More...
| Iterator (const BytesTrie &trie, int32_t maxStringLength, UErrorCode &errorCode)
| Iterates from the current state of the specified BytesTrie. More...
| ~Iterator ()
| Destructor. More...
Iterator & | reset ()
| Resets this iterator to its initial state. More...
UBool | hasNext () const
UBool | next (UErrorCode &errorCode)
| Finds the next (byte sequence, value) pair if there is one. More...
StringPiece | getString () const
int32_t | getValue () const

## Detailed Description

Iterator for all of the (byte sequence, value) pairs in a BytesTrie.

Stable:
  ICU 4.8

Definition at line 282 of file bytestrie.h.

## Constructor & Destructor Documentation

## ◆ Iterator() [1/2]

icu::BytesTrie::Iterator::Iterator | ( | const void * | trieBytes,
|  | int32_t | maxStringLength,
|  | UErrorCode & | errorCode
| ) |  |

Iterates from the root of a byte-serialized BytesTrie.

Parameters

  trieBytes | The trie bytes.
  maxStringLength | If 0, the iterator returns full strings/byte sequences. Otherwise, the iterator returns strings with this maximum length.
  errorCode | Standard 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::BytesTrie::Iterator::Iterator | ( | const BytesTrie & | trie,
|  | int32_t | maxStringLength,
|  | UErrorCode & | errorCode
| ) |  |

Iterates from the current state of the specified BytesTrie.

Parameters

  trie | The trie whose state will be copied for iteration.
  maxStringLength | If 0, the iterator returns full strings/byte sequences. Otherwise, the iterator returns strings with this maximum length.
  errorCode | Standard 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::BytesTrie::Iterator::~Iterator | ( |  | ) |

Destructor.

Stable:
  ICU 4.8

## Member Function Documentation

## ◆ getString()

StringPiece icu::BytesTrie::Iterator::getString | ( |  | ) | const

Returns
  The NUL-terminated byte sequence for the last successful next().

Stable:
  ICU 4.8

## ◆ getValue()

int32_t icu::BytesTrie::Iterator::getValue | ( |  | ) | const
| inline

Returns
  The value for the last successful next().

Stable:
  ICU 4.8

Definition at line 354 of file bytestrie.h.

## ◆ hasNext()

UBool icu::BytesTrie::Iterator::hasNext | ( |  | ) | const

Returns
  true if there are more elements.

Stable:
  ICU 4.8

## ◆ next()

UBool icu::BytesTrie::Iterator::next | ( | UErrorCode & | errorCode | ) |

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

If the byte sequence 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

  errorCode | Standard 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::BytesTrie::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:

- bytestrie.h