Lines Matching refs:UText
8 * file name: utext.cpp
21 #include "unicode/utext.h"
33 utext_access(UText *ut, int64_t index, UBool forward) {
40 utext_moveIndex32(UText *ut, int32_t delta) {
80 utext_nativeLength(UText *ut) {
86 utext_isLengthExpensive(const UText *ut) {
93 utext_getNativeIndex(const UText *ut) {
103 utext_setNativeIndex(UText *ut, int64_t index) {
137 utext_getPreviousNativeIndex(UText *ut) {
176 // UText iteration position is always on a code point boundary,
180 utext_current32(UText *ut) {
234 utext_char32At(UText *ut, int64_t nativeIndex) {
261 utext_next32(UText *ut) {
301 utext_previous32(UText *ut) {
341 utext_next32From(UText *ut, int64_t index) {
370 utext_previous32From(UText *ut, int64_t index) {
418 utext_extract(UText *ut,
428 utext_equals(const UText *a, const UText *b) {
454 utext_isWritable(const UText *ut)
462 utext_freeze(UText *ut) {
469 utext_hasMetaData(const UText *ut)
478 utext_replace(UText *ut,
495 utext_copy(UText *ut,
513 U_CAPI UText * U_EXPORT2
514 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status) {
515 UText *result;
527 // UText common functions implementation
532 // UText
535 UTEXT_HEAP_ALLOCATED = 1, // 1 if ICU has allocated this UText struct on the heap.
536 // 0 if caller provided storage for the UText.
542 // of the main UText storage.
544 UTEXT_OPEN = 4 // 1 if this UText is currently open
545 // 0 if this UText is not open.
550 // Extended form of a UText. The purpose is to aid in computing the total size required
551 // when a provider asks for a UText to be allocated with extra storage.
554 UText ut;
558 static const UText emptyText = UTEXT_INITIALIZER;
560 U_CAPI UText * U_EXPORT2
561 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
567 // We need to heap-allocate storage for the new UText
568 int32_t spaceRequired = sizeof(UText);
572 ut = (UText *)uprv_malloc(spaceRequired);
585 // We have been supplied with an already existing UText.
586 // Verify that it really appears to be a UText.
619 // Initialize all remaining fields of the UText.
647 U_CAPI UText * U_EXPORT2
648 utext_close(UText *ut) {
653 // The supplied ut is not an open UText.
665 // If we (the framework) allocated the UText or subsidiary storage,
674 // Zero out function table of the closed UText. This is a defensive move,
676 // utext to crash with null pointer errors.
680 // This UText was allocated by UText setup. We need to free it.
682 // tries to reopen another UText using the deleted storage.
701 invalidateChunk(UText *ut) {
730 // Adjust a pointer that refers to something within one UText (the source)
731 // to refer to the same relative offset within a another UText (the target)
733 static void adjustPointer(UText *dest, const void **destPtr, const UText *src) {
740 // target ptr was to something within the src UText's pExtra storage.
741 // relocate it into the target UText's pExtra region.
744 // target ptr was pointing to somewhere within the source UText itself.
745 // Move it to the same offset within the target UText.
752 // Clone. This is a generic copy-the-utext-by-value clone function that can be
753 // used as-is with some utext types, and as a helper by other clones.
755 static UText * U_CALLCONV
756 shallowTextClone(UText * dest, const UText * src, UErrorCode * status) {
771 // flags (how the UText was allocated) and the pointer to the
772 // extra storage must retain the values in the cloned utext that
781 // Copy the whole UText struct by value.
796 // Relocate any pointers in the target that refer to the UText itself
815 // UText implementation for UTF-8 char * strings (read-only)
819 // Use of UText data members:
821 // utext.b is the input string length (bytes).
822 // utext.c Length scanned so far in string
824 // utext.p pointer to the current buffer
825 // utext.q pointer to the other buffer.
837 // UTF8Buf Two of these structs will be set up in the UText's extra allocated space.
886 utf8TextLength(UText *ut) {
912 utf8TextAccess(UText *ut, int64_t index, UBool forward) {
1173 // Swap the UText buffers.
1256 // Set UText chunk to refer to this buffer.
1288 // Swap the UText buffers.
1460 utf8TextExtract(UText *ut,
1517 utf8TextMapOffsetToNative(const UText *ut) {
1530 utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) {
1542 static UText * U_CALLCONV
1543 utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
1545 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1558 int32_t len = (int32_t)utext_nativeLength((UText *)src);
1573 utf8TextClose(UText *ut) {
1574 // Most of the work of close is done by the generic UText framework close.
1575 // All that needs to be done here is to delete the UTF8 string if the UText
1576 // owns it. This occurs if the UText was created by cloning.
1608 U_CAPI UText * U_EXPORT2
1609 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) {
1650 // UText implementation wrapper for Replaceable (read/write)
1652 // Use of UText data members:
1654 // p pointer to Replaceable if it is owned by the UText.
1675 static UText * U_CALLCONV
1676 repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
1677 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1681 // The copied Replaceable storage is owned by the newly created UText clone.
1682 // A non-NULL pointer in UText.p is the signal to the close() function to delete
1698 repTextClose(UText *ut) {
1699 // Most of the work of close is done by the generic UText framework close.
1700 // All that needs to be done here is delete the Replaceable if the UText
1701 // owns it. This occurs if the UText was created by cloning.
1711 repTextLength(UText *ut) {
1719 repTextAccess(UText *ut, int64_t index, UBool forward) {
1836 repTextExtract(UText *ut,
1877 repTextReplace(UText *ut,
1918 // Is the UText chunk buffer OK?
1934 repTextCopy(UText *ut,
2013 U_CAPI UText * U_EXPORT2
2014 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status)
2046 // UText implementation for UnicodeString (read/write) and
2050 // Use of UText data members:
2052 // p pointer to UnicodeString IF this UText owns the string
2060 static UText * U_CALLCONV
2061 unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2062 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2066 // The copied UnicodeString storage is owned by the newly created UText clone.
2067 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2068 // the UText.
2082 unistrTextClose(UText *ut) {
2083 // Most of the work of close is done by the generic UText framework close.
2084 // All that needs to be done here is delete the UnicodeString if the UText
2085 // owns it. This occurs if the UText was created by cloning.
2095 unistrTextLength(UText *t) {
2101 unistrTextAccess(UText *ut, int64_t index, UBool forward) {
2113 unistrTextExtract(UText *t,
2147 unistrTextReplace(UText *ut,
2192 unistrTextCopy(UText *ut,
2265 U_CAPI UText * U_EXPORT2
2266 utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status) {
2287 U_CAPI UText * U_EXPORT2
2288 utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status) {
2308 // UText implementation for const UChar * strings
2310 // Use of UText data members:
2321 static UText * U_CALLCONV
2322 ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) {
2328 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2355 ucstrTextClose(UText *ut) {
2356 // Most of the work of close is done by the generic UText framework close.
2357 // All that needs to be done here is delete the string if the UText
2358 // owns it. This occurs if the UText was created by cloning.
2369 ucstrTextLength(UText *ut) {
2391 ucstrTextAccess(UText *ut, int64_t index, UBool forward) {
2480 ucstrTextExtract(UText *ut,
2517 ut->a = si; // set string length for this UText
2581 U_CAPI UText * U_EXPORT2
2582 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) {
2615 // UText implementation for text from ICU CharacterIterators
2617 // Use of UText data members:
2624 // r pointer to the character iterator if the UText owns it.
2632 charIterTextClose(UText *ut) {
2633 // Most of the work of close is done by the generic UText framework close.
2634 // All that needs to be done here is delete the CharacterIterator if the UText
2635 // owns it. This occurs if the UText was created by cloning.
2642 charIterTextLength(UText *ut) {
2647 charIterTextAccess(UText *ut, int64_t index, UBool forward) {
2716 static UText * U_CALLCONV
2717 charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status) {
2732 int64_t ix = utext_getNativeIndex((UText *)src);
2734 dest->r = srcCI; // flags that this UText owns the CharacterIterator
2740 charIterTextExtract(UText *ut,
2797 U_CAPI UText * U_EXPORT2
2798 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) {
2809 // Extra space in UText for 2 buffers of CIBufSize UChars each.