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,
694 utext_caseCompareNativeLimit(UText *s1, int64_t limit1,
695 UText *s2, int64_t limit2,
810 utext_isWritable(const UText *ut)
818 utext_freeze(UText *ut) {
825 utext_hasMetaData(const UText *ut)
834 utext_replace(UText *ut,
851 utext_copy(UText *ut,
869 U_CAPI UText * U_EXPORT2
870 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status) {
871 UText *result;
883 // UText common functions implementation
888 // UText.flags bit definitions
891 UTEXT_HEAP_ALLOCATED = 1, // 1 if ICU has allocated this UText struct on the heap.
892 // 0 if caller provided storage for the UText.
898 // of the main UText storage.
900 UTEXT_OPEN = 4 // 1 if this UText is currently open
901 // 0 if this UText is not open.
906 // Extended form of a UText. The purpose is to aid in computing the total size required
907 // when a provider asks for a UText to be allocated with extra storage.
910 UText ut;
914 static const UText emptyText = UTEXT_INITIALIZER;
916 U_CAPI UText * U_EXPORT2
917 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
923 // We need to heap-allocate storage for the new UText
924 int32_t spaceRequired = sizeof(UText);
928 ut = (UText *)uprv_malloc(spaceRequired);
941 // We have been supplied with an already existing UText.
942 // Verify that it really appears to be a UText.
975 // Initialize all remaining fields of the UText.
1003 U_CAPI UText * U_EXPORT2
1004 utext_close(UText *ut) {
1009 // The supplied ut is not an open UText.
1021 // If we (the framework) allocated the UText or subsidiary storage,
1030 // Zero out function table of the closed UText. This is a defensive move,
1032 // utext to crash with null pointer errors.
1036 // This UText was allocated by UText setup. We need to free it.
1038 // tries to reopen another UText using the deleted storage.
1057 invalidateChunk(UText *ut) {
1086 // Adjust a pointer that refers to something within one UText (the source)
1087 // to refer to the same relative offset within a another UText (the target)
1089 static void adjustPointer(UText *dest, const void **destPtr, const UText *src) {
1096 // target ptr was to something within the src UText's pExtra storage.
1097 // relocate it into the target UText's pExtra region.
1100 // target ptr was pointing to somewhere within the source UText itself.
1101 // Move it to the same offset within the target UText.
1108 // Clone. This is a generic copy-the-utext-by-value clone function that can be
1109 // used as-is with some utext types, and as a helper by other clones.
1111 static UText * U_CALLCONV
1112 shallowTextClone(UText * dest, const UText * src, UErrorCode * status) {
1127 // flags (how the UText was allocated) and the pointer to the
1128 // extra storage must retain the values in the cloned utext that
1137 // Copy the whole UText struct by value.
1152 // Relocate any pointers in the target that refer to the UText itself
1171 // UText implementation for UTF-8 char * strings (read-only)
1175 // Use of UText data members:
1177 // utext.b is the input string length (bytes).
1178 // utext.c Length scanned so far in string
1180 // utext.p pointer to the current buffer
1181 // utext.q pointer to the other buffer.
1193 // UTF8Buf Two of these structs will be set up in the UText's extra allocated space.
1242 utf8TextLength(UText *ut) {
1268 utf8TextAccess(UText *ut, int64_t index, UBool forward) {
1529 // Swap the UText buffers.
1612 // Set UText chunk to refer to this buffer.
1644 // Swap the UText buffers.
1816 utf8TextExtract(UText *ut,
1874 utf8TextMapOffsetToNative(const UText *ut) {
1887 utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) {
1899 static UText * U_CALLCONV
1900 utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
1902 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1915 int32_t len = (int32_t)utext_nativeLength((UText *)src);
1930 utf8TextClose(UText *ut) {
1931 // Most of the work of close is done by the generic UText framework close.
1932 // All that needs to be done here is to delete the UTF8 string if the UText
1933 // owns it. This occurs if the UText was created by cloning.
1965 U_CAPI UText * U_EXPORT2
1966 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) {
2007 // UText implementation wrapper for Replaceable (read/write)
2009 // Use of UText data members:
2011 // p pointer to Replaceable if it is owned by the UText.
2032 static UText * U_CALLCONV
2033 repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2034 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2038 // The copied Replaceable storage is owned by the newly created UText clone.
2039 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2055 repTextClose(UText *ut) {
2056 // Most of the work of close is done by the generic UText framework close.
2057 // All that needs to be done here is delete the Replaceable if the UText
2058 // owns it. This occurs if the UText was created by cloning.
2068 repTextLength(UText *ut) {
2076 repTextAccess(UText *ut, int64_t index, UBool forward) {
2193 repTextExtract(UText *ut,
2236 repTextReplace(UText *ut,
2277 // Is the UText chunk buffer OK?
2293 repTextCopy(UText *ut,
2372 U_CAPI UText * U_EXPORT2
2373 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status)
2405 // UText implementation for UnicodeString (read/write) and
2409 // Use of UText data members:
2411 // p pointer to UnicodeString IF this UText owns the string
2419 static UText * U_CALLCONV
2420 unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2421 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2425 // The copied UnicodeString storage is owned by the newly created UText clone.
2426 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2427 // the UText.
2441 unistrTextClose(UText *ut) {
2442 // Most of the work of close is done by the generic UText framework close.
2443 // All that needs to be done here is delete the UnicodeString if the UText
2444 // owns it. This occurs if the UText was created by cloning.
2454 unistrTextLength(UText
2460 unistrTextAccess(UText *ut, int64_t index, UBool forward) {
2472 unistrTextExtract(UText *t,
2509 unistrTextReplace(UText *ut,
2554 unistrTextCopy(UText *ut,
2627 U_CAPI UText * U_EXPORT2
2628 utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status) {
2649 U_CAPI UText * U_EXPORT2
2650 utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status) {
2670 // UText implementation for const UChar * strings
2672 // Use of UText data members:
2683 static UText * U_CALLCONV
2684 ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) {
2690 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2717 ucstrTextClose(UText *ut) {
2718 // Most of the work of close is done by the generic UText framework close.
2719 // All that needs to be done here is delete the string if the UText
2720 // owns it. This occurs if the UText was created by cloning.
2731 ucstrTextLength(UText *ut) {
2753 ucstrTextAccess(UText *ut, int64_t index, UBool forward) {
2842 ucstrTextExtract(UText *ut,
2879 ut->a = si; // set string length for this UText
2943 U_CAPI UText * U_EXPORT2
2944 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) {
2977 // UText implementation for text from ICU CharacterIterators
2979 // Use of UText data members:
2986 // r pointer to the character iterator if the UText owns it.
2994 charIterTextClose(UText *ut) {
2995 // Most of the work of close is done by the generic UText framework close.
2996 // All that needs to be done here is delete the CharacterIterator if the UText
2997 // owns it. This occurs if the UText was created by cloning.
3004 charIterTextLength(UText *ut) {
3009 charIterTextAccess(UText *ut, int64_t index, UBool forward) {
3078 static UText * U_CALLCONV
3079 charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status) {
3094 int64_t ix = utext_getNativeIndex((UText *)src);
3096 dest->r = srcCI; // flags that this UText owns the CharacterIterator
3102 charIterTextExtract(UText *ut,
3164 U_CAPI UText * U_EXPORT2
3165 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) {
3176 // Extra space in UText for 2 buffers of CIBufSize UChars each.