X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..249c4c5ea9376c24572daf9c2effa7484a282f14:/icuSources/common/unicode/utext.h diff --git a/icuSources/common/unicode/utext.h b/icuSources/common/unicode/utext.h index 5918bf50..81730606 100644 --- a/icuSources/common/unicode/utext.h +++ b/icuSources/common/unicode/utext.h @@ -1,12 +1,14 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * -* Copyright (C) 2004-2006, International Business Machines +* Copyright (C) 2004-2012, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utext.h -* encoding: US-ASCII +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -136,17 +138,19 @@ #include "unicode/utypes.h" -#ifdef XP_CPLUSPLUS +#include "unicode/uchar.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" #include "unicode/rep.h" #include "unicode/unistr.h" #include "unicode/chariter.h" -#endif +#endif // U_SHOW_CPLUSPLUS_API U_CDECL_BEGIN struct UText; -typedef struct UText UText; /**< C typedef for struct UText. @draft ICU 3.6 */ +typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ /*************************************************************************************** @@ -174,11 +178,29 @@ typedef struct UText UText; /**< C typedef for struct UText. @draft ICU 3.6 */ * returned by this function, and may be safely used again in * a subsequent utext_open. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 +U_STABLE UText * U_EXPORT2 utext_close(UText *ut); +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUTextPointer + * "Smart pointer" class, closes a UText via utext_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API /** * Open a read-only UText implementation for UTF-8 strings. @@ -199,9 +221,9 @@ utext_close(UText *ut); * @param status Errors are returned here. * @return A pointer to the UText. If a pre-allocated UText was provided, it * will always be used and returned. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 +U_STABLE UText * U_EXPORT2 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); @@ -217,13 +239,13 @@ utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); * @param status Errors are returned here. * @return A pointer to the UText. If a pre-allocated UText was provided, it * will always be used and returned. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 +U_STABLE UText * U_EXPORT2 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); -#ifdef XP_CPLUSPLUS +#if U_SHOW_CPLUSPLUS_API /** * Open a writable UText for a non-const UnicodeString. * @@ -234,10 +256,10 @@ utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 -utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status); +U_STABLE UText * U_EXPORT2 +utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); /** @@ -250,10 +272,10 @@ utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status); * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 -utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status); +U_STABLE UText * U_EXPORT2 +utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status); /** @@ -266,10 +288,10 @@ utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *stat * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @see Replaceable - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 -utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status); +U_STABLE UText * U_EXPORT2 +utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); /** * Open a UText implementation over an ICU CharacterIterator. @@ -281,12 +303,12 @@ utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status); * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @see Replaceable - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 -utext_openCharacterIterator(UText *ut, CharacterIterator *ic, UErrorCode *status); +U_STABLE UText * U_EXPORT2 +utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status); -#endif +#endif // U_SHOW_CPLUSPLUS_API /** @@ -344,9 +366,9 @@ utext_openCharacterIterator(UText *ut, CharacterIterator *ic, UErrorCode *status * will be returned if the text provider is unable to clone the * original text. * @return The newly created clone, or NULL if the clone operation failed. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 +U_STABLE UText * U_EXPORT2 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); @@ -359,15 +381,15 @@ utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCod * @param a The first of the two UTexts to compare. * @param b The other UText to be compared. * @return TRUE if the two UTexts are equal. - * @draft ICU 3.6 + * @stable ICU 3.6 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 utext_equals(const UText *a, const UText *b); /***************************************************************************** * - * Functions to work with the text represeted by a UText wrapper + * Functions to work with the text represented by a UText wrapper * *****************************************************************************/ @@ -380,9 +402,9 @@ utext_equals(const UText *a, const UText *b); * @param ut the text to be accessed. * @return the length of the text, expressed in native units. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT int64_t U_EXPORT2 +U_STABLE int64_t U_EXPORT2 utext_nativeLength(UText *ut); /** @@ -396,9 +418,9 @@ utext_nativeLength(UText *ut); * * @param ut the text to be accessed. * @return TRUE if determining the length of the text could be time consuming. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 utext_isLengthExpensive(const UText *ut); /** @@ -411,7 +433,7 @@ utext_isLengthExpensive(const UText *ut); * * The iteration position will be set to the start of the returned code point. * - * This function is roughly equivalent to the the sequence + * This function is roughly equivalent to the sequence * utext_setNativeIndex(index); * utext_current32(); * (There is a subtle difference if the index is out of bounds by being less than zero - @@ -424,9 +446,9 @@ utext_isLengthExpensive(const UText *ut); * to other than the first unit of a multi-unit character, it will be adjusted * to the start of the character. * @return the code point at the specified index. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_char32At(UText *ut, int64_t nativeIndex); @@ -438,9 +460,9 @@ utext_char32At(UText *ut, int64_t nativeIndex); * * @param ut the text to be accessed. * @return the Unicode code point at the current iterator position. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_current32(UText *ut); @@ -460,9 +482,9 @@ utext_current32(UText *ut); * @param ut the text to be accessed. * @return the Unicode code point at the iteration position. * @see UTEXT_NEXT32 - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_next32(UText *ut); @@ -481,9 +503,9 @@ utext_next32(UText *ut); * @return the previous UChar32 code point, or U_SENTINEL (-1) * if the iteration has reached the start of the text. * @see UTEXT_PREVIOUS32 - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_previous32(UText *ut); @@ -503,9 +525,9 @@ utext_previous32(UText *ut); * @param nativeIndex Iteration index, in the native units of the text provider. * @return Code point which starts at or before index, * or U_SENTINEL (-1) if it is out of bounds. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_next32From(UText *ut, int64_t nativeIndex); @@ -523,9 +545,9 @@ utext_next32From(UText *ut, int64_t nativeIndex); * @return Code point preceding the one at the initial index, * or U_SENTINEL (-1) if it is out of bounds. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UChar32 U_EXPORT2 +U_STABLE UChar32 U_EXPORT2 utext_previous32From(UText *ut, int64_t nativeIndex); /** @@ -538,9 +560,9 @@ utext_previous32From(UText *ut, int64_t nativeIndex); * * @param ut the text to be accessed. * @return the current index position, in the native units of the text provider. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT int64_t U_EXPORT2 +U_STABLE int64_t U_EXPORT2 utext_getNativeIndex(const UText *ut); /** @@ -564,13 +586,13 @@ utext_getNativeIndex(const UText *ut); * * @param ut the text to be accessed. * @param nativeIndex the native unit index of the new iteration position. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT void U_EXPORT2 +U_STABLE void U_EXPORT2 utext_setNativeIndex(UText *ut, int64_t nativeIndex); /** - * Move the iterator postion by delta code points. The number of code points + * Move the iterator position by delta code points. The number of code points * is a signed number; a negative delta will move the iterator backwards, * towards the start of the text. *

