Home | History | Annotate | Download | only in common

Lines Matching full:utext

8 *   file name:  utext.cpp
21 #include "unicode/utext.h"
37 utext_access(UText *ut, int64_t index, UBool forward) {
44 utext_moveIndex32(UText *ut, int32_t delta) {
84 utext_nativeLength(UText *ut) {
90 utext_isLengthExpensive(const UText *ut) {
97 utext_getNativeIndex(const UText *ut) {
107 utext_setNativeIndex(UText *ut, int64_t index) {
141 utext_getPreviousNativeIndex(UText *ut) {
180 // UText iteration position is always on a code point boundary,
184 utext_current32(UText *ut) {
238 utext_char32At(UText *ut, int64_t nativeIndex) {
265 utext_next32(UText *ut) {
305 utext_previous32(UText *ut) {
345 utext_next32From(UText *ut, int64_t index) {
374 utext_previous32From(UText *ut, int64_t index) {
422 utext_extract(UText *ut,
432 utext_equals(const UText *a, const UText *b) {
458 utext_isWritable(const UText *ut)
466 utext_freeze(UText *ut) {
473 utext_hasMetaData(const UText *ut)
482 utext_replace(UText *ut,
499 utext_copy(UText *ut,
517 U_CAPI UText * U_EXPORT2
518 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status) {
522 UText *result = src->pFuncs->clone(dest, src, deep, status);
540 // UText common functions implementation
545 // UText.flags bit definitions
548 UTEXT_HEAP_ALLOCATED = 1, // 1 if ICU has allocated this UText struct on the heap.
549 // 0 if caller provided storage for the UText.
555 // of the main UText storage.
557 UTEXT_OPEN = 4 // 1 if this UText is currently open
558 // 0 if this UText is not open.
563 // Extended form of a UText. The purpose is to aid in computing the total size required
564 // when a provider asks for a UText to be allocated with extra storage.
567 UText ut;
571 static const UText emptyText = UTEXT_INITIALIZER;
573 U_CAPI UText * U_EXPORT2
574 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
580 // We need to heap-allocate storage for the new UText
581 int32_t spaceRequired = sizeof(UText);
585 ut = (UText *)uprv_malloc(spaceRequired);
598 // We have been supplied with an already existing UText.
599 // Verify that it really appears to be a UText.
632 // Initialize all remaining fields of the UText.
660 U_CAPI UText * U_EXPORT2
661 utext_close(UText *ut) {
666 // The supplied ut is not an open UText.
678 // If we (the framework) allocated the UText or subsidiary storage,
687 // Zero out function table of the closed UText. This is a defensive move,
689 // utext to crash with null pointer errors.
693 // This UText was allocated by UText setup. We need to free it.
695 // tries to reopen another UText using the deleted storage.
714 invalidateChunk(UText *ut) {
743 // Adjust a pointer that refers to something within one UText (the source)
744 // to refer to the same relative offset within a another UText (the target)
746 static void adjustPointer(UText *dest, const void **destPtr, const UText *src) {
753 // target ptr was to something within the src UText's pExtra storage.
754 // relocate it into the target UText's pExtra region.
757 // target ptr was pointing to somewhere within the source UText itself.
758 // Move it to the same offset within the target UText.
765 // Clone. This is a generic copy-the-utext-by-value clone function that can be
766 // used as-is with some utext types, and as a helper by other clones.
768 static UText * U_CALLCONV
769 shallowTextClone(UText * dest, const UText * src, UErrorCode * status) {
784 // flags (how the UText was allocated) and the pointer to the
785 // extra storage must retain the values in the cloned utext that
794 // Copy the whole UText struct by value.
809 // Relocate any pointers in the target that refer to the UText itself
818 // The newly shallow-cloned UText does _not_ own the underlying storage for the text.
833 // UText implementation for UTF-8 char * strings (read-only)
837 // Use of UText data members:
839 // utext.b is the input string length (bytes).
840 // utext.c Length scanned so far in string
842 // utext.p pointer to the current buffer
843 // utext.q pointer to the other buffer.
855 // UTF8Buf Two of these structs will be set up in the UText's extra allocated space.
904 utf8TextLength(UText *ut) {
930 utf8TextAccess(UText *ut, int64_t index, UBool forward) {
1191 // Swap the UText buffers.
1270 // Set UText chunk to refer to this buffer.
1302 // Swap the UText buffers.
1464 utf8TextExtract(UText *ut,
1522 utf8TextMapOffsetToNative(const UText *ut) {
1535 utf8TextMapIndexToUTF16(const UText *ut, int64_t index64) {
1547 static UText * U_CALLCONV
1548 utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
1550 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1563 int32_t len = (int32_t)utext_nativeLength((UText *)src);
1578 utf8TextClose(UText *ut) {
1579 // Most of the work of close is done by the generic UText framework close.
1580 // All that needs to be done here is to delete the UTF8 string if the UText
1581 // owns it. This occurs if the UText was created by cloning.
1613 U_CAPI UText * U_EXPORT2
1614 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) {
1655 // UText implementation wrapper for Replaceable (read/write)
1657 // Use of UText data members:
1659 // p pointer to Replaceable if it is owned by the UText.
1680 static UText * U_CALLCONV
1681 repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
1682 // First do a generic shallow clone. Does everything needed for the UText struct itself.
1686 // The copied Replaceable storage is owned by the newly created UText clone.
1687 // A non-NULL pointer in UText.p is the signal to the close() function to delete
1703 repTextClose(UText *ut) {
1704 // Most of the work of close is done by the generic UText framework close.
1705 // All that needs to be done here is delete the Replaceable if the UText
1706 // owns it. This occurs if the UText was created by cloning.
1716 repTextLength(UText *ut) {
1724 repTextAccess(UText *ut, int64_t index, UBool forward) {
1841 repTextExtract(UText *ut,
1884 repTextReplace(UText *ut,
1925 // Is the UText chunk buffer OK?
1941 repTextCopy(UText *ut,
2020 U_CAPI UText * U_EXPORT2
2021 utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status)
2053 // UText implementation for UnicodeString (read/write) and
2057 // Use of UText data members:
2059 // p pointer to UnicodeString IF this UText owns the string
2067 static UText * U_CALLCONV
2068 unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
2069 // First do a generic shallow clone. Does everything needed for the UText struct itself.
2073 // The copied UnicodeString storage is owned by the newly created UText clone.
2074 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2075 // the UText.
2089 unistrTextClose(UText *ut) {
2090 // Most of the work of close is done by the generic UText framework close.
2091 // All that needs to be done here is delete the UnicodeString if the UText
2092 // owns it. This occurs if the UText was created by cloning.
2102 unistrTextLength(UText *t) {
2108 unistrTextAccess(UText *ut, int64_t index, UBool forward) {
2120 unistrTextExtract(UText *t,
2157 unistrTextReplace(UText *ut,
2202 unistrTextCopy(UText *ut,
2275 U_CAPI UText * U_EXPORT2
2276 utext_openUnicodeString(UText *ut, UnicodeString *s, UErrorCode *status) {
2286 U_CAPI UText * U_EXPORT2
2287 utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *status) {
2289 // The UnicodeString is bogus, but we still need to detach the UText
2314 // UText implementation for const UChar * strings
2316 // Use of UText data members:
2327 static UText * U_CALLCONV
2328 ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status) {
2334 // A non-NULL pointer in UText.p is the signal to the close() function to delete
2361 ucstrTextClose(UText *ut) {
2362 // Most of the work of close is done by the generic UText framework close.
2363 // All that needs to be done here is delete the string if the UText
2364 // owns it. This occurs if the UText was created by cloning.
2375 ucstrTextLength(UText *ut) {
2397 ucstrTextAccess(UText *ut, int64_t index, UBool forward) {
2486 ucstrTextExtract(UText *ut,
2522 ut->a = si; // set string length for this UText
2587 U_CAPI UText * U_EXPORT2
2588 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) {
2621 // UText implementation for text from ICU CharacterIterators
2623 // Use of UText data members:
2630 // r pointer to the character iterator if the UText owns it.
2638 charIterTextClose(UText *ut) {
2639 // Most of the work of close is done by the generic UText framework close.
2640 // All that needs to be done here is delete the CharacterIterator if the UText
2641 // owns it. This occurs if the UText was created by cloning.
2648 charIterTextLength(UText *ut) {
2653 charIterTextAccess(UText *ut, int64_t index, UBool forward) {
2722 static UText * U_CALLCONV
2723 charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status) {
2738 int64_t ix = utext_getNativeIndex((UText *)src);
2740 dest->r = srcCI; // flags that this UText owns the CharacterIterator
2746 charIterTextExtract(UText *ut,
2809 U_CAPI UText * U_EXPORT2
2810 utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) {
2821 // Extra space in UText for 2 buffers of CIBufSize UChars each.