ICU 56.1: uiter.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

uiter.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2002-2011 International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: uiter.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2002jan18
14 * created by: Markus W. Scherer
15 */
16
17 #ifndef __UITER_H__
18 #define __UITER_H__
19
27 #include "unicode/utypes.h"
28
29 #if U_SHOW_CPLUSPLUS_API
30 U_NAMESPACE_BEGIN
31
32 class CharacterIterator;
33 class Replaceable;
34
35 U_NAMESPACE_END
36 #endif
37
38 U_CDECL_BEGIN
39
40 struct UCharIterator;
41 typedef struct UCharIterator UCharIterator;
49 typedef enum UCharIteratorOrigin {
50 UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH
51 } UCharIteratorOrigin;
52
54 enum {
69 UITER_UNKNOWN_INDEX=-2
70 };
71
72
84 #define UITER_NO_STATE ((uint32_t)0xffffffff)
85
104 typedef int32_t U_CALLCONV
105 UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
106
141 typedef int32_t U_CALLCONV
142 UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin);
143
156 typedef UBool U_CALLCONV
157 UCharIteratorHasNext(UCharIterator *iter);
158
170 typedef UBool U_CALLCONV
171 UCharIteratorHasPrevious(UCharIterator *iter);
172
185 typedef UChar32 U_CALLCONV
186 UCharIteratorCurrent(UCharIterator *iter);
187
201 typedef UChar32 U_CALLCONV
202 UCharIteratorNext(UCharIterator *iter);
203
217 typedef UChar32 U_CALLCONV
218 UCharIteratorPrevious(UCharIterator *iter);
219
231 typedef int32_t U_CALLCONV
232 UCharIteratorReserved(UCharIterator *iter, int32_t something);
233
278 typedef uint32_t U_CALLCONV
279 UCharIteratorGetState(const UCharIterator *iter);
280
306 typedef void U_CALLCONV
307 UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
308
309
339 struct UCharIterator {
345 const void *context;
346
352 int32_t length;
353
359 int32_t start;
360
366 int32_t index;
367
373 int32_t limit;
374
379 int32_t reservedField;
380
388 UCharIteratorGetIndex *getIndex;
389
399 UCharIteratorMove *move;
400
408 UCharIteratorHasNext *hasNext;
409
416 UCharIteratorHasPrevious *hasPrevious;
417
425 UCharIteratorCurrent *current;
426
435 UCharIteratorNext *next;
436
445 UCharIteratorPrevious *previous;
446
453 UCharIteratorReserved *reservedFn;
454
462 UCharIteratorGetState *getState;
463
472 UCharIteratorSetState *setState;
473 };
474
493 U_STABLE UChar32 U_EXPORT2
494 uiter_current32(UCharIterator *iter);
495
510 U_STABLE UChar32 U_EXPORT2
511 uiter_next32(UCharIterator *iter);
512
527 U_STABLE UChar32 U_EXPORT2
528 uiter_previous32(UCharIterator *iter);
529
548 U_STABLE uint32_t U_EXPORT2
549 uiter_getState(const UCharIterator *iter);
550
566 U_STABLE void U_EXPORT2
567 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
568
591 U_STABLE void U_EXPORT2
592 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
593
614 U_STABLE void U_EXPORT2
615 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
616
650 U_STABLE void U_EXPORT2
651 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
652
653 #if U_SHOW_CPLUSPLUS_API
654
675 U_STABLE void U_EXPORT2
676 uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter);
677
700 U_STABLE void U_EXPORT2
701 uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep);
702
703 #endif
704
705 U_CDECL_END
706
707 #endif
uiter_setReplaceable
void uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep)
Set up a UCharIterator to iterate over a C++ Replaceable.
UCharIteratorGetState
uint32_t UCharIteratorGetState(const UCharIterator *iter)
Function type declaration for UCharIterator.getState().
Definition: uiter.h:279
UCharIterator::getState
UCharIteratorGetState * getState
(public) Return the state of the iterator, to be restored later with setState().
Definition: uiter.h:462
uiter_previous32
UChar32 uiter_previous32(UCharIterator *iter)
Helper function for UCharIterator to get the previous code point.
UCharIterator::context
const void * context
(protected) Pointer to string or wrapped object or similar.
Definition: uiter.h:345
UCharIteratorCurrent
UChar32 UCharIteratorCurrent(UCharIterator *iter)
Function type declaration for UCharIterator.current().
Definition: uiter.h:186
UCharIterator::reservedField
int32_t reservedField
(protected) Used by UTF-8 iterators and possibly others.
Definition: uiter.h:379
UCharIterator::next
UCharIteratorNext * 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).
Definition: uiter.h:435
uiter_getState
uint32_t uiter_getState(const UCharIterator *iter)
Get the "state" of the iterator in the form of a single 32-bit word.
uiter_setString
void uiter_setString(UCharIterator *iter, const UChar *s, int32_t length)
Set up a UCharIterator to iterate over a string.
uiter_setUTF8
void uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length)
Set up a UCharIterator to iterate over a UTF-8 string.
U_CALLCONV
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition: platform.h:823
UCharIteratorNext
UChar32 UCharIteratorNext(UCharIterator *iter)
Function type declaration for UCharIterator.next().
Definition: uiter.h:202
UCharIterator
C API for code unit iteration.
Definition: uiter.h:339
UCharIteratorPrevious
UChar32 UCharIteratorPrevious(UCharIterator *iter)
Function type declaration for UCharIterator.previous().
Definition: uiter.h:218
uiter_setCharacterIterator
void uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter)
Set up a UCharIterator to wrap around a C++ CharacterIterator.
UCharIterator::hasNext
UCharIteratorHasNext * hasNext
(public) Check if current() and next() can still return another code unit.
Definition: uiter.h:408
UCharIterator::previous
UCharIteratorPrevious * previous
(public) Decrement the index and return the code unit from there (pre-decrement, like s[–i])...
Definition: uiter.h:445
UCharIteratorReserved
int32_t UCharIteratorReserved(UCharIterator *iter, int32_t something)
Function type declaration for UCharIterator.reservedFn().
Definition: uiter.h:232
U_CDECL_BEGIN
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
Definition: umachine.h:82
UCharIterator::reservedFn
UCharIteratorReserved * reservedFn
(public) Reserved for future use.
Definition: uiter.h:453
UCharIterator::start
int32_t start
(protected) Start index or similar.
Definition: uiter.h:359
UCharIterator::length
int32_t length
(protected) Length of string or similar.
Definition: uiter.h:352
icu::Replaceable
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
Definition: rep.h:71
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UCharIteratorGetIndex
int32_t UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin)
Function type declaration for UCharIterator.getIndex().
Definition: uiter.h:105
UCharIteratorOrigin
UCharIteratorOrigin
Origin constants for UCharIterator.getIndex() and UCharIterator.move().
Definition: uiter.h:49
icu::CharacterIterator
Abstract class that defines an API for iteration on text objects.
Definition: chariter.h:356
UCharIteratorMove
int32_t UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin)
Function type declaration for UCharIterator.move().
Definition: uiter.h:142
UCharIteratorHasPrevious
UBool UCharIteratorHasPrevious(UCharIterator *iter)
Function type declaration for UCharIterator.hasPrevious().
Definition: uiter.h:171
UCharIterator::hasPrevious
UCharIteratorHasPrevious * hasPrevious
(public) Check if previous() can still return another code unit.
Definition: uiter.h:416
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
uiter_setUTF16BE
void uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length)
Set up a UCharIterator to iterate over a UTF-16BE string (byte vector with a big-endian pair of bytes...
UITER_UNKNOWN_INDEX
Constant value that may be returned by UCharIteratorMove indicating that the final UTF-16 index is no...
Definition: uiter.h:69
uiter_next32
UChar32 uiter_next32(UCharIterator *iter)
Helper function for UCharIterator to get the next code point.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
U_CDECL_END
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
Definition: umachine.h:83
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
UCharIterator::getIndex
UCharIteratorGetIndex * getIndex
(public) Returns the current position or the start or limit index of the iteration range...
Definition: uiter.h:388
UCharIteratorHasNext
UBool UCharIteratorHasNext(UCharIterator *iter)
Function type declaration for UCharIterator.hasNext().
Definition: uiter.h:157
UCharIterator::move
UCharIteratorMove * move
(public) Moves the current position relative to the start or limit of the iteration range...
Definition: uiter.h:399
uiter_current32
UChar32 uiter_current32(UCharIterator *iter)
Helper function for UCharIterator to get the code point at the current index.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
uiter_setState
void uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode)
Restore the "state" of the iterator using a state word from a getState() call.
UCharIteratorSetState
void UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode)
Function type declaration for UCharIterator.setState().
Definition: uiter.h:307
UCharIterator::index
int32_t index
(protected) Current index or similar.
Definition: uiter.h:366
UCharIterator::setState
UCharIteratorSetState * setState
(public) Restore the iterator state from the state word from a call to getState().
Definition: uiter.h:472
UCharIterator::current
UCharIteratorCurrent * current
(public) Return the code unit at the current position, or U_SENTINEL if there is none (index is at th...
Definition: uiter.h:425
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
UCharIterator::limit
int32_t limit
(protected) Limit index or similar.
Definition: uiter.h:373