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

U_STABLE void U_EXPORT2 usearch_setAttribute ( UStringSearch strsrch,
USearchAttribute  attribute,
USearchAttributeValue  value,
UErrorCode status 
)

Sets the text searching attributes located in the enum USearchAttribute with values from the enum USearchAttributeValue. USEARCH_DEFAULT can be used for all attributes for resetting.

Parameters:
strsrchsearch iterator data struct
attributetext attribute to be set
valuetext attribute value
statusfor errors if it occurs
See also:
usearch_getAttribute ICU 2.4

Definition at line 2824 of file usearch.cpp.

References FALSE, TRUE, U_ILLEGAL_ARGUMENT_ERROR, U_SUCCESS, USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, USEARCH_CANONICAL_MATCH, USEARCH_ELEMENT_COMPARISON, USEARCH_ON, USEARCH_OVERLAP, and USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD.

{
    if (U_SUCCESS(*status) && strsrch) {
        switch (attribute)
        {
        case USEARCH_OVERLAP :
            strsrch->search->isOverlap = (value == USEARCH_ON ? TRUE : FALSE);
            break;
        case USEARCH_CANONICAL_MATCH :
            strsrch->search->isCanonicalMatch = (value == USEARCH_ON ? TRUE :
                                                                      FALSE);
            break;
        case USEARCH_ELEMENT_COMPARISON :
            if (value == USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD || value == USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD) {
                strsrch->search->elementComparisonType = (int16_t)value;
            } else {
                strsrch->search->elementComparisonType = 0;
            }
            break;
        case USEARCH_ATTRIBUTE_COUNT :
        default:
            *status = U_ILLEGAL_ARGUMENT_ERROR;
        }
    }
    if (value == USEARCH_ATTRIBUTE_VALUE_COUNT) {
        *status = U_ILLEGAL_ARGUMENT_ERROR;
    }
}

Generated by  Doxygen 1.6.0   Back to index