Lines Matching refs:UText
8 * file name: utext.cpp
21 #include "unicode/utext.h"
34 utext_access(UText *ut, int64_t index, UBool forward) {
41 utext_moveIndex32(UText *ut, int32_t delta) {
81 utext_nativeLength(UText *ut) {
87 utext_isLengthExpensive(const UText *ut) {
94 utext_getNativeIndex(const UText *ut) {
104 utext_setNativeIndex(UText *ut, int64_t index) {
138 utext_getPreviousNativeIndex(UText *ut) {
177 // UText iteration position is always on a code point boundary,
181 utext_current32(UText *ut) {
235 utext_char32At(UText *ut, int64_t nativeIndex) {
262 utext_next32(UText *ut) {
302 utext_previous32(UText *ut) {
342 utext_next32From(UText *ut, int64_t index) {
371 utext_previous32From(UText *ut, int64_t index) {
419 utext_extract(UText *ut,
429 utext_equals(const UText *a, const UText *b) {
455 utext_compare(UText *s1, int32_t length1,
456 UText *s2, int32_t length2) {
515 utext_compareNativeLimit(UText *s1, int64_t limit1,
516 UText *s2, int64_t limit2) {
570 utext_caseCompare(UText *s1, int32_t length1,
571 UText *s2, int32_t length2,
691 utext_caseCompareNativeLimit(UText *s1, int64_t limit1,
692 UText *s2, int64_t limit2,
804 utext_isWritable(const UText *ut)
812 utext_freeze(UText *ut) {
819 utext_hasMetaData(const UText *ut)
828 utext_replace(UText *ut,
845 utext_copy(UText *ut,
863 U_CAPI UText * U_EXPORT2
864 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status) {
865 UText *result;
877 // UText common functions implementation
882 // UText.flags bit definitions
885 UTEXT_HEAP_ALLOCATED = 1, // 1 if ICU has allocated this UText struct on the heap.
886 // 0 if caller provided storage for the UText.
892 // of the main UText storage.
894 UTEXT_OPEN = 4 // 1 if this UText is currently open
895 // 0 if this UText is not open.
900 // Extended form of a UText. The purpose is to aid in computing the total size required
901 // when a provider asks for a UText to be allocated with extra storage.
904 UText ut;
908 static const UText emptyText = UTEXT_INITIALIZER;
910 U_CAPI UText * U_EXPORT2
911 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
917 // We need to heap-allocate storage for the new UText
918 int32_t spaceRequired = sizeof(UText);
922 ut = (UText *)uprv_malloc(spaceRequired);
935 // We have been supplied with an already existing UText.
936 // Verify that it really appears to be a UText.
969 // Initialize all remaining fields of the UText.
997 U_CAPI UText * U_EXPORT2
998 utext_close(UText *ut) {
1003 // The supplied ut is not an open UText.
1015 // If we (the framework) allocated the UText or subsidiary storage,
1024 // Zero out function table of the closed UText. This is a defensive move,
1026 // utext to crash with null pointer errors.
1030 // This UText was allocated by UText setup. We need to free it.
1032 // tries to reopen another UText using the deleted storage.
1051 invalidateChunk(UText *ut) {
1080 // Adjust a pointer that refers to something within one UText (the source)
1081 // to refer to the same relative offset within a another UText (the target)
1083 static void adjustPointer(UText *dest, const void **destPtr, const UText *src) {
1090 // target ptr was to something within the src UText's pExtra storage.
1091 // relocate it into the target UText's pExtra region.
1094 // target ptr was pointing to somewhere within the source UText itself.
1095 // Move it to the same offset within the target UText.
1102 // Clone. This is a generic copy-the-utext-by-value clone function that can be
1103 // used as-is with some utext types, and as a helper by other clones.
1105 static UText * U_CALLCONV
1106 shallowTextClone(UText * dest, const UText * src, UErrorCode * status) {
1121 // flags (how the UText was allocated) and the pointer to the
1122 // extra storage must retain the values in the cloned utext that
1131 // Copy the whole UText struct by value.
1146 // Relocate any pointers in the target that refer to the UText itself
1165 // UText implementation for UTF-8 char * strings (read-only)
1169 // Use of UText data members:
1171 // utext.b is the input string length (bytes).
1172 // utext.c Length scanned so far in string
1174 // utext.p pointer to the current buffer
1175 // utext.q pointer to the other buffer.
1187 // UTF8Buf Two of these structs will be set up in the UText's extra allocated space.
1236 utf8TextLength(UText *ut) {
1262 utf8TextAccess(UText *ut, int64_t index, UBool forward) {
1523 // Swap the UText buffers.
1606 // Set UText chunk to refer to this buffer.
1638 // Swap the UText buffers.
1810 utf8TextExtract(UText *ut,
1868 utf8TextMapOffsetToNative(const UText *ut) {
1881 utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) {
1893 static UText * U_CALLCONV
1894 utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
1896 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1909 int32_t len = (int32_t)utext_nativeLength((UText *)src);
1924 utf8TextClose(UText *ut) {
1925 // Most of the work of close is done by the generic UText framework close.
1926 // All that needs to be done here is to delete the UTF8 string if the UText
1927 // owns it. This occurs if the UText was created by cloning.
1959 U_CAPI UText * U_EXPORT2
1960 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) {
2001 // UText implementation wrapper for Replaceable (read/write)
2003 // Use of UText data members:
2005 // p pointer to Replaceable if it is owned by the UText.
2026 static UText * U_CALLCONV
2027 repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2028 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2032 // The copied Replaceable storage is owned by the newly created UText clone.
2033 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2049 repTextClose(UText *ut) {
2050 // Most of the work of close is done by the generic UText framework close.
2051 // All that needs to be done here is delete the Replaceable if the UText
2052 // owns it. This occurs if the UText was created by cloning.
2062 repTextLength(UText *ut) {
2070 repTextAccess(UText *ut, int64_t index, UBool forward) {
2187 repTextExtract(UText *ut,
2230 repTextReplace(UText *ut,
2271 // Is the UText chunk buffer OK?
2287 repTextCopy(UText *ut,
2366 U_CAPI UText * U_EXPORT2
2367 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status)
2399 // UText implementation for UnicodeString (read/write) and
2403 // Use of UText data members:
2405 // p pointer to UnicodeString IF this UText owns the string
2413 static UText * U_CALLCONV
2414 unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2415 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2419 // The copied UnicodeString storage is owned by the newly created UText clone.
2420 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2421 // the UText.
2435 unistrTextClose(UText *ut) {
2436 // Most of the work of close is done by the generic UText framework close.
2437 // All that needs to be done here is delete the UnicodeString if the UText
2438 // owns it. This occurs if the UText was created by cloning.
2448 unistrTextLength(UText *t) {
2454 unistrTextAccess(UText *ut, int64_t index, UBool forward) {
2466 unistrTextExtract(UText *t,
2503 unistrTextReplace(UText *ut,
2548 unistrTextCopy(UText *ut,
2621 U_CAPI UText * U_EXPORT2
2622 utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status) {
2632 U_CAPI UText * U_EXPORT2
2633 utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status) {
2635 // The UnicodeString is bogus, but we still need to detach the UText
2660 // UText implementation for const UChar * strings
2662 // Use of UText data members:
2673 static UText * U_CALLCONV
2674 ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) {
2680 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2707 ucstrTextClose(UText *ut) {
2708 // Most of the work of close is done by the generic UText framework close.
2709 // All that needs to be done here is delete the string if the UText
2710 // owns it. This occurs if the UText was created by cloning.
2721 ucstrTextLength(UText *ut) {
2743 ucstrTextAccess(UText *ut, int64_t index, UBool forward) {
2832 ucstrTextExtract(UText *ut,
2869 ut->a = si; // set string length for this UText
2933 U_CAPI UText * U_EXPORT2
2934 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) {
2967 // UText implementation for text from ICU CharacterIterators
2969 // Use of UText data members:
2976 // r pointer to the character iterator if the UText owns it.
2984 charIterTextClose(UText *ut) {
2985 // Most of the work of close is done by the generic UText framework close.
2986 // All that needs to be done here is delete the CharacterIterator if the UText
2987 // owns it. This occurs if the UText was created by cloning.
2994 charIterTextLength(UText *ut) {
2999 charIterTextAccess(UText *ut, int64_t index, UBool forward) {
3068 static UText * U_CALLCONV
3069 charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status) {
3084 int64_t ix = utext_getNativeIndex((UText *)src);
3086 dest->r = srcCI; // flags that this UText owns the CharacterIterator
3092 charIterTextExtract(UText *ut,
3154 U_CAPI UText * U_EXPORT2
3155 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) {
3166 // Extra space in UText for 2 buffers of CIBufSize UChars each.