#include "unicode/utypes.h"
#include "unicode/unorm.h"
#include "unicode/parseerr.h"
#include "unicode/uloc.h"
#include "unicode/uset.h"
Go to the source code of this file.
Defines | |
#define | U_COL_SAFECLONE_BUFFERSIZE 512 |
default memory size for the new clone. | |
#define | UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000 |
Returned by ucol_collatorToIdentifier to signify that collator is not encodable as an identifier. | |
Typedefs | |
typedef UCollator | UCollator |
structure representing a collator object instance | |
typedef UColAttributeValue | UCollationStrength |
Base letter represents a primary difference. | |
Enumerations | |
enum | UCollationResult { UCOL_EQUAL = 0, UCOL_GREATER = 1, UCOL_LESS = -1 } |
UCOL_LESS is returned if source string is compared to be less than target string in the u_strcoll() method. More... | |
enum | UColAttributeValue { UCOL_DEFAULT = -1, UCOL_PRIMARY = 0, UCOL_SECONDARY = 1, UCOL_TERTIARY = 2, UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY, UCOL_CE_STRENGTH_LIMIT, UCOL_QUATERNARY = 3, UCOL_IDENTICAL = 15, UCOL_STRENGTH_LIMIT, UCOL_OFF = 16, UCOL_ON = 17, UCOL_SHIFTED = 20, UCOL_NON_IGNORABLE = 21, UCOL_LOWER_FIRST = 24, UCOL_UPPER_FIRST = 25, UCOL_ATTRIBUTE_VALUE_COUNT } |
Enum containing attribute values for controling collation behavior. More... | |
enum | UColAttribute { UCOL_FRENCH_COLLATION, UCOL_ALTERNATE_HANDLING, UCOL_CASE_FIRST, UCOL_CASE_LEVEL, UCOL_NORMALIZATION_MODE, UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE, UCOL_STRENGTH, UCOL_HIRAGANA_QUATERNARY_MODE, UCOL_NUMERIC_COLLATION, UCOL_ATTRIBUTE_COUNT } |
Attributes that collation service understands. More... | |
enum | UColRuleOption { UCOL_TAILORING_ONLY, UCOL_FULL_RULES } |
Options for retrieving the rule string. More... | |
enum | UColBoundMode { UCOL_BOUND_LOWER = 0, UCOL_BOUND_UPPER = 1, UCOL_BOUND_UPPER_LONG = 2, UCOL_BOUND_VALUE_COUNT } |
enum that is taken by ucol_getBound API See below for explanation do not change the values assigned to the members of this enum. More... | |
Functions | |
UCollator * | ucol_open (const char *loc, UErrorCode *status) |
Open a UCollator for comparing strings. | |
UCollator * | ucol_openRules (const UChar *rules, int32_t rulesLength, UColAttributeValue normalizationMode, UCollationStrength strength, UParseError *parseError, UErrorCode *status) |
Produce an UCollator instance according to the rules supplied. | |
UCollator * | ucol_openFromShortString (const char *definition, UBool forceDefaults, UParseError *parseError, UErrorCode *status) |
Open a collator defined by a short form string. | |
int32_t | ucol_getContractions (const UCollator *coll, USet *conts, UErrorCode *status) |
Get a set containing the contractions defined by the collator. | |
void | ucol_getContractionsAndExpansions (const UCollator *coll, USet *contractions, USet *expansions, UBool addPrefixes, UErrorCode *status) |
Get a set containing the expansions defined by the collator. | |
void | ucol_close (UCollator *coll) |
Close a UCollator. | |
UCollationResult | ucol_strcoll (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Compare two strings. | |
UBool | ucol_greater (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Determine if one string is greater than another. | |
UBool | ucol_greaterOrEqual (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Determine if one string is greater than or equal to another. | |
UBool | ucol_equal (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Compare two strings for equality. | |
UCollationResult | ucol_strcollIter (const UCollator *coll, UCharIterator *sIter, UCharIterator *tIter, UErrorCode *status) |
Compare two UTF-8 encoded trings. | |
UCollationStrength | ucol_getStrength (const UCollator *coll) |
Get the collation strength used in a UCollator. | |
void | ucol_setStrength (UCollator *coll, UCollationStrength strength) |
Set the collation strength used in a UCollator. | |
int32_t | ucol_getDisplayName (const char *objLoc, const char *dispLoc, UChar *result, int32_t resultLength, UErrorCode *status) |
Get the display name for a UCollator. | |
const char * | ucol_getAvailable (int32_t index) |
Get a locale for which collation rules are available. | |
int32_t | ucol_countAvailable (void) |
Determine how many locales have collation rules available. | |
UEnumeration * | ucol_openAvailableLocales (UErrorCode *status) |
Create a string enumerator of all locales for which a valid collator may be opened. | |
UEnumeration * | ucol_getKeywords (UErrorCode *status) |
Create a string enumerator of all possible keywords that are relevant to collation. | |
UEnumeration * | ucol_getKeywordValues (const char *keyword, UErrorCode *status) |
Given a keyword, create a string enumeration of all values for that keyword that are currently in use. | |
int32_t | ucol_getFunctionalEquivalent (char *result, int32_t resultCapacity, const char *keyword, const char *locale, UBool *isAvailable, UErrorCode *status) |
Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service. | |
const UChar * | ucol_getRules (const UCollator *coll, int32_t *length) |
Get the collation rules from a UCollator. | |
int32_t | ucol_getShortDefinitionString (const UCollator *coll, const char *locale, char *buffer, int32_t capacity, UErrorCode *status) |
Get the short definition string for a collator. | |
int32_t | ucol_normalizeShortDefinitionString (const char *source, char *destination, int32_t capacity, UParseError *parseError, UErrorCode *status) |
Verifies and normalizes short definition string. | |
int32_t | ucol_getSortKey (const UCollator *coll, const UChar *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) |
Get a sort key for a string from a UCollator. | |
int32_t | ucol_nextSortKeyPart (const UCollator *coll, UCharIterator *iter, uint32_t state[2], uint8_t *dest, int32_t count, UErrorCode *status) |
Gets the next count bytes of a sort key. | |
int32_t | ucol_getBound (const uint8_t *source, int32_t sourceLength, UColBoundMode boundType, uint32_t noOfLevels, uint8_t *result, int32_t resultLength, UErrorCode *status) |
Produce a bound for a given sortkey and a number of levels. | |
void | ucol_getVersion (const UCollator *coll, UVersionInfo info) |
Gets the version information for a Collator. | |
void | ucol_getUCAVersion (const UCollator *coll, UVersionInfo info) |
Gets the UCA version information for a Collator. | |
int32_t | ucol_mergeSortkeys (const uint8_t *src1, int32_t src1Length, const uint8_t *src2, int32_t src2Length, uint8_t *dest, int32_t destCapacity) |
Merge two sort keys. | |
void | ucol_setAttribute (UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status) |
Universal attribute setter. | |
UColAttributeValue | ucol_getAttribute (const UCollator *coll, UColAttribute attr, UErrorCode *status) |
Universal attribute getter. | |
uint32_t | ucol_setVariableTop (UCollator *coll, const UChar *varTop, int32_t len, UErrorCode *status) |
Variable top is a two byte primary value which causes all the codepoints with primary values that are less or equal than the variable top to be shifted when alternate handling is set to UCOL_SHIFTED. | |
uint32_t | ucol_getVariableTop (const UCollator *coll, UErrorCode *status) |
Gets the variable top value of a Collator. | |
void | ucol_restoreVariableTop (UCollator *coll, const uint32_t varTop, UErrorCode *status) |
Sets the variable top to a collation element value supplied. | |
UCollator * | ucol_safeClone (const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status) |
Thread safe cloning operation. | |
int32_t | ucol_getRulesEx (const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen) |
Returns current rules. | |
const char * | ucol_getLocale (const UCollator *coll, ULocDataLocaleType type, UErrorCode *status) |
gets the locale name of the collator. | |
const char * | ucol_getLocaleByType (const UCollator *coll, ULocDataLocaleType type, UErrorCode *status) |
gets the locale name of the collator. | |
USet * | ucol_getTailoredSet (const UCollator *coll, UErrorCode *status) |
Get an Unicode set that contains all the characters and sequences tailored in this collator. | |
uint32_t | ucol_collatorToIdentifier (const UCollator *coll, const char *locale, UErrorCode *status) |
Get a 31-bit identifier given a collator. | |
UCollator * | ucol_openFromIdentifier (uint32_t identifier, UBool forceDefaults, UErrorCode *status) |
Open a collator given a 31-bit identifier. | |
int32_t | ucol_identifierToShortString (uint32_t identifier, char *buffer, int32_t capacity, UBool forceDefaults, UErrorCode *status) |
Calculate the short definition string given an identifier. | |
uint32_t | ucol_shortStringToIdentifier (const char *definition, UBool forceDefaults, UErrorCode *status) |
Calculate the identifier given a short definition string. | |
UColAttributeValue | ucol_getAttributeOrDefault (const UCollator *coll, UColAttribute attr, UErrorCode *status) |
Universal attribute getter that returns UCOL_DEFAULT if the value is default. | |
UBool | ucol_equals (const UCollator *source, const UCollator *target) |
Check whether two collators are equal. | |
int32_t | ucol_getUnsafeSet (const UCollator *coll, USet *unsafe, UErrorCode *status) |
Calculates the set of unsafe code points, given a collator. | |
void | ucol_forgetUCA (void) |
Reset UCA's static pointers. | |
void | ucol_prepareShortStringOpen (const char *definition, UBool forceDefaults, UParseError *parseError, UErrorCode *status) |
Touches all resources needed for instantiating a collator from a short string definition, thus filling up the cache. | |
int32_t | ucol_cloneBinary (const UCollator *coll, uint8_t *buffer, int32_t capacity, UErrorCode *status) |
Creates a binary image of a collator. | |
UCollator * | ucol_openBinary (const uint8_t *bin, int32_t length, const UCollator *base, UErrorCode *status) |
Opens a collator from a collator binary image created using ucol_cloneBinary. |
The C API for Collator performs locale-sensitive string comparison. You use this service to build searching and sorting routines for natural language text. Important: The ICU collation service has been reimplemented in order to achieve better performance and UCA compliance. For details, see the collation design document.
For more information about the collation service see the users guide.
Collation service provides correct sorting orders for most locales supported in ICU. If specific data for a locale is not available, the orders eventually falls back to the UCA sort order.
Sort ordering may be customized by providing your own set of rules. For more on this subject see the Collation customization section of the users guide.
Definition in file ucol.h.
|
default memory size for the new clone. It needs to be this large for os/400 large pointers
|
|
Returned by ucol_collatorToIdentifier to signify that collator is not encodable as an identifier.
|
|
Base letter represents a primary difference. Set comparison level to UCOL_PRIMARY to ignore secondary and tertiary differences. Use this to set the strength of a Collator object. Example of primary difference, "abc" < "abd" Diacritical differences on the same base letter represent a secondary difference. Set comparison level to UCOL_SECONDARY to ignore tertiary differences. Use this to set the strength of a Collator object. Example of secondary difference, "ä" >> "a". Uppercase and lowercase versions of the same character represents a tertiary difference. Set comparison level to UCOL_TERTIARY to include all comparison differences. Use this to set the strength of a Collator object. Example of tertiary difference, "abc" <<< "ABC". Two characters are considered "identical" when they have the same unicode spellings. UCOL_IDENTICAL. For example, "ä" == "ä". UCollationStrength is also used to determine the strength of sort keys generated from UCollator objects These values can be now found in the UColAttributeValue enum.
|
|
structure representing a collator object instance
|
|
Attributes that collation service understands. All the attributes can take UCOL_DEFAULT value, as well as the values specific to each one.
|
|
Enum containing attribute values for controling collation behavior. Here are all the allowable values. Not every attribute can take every value. The only universal value is UCOL_DEFAULT, which resets the attribute value to the predefined value for that locale
|
|
enum that is taken by ucol_getBound API See below for explanation do not change the values assigned to the members of this enum. Underlying code depends on them having these numbers
|
|
UCOL_LESS is returned if source string is compared to be less than target string in the u_strcoll() method. UCOL_EQUAL is returned if source string is compared to be equal to target string in the u_strcoll() method. UCOL_GREATER is returned if source string is compared to be greater than target string in the u_strcoll() method.
|
|
Options for retrieving the rule string.
|
|
Creates a binary image of a collator. This binary image can be stored and later used to instantiate a collator using ucol_openBinary. This API supports preflighting.
|
|
Close a UCollator. Once closed, a UCollator should not be used. Every open collator should be closed. Otherwise, a memory leak will result.
|
|
Get a 31-bit identifier given a collator.
|
|
Determine how many locales have collation rules available. This function is most useful as determining the loop ending condition for calls to ucol_getAvailable.
|
|
Compare two strings for equality. This function is equivalent to ucol_strcoll == UCOL_EQUAL
|
|
Check whether two collators are equal. Collators are considered equal if they will sort strings the same. This means that both the current attributes and the rules must be equivalent. Currently used for RuleBasedCollator::operator==.
|
|
Reset UCA's static pointers. You don't want to use this, unless your static memory can go away.
|
|
Universal attribute getter.
|
|
Universal attribute getter that returns UCOL_DEFAULT if the value is default.
|
|
Get a locale for which collation rules are available. A UCollator in a locale returned by this function will perform the correct collation for the locale.
|
|
Produce a bound for a given sortkey and a number of levels.
Return value is always the number of bytes needed, regardless of whether the result buffer was big enough or even valid.
|
|
Get a set containing the contractions defined by the collator. The set includes both the UCA contractions and the contractions defined by the collator. This set will contain only strings. If a tailoring explicitly suppresses contractions from the UCA (like Russian), removed contractions will not be in the resulting set.
|
|
Get a set containing the expansions defined by the collator. The set includes both the UCA expansions and the expansions defined by the tailoring
|
|
Get the display name for a UCollator. The display name is suitable for presentation to a user.
|
|
Return the functionally equivalent locale for the given requested locale, with respect to given keyword, for the collation service. If two locales return the same result, then collators instantiated for these locales will behave equivalently. The converse is not always true; two collators may in fact be equivalent, but return different results, due to internal details. The return result has no other meaning than that stated above, and implies nothing as to the relationship between the two locales. This is intended for use by applications who wish to cache collators, or otherwise reuse collators when possible. The functional equivalent may change over time. For more information, please see the Locales and Services section of the ICU User Guide.
|
|
Create a string enumerator of all possible keywords that are relevant to collation. At this point, the only recognized keyword for this service is "collation".
|
|
Given a keyword, create a string enumeration of all values for that keyword that are currently in use.
|
|
gets the locale name of the collator. If the collator is instantiated from the rules, then this function returns NULL.
|
|
gets the locale name of the collator. If the collator is instantiated from the rules, then this function returns NULL.
|
|
Get the collation rules from a UCollator. The rules will follow the rule syntax.
|
|
Returns current rules. Delta defines whether full rules are returned or just the tailoring. Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough to store rules, will store up to available space.
|
|
Get the short definition string for a collator. This API harvests the collator's locale and the attribute set and produces a string that can be used for opening a collator with the same properties using the ucol_openFromShortString API. This string will be normalized. The structure and the syntax of the string is defined in the "Naming collators" section of the users guide: http://icu.sourceforge.net/userguide/Collate_Concepts.html#Naming_Collators This API supports preflighting.
|
|
Get a sort key for a string from a UCollator.
Sort keys may be compared using
|
|
Get the collation strength used in a UCollator. The strength influences how strings are compared.
|
|
Get an Unicode set that contains all the characters and sequences tailored in this collator. The result must be disposed of by using uset_close.
|
|
Gets the UCA version information for a Collator. Version is the UCA version number (3.1.1, 4.0).
|
|
Calculates the set of unsafe code points, given a collator. A character is unsafe if you could append any character and cause the ordering to alter significantly. Collation sorts in normalized order, so anything that rearranges in normalization can cause this. Thus if you have a character like a_umlaut, and you add a lower_dot to it, then it normalizes to a_lower_dot + umlaut, and sorts differently.
|
|
Gets the variable top value of a Collator. Lower 16 bits are undefined and should be ignored.
|
|
Gets the version information for a Collator. Version is currently an opaque 32-bit number which depends, among other things, on major versions of the collator tailoring and UCA.
|
|
Determine if one string is greater than another. This function is equivalent to ucol_strcoll == UCOL_GREATER
|
|
Determine if one string is greater than or equal to another. This function is equivalent to ucol_strcoll != UCOL_LESS
|
|
Calculate the short definition string given an identifier. Supports preflighting.
|
|
Merge two sort keys. The levels are merged with their corresponding counterparts (primaries with primaries, secondaries with secondaries etc.). Between the values from the same level a separator is inserted. example (uncompressed): 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00 will be merged as 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00 This allows for concatenating of first and last names for sorting, among other things. If the destination buffer is not big enough, the results are undefined. If any of source lengths are zero or any of source pointers are NULL/undefined, result is of size zero.
|
|
Gets the next count bytes of a sort key. Caller needs to preserve state array between calls and to provide the same type of UCharIterator set with the same string. The destination buffer provided must be big enough to store the number of requested bytes. Generated sortkey is not compatible with sortkeys generated using ucol_getSortKey API, since we don't do any compression. If uncompressed sortkeys are required, this API can be used.
|
|
Verifies and normalizes short definition string. Normalized short definition string has all the option sorted by the argument name, so that equivalent definition strings are the same. This API supports preflighting.
|
|
Open a UCollator for comparing strings. The UCollator pointer is used in all the calls to the Collation service. After finished, collator must be disposed of by calling ucol_close.
|
|
Create a string enumerator of all locales for which a valid collator may be opened.
|
|
Opens a collator from a collator binary image created using ucol_cloneBinary. Binary image used in instantiation of the collator remains owned by the user and should stay around for the lifetime of the collator. The API also takes a base collator which usualy should be UCA.
|
|
Open a collator given a 31-bit identifier.
|
|
Open a collator defined by a short form string. The structure and the syntax of the string is defined in the "Naming collators" section of the users guide: http://icu.sourceforge.net/userguide/Collate_Concepts.html#Naming_Collators Attributes are overriden by the subsequent attributes. So, for "S2_S3", final strength will be 3. 3066bis locale overrides individual locale parts. The call to this function is equivalent to a call to ucol_open, followed by a series of calls to ucol_setAttribute and ucol_setVariableTop.
|
|
Produce an UCollator instance according to the rules supplied. The rules are used to change the default ordering, defined in the UCA in a process called tailoring. The resulting UCollator pointer can be used in the same way as the one obtained by ucol_strcoll.
|
|
Touches all resources needed for instantiating a collator from a short string definition, thus filling up the cache.
|
|
Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits. Lower 16 bits are ignored.
|
|
Thread safe cloning operation. The result is a clone of a given collator.
|
|
Universal attribute setter.
|
|
Set the collation strength used in a UCollator. The strength influences how strings are compared.
|
|
Variable top is a two byte primary value which causes all the codepoints with primary values that are less or equal than the variable top to be shifted when alternate handling is set to UCOL_SHIFTED. Sets the variable top to a collation element value of a string supplied.
|
|
Calculate the identifier given a short definition string. Supports preflighting.
|
|
Compare two strings. The strings will be compared using the options already specified.
|
|
Compare two UTF-8 encoded trings. The strings will be compared using the options already specified.
|