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

U_STABLE UBool U_EXPORT2 utext_equals ( const UText a,
const UText b 
)

Compare two UText objects for equality. UTexts are equal if they are iterating over the same text, and have the same iteration position within the text. If either or both of the parameters are NULL, the comparison is FALSE.

Parameters:
a The first of the two UTexts to compare.
b The other UText to be compared.
Returns:
TRUE if the two UTexts are equal. ICU 3.6

Definition at line 429 of file utext.cpp.

References UText::context, FALSE, UText::magic, NULL, UText::pFuncs, and TRUE.

                                             {
    if (a==NULL || b==NULL ||
        a->magic != UTEXT_MAGIC ||
        b->magic != UTEXT_MAGIC) {
            // Null or invalid arguments don't compare equal to anything.
            return FALSE;
    }

    if (a->pFuncs != b->pFuncs) {
        // Different types of text providers.
        return FALSE;
    }

    if (a->context != b->context) {
        // Different sources (different strings)
        return FALSE;
    }
    if (utext_getNativeIndex(a) != utext_getNativeIndex(b)) {
        // Different current position in the string.
        return FALSE;
    }

    return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index