Re: ICU4C API Addition Proposal: ucol_openFromBinary
Vladimir Weinstein <[email protected]> Mon, 11 Oct 2004 12:59:56 -0700
| Newsgroups | gmane.comp.lib.icu.general |
|---|---|
| Message-ID | <[email protected]> |
Collator images won't have UDataMemory headers. They are ordinary binary chunks. Length is here just for sanity checking. I have some amendments to make though: - binary image used in instantiation of the collator remains owned by the user and should stay around for the lifetime of the collator. - For the purpose of creating a collator binary image, the following API is proposed: /** * Clones collator's binary image. The image can be stored and * used for opening a collator using ucol_openBinary. * * @param coll The collator to get the image from * @param length returns the length of the data, in bytes. * @param status the error status * @return memory, owned by the caller, of size 'length' bytes. */ U_CAPI uint8_t* U_EXPORT2 ucol_cloneBinary(const UCollator *coll, int32_t *length, UErrorCode *status); Regards, v. George Rhoten wrote: > Can you make this API work like the BreakIterator? > > RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); > > > Also why is length needed? Shouldn't the binary image already have the > length within the structure? > > George Rhoten > IBM Globalization Center of Competency/ICU San José, CA, USA > ICU main website: http://oss.software.ibm.com/icu/index.html > > > > Vladimir Weinstein <[email protected]> > Sent by: [email protected] > 10/08/2004 04:43 PM > > To > icu list <[email protected]> > cc > > Subject > ICU4C API Addition Proposal: ucol_openFromBinary > > > > > > > Expires: 10/15/2004 > > > I am proposing to add the following API: > > UCollator *ucol_openBinary(const uint8_t *bin, int32_t length, const > UCollator > *base, UErrorCode *pErrorCode); > > This API would initialize a collator from a collator image bin. If length > is > less than zero, the API will preflight. > > base is the collator that is used for fallback if a value is not found in > the > collator. It is usually UCA, but can be any other collator. If this value > is > NULL, no fallback will occur. > > Status returnes error codes, if any. > > Thank you! > > Regards, > v. > -- Vladimir Weinstein, IBM GCoC-Unicode/ICU San Jose, CA [email protected]