Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE void U_EXPORT2 utext_copy ( UText ut,
int64_t  nativeStart,
int64_t  nativeLimit,
int64_t  destIndex,
UBool  move,
UErrorCode status 
)

Copy or move a substring from one position to another within the text, while retaining any metadata associated with the text. This function is used to duplicate or reorder substrings. The destination index must not overlap the source range.

The text to be copied or moved is inserted at destIndex; it does not replace or overwrite any existing text.

The iteration position is left following the newly inserted text at the destination position.

This function is only available on UText types that support writing, that is, ones where utext_isWritable() returns TRUE.

When using this function, there should be only a single UText opened onto the underlying native text string. Behavior after a copy operation on a UText is undefined in any other additional UTexts that refer to the modified string.

Parameters:
ut The UText representing the text to be operated on.
nativeStart The native index of the start of the region to be copied or moved
nativeLimit The native index of the character position following the region to be copied.
destIndex The native destination index to which the source substring is copied or moved.
move If TRUE, then the substring is moved, not copied/duplicated.
status receives any error status. Possible errors include U_NO_WRITE_PERMISSION
ICU 3.4

Definition at line 851 of file utext.cpp.

References UTextFuncs::copy, UText::pFuncs, UText::providerProperties, U_FAILURE, U_NO_WRITE_PERMISSION, and UTEXT_PROVIDER_WRITABLE.

{
    if (U_FAILURE(*status)) {
        return;
    }
    if ((ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_WRITABLE)) == 0) {
        *status = U_NO_WRITE_PERMISSION;
        return;
    }
    ut->pFuncs->copy(ut, nativeStart, nativeLimit, destIndex, move, status);
}


Generated by  Doxygen 1.6.0   Back to index