#include "unicode/utypes.h"
#include "unicode/unorm.h"
#include "unicode/parseerr.h"
#include "unicode/uloc.h"
#include "unicode/ucoleitr.h"
Go to the source code of this file.
Defines | |
#define | U_COL_SAFECLONE_BUFFERSIZE 384 |
default memory size for the new clone | |
Typedefs | |
typedef collIterate | collIterate |
structure representing collation element iterator instance | |
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_ON_WITHOUT_HANGUL = 28, 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_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 More... | |
Functions | |
U_CAPI UCollator *U_EXPORT2 | ucol_open (const char *loc, UErrorCode *status) |
Open a UCollator for comparing strings. | |
U_CAPI UCollator *U_EXPORT2 | 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. | |
U_CAPI void U_EXPORT2 | ucol_close (UCollator *coll) |
Close a UCollator. | |
U_CAPI UCollationResult U_EXPORT2 | ucol_strcoll (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Compare two strings. | |
U_CAPI UBool U_EXPORT2 | 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. | |
U_CAPI UBool U_EXPORT2 | 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. | |
U_CAPI UBool U_EXPORT2 | ucol_equal (const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength) |
Compare two strings for equality. | |
U_CAPI UCollationStrength U_EXPORT2 | ucol_getStrength (const UCollator *coll) |
Get the collation strength used in a UCollator. | |
U_CAPI void U_EXPORT2 | ucol_setStrength (UCollator *coll, UCollationStrength strength) |
Set the collation strength used in a UCollator. | |
U_CAPI int32_t U_EXPORT2 | ucol_getDisplayName (const char *objLoc, const char *dispLoc, UChar *result, int32_t resultLength, UErrorCode *status) |
Get the display name for a UCollator. | |
U_CAPI const char *U_EXPORT2 | ucol_getAvailable (int32_t index) |
Get a locale for which collation rules are available. | |
U_CAPI int32_t U_EXPORT2 | ucol_countAvailable (void) |
Determine how many locales have collation rules available. | |
U_CAPI const UChar *U_EXPORT2 | ucol_getRules (const UCollator *coll, int32_t *length) |
Get the collation rules from a UCollator. | |
U_CAPI int32_t U_EXPORT2 | 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. | |
U_CAPI int32_t U_EXPORT2 | 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. | |
U_CAPI void U_EXPORT2 | ucol_getVersion (const UCollator *coll, UVersionInfo info) |
Gets the version information for a Collator. | |
U_CAPI int32_t U_EXPORT2 | 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. | |
U_CAPI void U_EXPORT2 | ucol_setAttribute (UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status) |
Universal attribute setter. | |
U_CAPI UColAttributeValue U_EXPORT2 | ucol_getAttribute (const UCollator *coll, UColAttribute attr, UErrorCode *status) |
Universal attribute getter. | |
U_CAPI uint32_t U_EXPORT2 | 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. | |
U_CAPI uint32_t | ucol_getVariableTop (const UCollator *coll, UErrorCode *status) |
Gets the variable top value of a Collator. | |
U_CAPI void U_EXPORT2 | ucol_restoreVariableTop (UCollator *coll, const uint32_t varTop, UErrorCode *status) |
Sets the variable top to a collation element value supplied. | |
U_CAPI UCollator *U_EXPORT2 | ucol_safeClone (const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status) |
Thread safe cloning operation. | |
U_CAPI int32_t U_EXPORT2 | ucol_getRulesEx (const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen) |
Returns current rules. | |
U_CAPI UCollator *U_EXPORT2 | ucol_openVersion (const char *loc, UVersionInfo version, UErrorCode *status) |
Open a UCollator with a specific version. | |
U_CAPI UNormalizationMode U_EXPORT2 | ucol_getNormalization (const UCollator *coll) |
Get the normalization mode used in a UCollator. | |
U_CAPI void U_EXPORT2 | ucol_setNormalization (UCollator *coll, UNormalizationMode mode) |
Set the normalization mode used in a UCollator. | |
U_CAPI const char *U_EXPORT2 | ucol_getLocale (const UCollator *coll, ULocDataLocaleType type, UErrorCode *status) |
gets the locale name of the collator. |
The C API for Collator performs locale-sensitive string comparison. You use this class 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.
|
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. |
|
|
Enum containing attribute values for controling collation behavior.
|
|
enum that is taken by ucol_getBound API
|
|
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.
|
|
Close a UCollator. Once closed, a UCollator should not be used. Every open collator should be closed. Otherwise, a memory leak will result.
|
|
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
|
|
Universal attribute getter.
|
|
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 the display name for a UCollator. The display name is suitable for presentation to a user.
|
|
gets the locale name of the collator. If the collator is instantiated from the rules, then this function returns NULL.
|
|
Get the normalization mode used in a UCollator. The normalization mode influences how strings are compared.
|
|
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 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.
|
|
Gets the variable top value of a Collator. Lower 16 bits are undefined and should be ignored.
|
|
Gets the version information for a Collator.
|
|
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
|
|
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.
|
|
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}.
|
|
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}.
|
|
Open a UCollator with a specific version. This is the same as ucol_open() except that ucol_getVersion() of the returned object is guaranteed to be the same as the version parameter. This is designed to be used to open the same collator for a given locale even when ICU is updated. The same locale and version guarantees the same sort keys and comparison results.
|
|
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 normalization mode used in a UCollator. The normalization mode influences how strings are compared.
|
|
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.
|
|
Compare two strings. The strings will be compared using the options already specified.
|