Logo Search packages:      
Sourcecode: icu version File versions

void RuleBasedCollator::getRules ( UColRuleOption  delta,
UnicodeString buffer 
)

Returns current rules. Delta defines whether full rules are returned or just the tailoring.

Parameters:
deltaone of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
bufferUnicodeString to store the result rules ICU 2.2

Definition at line 299 of file tblcoll.cpp.

References NULL, UnicodeString::remove(), UnicodeString::setTo(), and ucollator.

{
    int32_t rulesize = ucol_getRulesEx(ucollator, delta, NULL, -1);

    if (rulesize > 0) {
        UChar *rules = (UChar*) uprv_malloc( sizeof(UChar) * (rulesize) );
        if(rules != NULL) {
            ucol_getRulesEx(ucollator, delta, rules, rulesize);
            buffer.setTo(rules, rulesize);
            uprv_free(rules);
        } else { // couldn't allocate
            buffer.remove();
        }
    }
    else {
        buffer.remove();
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index