Victor Chang | f1a8c98 | 2020-11-20 18:16:37 +0000 | [diff] [blame^] | 1 | --- libicu/ndk_headers/unicode/utext.h 2020-11-21 00:51:06.071856434 +0000 |
| 2 | +++ libicu/ndk_headers/unicode/utext.h 2020-11-21 00:50:57.371794900 +0000 |
| 3 | @@ -676,787 +676,6 @@ |
| 4 | |
| 5 | |
| 6 | |
| 7 | -/************************************************************************************ |
| 8 | - * |
| 9 | - * #define inline versions of selected performance-critical text access functions |
| 10 | - * Caution: do not use auto increment++ or decrement-- expressions |
| 11 | - * as parameters to these macros. |
| 12 | - * |
| 13 | - * For most use, where there is no extreme performance constraint, the |
| 14 | - * normal, non-inline functions are a better choice. The resulting code |
| 15 | - * will be smaller, and, if the need ever arises, easier to debug. |
| 16 | - * |
| 17 | - * These are implemented as #defines rather than real functions |
| 18 | - * because there is no fully portable way to do inline functions in plain C. |
| 19 | - * |
| 20 | - ************************************************************************************/ |
| 21 | - |
| 22 | -#ifndef U_HIDE_INTERNAL_API |
| 23 | -/** |
| 24 | - * inline version of utext_current32(), for performance-critical situations. |
| 25 | - * |
| 26 | - * Get the code point at the current iteration position of the UText. |
| 27 | - * Returns U_SENTINEL (-1) if the position is at the end of the |
| 28 | - * text. |
| 29 | - * |
| 30 | - * @internal ICU 4.4 technology preview |
| 31 | - */ |
| 32 | -#define UTEXT_CURRENT32(ut) \ |
| 33 | - ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ |
| 34 | - ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut)) |
| 35 | -#endif /* U_HIDE_INTERNAL_API */ |
| 36 | - |
| 37 | -/** |
| 38 | - * inline version of utext_next32(), for performance-critical situations. |
| 39 | - * |
| 40 | - * Get the code point at the current iteration position of the UText, and |
| 41 | - * advance the position to the first index following the character. |
| 42 | - * This is a post-increment operation. |
| 43 | - * Returns U_SENTINEL (-1) if the position is at the end of the |
| 44 | - * text. |
| 45 | - * |
| 46 | - * @stable ICU 3.4 |
| 47 | - */ |
| 48 | -#define UTEXT_NEXT32(ut) \ |
| 49 | - ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ |
| 50 | - ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut)) |
| 51 | - |
| 52 | -/** |
| 53 | - * inline version of utext_previous32(), for performance-critical situations. |
| 54 | - * |
| 55 | - * Move the iterator position to the character (code point) whose |
| 56 | - * index precedes the current position, and return that character. |
| 57 | - * This is a pre-decrement operation. |
| 58 | - * Returns U_SENTINEL (-1) if the position is at the start of the text. |
| 59 | - * |
| 60 | - * @stable ICU 3.4 |
| 61 | - */ |
| 62 | -#define UTEXT_PREVIOUS32(ut) \ |
| 63 | - ((ut)->chunkOffset > 0 && \ |
| 64 | - (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \ |
| 65 | - (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut)) |
| 66 | - |
| 67 | -/** |
| 68 | - * inline version of utext_getNativeIndex(), for performance-critical situations. |
| 69 | - * |
| 70 | - * Get the current iterator position, which can range from 0 to |
| 71 | - * the length of the text. |
| 72 | - * The position is a native index into the input text, in whatever format it |
| 73 | - * may have (possibly UTF-8 for example), and may not always be the same as |
| 74 | - * the corresponding UChar (UTF-16) index. |
| 75 | - * The returned position will always be aligned to a code point boundary. |
| 76 | - * |
| 77 | - * @stable ICU 3.6 |
| 78 | - */ |
| 79 | -#define UTEXT_GETNATIVEINDEX(ut) \ |
| 80 | - ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ |
| 81 | - (ut)->chunkNativeStart+(ut)->chunkOffset : \ |
| 82 | - (ut)->pFuncs->mapOffsetToNative(ut)) |
| 83 | - |
| 84 | -/** |
| 85 | - * inline version of utext_setNativeIndex(), for performance-critical situations. |
| 86 | - * |
| 87 | - * Set the current iteration position to the nearest code point |
| 88 | - * boundary at or preceding the specified index. |
| 89 | - * The index is in the native units of the original input text. |
| 90 | - * If the index is out of range, it will be pinned to be within |
| 91 | - * the range of the input text. |
| 92 | - * |
| 93 | - * @stable ICU 3.8 |
| 94 | - */ |
| 95 | -#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \ |
| 96 | - int64_t __offset = (ix) - (ut)->chunkNativeStart; \ |
| 97 | - if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ |
| 98 | - (ut)->chunkOffset=(int32_t)__offset; \ |
| 99 | - } else { \ |
| 100 | - utext_setNativeIndex((ut), (ix)); \ |
| 101 | - } \ |
| 102 | -} UPRV_BLOCK_MACRO_END |
| 103 | - |
| 104 | - |
| 105 | - |
| 106 | -/************************************************************************************ |
| 107 | - * |
| 108 | - * Functions related to writing or modifying the text. |
| 109 | - * These will work only with modifiable UTexts. Attempting to |
| 110 | - * modify a read-only UText will return an error status. |
| 111 | - * |
| 112 | - ************************************************************************************/ |
| 113 | - |
| 114 | - |
| 115 | - |
| 116 | - |
| 117 | - |
| 118 | - |
| 119 | - |
| 120 | - |
| 121 | - |
| 122 | - |
| 123 | - |
| 124 | - |
| 125 | - |
| 126 | - |
| 127 | - |
| 128 | - |
| 129 | - |
| 130 | - |
| 131 | -/** |
| 132 | - * UText provider properties (bit field indexes). |
| 133 | - * |
| 134 | - * @see UText |
| 135 | - * @stable ICU 3.4 |
| 136 | - */ |
| 137 | -enum { |
| 138 | - /** |
| 139 | - * It is potentially time consuming for the provider to determine the length of the text. |
| 140 | - * @stable ICU 3.4 |
| 141 | - */ |
| 142 | - UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, |
| 143 | - /** |
| 144 | - * Text chunks remain valid and usable until the text object is modified or |
| 145 | - * deleted, not just until the next time the access() function is called |
| 146 | - * (which is the default). |
| 147 | - * @stable ICU 3.4 |
| 148 | - */ |
| 149 | - UTEXT_PROVIDER_STABLE_CHUNKS = 2, |
| 150 | - /** |
| 151 | - * The provider supports modifying the text via the replace() and copy() |
| 152 | - * functions. |
| 153 | - * @see Replaceable |
| 154 | - * @stable ICU 3.4 |
| 155 | - */ |
| 156 | - UTEXT_PROVIDER_WRITABLE = 3, |
| 157 | - /** |
| 158 | - * There is meta data associated with the text. |
| 159 | - * @see Replaceable::hasMetaData() |
| 160 | - * @stable ICU 3.4 |
| 161 | - */ |
| 162 | - UTEXT_PROVIDER_HAS_META_DATA = 4, |
| 163 | - /** |
| 164 | - * Text provider owns the text storage. |
| 165 | - * Generally occurs as the result of a deep clone of the UText. |
| 166 | - * When closing the UText, the associated text must |
| 167 | - * also be closed/deleted/freed/ whatever is appropriate. |
| 168 | - * @stable ICU 3.6 |
| 169 | - */ |
| 170 | - UTEXT_PROVIDER_OWNS_TEXT = 5 |
| 171 | -}; |
| 172 | - |
| 173 | -/** |
| 174 | - * Function type declaration for UText.clone(). |
| 175 | - * |
| 176 | - * clone a UText. Much like opening a UText where the source text is itself |
| 177 | - * another UText. |
| 178 | - * |
| 179 | - * A deep clone will copy both the UText data structures and the underlying text. |
| 180 | - * The original and cloned UText will operate completely independently; modifications |
| 181 | - * made to the text in one will not effect the other. Text providers are not |
| 182 | - * required to support deep clones. The user of clone() must check the status return |
| 183 | - * and be prepared to handle failures. |
| 184 | - * |
| 185 | - * A shallow clone replicates only the UText data structures; it does not make |
| 186 | - * a copy of the underlying text. Shallow clones can be used as an efficient way to |
| 187 | - * have multiple iterators active in a single text string that is not being |
| 188 | - * modified. |
| 189 | - * |
| 190 | - * A shallow clone operation must not fail except for truly exceptional conditions such |
| 191 | - * as memory allocation failures. |
| 192 | - * |
| 193 | - * A UText and its clone may be safely concurrently accessed by separate threads. |
| 194 | - * This is true for both shallow and deep clones. |
| 195 | - * It is the responsibility of the Text Provider to ensure that this thread safety |
| 196 | - * constraint is met. |
| 197 | - |
| 198 | - * |
| 199 | - * @param dest A UText struct to be filled in with the result of the clone operation, |
| 200 | - * or NULL if the clone function should heap-allocate a new UText struct. |
| 201 | - * @param src The UText to be cloned. |
| 202 | - * @param deep TRUE to request a deep clone, FALSE for a shallow clone. |
| 203 | - * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR |
| 204 | - * should be returned if the text provider is unable to clone the |
| 205 | - * original text. |
| 206 | - * @return The newly created clone, or NULL if the clone operation failed. |
| 207 | - * |
| 208 | - * @stable ICU 3.4 |
| 209 | - */ |
| 210 | -typedef UText * U_CALLCONV |
| 211 | -UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); |
| 212 | - |
| 213 | - |
| 214 | -/** |
| 215 | - * Function type declaration for UText.nativeLength(). |
| 216 | - * |
| 217 | - * @param ut the UText to get the length of. |
| 218 | - * @return the length, in the native units of the original text string. |
| 219 | - * @see UText |
| 220 | - * @stable ICU 3.4 |
| 221 | - */ |
| 222 | -typedef int64_t U_CALLCONV |
| 223 | -UTextNativeLength(UText *ut); |
| 224 | - |
| 225 | -/** |
| 226 | - * Function type declaration for UText.access(). Get the description of the text chunk |
| 227 | - * containing the text at a requested native index. The UText's iteration |
| 228 | - * position will be left at the requested index. If the index is out |
| 229 | - * of bounds, the iteration position will be left at the start or end |
| 230 | - * of the string, as appropriate. |
| 231 | - * |
| 232 | - * Chunks must begin and end on code point boundaries. A single code point |
| 233 | - * comprised of multiple storage units must never span a chunk boundary. |
| 234 | - * |
| 235 | - * |
| 236 | - * @param ut the UText being accessed. |
| 237 | - * @param nativeIndex Requested index of the text to be accessed. |
| 238 | - * @param forward If TRUE, then the returned chunk must contain text |
| 239 | - * starting from the index, so that start<=index<limit. |
| 240 | - * If FALSE, then the returned chunk must contain text |
| 241 | - * before the index, so that start<index<=limit. |
| 242 | - * @return True if the requested index could be accessed. The chunk |
| 243 | - * will contain the requested text. |
| 244 | - * False value if a chunk cannot be accessed |
| 245 | - * (the requested index is out of bounds). |
| 246 | - * |
| 247 | - * @see UText |
| 248 | - * @stable ICU 3.4 |
| 249 | - */ |
| 250 | -typedef UBool U_CALLCONV |
| 251 | -UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); |
| 252 | - |
| 253 | -/** |
| 254 | - * Function type declaration for UText.extract(). |
| 255 | - * |
| 256 | - * Extract text from a UText into a UChar buffer. The range of text to be extracted |
| 257 | - * is specified in the native indices of the UText provider. These may not necessarily |
| 258 | - * be UTF-16 indices. |
| 259 | - * <p> |
| 260 | - * The size (number of 16 bit UChars) in the data to be extracted is returned. The |
| 261 | - * full amount is returned, even when the specified buffer size is smaller. |
| 262 | - * <p> |
| 263 | - * The extracted string will (if you are a user) / must (if you are a text provider) |
| 264 | - * be NUL-terminated if there is sufficient space in the destination buffer. |
| 265 | - * |
| 266 | - * @param ut the UText from which to extract data. |
| 267 | - * @param nativeStart the native index of the first character to extract. |
| 268 | - * @param nativeLimit the native string index of the position following the last |
| 269 | - * character to extract. |
| 270 | - * @param dest the UChar (UTF-16) buffer into which the extracted text is placed |
| 271 | - * @param destCapacity The size, in UChars, of the destination buffer. May be zero |
| 272 | - * for precomputing the required size. |
| 273 | - * @param status receives any error status. |
| 274 | - * If U_BUFFER_OVERFLOW_ERROR: Returns number of UChars for |
| 275 | - * preflighting. |
| 276 | - * @return Number of UChars in the data. Does not include a trailing NUL. |
| 277 | - * |
| 278 | - * @stable ICU 3.4 |
| 279 | - */ |
| 280 | -typedef int32_t U_CALLCONV |
| 281 | -UTextExtract(UText *ut, |
| 282 | - int64_t nativeStart, int64_t nativeLimit, |
| 283 | - UChar *dest, int32_t destCapacity, |
| 284 | - UErrorCode *status); |
| 285 | - |
| 286 | -/** |
| 287 | - * Function type declaration for UText.replace(). |
| 288 | - * |
| 289 | - * Replace a range of the original text with a replacement text. |
| 290 | - * |
| 291 | - * Leaves the current iteration position at the position following the |
| 292 | - * newly inserted replacement text. |
| 293 | - * |
| 294 | - * This function need only be implemented on UText types that support writing. |
| 295 | - * |
| 296 | - * When using this function, there should be only a single UText opened onto the |
| 297 | - * underlying native text string. The function is responsible for updating the |
| 298 | - * text chunk within the UText to reflect the updated iteration position, |
| 299 | - * taking into account any changes to the underlying string's structure caused |
| 300 | - * by the replace operation. |
| 301 | - * |
| 302 | - * @param ut the UText representing the text to be operated on. |
| 303 | - * @param nativeStart the index of the start of the region to be replaced |
| 304 | - * @param nativeLimit the index of the character following the region to be replaced. |
| 305 | - * @param replacementText pointer to the replacement text |
| 306 | - * @param replacmentLength length of the replacement text in UChars, or -1 if the text is NUL terminated. |
| 307 | - * @param status receives any error status. Possible errors include |
| 308 | - * U_NO_WRITE_PERMISSION |
| 309 | - * |
| 310 | - * @return The signed number of (native) storage units by which |
| 311 | - * the length of the text expanded or contracted. |
| 312 | - * |
| 313 | - * @stable ICU 3.4 |
| 314 | - */ |
| 315 | -typedef int32_t U_CALLCONV |
| 316 | -UTextReplace(UText *ut, |
| 317 | - int64_t nativeStart, int64_t nativeLimit, |
| 318 | - const UChar *replacementText, int32_t replacmentLength, |
| 319 | - UErrorCode *status); |
| 320 | - |
| 321 | -/** |
| 322 | - * Function type declaration for UText.copy(). |
| 323 | - * |
| 324 | - * Copy or move a substring from one position to another within the text, |
| 325 | - * while retaining any metadata associated with the text. |
| 326 | - * This function is used to duplicate or reorder substrings. |
| 327 | - * The destination index must not overlap the source range. |
| 328 | - * |
| 329 | - * The text to be copied or moved is inserted at destIndex; |
| 330 | - * it does not replace or overwrite any existing text. |
| 331 | - * |
| 332 | - * This function need only be implemented for UText types that support writing. |
| 333 | - * |
| 334 | - * When using this function, there should be only a single UText opened onto the |
| 335 | - * underlying native text string. The function is responsible for updating the |
| 336 | - * text chunk within the UText to reflect the updated iteration position, |
| 337 | - * taking into account any changes to the underlying string's structure caused |
| 338 | - * by the replace operation. |
| 339 | - * |
| 340 | - * @param ut The UText representing the text to be operated on. |
| 341 | - * @param nativeStart The index of the start of the region to be copied or moved |
| 342 | - * @param nativeLimit The index of the character following the region to be replaced. |
| 343 | - * @param nativeDest The destination index to which the source substring is copied or moved. |
| 344 | - * @param move If TRUE, then the substring is moved, not copied/duplicated. |
| 345 | - * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION |
| 346 | - * |
| 347 | - * @stable ICU 3.4 |
| 348 | - */ |
| 349 | -typedef void U_CALLCONV |
| 350 | -UTextCopy(UText *ut, |
| 351 | - int64_t nativeStart, int64_t nativeLimit, |
| 352 | - int64_t nativeDest, |
| 353 | - UBool move, |
| 354 | - UErrorCode *status); |
| 355 | - |
| 356 | -/** |
| 357 | - * Function type declaration for UText.mapOffsetToNative(). |
| 358 | - * Map from the current UChar offset within the current text chunk to |
| 359 | - * the corresponding native index in the original source text. |
| 360 | - * |
| 361 | - * This is required only for text providers that do not use native UTF-16 indexes. |
| 362 | - * |
| 363 | - * @param ut the UText. |
| 364 | - * @return Absolute (native) index corresponding to chunkOffset in the current chunk. |
| 365 | - * The returned native index should always be to a code point boundary. |
| 366 | - * |
| 367 | - * @stable ICU 3.4 |
| 368 | - */ |
| 369 | -typedef int64_t U_CALLCONV |
| 370 | -UTextMapOffsetToNative(const UText *ut); |
| 371 | - |
| 372 | -/** |
| 373 | - * Function type declaration for UText.mapIndexToUTF16(). |
| 374 | - * Map from a native index to a UChar offset within a text chunk. |
| 375 | - * Behavior is undefined if the native index does not fall within the |
| 376 | - * current chunk. |
| 377 | - * |
| 378 | - * This function is required only for text providers that do not use native UTF-16 indexes. |
| 379 | - * |
| 380 | - * @param ut The UText containing the text chunk. |
| 381 | - * @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit. |
| 382 | - * @return Chunk-relative UTF-16 offset corresponding to the specified native |
| 383 | - * index. |
| 384 | - * |
| 385 | - * @stable ICU 3.4 |
| 386 | - */ |
| 387 | -typedef int32_t U_CALLCONV |
| 388 | -UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); |
| 389 | - |
| 390 | - |
| 391 | -/** |
| 392 | - * Function type declaration for UText.utextClose(). |
| 393 | - * |
| 394 | - * A Text Provider close function is only required for provider types that make |
| 395 | - * allocations in their open function (or other functions) that must be |
| 396 | - * cleaned when the UText is closed. |
| 397 | - * |
| 398 | - * The allocation of the UText struct itself and any "extra" storage |
| 399 | - * associated with the UText is handled by the common UText implementation |
| 400 | - * and does not require provider specific cleanup in a close function. |
| 401 | - * |
| 402 | - * Most UText provider implementations do not need to implement this function. |
| 403 | - * |
| 404 | - * @param ut A UText object to be closed. |
| 405 | - * |
| 406 | - * @stable ICU 3.4 |
| 407 | - */ |
| 408 | -typedef void U_CALLCONV |
| 409 | -UTextClose(UText *ut); |
| 410 | - |
| 411 | - |
| 412 | -/** |
| 413 | - * (public) Function dispatch table for UText. |
| 414 | - * Conceptually very much like a C++ Virtual Function Table. |
| 415 | - * This struct defines the organization of the table. |
| 416 | - * Each text provider implementation must provide an |
| 417 | - * actual table that is initialized with the appropriate functions |
| 418 | - * for the type of text being handled. |
| 419 | - * @stable ICU 3.6 |
| 420 | - */ |
| 421 | -struct UTextFuncs { |
| 422 | - /** |
| 423 | - * (public) Function table size, sizeof(UTextFuncs) |
| 424 | - * Intended for use should the table grow to accommodate added |
| 425 | - * functions in the future, to allow tests for older format |
| 426 | - * function tables that do not contain the extensions. |
| 427 | - * |
| 428 | - * Fields are placed for optimal alignment on |
| 429 | - * 32/64/128-bit-pointer machines, by normally grouping together |
| 430 | - * 4 32-bit fields, |
| 431 | - * 4 pointers, |
| 432 | - * 2 64-bit fields |
| 433 | - * in sequence. |
| 434 | - * @stable ICU 3.6 |
| 435 | - */ |
| 436 | - int32_t tableSize; |
| 437 | - |
| 438 | - /** |
| 439 | - * (private) Alignment padding. |
| 440 | - * Do not use, reserved for use by the UText framework only. |
| 441 | - * @internal |
| 442 | - */ |
| 443 | - int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; |
| 444 | - |
| 445 | - |
| 446 | - /** |
| 447 | - * (public) Function pointer for UTextClone |
| 448 | - * |
| 449 | - * @see UTextClone |
| 450 | - * @stable ICU 3.6 |
| 451 | - */ |
| 452 | - UTextClone *clone; |
| 453 | - |
| 454 | - /** |
| 455 | - * (public) function pointer for UTextLength |
| 456 | - * May be expensive to compute! |
| 457 | - * |
| 458 | - * @see UTextLength |
| 459 | - * @stable ICU 3.6 |
| 460 | - */ |
| 461 | - UTextNativeLength *nativeLength; |
| 462 | - |
| 463 | - /** |
| 464 | - * (public) Function pointer for UTextAccess. |
| 465 | - * |
| 466 | - * @see UTextAccess |
| 467 | - * @stable ICU 3.6 |
| 468 | - */ |
| 469 | - UTextAccess *access; |
| 470 | - |
| 471 | - /** |
| 472 | - * (public) Function pointer for UTextExtract. |
| 473 | - * |
| 474 | - * @see UTextExtract |
| 475 | - * @stable ICU 3.6 |
| 476 | - */ |
| 477 | - UTextExtract *extract; |
| 478 | - |
| 479 | - /** |
| 480 | - * (public) Function pointer for UTextReplace. |
| 481 | - * |
| 482 | - * @see UTextReplace |
| 483 | - * @stable ICU 3.6 |
| 484 | - */ |
| 485 | - UTextReplace *replace; |
| 486 | - |
| 487 | - /** |
| 488 | - * (public) Function pointer for UTextCopy. |
| 489 | - * |
| 490 | - * @see UTextCopy |
| 491 | - * @stable ICU 3.6 |
| 492 | - */ |
| 493 | - UTextCopy *copy; |
| 494 | - |
| 495 | - /** |
| 496 | - * (public) Function pointer for UTextMapOffsetToNative. |
| 497 | - * |
| 498 | - * @see UTextMapOffsetToNative |
| 499 | - * @stable ICU 3.6 |
| 500 | - */ |
| 501 | - UTextMapOffsetToNative *mapOffsetToNative; |
| 502 | - |
| 503 | - /** |
| 504 | - * (public) Function pointer for UTextMapNativeIndexToUTF16. |
| 505 | - * |
| 506 | - * @see UTextMapNativeIndexToUTF16 |
| 507 | - * @stable ICU 3.6 |
| 508 | - */ |
| 509 | - UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; |
| 510 | - |
| 511 | - /** |
| 512 | - * (public) Function pointer for UTextClose. |
| 513 | - * |
| 514 | - * @see UTextClose |
| 515 | - * @stable ICU 3.6 |
| 516 | - */ |
| 517 | - UTextClose *close; |
| 518 | - |
| 519 | - /** |
| 520 | - * (private) Spare function pointer |
| 521 | - * @internal |
| 522 | - */ |
| 523 | - UTextClose *spare1; |
| 524 | - |
| 525 | - /** |
| 526 | - * (private) Spare function pointer |
| 527 | - * @internal |
| 528 | - */ |
| 529 | - UTextClose *spare2; |
| 530 | - |
| 531 | - /** |
| 532 | - * (private) Spare function pointer |
| 533 | - * @internal |
| 534 | - */ |
| 535 | - UTextClose *spare3; |
| 536 | - |
| 537 | -}; |
| 538 | -/** |
| 539 | - * Function dispatch table for UText |
| 540 | - * @see UTextFuncs |
| 541 | - */ |
| 542 | -typedef struct UTextFuncs UTextFuncs; |
| 543 | - |
| 544 | - /** |
| 545 | - * UText struct. Provides the interface between the generic UText access code |
| 546 | - * and the UText provider code that works on specific kinds of |
| 547 | - * text (UTF-8, noncontiguous UTF-16, whatever.) |
| 548 | - * |
| 549 | - * Applications that are using predefined types of text providers |
| 550 | - * to pass text data to ICU services will have no need to view the |
| 551 | - * internals of the UText structs that they open. |
| 552 | - * |
| 553 | - * @stable ICU 3.6 |
| 554 | - */ |
| 555 | -struct UText { |
| 556 | - /** |
| 557 | - * (private) Magic. Used to help detect when UText functions are handed |
| 558 | - * invalid or uninitialized UText structs. |
| 559 | - * utext_openXYZ() functions take an initialized, |
| 560 | - * but not necessarily open, UText struct as an |
| 561 | - * optional fill-in parameter. This magic field |
| 562 | - * is used to check for that initialization. |
| 563 | - * Text provider close functions must NOT clear |
| 564 | - * the magic field because that would prevent |
| 565 | - * reuse of the UText struct. |
| 566 | - * @internal |
| 567 | - */ |
| 568 | - uint32_t magic; |
| 569 | - |
| 570 | - |
| 571 | - /** |
| 572 | - * (private) Flags for managing the allocation and freeing of |
| 573 | - * memory associated with this UText. |
| 574 | - * @internal |
| 575 | - */ |
| 576 | - int32_t flags; |
| 577 | - |
| 578 | - |
| 579 | - /** |
| 580 | - * Text provider properties. This set of flags is maintained by the |
| 581 | - * text provider implementation. |
| 582 | - * @stable ICU 3.4 |
| 583 | - */ |
| 584 | - int32_t providerProperties; |
| 585 | - |
| 586 | - /** |
| 587 | - * (public) sizeOfStruct=sizeof(UText) |
| 588 | - * Allows possible backward compatible extension. |
| 589 | - * |
| 590 | - * @stable ICU 3.4 |
| 591 | - */ |
| 592 | - int32_t sizeOfStruct; |
| 593 | - |
| 594 | - /* ------ 16 byte alignment boundary ----------- */ |
| 595 | - |
| 596 | - |
| 597 | - /** |
| 598 | - * (protected) Native index of the first character position following |
| 599 | - * the current chunk. |
| 600 | - * @stable ICU 3.6 |
| 601 | - */ |
| 602 | - int64_t chunkNativeLimit; |
| 603 | - |
| 604 | - /** |
| 605 | - * (protected) Size in bytes of the extra space (pExtra). |
| 606 | - * @stable ICU 3.4 |
| 607 | - */ |
| 608 | - int32_t extraSize; |
| 609 | - |
| 610 | - /** |
| 611 | - * (protected) The highest chunk offset where native indexing and |
| 612 | - * chunk (UTF-16) indexing correspond. For UTF-16 sources, value |
| 613 | - * will be equal to chunkLength. |
| 614 | - * |
| 615 | - * @stable ICU 3.6 |
| 616 | - */ |
| 617 | - int32_t nativeIndexingLimit; |
| 618 | - |
| 619 | - /* ---- 16 byte alignment boundary------ */ |
| 620 | - |
| 621 | - /** |
| 622 | - * (protected) Native index of the first character in the text chunk. |
| 623 | - * @stable ICU 3.6 |
| 624 | - */ |
| 625 | - int64_t chunkNativeStart; |
| 626 | - |
| 627 | - /** |
| 628 | - * (protected) Current iteration position within the text chunk (UTF-16 buffer). |
| 629 | - * This is the index to the character that will be returned by utext_next32(). |
| 630 | - * @stable ICU 3.6 |
| 631 | - */ |
| 632 | - int32_t chunkOffset; |
| 633 | - |
| 634 | - /** |
| 635 | - * (protected) Length the text chunk (UTF-16 buffer), in UChars. |
| 636 | - * @stable ICU 3.6 |
| 637 | - */ |
| 638 | - int32_t chunkLength; |
| 639 | - |
| 640 | - /* ---- 16 byte alignment boundary-- */ |
| 641 | - |
| 642 | - |
| 643 | - /** |
| 644 | - * (protected) pointer to a chunk of text in UTF-16 format. |
| 645 | - * May refer either to original storage of the source of the text, or |
| 646 | - * if conversion was required, to a buffer owned by the UText. |
| 647 | - * @stable ICU 3.6 |
| 648 | - */ |
| 649 | - const UChar *chunkContents; |
| 650 | - |
| 651 | - /** |
| 652 | - * (public) Pointer to Dispatch table for accessing functions for this UText. |
| 653 | - * @stable ICU 3.6 |
| 654 | - */ |
| 655 | - const UTextFuncs *pFuncs; |
| 656 | - |
| 657 | - /** |
| 658 | - * (protected) Pointer to additional space requested by the |
| 659 | - * text provider during the utext_open operation. |
| 660 | - * @stable ICU 3.4 |
| 661 | - */ |
| 662 | - void *pExtra; |
| 663 | - |
| 664 | - /** |
| 665 | - * (protected) Pointer to string or text-containing object or similar. |
| 666 | - * This is the source of the text that this UText is wrapping, in a format |
| 667 | - * that is known to the text provider functions. |
| 668 | - * @stable ICU 3.4 |
| 669 | - */ |
| 670 | - const void *context; |
| 671 | - |
| 672 | - /* --- 16 byte alignment boundary--- */ |
| 673 | - |
| 674 | - /** |
| 675 | - * (protected) Pointer fields available for use by the text provider. |
| 676 | - * Not used by UText common code. |
| 677 | - * @stable ICU 3.6 |
| 678 | - */ |
| 679 | - const void *p; |
| 680 | - /** |
| 681 | - * (protected) Pointer fields available for use by the text provider. |
| 682 | - * Not used by UText common code. |
| 683 | - * @stable ICU 3.6 |
| 684 | - */ |
| 685 | - const void *q; |
| 686 | - /** |
| 687 | - * (protected) Pointer fields available for use by the text provider. |
| 688 | - * Not used by UText common code. |
| 689 | - * @stable ICU 3.6 |
| 690 | - */ |
| 691 | - const void *r; |
| 692 | - |
| 693 | - /** |
| 694 | - * Private field reserved for future use by the UText framework |
| 695 | - * itself. This is not to be touched by the text providers. |
| 696 | - * @internal ICU 3.4 |
| 697 | - */ |
| 698 | - void *privP; |
| 699 | - |
| 700 | - |
| 701 | - /* --- 16 byte alignment boundary--- */ |
| 702 | - |
| 703 | - |
| 704 | - /** |
| 705 | - * (protected) Integer field reserved for use by the text provider. |
| 706 | - * Not used by the UText framework, or by the client (user) of the UText. |
| 707 | - * @stable ICU 3.4 |
| 708 | - */ |
| 709 | - int64_t a; |
| 710 | - |
| 711 | - /** |
| 712 | - * (protected) Integer field reserved for use by the text provider. |
| 713 | - * Not used by the UText framework, or by the client (user) of the UText. |
| 714 | - * @stable ICU 3.4 |
| 715 | - */ |
| 716 | - int32_t b; |
| 717 | - |
| 718 | - /** |
| 719 | - * (protected) Integer field reserved for use by the text provider. |
| 720 | - * Not used by the UText framework, or by the client (user) of the UText. |
| 721 | - * @stable ICU 3.4 |
| 722 | - */ |
| 723 | - int32_t c; |
| 724 | - |
| 725 | - /* ---- 16 byte alignment boundary---- */ |
| 726 | - |
| 727 | - |
| 728 | - /** |
| 729 | - * Private field reserved for future use by the UText framework |
| 730 | - * itself. This is not to be touched by the text providers. |
| 731 | - * @internal ICU 3.4 |
| 732 | - */ |
| 733 | - int64_t privA; |
| 734 | - /** |
| 735 | - * Private field reserved for future use by the UText framework |
| 736 | - * itself. This is not to be touched by the text providers. |
| 737 | - * @internal ICU 3.4 |
| 738 | - */ |
| 739 | - int32_t privB; |
| 740 | - /** |
| 741 | - * Private field reserved for future use by the UText framework |
| 742 | - * itself. This is not to be touched by the text providers. |
| 743 | - * @internal ICU 3.4 |
| 744 | - */ |
| 745 | - int32_t privC; |
| 746 | -}; |
| 747 | - |
| 748 | - |
| 749 | - |
| 750 | - |
| 751 | -// do not use #ifndef U_HIDE_INTERNAL_API around the following! |
| 752 | -/** |
| 753 | - * @internal |
| 754 | - * Value used to help identify correctly initialized UText structs. |
| 755 | - * Note: must be publicly visible so that UTEXT_INITIALIZER can access it. |
| 756 | - */ |
| 757 | -enum { |
| 758 | - UTEXT_MAGIC = 0x345ad82c |
| 759 | -}; |
| 760 | - |
| 761 | -/** |
| 762 | - * initializer to be used with local (stack) instances of a UText |
| 763 | - * struct. UText structs must be initialized before passing |
| 764 | - * them to one of the utext_open functions. |
| 765 | - * |
| 766 | - * @stable ICU 3.6 |
| 767 | - */ |
| 768 | -#define UTEXT_INITIALIZER { \ |
| 769 | - UTEXT_MAGIC, /* magic */ \ |
| 770 | - 0, /* flags */ \ |
| 771 | - 0, /* providerProps */ \ |
| 772 | - sizeof(UText), /* sizeOfStruct */ \ |
| 773 | - 0, /* chunkNativeLimit */ \ |
| 774 | - 0, /* extraSize */ \ |
| 775 | - 0, /* nativeIndexingLimit */ \ |
| 776 | - 0, /* chunkNativeStart */ \ |
| 777 | - 0, /* chunkOffset */ \ |
| 778 | - 0, /* chunkLength */ \ |
| 779 | - NULL, /* chunkContents */ \ |
| 780 | - NULL, /* pFuncs */ \ |
| 781 | - NULL, /* pExtra */ \ |
| 782 | - NULL, /* context */ \ |
| 783 | - NULL, NULL, NULL, /* p, q, r */ \ |
| 784 | - NULL, /* privP */ \ |
| 785 | - 0, 0, 0, /* a, b, c */ \ |
| 786 | - 0, 0, 0 /* privA,B,C, */ \ |
| 787 | - } |
| 788 | |
| 789 | |
| 790 | U_CDECL_END |