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

UBool TransliterationRuleSet::transliterate ( Replaceable text,
UTransPosition pos,
UBool  incremental 
)

Transliterate the given text with the given UTransPosition indices. Return TRUE if the transliteration should continue or FALSE if it should halt (because of a U_PARTIAL_MATCH match). Note that FALSE is only ever returned if isIncremental is TRUE.

Parameters:
text the text to be transliterated
index the position indices, which will be updated
isIncremental if TRUE, assume new text may be inserted at index.limit, and return FALSE if thre is a partial match.
Returns:
TRUE unless a U_PARTIAL_MATCH has been obtained, indicating that transliteration should stop until more text arrives.
Transliterate the given text with the given UTransPosition indices. Return TRUE if the transliteration should continue or FALSE if it should halt (because of a U_PARTIAL_MATCH match). Note that FALSE is only ever returned if isIncremental is TRUE.
Parameters:
text the text to be transliterated
pos the position indices, which will be updated
incremental if TRUE, assume new text may be inserted at index.limit, and return FALSE if thre is a partial match.
Returns:
TRUE unless a U_PARTIAL_MATCH has been obtained, indicating that transliteration should stop until more text arrives.

Definition at line 401 of file rbt_set.cpp.

References Replaceable::char32At(), FALSE, index, TransliterationRule::matchAndReplace(), NULL, rules, UTransPosition::start, TRUE, U_MATCH, U_PARTIAL_MATCH, and UTF_CHAR_LENGTH.

Referenced by RuleBasedTransliterator::handleTransliterate().

                                                               {
    int16_t indexByte = (int16_t) (text.char32At(pos.start) & 0xFF);
    for (int32_t i=index[indexByte]; i<index[indexByte+1]; ++i) {
        UMatchDegree m = rules[i]->matchAndReplace(text, pos, incremental);
        switch (m) {
        case U_MATCH:
            _debugOut("match", rules[i], text, pos);
            return TRUE;
        case U_PARTIAL_MATCH:
            _debugOut("partial match", rules[i], text, pos);
            return FALSE;
        default: /* Ram: added default to make GCC happy */
            break;
        }
    }
    // No match or partial match from any rule
    pos.start += UTF_CHAR_LENGTH(text.char32At(pos.start));
    _debugOut("no match", NULL, text, pos);
    return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index