1999-12-28 23:57:50 +00:00
|
|
|
|
/*
|
|
|
|
|
*******************************************************************************
|
2003-05-01 01:51:51 +00:00
|
|
|
|
* Copyright (c) 1996-2003, International Business Machines Corporation and others.
|
2001-08-16 00:55:51 +00:00
|
|
|
|
* All Rights Reserved.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef UCOL_H
|
|
|
|
|
#define UCOL_H
|
|
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
2002-09-20 01:54:48 +00:00
|
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_COLLATION
|
|
|
|
|
|
2000-12-06 00:53:48 +00:00
|
|
|
|
#include "unicode/unorm.h"
|
2001-08-16 00:55:51 +00:00
|
|
|
|
#include "unicode/parseerr.h"
|
2002-03-13 05:48:25 +00:00
|
|
|
|
#include "unicode/uloc.h"
|
2002-09-04 06:08:04 +00:00
|
|
|
|
#include "unicode/uset.h"
|
2001-01-15 19:02:30 +00:00
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
/**
|
2000-12-08 18:46:55 +00:00
|
|
|
|
* \file
|
2000-12-15 04:02:27 +00:00
|
|
|
|
* \brief C API: Collator
|
2000-12-08 18:46:55 +00:00
|
|
|
|
*
|
|
|
|
|
* <h2> Collator C API </h2>
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*
|
|
|
|
|
* The C API for Collator performs locale-sensitive
|
2002-07-26 18:46:43 +00:00
|
|
|
|
* string comparison. You use this service to build
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* searching and sorting routines for natural language text.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* <em>Important: </em>The ICU collation service has been reimplemented
|
|
|
|
|
* in order to achieve better performance and UCA compliance.
|
|
|
|
|
* For details, see the
|
|
|
|
|
* <a href="http://oss.software.ibm.com/cvs/icu/~checkout~/icuhtml/design/collation/ICU_collation_design.htm">
|
|
|
|
|
* collation design document</a>.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* <p>
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* For more information about the collation service see
|
|
|
|
|
* <a href="http://oss.software.ibm.com/icu/userguide/Collate_Intro.html">the users guide</a>.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* <p>
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* 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 <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* <p>
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* Sort ordering may be customized by providing your own set of rules. For more on
|
|
|
|
|
* this subject see the
|
|
|
|
|
* <a href="http://oss.software.ibm.com/icu/userguide/Collate_Customization.html">
|
|
|
|
|
* Collation customization</a> section of the users guide.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* <p>
|
|
|
|
|
* @see UCollationResult
|
|
|
|
|
* @see UNormalizationMode
|
2002-07-26 18:46:43 +00:00
|
|
|
|
* @see UCollationStrength
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @see UCollationElements
|
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
|
|
|
|
|
|
/** A collation element iterator.
|
|
|
|
|
* For usage in C programs.
|
|
|
|
|
*/
|
2000-12-14 01:11:11 +00:00
|
|
|
|
struct collIterate;
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** structure representing collation element iterator instance
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2000-12-14 01:11:11 +00:00
|
|
|
|
typedef struct collIterate collIterate;
|
|
|
|
|
|
2001-01-15 19:02:30 +00:00
|
|
|
|
/** A collator.
|
|
|
|
|
* For usage in C programs.
|
|
|
|
|
*/
|
2001-01-15 07:28:54 +00:00
|
|
|
|
struct UCollator;
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** structure representing a collator object instance
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2001-01-15 07:28:54 +00:00
|
|
|
|
typedef struct UCollator UCollator;
|
2001-01-04 00:45:41 +00:00
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
* @see u_strcoll()
|
|
|
|
|
* <p>
|
2002-12-11 23:57:33 +00:00
|
|
|
|
* Possible values for a comparison result
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2000-12-06 00:53:48 +00:00
|
|
|
|
typedef enum {
|
1999-12-28 23:57:50 +00:00
|
|
|
|
/** string a == string b */
|
|
|
|
|
UCOL_EQUAL = 0,
|
|
|
|
|
/** string a > string b */
|
|
|
|
|
UCOL_GREATER = 1,
|
|
|
|
|
/** string a < string b */
|
|
|
|
|
UCOL_LESS = -1
|
2000-12-06 00:53:48 +00:00
|
|
|
|
} UCollationResult ;
|
2000-11-29 04:02:53 +00:00
|
|
|
|
|
|
|
|
|
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** 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
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2000-11-29 04:02:53 +00:00
|
|
|
|
typedef enum {
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** accepted by most attributes */
|
2000-11-29 04:02:53 +00:00
|
|
|
|
UCOL_DEFAULT = -1,
|
2000-12-06 00:53:48 +00:00
|
|
|
|
|
2000-11-30 23:20:14 +00:00
|
|
|
|
/** Primary collation strength */
|
|
|
|
|
UCOL_PRIMARY = 0,
|
|
|
|
|
/** Secondary collation strength */
|
|
|
|
|
UCOL_SECONDARY = 1,
|
|
|
|
|
/** Tertiary collation strength */
|
|
|
|
|
UCOL_TERTIARY = 2,
|
2000-12-06 00:53:48 +00:00
|
|
|
|
/** Default collation strength */
|
2000-11-30 23:20:14 +00:00
|
|
|
|
UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
|
2001-02-21 17:45:06 +00:00
|
|
|
|
UCOL_CE_STRENGTH_LIMIT,
|
2000-11-30 23:20:14 +00:00
|
|
|
|
/** Quaternary collation strength */
|
|
|
|
|
UCOL_QUATERNARY=3,
|
|
|
|
|
/** Identical collation strength */
|
|
|
|
|
UCOL_IDENTICAL=15,
|
2001-02-21 17:45:06 +00:00
|
|
|
|
UCOL_STRENGTH_LIMIT,
|
2000-11-30 23:20:14 +00:00
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Turn the feature off - works for UCOL_FRENCH_COLLATION,
|
|
|
|
|
UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
|
|
|
|
|
& UCOL_DECOMPOSITION_MODE*/
|
2000-11-30 23:20:14 +00:00
|
|
|
|
UCOL_OFF = 16,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Turn the feature on - works for UCOL_FRENCH_COLLATION,
|
|
|
|
|
UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
|
|
|
|
|
& UCOL_DECOMPOSITION_MODE*/
|
2000-11-30 23:20:14 +00:00
|
|
|
|
UCOL_ON = 17,
|
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
|
2000-12-06 00:53:48 +00:00
|
|
|
|
UCOL_SHIFTED = 20,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
|
2000-12-06 00:53:48 +00:00
|
|
|
|
UCOL_NON_IGNORABLE = 21,
|
2000-11-30 23:20:14 +00:00
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Valid for UCOL_CASE_FIRST -
|
|
|
|
|
lower case sorts before upper case */
|
2000-12-06 00:53:48 +00:00
|
|
|
|
UCOL_LOWER_FIRST = 24,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** upper case sorts before lower case */
|
2000-12-06 00:53:48 +00:00
|
|
|
|
UCOL_UPPER_FIRST = 25,
|
2000-11-30 23:20:14 +00:00
|
|
|
|
|
2000-11-29 04:02:53 +00:00
|
|
|
|
UCOL_ATTRIBUTE_VALUE_COUNT
|
2000-11-30 23:20:14 +00:00
|
|
|
|
|
2000-11-29 04:02:53 +00:00
|
|
|
|
} UColAttributeValue;
|
|
|
|
|
|
2002-07-26 18:46:43 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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, "<EFBFBD>" >> "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, "<EFBFBD>" == "<EFBFBD>".
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
2002-12-11 23:57:33 +00:00
|
|
|
|
* @stable ICU 2.0
|
2002-07-26 18:46:43 +00:00
|
|
|
|
**/
|
2000-11-29 04:02:53 +00:00
|
|
|
|
typedef UColAttributeValue UCollationStrength;
|
2000-11-29 00:16:15 +00:00
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
|
2002-12-11 23:57:33 +00:00
|
|
|
|
* value, as well as the values specific to each one.
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2000-11-29 04:02:53 +00:00
|
|
|
|
typedef enum {
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** Attribute for direction of secondary weights - used in French.\
|
|
|
|
|
* Acceptable values are UCOL_ON, which results in secondary weights
|
|
|
|
|
* being considered backwards and UCOL_OFF which treats secondary
|
|
|
|
|
* weights in the order they appear.*/
|
|
|
|
|
UCOL_FRENCH_COLLATION,
|
|
|
|
|
/** Attribute for handling variable elements.\
|
|
|
|
|
* Acceptable values are UCOL_NON_IGNORABLE (default)
|
|
|
|
|
* which treats all the codepoints with non-ignorable
|
|
|
|
|
* primary weights in the same way,
|
|
|
|
|
* and UCOL_SHIFTED which causes codepoints with primary
|
|
|
|
|
* weights that are equal or below the variable top value
|
|
|
|
|
* to be ignored on primary level and moved to the quaternary
|
|
|
|
|
* level.*/
|
|
|
|
|
UCOL_ALTERNATE_HANDLING,
|
|
|
|
|
/** Controls the ordering of upper and lower case letters.\
|
|
|
|
|
* Acceptable values are UCOL_OFF (default), which orders
|
|
|
|
|
* upper and lower case letters in accordance to their tertiary
|
|
|
|
|
* weights, UCOL_UPPER_FIRST which forces upper case letters to
|
|
|
|
|
* sort before lower case letters, and UCOL_LOWER_FIRST which does
|
|
|
|
|
* the opposite. */
|
|
|
|
|
UCOL_CASE_FIRST,
|
|
|
|
|
/** Controls whether an extra case level (positioned before the third
|
|
|
|
|
* level) is generated or not.\ Acceptable values are UCOL_OFF (default),
|
|
|
|
|
* when case level is not generated, and UCOL_ON which causes the case
|
|
|
|
|
* level to be generated.\ Contents of the case level are affected by
|
|
|
|
|
* the value of UCOL_CASE_FIRST attribute.\ A simple way to ignore
|
|
|
|
|
* accent differences in a string is to set the strength to UCOL_PRIMARY
|
|
|
|
|
* and enable case level. */
|
|
|
|
|
UCOL_CASE_LEVEL,
|
|
|
|
|
/** Controls whether the normalization check and necessary normalizations
|
|
|
|
|
* are performed.\ When set to UCOL_OFF (default) no normalization check
|
|
|
|
|
* is performed.\ The correctness of the result is guaranteed only if the
|
|
|
|
|
* input data is in so-called FCD form (see users manual for more info).\
|
|
|
|
|
* When set to UCOL_ON, an incremental check is performed to see whether the input data
|
|
|
|
|
* is in the FCD form.\ If the data is not in the FCD form, incremental
|
|
|
|
|
* NFD normalization is performed. */
|
|
|
|
|
UCOL_NORMALIZATION_MODE,
|
|
|
|
|
/** An alias for UCOL_NORMALIZATION_MODE attribute */
|
2001-05-02 05:09:40 +00:00
|
|
|
|
UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** The strength attribute.\ Can be either UCOL_PRIMARY, UCOL_SECONDARY,
|
|
|
|
|
* UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL.\ The usual strength
|
|
|
|
|
* for most locales (except Japanese) is tertiary.\ Quaternary strength
|
|
|
|
|
* is useful when combined with shifted setting for alternate handling
|
|
|
|
|
* attribute and for JIS x 4061 collation, when it is used to distinguish
|
|
|
|
|
* between Katakana and Hiragana (this is achieved by setting the
|
|
|
|
|
* UCOL_HIRAGANA_QUATERNARY mode to on.\ Otherwise, quaternary level
|
|
|
|
|
* is affected only by the number of non ignorable code points in
|
|
|
|
|
* the string.\ Identical strength is rarely useful, as it amounts
|
|
|
|
|
* to codepoints of the NFD form of the string. */
|
|
|
|
|
UCOL_STRENGTH,
|
|
|
|
|
/** when turned on, this attribute
|
|
|
|
|
* positions Hiragana before all
|
|
|
|
|
* non-ignorables on quaternary level
|
|
|
|
|
* This is a sneaky way to produce JIS
|
|
|
|
|
* sort order */
|
2003-07-25 05:31:54 +00:00
|
|
|
|
UCOL_HIRAGANA_QUATERNARY_MODE,
|
|
|
|
|
/** when turned on, this attribute
|
|
|
|
|
* generates a collation key
|
|
|
|
|
* for the numeric value of substrings
|
|
|
|
|
* of digits. This is a way to get '100'
|
|
|
|
|
* to sort AFTER '2'.*/
|
|
|
|
|
UCOL_NUMERIC_COLLATION,
|
2000-11-29 00:16:15 +00:00
|
|
|
|
UCOL_ATTRIBUTE_COUNT
|
2000-11-29 04:02:53 +00:00
|
|
|
|
} UColAttribute;
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** Options for retrieving the rule string
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2000-12-14 01:11:11 +00:00
|
|
|
|
typedef enum {
|
2002-07-26 18:46:43 +00:00
|
|
|
|
/** Retrieve tailoring only */
|
|
|
|
|
UCOL_TAILORING_ONLY,
|
|
|
|
|
/** Retrieve UCA rules and tailoring */
|
|
|
|
|
UCOL_FULL_RULES
|
|
|
|
|
} UColRuleOption ;
|
2000-12-14 01:11:11 +00:00
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
/**
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* Open a UCollator for comparing strings.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* The UCollator pointer is used in all the calls to the Collation
|
|
|
|
|
* service. After finished, collator must be disposed of by calling
|
|
|
|
|
* \Ref{ucol_close}.
|
|
|
|
|
* @param loc The locale containing the required collation rules.
|
2002-07-26 18:46:43 +00:00
|
|
|
|
* Special values for locales can be passed in -
|
|
|
|
|
* if NULL is passed for the locale, the default locale
|
|
|
|
|
* collation rules will be used. If empty string ("") or
|
|
|
|
|
* "root" are passed, UCA rules will be used.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param status A pointer to an UErrorCode to receive any errors
|
|
|
|
|
* @return A pointer to a UCollator, or 0 if an error occurred.
|
|
|
|
|
* @see ucol_openRules
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_safeClone
|
|
|
|
|
* @see ucol_close
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UCollator* U_EXPORT2
|
2001-11-17 02:01:44 +00:00
|
|
|
|
ucol_open(const char *loc, UErrorCode *status);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* 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 \Ref{ucol_strcoll}.
|
|
|
|
|
* @param rules A string describing the collation rules. For the syntax
|
|
|
|
|
* of the rules please see users guide.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param rulesLength The length of rules, or -1 if null-terminated.
|
2001-09-22 01:02:01 +00:00
|
|
|
|
* @param normalizationMode The normalization mode: One of
|
|
|
|
|
* UCOL_OFF (expect the text to not need normalization),
|
|
|
|
|
* UCOL_ON (normalize), or
|
|
|
|
|
* UCOL_DEFAULT (set the mode according to the rules)
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
|
|
|
|
|
* UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
|
2001-08-16 00:55:51 +00:00
|
|
|
|
* @param parseError A pointer to UParseError to recieve information about errors
|
2001-11-14 21:55:21 +00:00
|
|
|
|
* occurred during parsing. This argument can currently be set
|
|
|
|
|
* to NULL, but at users own risk. Please provide a real structure.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @param status A pointer to an UErrorCode to receive any errors
|
|
|
|
|
* @return A pointer to a UCollator.\ It is not guaranteed that NULL be returned in case
|
|
|
|
|
* of error - please use status argument to check for errors.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @see ucol_open
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_safeClone
|
|
|
|
|
* @see ucol_close
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UCollator* U_EXPORT2
|
2001-08-16 00:55:51 +00:00
|
|
|
|
ucol_openRules( const UChar *rules,
|
|
|
|
|
int32_t rulesLength,
|
2001-09-22 01:02:01 +00:00
|
|
|
|
UColAttributeValue normalizationMode,
|
2001-08-16 00:55:51 +00:00
|
|
|
|
UCollationStrength strength,
|
|
|
|
|
UParseError *parseError,
|
|
|
|
|
UErrorCode *status);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Close a UCollator.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* Once closed, a UCollator should not be used.\ Every open collator should
|
|
|
|
|
* be closed.\ Otherwise, a memory leak will result.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator to close.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_open
|
|
|
|
|
* @see ucol_openRules
|
|
|
|
|
* @see ucol_safeClone
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI void U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_close(UCollator *coll);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Compare two strings.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* The strings will be compared using the options already specified.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param source The source string.
|
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
|
|
|
|
* @param target The target string.
|
|
|
|
|
* @param targetLength The length of target, or -1 if null-terminated.
|
|
|
|
|
* @return The result of comparing the strings; one of UCOL_EQUAL,
|
|
|
|
|
* UCOL_GREATER, UCOL_LESS
|
|
|
|
|
* @see ucol_greater
|
|
|
|
|
* @see ucol_greaterOrEqual
|
|
|
|
|
* @see ucol_equal
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UCollationResult U_EXPORT2
|
2001-01-15 07:28:54 +00:00
|
|
|
|
ucol_strcoll( const UCollator *coll,
|
2001-01-04 00:45:41 +00:00
|
|
|
|
const UChar *source,
|
|
|
|
|
int32_t sourceLength,
|
|
|
|
|
const UChar *target,
|
|
|
|
|
int32_t targetLength);
|
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* Determine if one string is greater than another.
|
|
|
|
|
* This function is equivalent to \Ref{ucol_strcoll} == UCOL_GREATER
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param source The source string.
|
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
|
|
|
|
* @param target The target string.
|
|
|
|
|
* @param targetLength The length of target, or -1 if null-terminated.
|
|
|
|
|
* @return TRUE if source is greater than target, FALSE otherwise.
|
|
|
|
|
* @see ucol_strcoll
|
|
|
|
|
* @see ucol_greaterOrEqual
|
|
|
|
|
* @see ucol_equal
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UBool U_EXPORT2
|
2001-11-17 02:01:44 +00:00
|
|
|
|
ucol_greater(const UCollator *coll,
|
|
|
|
|
const UChar *source, int32_t sourceLength,
|
|
|
|
|
const UChar *target, int32_t targetLength);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine if one string is greater than or equal to another.
|
|
|
|
|
* This function is equivalent to \Ref{ucol_strcoll} != UCOL_LESS
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param source The source string.
|
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
|
|
|
|
* @param target The target string.
|
|
|
|
|
* @param targetLength The length of target, or -1 if null-terminated.
|
|
|
|
|
* @return TRUE if source is greater than or equal to target, FALSE otherwise.
|
|
|
|
|
* @see ucol_strcoll
|
|
|
|
|
* @see ucol_greater
|
|
|
|
|
* @see ucol_equal
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UBool U_EXPORT2
|
2001-11-17 02:01:44 +00:00
|
|
|
|
ucol_greaterOrEqual(const UCollator *coll,
|
|
|
|
|
const UChar *source, int32_t sourceLength,
|
|
|
|
|
const UChar *target, int32_t targetLength);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Compare two strings for equality.
|
|
|
|
|
* This function is equivalent to \Ref{ucol_strcoll} == UCOL_EQUAL
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param source The source string.
|
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
|
|
|
|
* @param target The target string.
|
|
|
|
|
* @param targetLength The length of target, or -1 if null-terminated.
|
|
|
|
|
* @return TRUE if source is equal to target, FALSE otherwise
|
|
|
|
|
* @see ucol_strcoll
|
|
|
|
|
* @see ucol_greater
|
|
|
|
|
* @see ucol_greaterOrEqual
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UBool U_EXPORT2
|
2001-11-17 02:01:44 +00:00
|
|
|
|
ucol_equal(const UCollator *coll,
|
|
|
|
|
const UChar *source, int32_t sourceLength,
|
|
|
|
|
const UChar *target, int32_t targetLength);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
2003-01-20 07:42:28 +00:00
|
|
|
|
/**
|
|
|
|
|
* Compare two UTF-8 encoded trings.
|
|
|
|
|
* The strings will be compared using the options already specified.
|
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
2003-05-12 21:09:11 +00:00
|
|
|
|
* @param sIter The source string iterator.
|
|
|
|
|
* @param tIter The target string iterator.
|
2003-01-20 07:42:28 +00:00
|
|
|
|
* @return The result of comparing the strings; one of UCOL_EQUAL,
|
|
|
|
|
* UCOL_GREATER, UCOL_LESS
|
2003-05-12 21:09:11 +00:00
|
|
|
|
* @param status A pointer to an UErrorCode to receive any errors
|
2003-01-20 07:42:28 +00:00
|
|
|
|
* @see ucol_strcoll
|
|
|
|
|
* @draft ICU 2.6
|
|
|
|
|
*/
|
|
|
|
|
U_CAPI UCollationResult U_EXPORT2
|
|
|
|
|
ucol_strcollIter( const UCollator *coll,
|
|
|
|
|
UCharIterator *sIter,
|
|
|
|
|
UCharIterator *tIter,
|
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* Get the collation strength used in a UCollator.
|
|
|
|
|
* The strength influences how strings are compared.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator to query.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @see ucol_setStrength
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UCollationStrength U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_getStrength(const UCollator *coll);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the collation strength used in a UCollator.
|
|
|
|
|
* The strength influences how strings are compared.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator to set.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param strength The desired collation strength; one of UCOL_PRIMARY,
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @see ucol_getStrength
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI void U_EXPORT2
|
2001-11-17 02:01:44 +00:00
|
|
|
|
ucol_setStrength(UCollator *coll,
|
|
|
|
|
UCollationStrength strength);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the display name for a UCollator.
|
|
|
|
|
* The display name is suitable for presentation to a user.
|
|
|
|
|
* @param objLoc The locale of the collator in question.
|
|
|
|
|
* @param dispLoc The locale for display.
|
|
|
|
|
* @param result A pointer to a buffer to receive the attribute.
|
|
|
|
|
* @param resultLength The maximum size of result.
|
|
|
|
|
* @param status A pointer to an UErrorCode to receive any errors
|
|
|
|
|
* @return The total buffer size needed; if greater than resultLength,
|
|
|
|
|
* the output was truncated.
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_getDisplayName( const char *objLoc,
|
|
|
|
|
const char *dispLoc,
|
|
|
|
|
UChar *result,
|
|
|
|
|
int32_t resultLength,
|
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
* @param index The index of the desired locale.
|
|
|
|
|
* @return A locale for which collation rules are available, or 0 if none.
|
|
|
|
|
* @see ucol_countAvailable
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI const char* U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_getAvailable(int32_t index);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Determine how many locales have collation rules available.
|
|
|
|
|
* This function is most useful as determining the loop ending condition for
|
|
|
|
|
* calls to \Ref{ucol_getAvailable}.
|
|
|
|
|
* @return The number of locales for which collation rules are available.
|
|
|
|
|
* @see ucol_getAvailable
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_countAvailable(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the collation rules from a UCollator.
|
|
|
|
|
* The rules will follow the rule syntax.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator to query.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param length
|
|
|
|
|
* @return The collation rules.
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI const UChar* U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_getRules( const UCollator *coll,
|
|
|
|
|
int32_t *length);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a sort key for a string from a UCollator.
|
2000-12-15 19:18:27 +00:00
|
|
|
|
* Sort keys may be compared using <TT>strcmp</TT>.
|
2001-03-13 07:29:58 +00:00
|
|
|
|
* @param coll The UCollator containing the collation rules.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param source The string to transform.
|
2003-05-12 21:09:11 +00:00
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
* @param result A pointer to a buffer to receive the attribute.
|
|
|
|
|
* @param resultLength The maximum size of result.
|
|
|
|
|
* @return The size needed to fully store the sort key..
|
|
|
|
|
* @see ucol_keyHashCode
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
|
ucol_getSortKey(const UCollator *coll,
|
2000-11-07 00:00:17 +00:00
|
|
|
|
const UChar *source,
|
|
|
|
|
int32_t sourceLength,
|
|
|
|
|
uint8_t *result,
|
|
|
|
|
int32_t resultLength);
|
|
|
|
|
|
2003-01-23 01:52:34 +00:00
|
|
|
|
|
|
|
|
|
/** 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
|
2003-03-25 18:23:32 +00:00
|
|
|
|
* the number of requested bytes. Generated sortkey is not
|
|
|
|
|
* compatible with sortkeys generated using ucol_getSortKey
|
2003-05-07 05:33:50 +00:00
|
|
|
|
* API, since we don't do any compression. If uncompressed
|
|
|
|
|
* sortkeys are required, this API can be used.
|
2003-01-23 01:52:34 +00:00
|
|
|
|
* @param coll The UCollator containing the collation rules.
|
|
|
|
|
* @param iter UCharIterator containing the string we need
|
|
|
|
|
* the sort key to be calculated for.
|
|
|
|
|
* @param state Opaque state of sortkey iteration.
|
|
|
|
|
* @param dest Buffer to hold the resulting sortkey part
|
|
|
|
|
* @param count number of sort key bytes required.
|
|
|
|
|
* @param status error code indicator.
|
|
|
|
|
* @return the actual number of bytes of a sortkey. It can be
|
|
|
|
|
* smaller than count if we have reached the end of
|
|
|
|
|
* the sort key.
|
2003-06-11 03:57:32 +00:00
|
|
|
|
* @draft ICU 2.6
|
2003-01-23 01:52:34 +00:00
|
|
|
|
*/
|
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
2003-03-27 20:09:38 +00:00
|
|
|
|
ucol_nextSortKeyPart(const UCollator *coll,
|
2003-01-23 01:52:34 +00:00
|
|
|
|
UCharIterator *iter,
|
|
|
|
|
uint32_t state[2],
|
|
|
|
|
uint8_t *dest, int32_t count,
|
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** 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
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2002-01-24 23:02:02 +00:00
|
|
|
|
typedef enum {
|
|
|
|
|
/** lower bound */
|
|
|
|
|
UCOL_BOUND_LOWER = 0,
|
|
|
|
|
/** upper bound that will match strings of exact size */
|
|
|
|
|
UCOL_BOUND_UPPER = 1,
|
|
|
|
|
/** upper bound that will match all the strings that have the same initial substring as the given string */
|
|
|
|
|
UCOL_BOUND_UPPER_LONG = 2,
|
|
|
|
|
UCOL_BOUND_VALUE_COUNT
|
|
|
|
|
} UColBoundMode;
|
2002-01-21 23:54:34 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2002-01-24 23:02:02 +00:00
|
|
|
|
* Produce a bound for a given sortkey and a number of levels.
|
2002-01-21 23:54:34 +00:00
|
|
|
|
* Return value is always the number of bytes needed, regardless of
|
2002-01-24 23:02:02 +00:00
|
|
|
|
* whether the result buffer was big enough or even valid.<br>
|
|
|
|
|
* Resulting bounds can be used to produce a range of strings that are
|
|
|
|
|
* between upper and lower bounds. For example, if bounds are produced
|
|
|
|
|
* for a sortkey of string "smith", strings between upper and lower
|
|
|
|
|
* bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
|
|
|
|
|
* There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
|
|
|
|
|
* is produced, strings matched would be as above. However, if bound
|
|
|
|
|
* produced using UCOL_BOUND_UPPER_LONG is used, the above example will
|
|
|
|
|
* also match "Smithsonian" and similar.<br>
|
|
|
|
|
* For more on usage, see example in cintltst/capitst.c in procedure
|
|
|
|
|
* TestBounds.
|
2002-01-21 23:54:34 +00:00
|
|
|
|
* Sort keys may be compared using <TT>strcmp</TT>.
|
|
|
|
|
* @param source The source sortkey.
|
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
2002-01-24 23:02:02 +00:00
|
|
|
|
* (If an unmodified sortkey is passed, it is always null
|
|
|
|
|
* terminated).
|
|
|
|
|
* @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
|
|
|
|
|
* produces a lower inclusive bound, UCOL_BOUND_UPPER, that
|
|
|
|
|
* produces upper bound that matches strings of the same length
|
|
|
|
|
* or UCOL_BOUND_UPPER_LONG that matches strings that have the
|
|
|
|
|
* same starting substring as the source string.
|
|
|
|
|
* @param noOfLevels Number of levels required in the resulting bound (for most
|
|
|
|
|
* uses, the recommended value is 1). See users guide for
|
|
|
|
|
* explanation on number of levels a sortkey can have.
|
2002-01-21 23:54:34 +00:00
|
|
|
|
* @param result A pointer to a buffer to receive the resulting sortkey.
|
|
|
|
|
* @param resultLength The maximum size of result.
|
2002-01-24 23:02:02 +00:00
|
|
|
|
* @param status Used for returning error code if something went wrong. If the
|
|
|
|
|
* number of levels requested is higher than the number of levels
|
|
|
|
|
* in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
|
|
|
|
|
* issued.
|
|
|
|
|
* @return The size needed to fully store the bound.
|
2002-01-21 23:54:34 +00:00
|
|
|
|
* @see ucol_keyHashCode
|
2003-06-04 00:04:35 +00:00
|
|
|
|
* @stable ICU 2.1
|
2002-01-21 23:54:34 +00:00
|
|
|
|
*/
|
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
2002-01-24 23:02:02 +00:00
|
|
|
|
ucol_getBound(const uint8_t *source,
|
2002-01-21 23:54:34 +00:00
|
|
|
|
int32_t sourceLength,
|
2002-01-24 23:02:02 +00:00
|
|
|
|
UColBoundMode boundType,
|
|
|
|
|
uint32_t noOfLevels,
|
2002-01-21 23:54:34 +00:00
|
|
|
|
uint8_t *result,
|
|
|
|
|
int32_t resultLength,
|
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
2000-05-15 19:48:26 +00:00
|
|
|
|
/**
|
2003-05-28 23:04:30 +00:00
|
|
|
|
* 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.
|
2002-07-01 11:04:45 +00:00
|
|
|
|
* @param coll The UCollator to query.
|
2000-05-15 19:48:26 +00:00
|
|
|
|
* @param info the version # information, the result will be filled in
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2000-05-15 19:48:26 +00:00
|
|
|
|
*/
|
|
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
|
ucol_getVersion(const UCollator* coll, UVersionInfo info);
|
|
|
|
|
|
2003-11-12 04:17:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* Gets the UCA version information for a Collator. Version is the
|
|
|
|
|
* UCA version number (3.1.1, 4.0).
|
|
|
|
|
* @param coll The UCollator to query.
|
|
|
|
|
* @param info the version # information, the result will be filled in
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
|
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
|
ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
|
2000-05-18 21:25:51 +00:00
|
|
|
|
|
2001-11-13 22:55:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
2003-05-09 20:10:44 +00:00
|
|
|
|
* If any of source lengths are zero or any of source pointers are NULL/undefined,
|
|
|
|
|
* result is of size zero.
|
2001-11-13 22:55:57 +00:00
|
|
|
|
* @param src1 pointer to the first sortkey
|
|
|
|
|
* @param src1Length length of the first sortkey
|
|
|
|
|
* @param src2 pointer to the second sortkey
|
|
|
|
|
* @param src2Length length of the second sortkey
|
|
|
|
|
* @param dest buffer to hold the result
|
|
|
|
|
* @param destCapacity size of the buffer for the result
|
|
|
|
|
* @return size of the result. If the buffer is big enough size is always
|
|
|
|
|
* src1Length+src2Length-1
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:55:57 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
2001-11-13 22:55:57 +00:00
|
|
|
|
ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
|
|
|
|
|
const uint8_t *src2, int32_t src2Length,
|
|
|
|
|
uint8_t *dest, int32_t destCapacity);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Universal attribute setter
|
|
|
|
|
* @param coll collator which attributes are to be changed
|
|
|
|
|
* @param attr attribute type
|
|
|
|
|
* @param value attribute value
|
|
|
|
|
* @param status to indicate whether the operation went on smoothly or there were errors
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see UColAttribute
|
|
|
|
|
* @see UColAttributeValue
|
|
|
|
|
* @see ucol_getAttribute
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2000-11-17 23:32:32 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
|
ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Universal attribute getter
|
|
|
|
|
* @param coll collator which attributes are to be changed
|
|
|
|
|
* @param attr attribute type
|
|
|
|
|
* @return attribute value
|
|
|
|
|
* @param status to indicate whether the operation went on smoothly or there were errors
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see UColAttribute
|
|
|
|
|
* @see UColAttributeValue
|
|
|
|
|
* @see ucol_setAttribute
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2000-11-17 23:32:32 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UColAttributeValue U_EXPORT2
|
|
|
|
|
ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
|
2001-11-17 02:01:44 +00:00
|
|
|
|
/** 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.
|
2001-06-26 22:24:10 +00:00
|
|
|
|
* Sets the variable top to a collation element value of a string supplied.
|
|
|
|
|
* @param coll collator which variable top needs to be changed
|
|
|
|
|
* @param varTop one or more (if contraction) UChars to which the variable top should be set
|
|
|
|
|
* @param len length of variable top string. If -1 it is considered to be zero terminated.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @param status error code. If error code is set, the return value is undefined.
|
|
|
|
|
* Errors set by this function are: <br>
|
|
|
|
|
* U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such
|
|
|
|
|
* a contraction<br>
|
2001-06-26 22:24:10 +00:00
|
|
|
|
* U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @return a 32 bit value containing the value of the variable top in upper 16 bits.
|
|
|
|
|
* Lower 16 bits are undefined
|
|
|
|
|
* @see ucol_getVariableTop
|
|
|
|
|
* @see ucol_restoreVariableTop
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2001-06-26 22:24:10 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI uint32_t U_EXPORT2
|
|
|
|
|
ucol_setVariableTop(UCollator *coll,
|
2002-04-02 02:55:31 +00:00
|
|
|
|
const UChar *varTop, int32_t len,
|
|
|
|
|
UErrorCode *status);
|
2001-06-26 22:24:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the variable top value of a Collator.
|
|
|
|
|
* Lower 16 bits are undefined and should be ignored.
|
|
|
|
|
* @param coll collator which variable top needs to be retrieved
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @param status error code (not changed by function). If error code is set,
|
|
|
|
|
* the return value is undefined.
|
2002-07-01 11:04:45 +00:00
|
|
|
|
* @return the variable top value of a Collator.
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_setVariableTop
|
|
|
|
|
* @see ucol_restoreVariableTop
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2001-06-26 22:24:10 +00:00
|
|
|
|
*/
|
2002-06-29 09:33:05 +00:00
|
|
|
|
U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
|
2001-06-26 22:24:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* Sets the variable top to a collation element value supplied. Variable top is
|
|
|
|
|
* set to the upper 16 bits.
|
2001-06-26 22:24:10 +00:00
|
|
|
|
* Lower 16 bits are ignored.
|
|
|
|
|
* @param coll collator which variable top needs to be changed
|
|
|
|
|
* @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop
|
|
|
|
|
* @param status error code (not changed by function)
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_getVariableTop
|
|
|
|
|
* @see ucol_setVariableTop
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2001-06-26 22:24:10 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI void U_EXPORT2
|
|
|
|
|
ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
|
2001-06-26 22:24:10 +00:00
|
|
|
|
|
2000-11-17 23:32:32 +00:00
|
|
|
|
/**
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* Thread safe cloning operation. The result is a clone of a given collator.
|
2000-11-17 23:32:32 +00:00
|
|
|
|
* @param coll collator to be cloned
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @param stackBuffer user allocated space for the new clone.
|
|
|
|
|
* If NULL new memory will be allocated.
|
2002-04-02 02:55:31 +00:00
|
|
|
|
* If buffer is not large enough, new memory will be allocated.
|
|
|
|
|
* Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
|
|
|
|
|
* This will probably be enough to avoid memory allocations.
|
2001-02-16 22:42:45 +00:00
|
|
|
|
* @param pBufferSize pointer to size of allocated space.
|
2002-04-02 02:55:31 +00:00
|
|
|
|
* If *pBufferSize == 0, a sufficient size for use in cloning will
|
|
|
|
|
* be returned ('pre-flighting')
|
|
|
|
|
* If *pBufferSize is not enough for a stack-based safe clone,
|
|
|
|
|
* new memory will be allocated.
|
2000-11-17 23:32:32 +00:00
|
|
|
|
* @param status to indicate whether the operation went on smoothly or there were errors
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
|
|
|
|
|
* allocations were necessary.
|
2000-11-17 23:32:32 +00:00
|
|
|
|
* @return pointer to the new clone
|
2001-11-17 02:01:44 +00:00
|
|
|
|
* @see ucol_open
|
|
|
|
|
* @see ucol_openRules
|
|
|
|
|
* @see ucol_close
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2000-11-17 23:32:32 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI UCollator* U_EXPORT2
|
|
|
|
|
ucol_safeClone(const UCollator *coll,
|
2002-04-02 02:55:31 +00:00
|
|
|
|
void *stackBuffer,
|
|
|
|
|
int32_t *pBufferSize,
|
|
|
|
|
UErrorCode *status);
|
2001-02-16 22:42:45 +00:00
|
|
|
|
|
2002-12-11 23:57:33 +00:00
|
|
|
|
/** default memory size for the new clone. It needs to be this large for os/400 large pointers
|
|
|
|
|
* @stable ICU 2.0
|
|
|
|
|
*/
|
2002-05-23 00:15:11 +00:00
|
|
|
|
#define U_COL_SAFECLONE_BUFFERSIZE 512
|
2000-11-17 23:32:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
* @param coll collator to get the rules from
|
2002-04-02 02:55:31 +00:00
|
|
|
|
* @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
|
2000-11-17 23:32:32 +00:00
|
|
|
|
* @param buffer buffer to store the result in. If NULL, you'll get no rules.
|
|
|
|
|
* @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in.
|
2002-07-01 11:04:45 +00:00
|
|
|
|
* @return current rules
|
2002-12-04 23:46:16 +00:00
|
|
|
|
* @stable ICU 2.0
|
2000-11-17 23:32:32 +00:00
|
|
|
|
*/
|
2001-11-21 01:08:55 +00:00
|
|
|
|
U_CAPI int32_t U_EXPORT2
|
|
|
|
|
ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
|
2002-08-21 19:12:24 +00:00
|
|
|
|
/**
|
|
|
|
|
* gets the locale name of the collator. If the collator
|
|
|
|
|
* is instantiated from the rules, then this function returns
|
|
|
|
|
* NULL.
|
|
|
|
|
* @param coll The UCollator for which the locale is needed
|
|
|
|
|
* @param type You can choose between requested, valid and actual
|
|
|
|
|
* locale. For description see the definition of
|
|
|
|
|
* ULocDataLocaleType in uloc.h
|
|
|
|
|
* @param status error code of the operation
|
|
|
|
|
* @return real locale name from which the collation data comes.
|
|
|
|
|
* If the collator was instantiated from rules, returns
|
|
|
|
|
* NULL.
|
2003-11-14 21:33:44 +00:00
|
|
|
|
* @deprecated ICU 2.8 Use ucol_getLocaleByType instead
|
2002-08-21 19:12:24 +00:00
|
|
|
|
*/
|
|
|
|
|
U_CAPI const char * U_EXPORT2
|
|
|
|
|
ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
|
|
|
|
|
|
|
|
|
|
2003-11-14 21:33:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gets the locale name of the collator. If the collator
|
|
|
|
|
* is instantiated from the rules, then this function returns
|
|
|
|
|
* NULL.
|
|
|
|
|
* @param coll The UCollator for which the locale is needed
|
|
|
|
|
* @param type You can choose between requested, valid and actual
|
|
|
|
|
* locale. For description see the definition of
|
|
|
|
|
* ULocDataLocaleType in uloc.h
|
|
|
|
|
* @param status error code of the operation
|
|
|
|
|
* @return real locale name from which the collation data comes.
|
|
|
|
|
* If the collator was instantiated from rules, returns
|
|
|
|
|
* NULL.
|
|
|
|
|
* @draft ICU 2.8
|
|
|
|
|
*/
|
|
|
|
|
U_CAPI const char * U_EXPORT2
|
|
|
|
|
ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
|
|
|
|
|
2002-09-04 06:08:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
* @param coll The UCollator for which we want to get tailored chars
|
|
|
|
|
* @param status error code of the operation
|
|
|
|
|
* @return a pointer to newly created USet. Must be be disposed by using uset_close
|
|
|
|
|
* @see ucol_openRules
|
|
|
|
|
* @see uset_close
|
|
|
|
|
* @draft ICU 2.4
|
|
|
|
|
*/
|
|
|
|
|
U_CAPI USet * U_EXPORT2
|
|
|
|
|
ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
|
|
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
|
#endif
|
2003-07-25 05:31:54 +00:00
|
|
|
|
|