@@ -583,13 +605,13 @@ utext_setNativeIndex(UText *ut, int64_t nativeIndex); * @param delta the signed number of code points to move the iteration position. * @return TRUE if the position could be moved the requested number of positions while * staying within the range [0 - text length]. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 utext_moveIndex32(UText *ut, int32_t delta); /** - * Get the native index of the character preceeding the current position. + * Get the native index of the character preceding the current position. * If the iteration position is already at the start of the text, zero * is returned. * The value returned is the same as that obtained from the following sequence, @@ -606,11 +628,11 @@ utext_moveIndex32(UText *ut, int32_t delta); * native index of the character most recently returned from utext_next(). * * @param ut the text to be accessed - * @return the native index of the character preceeding the current index position, + * @return the native index of the character preceding the current index position, * or zero if the current position is at the start of the text. - * @draft ICU 3.6 + * @stable ICU 3.6 */ -U_DRAFT int64_t U_EXPORT2 +U_STABLE int64_t U_EXPORT2 utext_getPreviousNativeIndex(UText *ut); @@ -633,10 +655,10 @@ utext_getPreviousNativeIndex(UText *ut); * @param ut the UText from which to extract data. * @param nativeStart the native index of the first character to extract.\ * If the specified index is out of range, - * it will be pinned to to be within 0 <= index <= textLength + * it will be pinned to be within 0 <= index <= textLength * @param nativeLimit the native string index of the position following the last * character to extract. If the specified index is out of range, - * it will be pinned to to be within 0 <= index <= textLength. + * it will be pinned to be within 0 <= index <= textLength. * nativeLimit must be >= nativeStart. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed * @param destCapacity The size, in UChars, of the destination buffer. May be zero @@ -646,16 +668,16 @@ utext_getPreviousNativeIndex(UText *ut); * buffer was too small. Returns number of UChars for preflighting. * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 utext_extract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status); -#ifndef U_HIDE_DRAFT_API + /************************************************************************************ * * #define inline versions of selected performance-critical text access functions @@ -671,6 +693,21 @@ utext_extract(UText *ut, * ************************************************************************************/ +#ifndef U_HIDE_INTERNAL_API +/** + * inline version of utext_current32(), for performance-critical situations. + * + * Get the code point at the current iteration position of the UText. + * Returns U_SENTINEL (-1) if the position is at the end of the + * text. + * + * @internal ICU 4.4 technology preview + */ +#define UTEXT_CURRENT32(ut) \ + ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ + ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut)) +#endif /* U_HIDE_INTERNAL_API */ + /** * inline version of utext_next32(), for performance-critical situations. * @@ -680,7 +717,7 @@ utext_extract(UText *ut, * Returns U_SENTINEL (-1) if the position is at the end of the * text. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ #define UTEXT_NEXT32(ut) \ ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ @@ -694,7 +731,7 @@ utext_extract(UText *ut, * This is a pre-decrement operation. * Returns U_SENTINEL (-1) if the position is at the start of the text. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ #define UTEXT_PREVIOUS32(ut) \ ((ut)->chunkOffset > 0 && \ @@ -711,7 +748,7 @@ utext_extract(UText *ut, * the corresponding UChar (UTF-16) index. * The returned position will always be aligned to a code point boundary. * - * @draft ICU 3.6 + * @stable ICU 3.6 */ #define UTEXT_GETNATIVEINDEX(ut) \ ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ @@ -727,19 +764,17 @@ utext_extract(UText *ut, * If the index is out of range, it will be pinned to be within * the range of the input text. * - * @draft ICU 3.8 + * @stable ICU 3.8 */ #define UTEXT_SETNATIVEINDEX(ut, ix) \ { int64_t __offset = (ix) - (ut)->chunkNativeStart; \ - if (__offset>=0 && __offset<=(int64_t)(ut)->nativeIndexingLimit) { \ + if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ (ut)->chunkOffset=(int32_t)__offset; \ } else { \ utext_setNativeIndex((ut), (ix)); } } -#endif - /************************************************************************************ * * Functions related to writing or modifying the text. @@ -764,10 +799,10 @@ utext_extract(UText *ut, * @see utext_freeze() * @see utext_replace() * @see utext_copy() - * @draft ICU 3.4 + * @stable ICU 3.4 * */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 utext_isWritable(const UText *ut); @@ -777,9 +812,9 @@ utext_isWritable(const UText *ut); * * @param ut The UText to be tested * @return TRUE if the underlying text includes meta data. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UBool U_EXPORT2 +U_STABLE UBool U_EXPORT2 utext_hasMetaData(const UText *ut); @@ -808,9 +843,9 @@ utext_hasMetaData(const UText *ut); * @return The signed number of (native) storage units by which * the length of the text expanded or contracted. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacementLength, @@ -848,9 +883,9 @@ utext_replace(UText *ut, * @param move If TRUE, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION * - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT void U_EXPORT2 +U_STABLE void U_EXPORT2 utext_copy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, @@ -871,49 +906,48 @@ utext_copy(UText *ut, * Caution: freezing a UText will disable changes made via the specific * frozen UText wrapper only; it will not have any effect on the ability to * directly modify the text by bypassing the UText. Any such backdoor modifications - * are always an error while UText access is occuring because the underlying + * are always an error while UText access is occurring because the underlying * text can get out of sync with UText's buffering. *

