142#if U_SHOW_CPLUSPLUS_API
229#if U_SHOW_CPLUSPLUS_API
656 int64_t nativeStart, int64_t nativeLimit,
657 UChar *dest, int32_t destCapacity,
677#ifndef U_HIDE_INTERNAL_API
687#define UTEXT_CURRENT32(ut) \
688 ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
689 ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut))
703#define UTEXT_NEXT32(ut) \
704 ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
705 ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut))
717#define UTEXT_PREVIOUS32(ut) \
718 ((ut)->chunkOffset > 0 && \
719 (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \
720 (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut))
734#define UTEXT_GETNATIVEINDEX(ut) \
735 ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \
736 (ut)->chunkNativeStart+(ut)->chunkOffset : \
737 (ut)->pFuncs->mapOffsetToNative(ut))
750#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \
751 int64_t __offset = (ix) - (ut)->chunkNativeStart; \
752 if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
753 (ut)->chunkOffset=(int32_t)__offset; \
755 utext_setNativeIndex((ut), (ix)); \
757} UPRV_BLOCK_MACRO_END
833 int64_t nativeStart, int64_t nativeLimit,
834 const UChar *replacementText, int32_t replacementLength,
873 int64_t nativeStart, int64_t nativeLimit,
1055 int64_t nativeStart, int64_t nativeLimit,
1056 UChar *dest, int32_t destCapacity,
1090 int64_t nativeStart, int64_t nativeLimit,
1091 const UChar *replacementText, int32_t replacmentLength,
1124 int64_t nativeStart, int64_t nativeLimit,
1548 UTEXT_MAGIC = 0x345ad82c
1558#define UTEXT_INITIALIZER { \
1583#if U_SHOW_CPLUSPLUS_API
C++ API: Character Iterator.
"Smart pointer" class, closes a UText via utext_close().
Abstract class that defines an API for iteration on text objects.
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C++ API: Replaceable String.
(public) Function dispatch table for UText.
int32_t reserved1
(private) Alignment padding.
UTextMapOffsetToNative * mapOffsetToNative
(public) Function pointer for UTextMapOffsetToNative.
UTextAccess * access
(public) Function pointer for UTextAccess.
UTextExtract * extract
(public) Function pointer for UTextExtract.
UTextClose * spare3
(private) Spare function pointer
int32_t tableSize
(public) Function table size, sizeof(UTextFuncs) Intended for use should the table grow to accommodat...
UTextNativeLength * nativeLength
(public) function pointer for UTextLength May be expensive to compute!
UTextReplace * replace
(public) Function pointer for UTextReplace.
UTextClose * spare2
(private) Spare function pointer
UTextClose * spare1
(private) Spare function pointer
UTextCopy * copy
(public) Function pointer for UTextCopy.
UTextMapNativeIndexToUTF16 * mapNativeIndexToUTF16
(public) Function pointer for UTextMapNativeIndexToUTF16.
UTextClose * close
(public) Function pointer for UTextClose.
UTextClone * clone
(public) Function pointer for UTextClone
int32_t b
(protected) Integer field reserved for use by the text provider.
int32_t chunkOffset
(protected) Current iteration position within the text chunk (UTF-16 buffer).
const void * p
(protected) Pointer fields available for use by the text provider.
int32_t extraSize
(protected) Size in bytes of the extra space (pExtra).
int64_t privA
Private field reserved for future use by the UText framework itself.
int32_t nativeIndexingLimit
(protected) The highest chunk offset where native indexing and chunk (UTF-16) indexing correspond.
int32_t sizeOfStruct
(public) sizeOfStruct=sizeof(UText) Allows possible backward compatible extension.
void * pExtra
(protected) Pointer to additional space requested by the text provider during the utext_open operatio...
int64_t chunkNativeLimit
(protected) Native index of the first character position following the current chunk.
const void * r
(protected) Pointer fields available for use by the text provider.
int32_t privB
Private field reserved for future use by the UText framework itself.
const UTextFuncs * pFuncs
(public) Pointer to Dispatch table for accessing functions for this UText.
int32_t chunkLength
(protected) Length the text chunk (UTF-16 buffer), in UChars.
int32_t providerProperties
Text provider properties.
const UChar * chunkContents
(protected) pointer to a chunk of text in UTF-16 format.
int32_t privC
Private field reserved for future use by the UText framework itself.
const void * q
(protected) Pointer fields available for use by the text provider.
void * privP
Private field reserved for future use by the UText framework itself.
int64_t chunkNativeStart
(protected) Native index of the first character in the text chunk.
const void * context
(protected) Pointer to string or text-containing object or similar.
int32_t c
(protected) Integer field reserved for use by the text provider.
int64_t a
(protected) Integer field reserved for use by the text provider.
C API: Unicode Properties.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
#define U_CDECL_END
This is used to end a declaration of a library private ICU C API.
int8_t UBool
The ICU boolean type, a signed-byte integer.
#define U_CAPI
This is used to declare a function as a public ICU C API.
char16_t UChar
The base type for UTF-16 code units and pointers.
#define U_CDECL_BEGIN
This is used to begin a declaration of a library private ICU C API.
int32_t UTextReplace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacmentLength, UErrorCode *status)
Function type declaration for UText.replace().
U_CAPI UChar32 utext_previous32From(UText *ut, int64_t nativeIndex)
Set the iteration index, and return the code point preceding the one specified by the initial index.
U_CAPI UText * utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status)
Open a read-only UText implementation for UTF-8 strings.
U_CAPI UText * utext_close(UText *ut)
Close function for UText instances.
U_CAPI UChar32 utext_previous32(UText *ut)
Move the iterator position to the character (code point) whose index precedes the current position,...
UText * UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
Function type declaration for UText.clone().
U_CAPI UBool utext_moveIndex32(UText *ut, int32_t delta)
Move the iterator position by delta code points.
U_CAPI UText * utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status)
Open a UText for a const UnicodeString.
int64_t UTextNativeLength(UText *ut)
Function type declaration for UText.nativeLength().
U_CAPI UBool utext_hasMetaData(const UText *ut)
Test whether there is meta data associated with the text.
int32_t UTextExtract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status)
Function type declaration for UText.extract().
void UTextClose(UText *ut)
Function type declaration for UText.utextClose().
U_CAPI int32_t utext_extract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status)
Extract text from a UText into a UChar buffer.
@ UTEXT_PROVIDER_HAS_META_DATA
There is meta data associated with the text.
@ UTEXT_PROVIDER_STABLE_CHUNKS
Text chunks remain valid and usable until the text object is modified or deleted, not just until the ...
@ UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE
It is potentially time consuming for the provider to determine the length of the text.
@ UTEXT_PROVIDER_OWNS_TEXT
Text provider owns the text storage.
@ UTEXT_PROVIDER_WRITABLE
The provider supports modifying the text via the replace() and copy() functions.
U_CAPI UText * utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status)
Common function for use by Text Provider implementations to allocate and/or initialize a new UText st...
UBool UTextAccess(UText *ut, int64_t nativeIndex, UBool forward)
Function type declaration for UText.access().
U_CAPI UText * utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status)
Open a UText implementation over an ICU CharacterIterator.
U_CAPI UText * utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status)
Open a read-only UText for UChar * string.
int64_t UTextMapOffsetToNative(const UText *ut)
Function type declaration for UText.mapOffsetToNative().
U_CAPI void utext_copy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, UBool move, UErrorCode *status)
Copy or move a substring from one position to another within the text, while retaining any metadata a...
int32_t UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex)
Function type declaration for UText.mapIndexToUTF16().
U_CAPI UText * utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status)
Open a writable UText implementation for an ICU Replaceable object.
U_CAPI UChar32 utext_char32At(UText *ut, int64_t nativeIndex)
Returns the code point at the requested index, or U_SENTINEL (-1) if it is out of bounds.
U_CAPI UBool utext_equals(const UText *a, const UText *b)
Compare two UText objects for equality.
U_CAPI int64_t utext_nativeLength(UText *ut)
Get the length of the text.
U_CAPI UBool utext_isLengthExpensive(const UText *ut)
Return true if calculating the length of the text could be expensive.
void UTextCopy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t nativeDest, UBool move, UErrorCode *status)
Function type declaration for UText.copy().
U_CAPI void utext_freeze(UText *ut)
U_CAPI int64_t utext_getPreviousNativeIndex(UText *ut)
Get the native index of the character preceding the current position.
U_CAPI UBool utext_isWritable(const UText *ut)
Return true if the text can be written (modified) with utext_replace() or utext_copy().
U_CAPI int32_t utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacementLength, UErrorCode *status)
Replace a range of the original text with a replacement text.
U_CAPI void utext_setNativeIndex(UText *ut, int64_t nativeIndex)
Set the current iteration position to the nearest code point boundary at or preceding the specified i...
U_CAPI UChar32 utext_next32From(UText *ut, int64_t nativeIndex)
Set the iteration index and return the code point at that index.
U_CAPI int64_t utext_getNativeIndex(const UText *ut)
Get the current iterator position, which can range from 0 to the length of the text.
U_CAPI UText * utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status)
Clone a UText.
U_CAPI UChar32 utext_next32(UText *ut)
Get the code point at the current iteration position of the UText, and advance the position to the fi...
U_CAPI UChar32 utext_current32(UText *ut)
Get the code point at the current iteration position, or U_SENTINEL (-1) if the iteration has reached...
U_CAPI UText * utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status)
Open a writable UText for a non-const UnicodeString.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.