Re: Proposal: RBBI, support multiple rule status values

George Rhoten <[email protected]> Mon, 1 Mar 2004 13:15:14 -0800
Newsgroups gmane.comp.lib.icu.general
Message-ID <OF68CAD83E.08451A04-ON86256E4A.00748E08-88256E4A.0074C0BB@us.ibm.com>
Please add a UErrorCode parameter to the new APIs.  Pre-flighting code 
usually requires this parameter.

George Rhoten
IBM Globalization Center of Competency/ICU  San José, CA, USA
ICU main website: http://oss.software.ibm.com/icu/index.html




Andy Heninger <[email protected]>
Sent by: [email protected]
03/01/2004 01:05 PM
Please respond to andyh
 
        To:     [email protected]
        cc: 
        Subject:        Proposal:  RBBI, support multiple rule status 
values


This is a proposal to extend RBBI to allow finding out the full set of
break rules that matched for a given boundary position.

From Jitterbug #3043,

> RFE, RBBI, provide for multiple rule status returns.
>
> More than one rule may yield a given text boundary.  When this happens,
> getRuleStatus()  can currently only return one value, and it will choose 
the
> largest value from the available rules.  We could have an alternative
> getRuleStatus() API that made the values for all matching rules 
available.

Here is a proposal for the new API

class RulesBasedBreakIterator {
...
public:
// Existing API
virtual int32_t getRuleStatus() const;

// new API
virtual int32_t getRuleStatusVec(
int32_t * vec,                 // Array to fill in with
// status values.
int32_t   capacity) const      // capacity of vec array.


The return value from the new function would be the number of available
status values (which might be larger than the capacity of the
destination array.)

The vector of status values would not be zero terminated.  A termination
doesn't make sense, because zero is a very common status value, and
because there is no reserved status value.

A capacity of zero, or a NULL pointer for the vec parameter would cause
the function to return the number of matching rules (the number of
available status values), without returning the status values themselves.



The plain C API would be similar:

int32_t ubrk_getRuleStatusVec (
UBreakIterator *bi, int32_t *vec, int32_t capacity);


--
-- Andy Heninger
[email protected]


_______________________________________________
icu mailing list
[email protected]
http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu