Movatterモバイル変換


[0]ホーム

URL:


ICU 78.1  78.1
Data Fields
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.More...
 
int32_t length
 (protected) Length of string or similar.More...
 
int32_t start
 (protected) Start index or similar.More...
 
int32_t index
 (protected) Current index or similar.More...
 
int32_t limit
 (protected) Limit index or similar.More...
 
int32_t reservedField
 (protected) Used by UTF-8 iterators and possibly others.More...
 
UCharIteratorGetIndexgetIndex
 (public) Returns the current position or the start or limit index of the iteration range.More...
 
UCharIteratorMovemove
 (public) Moves the current position relative to the start or limit of the iteration range, or relative to the current position itself.More...
 
UCharIteratorHasNexthasNext
 (public) Check ifcurrent() andnext() can still return another code unit.More...
 
UCharIteratorHasPrevioushasPrevious
 (public) Check ifprevious() can still return another code unit.More...
 
UCharIteratorCurrentcurrent
 (public) Return the code unit at the current position, or U_SENTINEL if there is none (index is at the limit).More...
 
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).More...
 
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).More...
 
UCharIteratorReservedreservedFn
 (public) Reserved for future use.More...
 
UCharIteratorGetStategetState
 (public) Return the state of the iterator, to be restored later withsetState().More...
 
UCharIteratorSetStatesetState
 (public) Restore the iterator state from the state word from a call togetState().More...
 

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 usingUCharIterator:

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

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

Thecurrent() andnext() functions only check the current index against the limit, andprevious() 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 line341 of fileuiter.h.

Field Documentation

◆ context

const void* UCharIterator::context

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

Not used by caller.

Stable:
ICU 2.1

Definition at line347 of fileuiter.h.

◆ current

UCharIteratorCurrent* UCharIterator::current

(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 line427 of fileuiter.h.

◆ getIndex

UCharIteratorGetIndex* UCharIterator::getIndex

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

See also
UCharIteratorGetIndex
Stable:
ICU 2.1

Definition at line390 of fileuiter.h.

◆ getState

UCharIteratorGetState* UCharIterator::getState

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

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

See also
UCharIteratorGet
Stable:
ICU 2.6

Definition at line464 of fileuiter.h.

◆ hasNext

UCharIteratorHasNext* UCharIterator::hasNext

(public) Check ifcurrent() andnext() can still return another code unit.

See also
UCharIteratorHasNext
Stable:
ICU 2.1

Definition at line410 of fileuiter.h.

◆ hasPrevious

UCharIteratorHasPrevious* UCharIterator::hasPrevious

(public) Check ifprevious() can still return another code unit.

See also
UCharIteratorHasPrevious
Stable:
ICU 2.1

Definition at line418 of fileuiter.h.

◆ index

int32_t UCharIterator::index

(protected) Current index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line368 of fileuiter.h.

◆ length

int32_t UCharIterator::length

(protected) Length of string or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line354 of fileuiter.h.

◆ limit

int32_t UCharIterator::limit

(protected) Limit index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line375 of fileuiter.h.

◆ move

UCharIteratorMove* UCharIterator::move

(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 line401 of fileuiter.h.

◆ next

UCharIteratorNext* UCharIterator::next

(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 line437 of fileuiter.h.

◆ previous

UCharIteratorPrevious* UCharIterator::previous

(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 line447 of fileuiter.h.

◆ reservedField

int32_t UCharIterator::reservedField

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

Stable:
ICU 2.1

Definition at line381 of fileuiter.h.

◆ reservedFn

UCharIteratorReserved* UCharIterator::reservedFn

(public) Reserved for future use.

Currently NULL.

See also
UCharIteratorReserved
Stable:
ICU 2.1

Definition at line455 of fileuiter.h.

◆ setState

UCharIteratorSetState* UCharIterator::setState

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

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

See also
UCharIteratorSet
Stable:
ICU 2.6

Definition at line474 of fileuiter.h.

◆ start

int32_t UCharIterator::start

(protected) Start index or similar.

Not used by caller.

Stable:
ICU 2.1

Definition at line361 of fileuiter.h.


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

Generated by doxygen 1.9.1
[8]ページ先頭

©2009-2025 Movatter.jp