//---------------------------------------------------------------------------------------- // // ubrk_openRules open a break iterator from a set of break rules. // Invokes the rule builder. // //---------------------------------------------------------------------------------------- U_CAPI UBreakIterator* U_EXPORT2 ubrk_openRules( const UChar *rules, int32_t rulesLength, const UChar *text, int32_t textLength, UParseError *parseErr, UErrorCode *status) { 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; } if (text != NULL) { UCharCharacterIterator *iter = 0; iter = new UCharCharacterIterator(text, textLength); if(iter == 0) { *status = U_MEMORY_ALLOCATION_ERROR; delete result; return 0; } result->adoptText(iter); } return (UBreakIterator *)result; }
//------------------------------------------------------------------------------ // // ubrk_openRules open a break iterator from a set of break rules. // Invokes the rule builder. // //------------------------------------------------------------------------------ U_CAPI UBreakIterator* U_EXPORT2 ubrk_openRules( const UChar *rules, int32_t rulesLength, const UChar *text, int32_t textLength, UParseError *parseErr, UErrorCode *status) { 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; }