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

void SearchIterator::setAttribute ( USearchAttribute  attribute,
USearchAttributeValue  value,
UErrorCode status 
) [inherited]

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:
attribute text attribute (enum USearchAttribute) to be set
value text attribute value
status for errors if it occurs ICU 2.0

Definition at line 48 of file search.cpp.

References FALSE, SearchIterator::m_search_, 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)) {
        switch (attribute)
        {
        case USEARCH_OVERLAP :
            m_search_->isOverlap = (value == USEARCH_ON ? TRUE : FALSE);
            break;
        case USEARCH_CANONICAL_MATCH :
            m_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) {
                m_search_->elementComparisonType = (int16_t)value;
            } else {
                m_search_->elementComparisonType = 0;
            }
            break;
        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