UCharIterator Struct Reference

C API for code unit iteration. More...

#include <uiter.h>

Data Fields

const void * context
 (protected) Pointer to string or wrapped object or similar.
int32_t length
 (protected) Length of string or similar.
int32_t start
 (protected) Start index or similar.
int32_t index
 (protected) Current index or similar.
int32_t limit
 (protected) Limit index or similar.
int32_t reservedField
 (protected) Used by UTF-8 iterators and possibly others.
UCharIteratorGetIndexgetIndex
 (public) Returns the current position or the start or limit index of the iteration range.
UCharIteratorMovemove
 (public) Moves the current position relative to the start or limit of the iteration range, or relative to the current position itself.
UCharIteratorHasNexthasNext
 (public) Check if current() and next() can still return another code unit.
UCharIteratorHasPrevioushasPrevious
 (public) Check if previous() can still return another code unit.
UCharIteratorCurrentcurrent
 (public) Return the code unit at the current position, or U_SENTINEL if there is none (index is at the limit).
UCharIteratorNextnext
 (public) Return the code unit at the current index and increment the index (post-increment, like s[i++]), or return U_SENTINEL if there is none (index is at the limit).
UCharIteratorPreviousprevious
 (public) Decrement the index and return the code unit from there (pre-decrement, like s[--i]), or return U_SENTINEL if there is none (index is at the start).
UCharIteratorReservedreservedFn
 (public) Reserved for future use.
UCharIteratorGetStategetState
 (public) Return the state of the iterator, to be restored later with setState().
UCharIteratorSetStatesetState
 (public) Restore the iterator state from the state word from a call to getState().

Detailed Description

C API for code unit iteration.

This can be used as a C wrapper around CharacterIterator, Replaceable, or implemented using simple strings, etc.

There are two roles for using UCharIterator:

A "provider" sets the necessary function pointers and controls the "protected" fields of the UCharIterator structure. A "provider" passes a UCharIterator into C APIs that need a UCharIterator as an abstract, flexible string interface.

Implementations of such C APIs are "callers" of UCharIterator functions; they only use the "public" function pointers and never access the "protected" fields directly.

The current() and next() functions only check the current index against the limit, and previous() only checks the current index against the start, to see if the iterator already reached the end of the iteration range.

The assumption - in all iterators - is that the index is moved via the API, which means it won't go out of bounds, or the index is modified by user code that knows enough about the iterator implementation to set valid index values.

UCharIterator functions return code unit values 0..0xffff, or U_SENTINEL if the iteration bounds are reached.

Stable:
ICU 2.1

Definition at line 339 of file uiter.h.


Field Documentation

(protected) Pointer to string or wrapped object or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line 345 of file uiter.h.

(public) Return the code unit at the current position, or U_SENTINEL if there is none (index is at the limit).

See also:
UCharIteratorCurrent
Stable:
ICU 2.1

Definition at line 425 of file uiter.h.

(public) Returns the current position or the start or limit index of the iteration range.

See also:
UCharIteratorGetIndex
Stable:
ICU 2.1

Definition at line 388 of file uiter.h.

(public) Return the state of the iterator, to be restored later with setState().

This function pointer is NULL if the iterator does not implement it.

See also:
UCharIteratorGet
Stable:
ICU 2.6

Definition at line 462 of file uiter.h.

(public) Check if current() and next() can still return another code unit.

See also:
UCharIteratorHasNext
Stable:
ICU 2.1

Definition at line 408 of file uiter.h.

(public) Check if previous() can still return another code unit.

See also:
UCharIteratorHasPrevious
Stable:
ICU 2.1

Definition at line 416 of file uiter.h.

(protected) Current index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line 366 of file uiter.h.

(protected) Length of string or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line 352 of file uiter.h.

(protected) Limit index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line 373 of file uiter.h.

(public) Moves the current position relative to the start or limit of the iteration range, or relative to the current position itself.

The movement is expressed in numbers of code units forward or backward by specifying a positive or negative delta.

See also:
UCharIteratorMove
Stable:
ICU 2.1

Definition at line 399 of file uiter.h.

(public) Return the code unit at the current index and increment the index (post-increment, like s[i++]), or return U_SENTINEL if there is none (index is at the limit).

See also:
UCharIteratorNext
Stable:
ICU 2.1

Definition at line 435 of file uiter.h.

(public) Decrement the index and return the code unit from there (pre-decrement, like s[--i]), or return U_SENTINEL if there is none (index is at the start).

See also:
UCharIteratorPrevious
Stable:
ICU 2.1

Definition at line 445 of file uiter.h.

(protected) Used by UTF-8 iterators and possibly others.

Stable:
ICU 2.1

Definition at line 379 of file uiter.h.

(public) Reserved for future use.

Currently NULL.

See also:
UCharIteratorReserved
Stable:
ICU 2.1

Definition at line 453 of file uiter.h.

(public) Restore the iterator state from the state word from a call to getState().

This function pointer is NULL if the iterator does not implement it.

See also:
UCharIteratorSet
Stable:
ICU 2.6

Definition at line 472 of file uiter.h.

(protected) Start index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line 359 of file uiter.h.


The documentation for this struct was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sat Jan 23 15:17:45 2010 for ICU 4.3.4 by  doxygen 1.6.1