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

U_STABLE UBreakIterator* U_EXPORT2 ubrk_openRules ( const UChar *  rules,
int32_t  rulesLength,
const UChar *  text,
int32_t  textLength,
UParseError parseErr,
UErrorCode status 
)

Open a new UBreakIterator for locating text boundaries using specified breaking rules. The rule syntax is ... (TBD)

Parameters:
rules A set of rules specifying the text breaking conventions.
rulesLength The number of characters in rules, or -1 if null-terminated.
text The text to be iterated over. May be null, in which case ubrk_setText() is used to specify the text to be iterated.
textLength The number of characters in text, or -1 if null-terminated.
parseErr Receives position and context information for any syntax errors detected while parsing the rules.
status A UErrorCode to receive any errors.
Returns:
A UBreakIterator for the specified rules.
See also:
ubrk_open ICU 2.2

Definition at line 94 of file ubrk.cpp.

References NULL, and U_FAILURE.

                                              {

    if (status == NULL || U_FAILURE(*status)){
        return 0;
    }

    BreakIterator *result = 0;
    UnicodeString ruleString(rules, rulesLength);
    result = RBBIRuleBuilder::createRuleBasedBreakIterator(ruleString, parseErr, *status);
    if(U_FAILURE(*status)) {
        return 0;
    }

    UBreakIterator *uBI = (UBreakIterator *)result;
    if (text != NULL) {
        ubrk_setText(uBI, text, textLength, status);
    }
    return uBI;
}


Generated by  Doxygen 1.6.0   Back to index