Go to the documentation of this file.
142 #if U_SHOW_CPLUSPLUS_API
186 #if U_SHOW_CPLUSPLUS_API
248 #if U_SHOW_CPLUSPLUS_API
675 int64_t nativeStart, int64_t nativeLimit,
676 UChar *dest, int32_t destCapacity,
696 #ifndef U_HIDE_INTERNAL_API
706 #define UTEXT_CURRENT32(ut) \
707 ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
708 ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut))
722 #define UTEXT_NEXT32(ut) \
723 ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
724 ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut))
736 #define UTEXT_PREVIOUS32(ut) \
737 ((ut)->chunkOffset > 0 && \
738 (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \
739 (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut))
753 #define UTEXT_GETNATIVEINDEX(ut) \
754 ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \
755 (ut)->chunkNativeStart+(ut)->chunkOffset : \
756 (ut)->pFuncs->mapOffsetToNative(ut))
769 #define UTEXT_SETNATIVEINDEX(ut, ix) \
770 { int64_t __offset = (ix) - (ut)->chunkNativeStart; \
771 if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
772 (ut)->chunkOffset=(int32_t)__offset; \
774 utext_setNativeIndex((ut), (ix)); } }
850 int64_t nativeStart, int64_t nativeLimit,
851 const UChar *replacementText, int32_t replacementLength,
890 int64_t nativeStart, int64_t nativeLimit,
1072 int64_t nativeStart, int64_t nativeLimit,
1073 UChar *dest, int32_t destCapacity,
1107 int64_t nativeStart, int64_t nativeLimit,
1108 const UChar *replacementText, int32_t replacmentLength,
1141 int64_t nativeStart, int64_t nativeLimit,
1558 #ifndef U_HIDE_INTERNAL_API
1565 UTEXT_MAGIC = 0x345ad82c
1576 #define UTEXT_INITIALIZER { \
UText * utext_close(UText *ut)
Close function for UText instances.
UText * utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status)
Open a read-only UText for UChar * string.
void UTextCopy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t nativeDest, UBool move, UErrorCode *status)
Function type declaration for UText.copy().
The provider supports modifying the text via the replace() and copy() functions.
Basic definitions for ICU, for both C and C++ APIs.
UChar32 utext_next32(UText *ut)
Get the code point at the current iteration position of the UText, and advance the position to the fi...
UText * utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status)
Clone a UText.
UBool utext_hasMetaData(const UText *ut)
Test whether there is meta data associated with the text.
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().
int8_t UBool
The ICU boolean type.
UTextClose * spare3
(private) Spare function pointer
int64_t UTextNativeLength(UText *ut)
Function type declaration for UText.nativeLength().
int32_t providerProperties
Text provider properties.
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
UChar32 utext_previous32(UText *ut)
Move the iterator position to the character (code point) whose index precedes the current position,...
UTextClone * clone
(public) Function pointer for UTextClone
int32_t nativeIndexingLimit
(protected) The highest chunk offset where native indexing and chunk (UTF-16) indexing correspond.
UBool utext_equals(const UText *a, const UText *b)
Compare two UText objects for equality.
UTextNativeLength * nativeLength
(public) function pointer for UTextLength May be expensive to compute!
UChar32 utext_next32From(UText *ut, int64_t nativeIndex)
Set the iteration index and return the code point at that index.
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.
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...
int64_t chunkNativeStart
(protected) Native index of the first character in the text chunk.
UTextAccess * access
(public) Function pointer for UTextAccess.
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...
UTextMapNativeIndexToUTF16 * mapNativeIndexToUTF16
(public) Function pointer for UTextMapNativeIndexToUTF16.
int32_t reserved1
(private) Alignment padding.
UBool utext_isWritable(const UText *ut)
Return TRUE if the text can be written (modified) with utext_replace() or utext_copy().
int32_t privC
Private field reserved for future use by the UText framework itself.
UText * UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
Function type declaration for UText.clone().
UTextClose * close
(public) Function pointer for UTextClose.
int32_t UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex)
Function type declaration for UText.mapIndexToUTF16().
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
int32_t tableSize
(public) Function table size, sizeof(UTextFuncs) Intended for use should the table grow to accommodat...
const void * q
(protected) Pointer fields available for use by the text provider.
There is meta data associated with the text.
(public) Function dispatch table for UText.
int32_t chunkLength
(protected) Length the text chunk (UTF-16 buffer), in UChars.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
int64_t a
(protected) Integer field reserved for use by the text provider.
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...
UTextCopy * copy
(public) Function pointer for UTextCopy.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
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.
UText * utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status)
Open a writable UText for a non-const UnicodeString.
int32_t b
(protected) Integer field reserved for use by the text provider.
UTextExtract * extract
(public) Function pointer for UTextExtract.
void * privP
Private field reserved for future use by the UText framework itself.
Text chunks remain valid and usable until the text object is modified or deleted, not just until the ...
int64_t utext_getNativeIndex(const UText *ut)
Get the current iterator position, which can range from 0 to the length of the text.
UBool utext_isLengthExpensive(const UText *ut)
Return TRUE if calculating the length of the text could be expensive.
void * pExtra
(protected) Pointer to additional space requested by the text provider during the utext_open operatio...
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.
int64_t chunkNativeLimit
(protected) Native index of the first character position following the current chunk.
const void * context
(protected) Pointer to string or text-containing object or similar.
UTextClose * spare2
(private) Spare function pointer
UText * utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status)
Open a UText implementation over an ICU CharacterIterator.
Text provider owns the text storage.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
Abstract class that defines an API for iteration on text objects.
const void * p
(protected) Pointer fields available for use by the text provider.
UText * utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status)
Open a writable UText implementation for an ICU Replaceable object.
UChar32 utext_current32(UText *ut)
Get the code point at the current iteration position, or U_SENTINEL (-1) if the iteration has reached...
const UTextFuncs * pFuncs
(public) Pointer to Dispatch table for accessing functions for this UText.
int64_t utext_nativeLength(UText *ut)
Get the length of the text.
int32_t sizeOfStruct
(public) sizeOfStruct=sizeof(UText) Allows possible backward compatible extension.
int64_t utext_getPreviousNativeIndex(UText *ut)
Get the native index of the character preceding the current position.
UText * utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status)
Open a read-only UText implementation for UTF-8 strings.
int32_t UTextExtract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status)
Function type declaration for UText.extract().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
It is potentially time consuming for the provider to determine the length of the text.
int32_t privB
Private field reserved for future use by the UText framework itself.
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.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
C++ API: Character Iterator.
UTextReplace * replace
(public) Function pointer for UTextReplace.
int32_t extraSize
(protected) Size in bytes of the extra space (pExtra).
C++ API: Replaceable String.
int64_t privA
Private field reserved for future use by the UText framework itself.
UBool UTextAccess(UText *ut, int64_t nativeIndex, UBool forward)
Function type declaration for UText.access().
UBool utext_moveIndex32(UText *ut, int32_t delta)
Move the iterator position by delta code points.
C API: Unicode Properties.
UTextMapOffsetToNative * mapOffsetToNative
(public) Function pointer for UTextMapOffsetToNative.
UTextClose * spare1
(private) Spare function pointer
const void * r
(protected) Pointer fields available for use by the text provider.
#define U_NAMESPACE_BEGIN
int32_t chunkOffset
(protected) Current iteration position within the text chunk (UTF-16 buffer).
void utext_freeze(UText *ut)
UText * utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status)
Open a UText for a const UnicodeString.
int32_t c
(protected) Integer field reserved for use by the text provider.
void UTextClose(UText *ut)
Function type declaration for UText.utextClose().
int64_t UTextMapOffsetToNative(const UText *ut)
Function type declaration for UText.mapOffsetToNative().
const UChar * chunkContents
(protected) pointer to a chunk of text in UTF-16 format.