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

U_STABLE UBool U_EXPORT2 uset_getSerializedRange ( const USerializedSet set,
int32_t  rangeIndex,
UChar32 pStart,
UChar32 pEnd 
)

Returns a range of characters contained in the given serialized set.

Parameters:
set the serialized set
rangeIndex a non-negative integer in the range 0.. uset_getSerializedRangeCount(set)-1
pStart pointer to variable to receive first character in range, inclusive
pEnd pointer to variable to receive last character in range, inclusive
Returns:
true if rangeIndex is valid, otherwise false ICU 2.4

Definition at line 480 of file uset.cpp.

References FALSE, NULL, and TRUE.

                                                        {
    const uint16_t* array;
    int32_t bmpLength, length;

    if(set==NULL || rangeIndex<0 || pStart==NULL || pEnd==NULL) {
        return FALSE;
    }

    array=set->array;
    length=set->length;
    bmpLength=set->bmpLength;

    rangeIndex*=2; /* address start/limit pairs */
    if(rangeIndex<bmpLength) {
        *pStart=array[rangeIndex++];
        if(rangeIndex<bmpLength) {
            *pEnd=array[rangeIndex]-1;
        } else if(rangeIndex<length) {
            *pEnd=((((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
        } else {
            *pEnd=0x10ffff;
        }
        return TRUE;
    } else {
        rangeIndex-=bmpLength;
        rangeIndex*=2; /* address pairs of pairs of units */
        length-=bmpLength;
        if(rangeIndex<length) {
            array+=bmpLength;
            *pStart=(((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1];
            rangeIndex+=2;
            if(rangeIndex<length) {
                *pEnd=((((int32_t)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
            } else {
                *pEnd=0x10ffff;
            }
            return TRUE;
        } else {
            return FALSE;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index