* * @param ut The UText to be frozen. * @see utext_isWritable() - * @draft ICU 3.6 + * @stable ICU 3.6 */ -U_DRAFT void U_EXPORT2 +U_STABLE void U_EXPORT2 utext_freeze(UText *ut); -#ifndef U_HIDE_DRAFT_API /** * UText provider properties (bit field indexes). * * @see UText - * @draft ICU 3.4 + * @stable ICU 3.4 */ enum { /** * It is potentially time consuming for the provider to determine the length of the text. - * @draft ICU 3.4 + * @stable ICU 3.4 */ UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, /** * Text chunks remain valid and usable until the text object is modified or * deleted, not just until the next time the access() function is called * (which is the default). - * @draft ICU 3.4 + * @stable ICU 3.4 */ UTEXT_PROVIDER_STABLE_CHUNKS = 2, /** * The provider supports modifying the text via the replace() and copy() * functions. * @see Replaceable - * @draft ICU 3.4 + * @stable ICU 3.4 */ UTEXT_PROVIDER_WRITABLE = 3, /** * There is meta data associated with the text. * @see Replaceable::hasMetaData() - * @draft ICU 3.4 + * @stable ICU 3.4 */ UTEXT_PROVIDER_HAS_META_DATA = 4, /** @@ -921,7 +955,7 @@ enum { * Generally occurs as the result of a deep clone of the UText. * When closing the UText, the associated text must * also be closed/deleted/freed/ whatever is appropriate. - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTEXT_PROVIDER_OWNS_TEXT = 5 }; @@ -961,7 +995,7 @@ enum { * original text. * @return The newly created clone, or NULL if the clone operation failed. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef UText * U_CALLCONV UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); @@ -973,7 +1007,7 @@ UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); * @param ut the UText to get the length of. * @return the length, in the native units of the original text string. * @see UText - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef int64_t U_CALLCONV UTextNativeLength(UText *ut); @@ -1001,7 +1035,7 @@ UTextNativeLength(UText *ut); * (the requested index is out of bounds). * * @see UText - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef UBool U_CALLCONV UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); @@ -1020,7 +1054,7 @@ UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); * be NUL-terminated if there is sufficient space in the destination buffer. * * @param ut the UText from which to extract data. - * @param nativeStart the native index of the first characer to extract. + * @param nativeStart the native index of the first character to extract. * @param nativeLimit the native string index of the position following the last * character to extract. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed @@ -1031,7 +1065,7 @@ UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); * preflighting. * @return Number of UChars in the data. Does not include a trailing NUL. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextExtract(UText *ut, @@ -1066,7 +1100,7 @@ UTextExtract(UText *ut, * @return The signed number of (native) storage units by which * the length of the text expanded or contracted. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextReplace(UText *ut, @@ -1100,7 +1134,7 @@ UTextReplace(UText *ut, * @param move If TRUE, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef void U_CALLCONV UTextCopy(UText *ut, @@ -1120,7 +1154,7 @@ UTextCopy(UText *ut, * @return Absolute (native) index corresponding to chunkOffset in the current chunk. * The returned native index should always be to a code point boundary. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef int64_t U_CALLCONV UTextMapOffsetToNative(const UText *ut); @@ -1138,7 +1172,7 @@ UTextMapOffsetToNative(const UText *ut); * @return Chunk-relative UTF-16 offset corresponding to the specified native * index. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); @@ -1159,7 +1193,7 @@ UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); * * @param ut A UText object to be closed. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ typedef void U_CALLCONV UTextClose(UText *ut); @@ -1172,12 +1206,12 @@ UTextClose(UText *ut); * Each text provider implementation must provide an * actual table that is initialized with the appropriate functions * for the type of text being handled. - * @draft ICU 3.6 + * @stable ICU 3.6 */ struct UTextFuncs { /** * (public) Function table size, sizeof(UTextFuncs) - * Intended for use should the table grow to accomodate added + * Intended for use should the table grow to accommodate added * functions in the future, to allow tests for older format * function tables that do not contain the extensions. * @@ -1187,7 +1221,7 @@ struct UTextFuncs { * 4 pointers, * 2 64-bit fields * in sequence. - * @draft ICU 3.6 + * @stable ICU 3.6 */ int32_t tableSize; @@ -1196,14 +1230,14 @@ struct UTextFuncs { * Do not use, reserved for use by the UText framework only. * @internal */ - int32_t reserved1, reserved2, reserved3; + int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; /** * (public) Function pointer for UTextClone * * @see UTextClone - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextClone *clone; @@ -1212,7 +1246,7 @@ struct UTextFuncs { * May be expensive to compute! * * @see UTextLength - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextNativeLength *nativeLength; @@ -1220,7 +1254,7 @@ struct UTextFuncs { * (public) Function pointer for UTextAccess. * * @see UTextAccess - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextAccess *access; @@ -1228,7 +1262,7 @@ struct UTextFuncs { * (public) Function pointer for UTextExtract. * * @see UTextExtract - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextExtract *extract; @@ -1236,7 +1270,7 @@ struct UTextFuncs { * (public) Function pointer for UTextReplace. * * @see UTextReplace - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextReplace *replace; @@ -1244,7 +1278,7 @@ struct UTextFuncs { * (public) Function pointer for UTextCopy. * * @see UTextCopy - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextCopy *copy; @@ -1252,7 +1286,7 @@ struct UTextFuncs { * (public) Function pointer for UTextMapOffsetToNative. * * @see UTextMapOffsetToNative - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextMapOffsetToNative *mapOffsetToNative; @@ -1260,7 +1294,7 @@ struct UTextFuncs { * (public) Function pointer for UTextMapNativeIndexToUTF16. * * @see UTextMapNativeIndexToUTF16 - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; @@ -1268,7 +1302,7 @@ struct UTextFuncs { * (public) Function pointer for UTextClose. * * @see UTextClose - * @draft ICU 3.6 + * @stable ICU 3.6 */ UTextClose *close; @@ -1276,8 +1310,8 @@ struct UTextFuncs { * (private) Spare function pointer * @internal */ - UTextClose *spare1; + /** * (private) Spare function pointer * @internal @@ -1291,11 +1325,12 @@ struct UTextFuncs { UTextClose *spare3; }; +/** + * Function dispatch table for UText + * @see UTextFuncs + */ typedef struct UTextFuncs UTextFuncs; -#endif - -#ifndef U_HIDE_DRAFT_API /** * UText struct. Provides the interface between the generic UText access code * and the UText provider code that works on specific kinds of @@ -1305,12 +1340,12 @@ typedef struct UTextFuncs UTextFuncs; * to pass text data to ICU services will have no need to view the * internals of the UText structs that they open. * - * @draft ICU 3.6 + * @stable ICU 3.6 */ struct UText { /** * (private) Magic. Used to help detect when UText functions are handed - * invalid or unitialized UText structs. + * invalid or uninitialized UText structs. * utext_openXYZ() functions take an initialized, * but not necessarily open, UText struct as an * optional fill-in parameter. This magic field @@ -1332,9 +1367,9 @@ struct UText { /** - * Text provider properties. This set of flags is maintainted by the + * Text provider properties. This set of flags is maintained by the * text provider implementation. - * @draft ICU 3.4 + * @stable ICU 3.4 */ int32_t providerProperties; @@ -1342,7 +1377,7 @@ struct UText { * (public) sizeOfStruct=sizeof(UText) * Allows possible backward compatible extension. * - * @draft ICU 3.4 + * @stable ICU 3.4 */ int32_t sizeOfStruct; @@ -1352,13 +1387,13 @@ struct UText { /** * (protected) Native index of the first character position following * the current chunk. - * @draft ICU 3.6 + * @stable ICU 3.6 */ int64_t chunkNativeLimit; /** * (protected) Size in bytes of the extra space (pExtra). - * @draft ICU 3.4 + * @stable ICU 3.4 */ int32_t extraSize; @@ -1367,7 +1402,7 @@ struct UText { * chunk (UTF-16) indexing correspond. For UTF-16 sources, value * will be equal to chunkLength. * - * @draft ICU 3.6 + * @stable ICU 3.6 */ int32_t nativeIndexingLimit; @@ -1375,20 +1410,20 @@ struct UText { /** * (protected) Native index of the first character in the text chunk. - * @draft ICU 3.6 + * @stable ICU 3.6 */ int64_t chunkNativeStart; /** * (protected) Current iteration position within the text chunk (UTF-16 buffer). * This is the index to the character that will be returned by utext_next32(). - * @draft ICU 3.6 + * @stable ICU 3.6 */ int32_t chunkOffset; /** * (protected) Length the text chunk (UTF-16 buffer), in UChars. - * @draft ICU 3.6 + * @stable ICU 3.6 */ int32_t chunkLength; @@ -1399,28 +1434,28 @@ struct UText { * (protected) pointer to a chunk of text in UTF-16 format. * May refer either to original storage of the source of the text, or * if conversion was required, to a buffer owned by the UText. - * @draft ICU 3.6 + * @stable ICU 3.6 */ const UChar *chunkContents; /** * (public) Pointer to Dispatch table for accessing functions for this UText. - * @draft ICU 3.6 + * @stable ICU 3.6 */ - UTextFuncs *pFuncs; - + const UTextFuncs *pFuncs; + /** * (protected) Pointer to additional space requested by the * text provider during the utext_open operation. - * @draft ICU 3.4 + * @stable ICU 3.4 */ void *pExtra; /** - * (protected) Pointer to string or text-containin object or similar. + * (protected) Pointer to string or text-containing object or similar. * This is the source of the text that this UText is wrapping, in a format * that is known to the text provider functions. - * @draft ICU 3.4 + * @stable ICU 3.4 */ const void *context; @@ -1429,19 +1464,19 @@ struct UText { /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. - * @draft ICU 3.6 + * @stable ICU 3.6 */ const void *p; /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. - * @draft ICU 3.6 + * @stable ICU 3.6 */ const void *q; /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. - * @draft ICU 3.6 + * @stable ICU 3.6 */ const void *r; @@ -1459,21 +1494,21 @@ struct UText { /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. - * @draft ICU 3.4 + * @stable ICU 3.4 */ int64_t a; /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. - * @draft ICU 3.4 + * @stable ICU 3.4 */ int32_t b; /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. - * @draft ICU 3.4 + * @stable ICU 3.4 */ int32_t c; @@ -1500,7 +1535,6 @@ struct UText { int32_t privC; }; -#endif /** * Common function for use by Text Provider implementations to allocate and/or initialize @@ -1516,11 +1550,12 @@ struct UText { * additional storage. * @param status Errors are returned here. * @return pointer to the UText, allocated if necessary, with extra space set up if requested. - * @draft ICU 3.4 + * @stable ICU 3.4 */ -U_DRAFT UText * U_EXPORT2 +U_STABLE UText * U_EXPORT2 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); +#ifndef U_HIDE_INTERNAL_API /** * @internal * Value used to help identify correctly initialized UText structs. @@ -1529,14 +1564,14 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); enum { UTEXT_MAGIC = 0x345ad82c }; -#ifndef U_HIDE_DRAFT_API +#endif /* U_HIDE_INTERNAL_API */ /** * initializer to be used with local (stack) instances of a UText * struct. UText structs must be initialized before passing * them to one of the utext_open functions. * - * @draft ICU 3.6 + * @stable ICU 3.6 */ #define UTEXT_INITIALIZER { \ UTEXT_MAGIC, /* magic */ \ @@ -1560,8 +1595,6 @@ enum { } -#endif /* U_HIDE_DRAFT_API */ - U_CDECL_END