1999-12-28 23:57:50 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
2014-02-25 21:21:49 +00:00
|
|
|
* Copyright (c) 1996-2014, 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"
|
2009-11-14 00:36:06 +00:00
|
|
|
#include "unicode/localpointer.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"
|
2011-03-18 22:52:30 +00:00
|
|
|
#include "unicode/uscript.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.
|
|
|
|
* <p>
|
2001-11-17 02:01:44 +00:00
|
|
|
* For more information about the collation service see
|
2014-02-25 21:21:49 +00:00
|
|
|
* <a href="http://userguide.icu-project.org/collation">the User 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
|
2014-02-25 21:21:49 +00:00
|
|
|
* to the <a href="http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Collation">CLDR root 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
|
2014-02-25 21:21:49 +00:00
|
|
|
* this subject see the <a href="http://userguide.icu-project.org/collation/customization">
|
|
|
|
* Collation Customization</a> section of the User 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
|
|
|
|
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
|
2013-08-30 23:46:37 +00:00
|
|
|
* string in the ucol_strcoll() method.
|
2001-11-17 02:01:44 +00:00
|
|
|
* UCOL_EQUAL is returned if source string is compared to be equal to target
|
2013-08-30 23:46:37 +00:00
|
|
|
* string in the ucol_strcoll() method.
|
2001-11-17 02:01:44 +00:00
|
|
|
* UCOL_GREATER is returned if source string is compared to be greater than
|
2013-08-30 23:46:37 +00:00
|
|
|
* target string in the ucol_strcoll() method.
|
|
|
|
* @see ucol_strcoll()
|
2001-11-17 02:01:44 +00:00
|
|
|
* <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;
|
|
|
|
|
2011-08-01 02:20:46 +00:00
|
|
|
/**
|
2011-03-18 22:52:30 +00:00
|
|
|
* Enum containing the codes for reordering segments of the collation table that are not script
|
|
|
|
* codes. These reordering codes are to be used in conjunction with the script codes.
|
|
|
|
* @see ucol_getReorderCodes
|
|
|
|
* @see ucol_setReorderCodes
|
|
|
|
* @see ucol_getEquivalentReorderCodes
|
2011-12-01 23:13:47 +00:00
|
|
|
* @see UScriptCode
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2010-10-27 18:02:52 +00:00
|
|
|
*/
|
2011-03-18 22:52:30 +00:00
|
|
|
typedef enum {
|
|
|
|
/**
|
|
|
|
* A special reordering code that is used to specify the default
|
|
|
|
* reordering codes for a locale.
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_DEFAULT = -1,
|
|
|
|
/**
|
|
|
|
* A special reordering code that is used to specify no reordering codes.
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
|
|
|
|
/**
|
|
|
|
* A special reordering code that is used to specify all other codes used for
|
|
|
|
* reordering except for the codes lised as UColReorderCode values and those
|
|
|
|
* listed explicitly in a reordering.
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
|
|
|
|
/**
|
|
|
|
* Characters with the space property.
|
2011-12-01 23:13:47 +00:00
|
|
|
* This is equivalent to the rule value "space".
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_SPACE = 0x1000,
|
|
|
|
/**
|
2011-12-01 23:13:47 +00:00
|
|
|
* The first entry in the enumeration of reordering groups. This is intended for use in
|
|
|
|
* range checking and enumeration of the reorder codes.
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
|
|
|
|
/**
|
|
|
|
* Characters with the punctuation property.
|
2011-12-01 23:13:47 +00:00
|
|
|
* This is equivalent to the rule value "punct".
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
|
|
|
|
/**
|
|
|
|
* Characters with the symbol property.
|
2011-12-01 23:13:47 +00:00
|
|
|
* This is equivalent to the rule value "symbol".
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_SYMBOL = 0x1002,
|
|
|
|
/**
|
|
|
|
* Characters with the currency property.
|
2011-12-01 23:13:47 +00:00
|
|
|
* This is equivalent to the rule value "currency".
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_CURRENCY = 0x1003,
|
|
|
|
/**
|
|
|
|
* Characters with the digit property.
|
2011-12-01 23:13:47 +00:00
|
|
|
* This is equivalent to the rule value "digit".
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_DIGIT = 0x1004,
|
|
|
|
/**
|
2011-12-01 23:13:47 +00:00
|
|
|
* The limit of the reorder codes. This is intended for use in range checking
|
|
|
|
* and enumeration of the reorder codes.
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
|
|
|
UCOL_REORDER_CODE_LIMIT = 0x1005
|
2010-10-27 18:02:52 +00:00
|
|
|
} UColReorderCode;
|
|
|
|
|
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.
|
2005-06-15 04:20:43 +00:00
|
|
|
* Example of secondary difference, "ä" >> "a".
|
2002-07-26 18:46:43 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2005-06-15 04:20:43 +00:00
|
|
|
* For example, "ä" == "ä".
|
2002-07-26 18:46:43 +00:00
|
|
|
*
|
|
|
|
* 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 {
|
2012-08-04 17:24:45 +00:00
|
|
|
/** Attribute for direction of secondary weights - used in Canadian French.
|
2001-11-17 02:01:44 +00:00
|
|
|
* Acceptable values are UCOL_ON, which results in secondary weights
|
|
|
|
* being considered backwards and UCOL_OFF which treats secondary
|
2012-08-04 17:24:45 +00:00
|
|
|
* weights in the order they appear.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_FRENCH_COLLATION,
|
2005-08-02 18:12:39 +00:00
|
|
|
/** Attribute for handling variable elements.
|
2001-11-17 02:01:44 +00:00
|
|
|
* 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
|
2012-08-04 17:24:45 +00:00
|
|
|
* level.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_ALTERNATE_HANDLING,
|
2005-08-02 18:12:39 +00:00
|
|
|
/** Controls the ordering of upper and lower case letters.
|
2001-11-17 02:01:44 +00:00
|
|
|
* 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
|
2012-08-04 17:24:45 +00:00
|
|
|
* the opposite.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_CASE_FIRST,
|
|
|
|
/** Controls whether an extra case level (positioned before the third
|
2005-08-02 18:12:39 +00:00
|
|
|
* level) is generated or not. Acceptable values are UCOL_OFF (default),
|
2001-11-17 02:01:44 +00:00
|
|
|
* when case level is not generated, and UCOL_ON which causes the case
|
2005-08-02 18:12:39 +00:00
|
|
|
* level to be generated. Contents of the case level are affected by
|
|
|
|
* the value of UCOL_CASE_FIRST attribute. A simple way to ignore
|
2001-11-17 02:01:44 +00:00
|
|
|
* accent differences in a string is to set the strength to UCOL_PRIMARY
|
2012-08-04 17:24:45 +00:00
|
|
|
* and enable case level.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_CASE_LEVEL,
|
|
|
|
/** Controls whether the normalization check and necessary normalizations
|
2005-08-02 18:12:39 +00:00
|
|
|
* 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,
|
2012-08-04 17:24:45 +00:00
|
|
|
* incremental NFD normalization is performed.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_NORMALIZATION_MODE,
|
2012-08-04 17:24:45 +00:00
|
|
|
/** An alias for UCOL_NORMALIZATION_MODE attribute.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-05-02 05:09:40 +00:00
|
|
|
UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
|
2005-08-02 18:12:39 +00:00
|
|
|
/** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
|
|
|
|
* UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
|
2014-03-04 19:32:53 +00:00
|
|
|
* for most locales (except Japanese) is tertiary.
|
|
|
|
*
|
|
|
|
* Quaternary strength
|
2001-11-17 02:01:44 +00:00
|
|
|
* is useful when combined with shifted setting for alternate handling
|
2014-03-04 19:32:53 +00:00
|
|
|
* attribute and for JIS X 4061 collation, when it is used to distinguish
|
|
|
|
* between Katakana and Hiragana.
|
|
|
|
* 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
|
2012-08-04 17:24:45 +00:00
|
|
|
* to codepoints of the NFD form of the string.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2001-11-17 02:01:44 +00:00
|
|
|
UCOL_STRENGTH,
|
2013-09-23 06:52:34 +00:00
|
|
|
#ifndef U_HIDE_DEPRECATED_API
|
2005-08-02 18:12:39 +00:00
|
|
|
/** When turned on, this attribute positions Hiragana before all
|
|
|
|
* non-ignorables on quaternary level This is a sneaky way to produce JIS
|
2012-08-04 17:24:45 +00:00
|
|
|
* sort order.
|
|
|
|
*
|
2014-03-04 19:32:53 +00:00
|
|
|
* This attribute was an implementation detail of the CLDR Japanese tailoring.
|
2012-08-04 17:24:45 +00:00
|
|
|
* Since ICU 50, this attribute is not settable any more via API functions.
|
2014-03-04 19:32:53 +00:00
|
|
|
* Since CLDR 25/ICU 53, explicit quaternary relations are used
|
|
|
|
* to achieve the same Japanese sort order.
|
|
|
|
*
|
|
|
|
* @deprecated ICU 50 Implementation detail, cannot be set via API, was removed from implementation.
|
2012-08-04 17:24:45 +00:00
|
|
|
*/
|
2013-09-23 06:52:34 +00:00
|
|
|
UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
|
|
|
|
#endif /* U_HIDE_DEPRECATED_API */
|
2014-02-28 22:50:10 +00:00
|
|
|
/**
|
|
|
|
* When turned on, this attribute makes
|
|
|
|
* substrings of digits sort according to their numeric values.
|
|
|
|
*
|
2010-03-03 23:40:19 +00:00
|
|
|
* This is a way to get '100' to sort AFTER '2'. Note that the longest
|
2014-02-28 22:50:10 +00:00
|
|
|
* digit substring that can be treated as a single unit is
|
2010-03-03 23:40:19 +00:00
|
|
|
* 254 digits (not counting leading zeros). If a digit substring is
|
|
|
|
* longer than that, the digits beyond the limit will be treated as a
|
2014-02-28 22:50:10 +00:00
|
|
|
* separate digit substring.
|
|
|
|
*
|
|
|
|
* A "digit" in this sense is a code point with General_Category=Nd,
|
|
|
|
* which does not include circled numbers, roman numerals, etc.
|
|
|
|
* Only a contiguous digit substring is considered, that is,
|
|
|
|
* non-negative integers without separators.
|
|
|
|
* There is no support for plus/minus signs, decimals, exponents, etc.
|
|
|
|
*
|
2012-08-04 17:24:45 +00:00
|
|
|
* @stable ICU 2.8
|
|
|
|
*/
|
2013-09-23 06:52:34 +00:00
|
|
|
UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
|
2012-08-04 17:24:45 +00:00
|
|
|
/**
|
|
|
|
* The number of UColAttribute constants.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
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 {
|
2012-09-20 05:37:31 +00:00
|
|
|
/**
|
|
|
|
* Retrieves the tailoring rules only.
|
|
|
|
* Same as calling the version of getRules() without UColRuleOption.
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2002-07-26 18:46:43 +00:00
|
|
|
UCOL_TAILORING_ONLY,
|
2012-09-20 05:37:31 +00:00
|
|
|
/**
|
|
|
|
* Retrieves the "UCA rules" concatenated with the tailoring rules.
|
|
|
|
* The "UCA rules" are an <i>approximation</i> of the root collator's sort order.
|
|
|
|
* They are almost never used or useful at runtime and can be removed from the data.
|
|
|
|
* See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
|
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2002-07-26 18:46:43 +00:00
|
|
|
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
|
2004-06-09 21:30:50 +00:00
|
|
|
* {@link #ucol_close }.
|
2001-11-17 02:01:44 +00:00
|
|
|
* @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
|
2014-02-25 21:21:49 +00:00
|
|
|
* "root" are passed, the root collator will be returned.
|
|
|
|
* @param status A pointer to a UErrorCode to receive any errors
|
1999-12-28 23:57:50 +00:00
|
|
|
* @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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
|
|
|
|
/**
|
2014-02-25 21:21:49 +00:00
|
|
|
* Produce a UCollator instance according to the rules supplied.
|
2001-11-17 02:01:44 +00:00
|
|
|
* The rules are used to change the default ordering, defined in the
|
|
|
|
* UCA in a process called tailoring. The resulting UCollator pointer
|
2004-06-09 21:30:50 +00:00
|
|
|
* can be used in the same way as the one obtained by {@link #ucol_strcoll }.
|
2001-11-17 02:01:44 +00:00
|
|
|
* @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.
|
2014-02-25 21:21:49 +00:00
|
|
|
* @param status A pointer to a UErrorCode to receive any errors
|
2005-08-02 18:12:39 +00:00
|
|
|
* @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
|
2001-11-17 02:01:44 +00:00
|
|
|
* 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
|
2004-05-08 16:03:58 +00:00
|
|
|
/**
|
|
|
|
* 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:
|
2014-02-25 21:21:49 +00:00
|
|
|
* http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
|
2004-05-24 22:11:31 +00:00
|
|
|
* Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
|
|
|
|
* strength will be 3. 3066bis locale overrides individual locale parts.
|
2004-05-08 16:03:58 +00:00
|
|
|
* 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.
|
|
|
|
* @param definition A short string containing a locale and a set of attributes.
|
|
|
|
* Attributes not explicitly mentioned are left at the default
|
|
|
|
* state for a locale.
|
|
|
|
* @param parseError if not NULL, structure that will get filled with error's pre
|
|
|
|
* and post context in case of error.
|
2004-06-14 21:00:06 +00:00
|
|
|
* @param forceDefaults if FALSE, the settings that are the same as the collator
|
|
|
|
* default settings will not be applied (for example, setting
|
|
|
|
* French secondary on a French collator would not be executed).
|
|
|
|
* If TRUE, all the settings will be applied regardless of the
|
|
|
|
* collator default value. If the definition
|
2004-05-24 22:11:31 +00:00
|
|
|
* strings are to be cached, should be set to FALSE.
|
2004-05-08 16:03:58 +00:00
|
|
|
* @param status Error code. Apart from regular error conditions connected to
|
|
|
|
* instantiating collators (like out of memory or similar), this
|
|
|
|
* API will return an error if an invalid attribute or attribute/value
|
|
|
|
* combination is specified.
|
|
|
|
* @return A pointer to a UCollator or 0 if an error occured (including an
|
|
|
|
* invalid attribute).
|
|
|
|
* @see ucol_open
|
|
|
|
* @see ucol_setAttribute
|
|
|
|
* @see ucol_setVariableTop
|
|
|
|
* @see ucol_getShortDefinitionString
|
|
|
|
* @see ucol_normalizeShortDefinitionString
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-05-08 16:03:58 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE UCollator* U_EXPORT2
|
2004-05-08 16:03:58 +00:00
|
|
|
ucol_openFromShortString( const char *definition,
|
2004-05-24 22:11:31 +00:00
|
|
|
UBool forceDefaults,
|
2004-05-08 16:03:58 +00:00
|
|
|
UParseError *parseError,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
2011-08-01 02:20:46 +00:00
|
|
|
#ifndef U_HIDE_DEPRECATED_API
|
2004-05-08 16:03:58 +00:00
|
|
|
/**
|
|
|
|
* Get a set containing the contractions defined by the collator. The set includes
|
2014-02-25 21:21:49 +00:00
|
|
|
* both the root collator's contractions and the contractions defined by the collator. This set
|
2004-06-14 21:00:06 +00:00
|
|
|
* will contain only strings. If a tailoring explicitly suppresses contractions from
|
2014-02-25 21:21:49 +00:00
|
|
|
* the root collator (like Russian), removed contractions will not be in the resulting set.
|
2004-05-08 16:03:58 +00:00
|
|
|
* @param coll collator
|
2004-06-14 21:00:06 +00:00
|
|
|
* @param conts the set to hold the result. It gets emptied before
|
|
|
|
* contractions are added.
|
2004-05-08 16:03:58 +00:00
|
|
|
* @param status to hold the error code
|
|
|
|
* @return the size of the contraction set
|
|
|
|
*
|
2005-06-20 22:58:50 +00:00
|
|
|
* @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
|
2004-05-08 16:03:58 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_DEPRECATED int32_t U_EXPORT2
|
2004-05-08 16:03:58 +00:00
|
|
|
ucol_getContractions( const UCollator *coll,
|
|
|
|
USet *conts,
|
|
|
|
UErrorCode *status);
|
2011-08-01 02:20:46 +00:00
|
|
|
#endif /* U_HIDE_DEPRECATED_API */
|
2004-05-08 16:03:58 +00:00
|
|
|
|
2005-06-20 22:58:50 +00:00
|
|
|
/**
|
|
|
|
* Get a set containing the expansions defined by the collator. The set includes
|
2014-02-25 21:21:49 +00:00
|
|
|
* both the root collator's expansions and the expansions defined by the tailoring
|
2005-06-20 22:58:50 +00:00
|
|
|
* @param coll collator
|
|
|
|
* @param contractions if not NULL, the set to hold the contractions
|
|
|
|
* @param expansions if not NULL, the set to hold the expansions
|
|
|
|
* @param addPrefixes add the prefix contextual elements to contractions
|
|
|
|
* @param status to hold the error code
|
|
|
|
*
|
2007-08-21 20:45:05 +00:00
|
|
|
* @stable ICU 3.4
|
2005-06-20 22:58:50 +00:00
|
|
|
*/
|
2007-08-21 20:45:05 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2005-06-20 22:58:50 +00:00
|
|
|
ucol_getContractionsAndExpansions( const UCollator *coll,
|
|
|
|
USet *contractions, USet *expansions,
|
|
|
|
UBool addPrefixes, UErrorCode *status);
|
2004-05-08 16:03:58 +00:00
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Close a UCollator.
|
2005-08-02 18:12:39 +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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
ucol_close(UCollator *coll);
|
|
|
|
|
2009-12-17 07:13:28 +00:00
|
|
|
#if U_SHOW_CPLUSPLUS_API
|
2009-11-14 00:36:06 +00:00
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \class LocalUCollatorPointer
|
|
|
|
* "Smart pointer" class, closes a UCollator via ucol_close().
|
|
|
|
* For most methods see the LocalPointerBase base class.
|
|
|
|
*
|
|
|
|
* @see LocalPointerBase
|
|
|
|
* @see LocalPointer
|
2010-11-15 19:40:24 +00:00
|
|
|
* @stable ICU 4.4
|
2009-11-14 00:36:06 +00:00
|
|
|
*/
|
|
|
|
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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);
|
|
|
|
|
2012-10-05 23:44:00 +00:00
|
|
|
/**
|
|
|
|
* Compare two strings in UTF-8.
|
|
|
|
* The strings will be compared using the options already specified.
|
|
|
|
* Note: When input string contains malformed a UTF-8 byte sequence,
|
|
|
|
* this function treats these bytes as REPLACEMENT CHARACTER (U+FFFD).
|
|
|
|
* @param coll The UCollator containing the comparison rules.
|
|
|
|
* @param source The source UTF-8 string.
|
|
|
|
* @param sourceLength The length of source, or -1 if null-terminated.
|
|
|
|
* @param target The target UTF-8 string.
|
|
|
|
* @param targetLength The length of target, or -1 if null-terminated.
|
2014-02-25 21:21:49 +00:00
|
|
|
* @param status A pointer to a UErrorCode to receive any errors
|
2012-10-05 23:44:00 +00:00
|
|
|
* @return The result of comparing the strings; one of UCOL_EQUAL,
|
|
|
|
* UCOL_GREATER, UCOL_LESS
|
|
|
|
* @see ucol_greater
|
|
|
|
* @see ucol_greaterOrEqual
|
|
|
|
* @see ucol_equal
|
2013-09-19 00:44:08 +00:00
|
|
|
* @stable ICU 50
|
2012-10-05 23:44:00 +00:00
|
|
|
*/
|
2013-09-19 00:44:08 +00:00
|
|
|
U_STABLE UCollationResult U_EXPORT2
|
2012-10-05 23:44:00 +00:00
|
|
|
ucol_strcollUTF8(
|
|
|
|
const UCollator *coll,
|
|
|
|
const char *source,
|
|
|
|
int32_t sourceLength,
|
|
|
|
const char *target,
|
|
|
|
int32_t targetLength,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Determine if one string is greater than another.
|
2004-06-09 21:30:50 +00:00
|
|
|
* This function is equivalent to {@link #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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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.
|
2004-06-09 21:30:50 +00:00
|
|
|
* This function is equivalent to {@link #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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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.
|
2004-06-09 21:30:50 +00:00
|
|
|
* This function is equivalent to {@link #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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
2014-02-25 21:21:49 +00:00
|
|
|
* @param status A pointer to a UErrorCode to receive any errors
|
2003-01-20 07:42:28 +00:00
|
|
|
* @see ucol_strcoll
|
2004-11-03 01:25:51 +00:00
|
|
|
* @stable ICU 2.6
|
2003-01-20 07:42:28 +00:00
|
|
|
*/
|
2004-11-03 01:25:51 +00:00
|
|
|
U_STABLE UCollationResult U_EXPORT2
|
2003-01-20 07:42:28 +00:00
|
|
|
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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
|
2010-10-27 18:02:52 +00:00
|
|
|
/**
|
2011-03-18 22:52:30 +00:00
|
|
|
* Retrieves the reordering codes for this collator.
|
|
|
|
* These reordering codes are a combination of UScript codes and UColReorderCode entries.
|
2010-10-27 18:02:52 +00:00
|
|
|
* @param coll The UCollator to query.
|
|
|
|
* @param dest The array to fill with the script ordering.
|
2011-03-18 22:52:30 +00:00
|
|
|
* @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
|
|
|
|
* will only return the length of the result without writing any of the result string (pre-flighting).
|
|
|
|
* @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
|
|
|
|
* failure before the function call.
|
|
|
|
* @return The number of reordering codes written to the dest array.
|
2010-11-03 02:41:22 +00:00
|
|
|
* @see ucol_setReorderCodes
|
2011-03-18 22:52:30 +00:00
|
|
|
* @see ucol_getEquivalentReorderCodes
|
2011-12-01 23:13:47 +00:00
|
|
|
* @see UScriptCode
|
|
|
|
* @see UColReorderCode
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2010-10-27 18:02:52 +00:00
|
|
|
*/
|
2012-10-08 05:16:32 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2010-11-03 02:41:22 +00:00
|
|
|
ucol_getReorderCodes(const UCollator* coll,
|
2010-10-27 18:02:52 +00:00
|
|
|
int32_t* dest,
|
2010-11-04 20:12:39 +00:00
|
|
|
int32_t destCapacity,
|
2010-10-27 18:02:52 +00:00
|
|
|
UErrorCode *pErrorCode);
|
2011-05-09 23:54:46 +00:00
|
|
|
/**
|
2011-03-18 22:52:30 +00:00
|
|
|
* Sets the reordering codes for this collator.
|
2011-05-09 23:54:46 +00:00
|
|
|
* Collation reordering allows scripts and some other defined blocks of characters
|
|
|
|
* to be moved relative to each other as a block. This reordering is done on top of
|
|
|
|
* the DUCET/CLDR standard collation order. Reordering can specify groups to be placed
|
|
|
|
* at the start and/or the end of the collation order. These groups are specified using
|
|
|
|
* UScript codes and UColReorderCode entries.
|
|
|
|
* <p>By default, reordering codes specified for the start of the order are placed in the
|
2011-09-28 20:54:03 +00:00
|
|
|
* order given after a group of "special" non-script blocks. These special groups of characters
|
2011-05-09 23:54:46 +00:00
|
|
|
* are space, punctuation, symbol, currency, and digit. These special groups are represented with
|
|
|
|
* UColReorderCode entries. Script groups can be intermingled with
|
|
|
|
* these special non-script blocks if those special blocks are explicitly specified in the reordering.
|
|
|
|
* <p>The special code OTHERS stands for any script that is not explicitly
|
|
|
|
* mentioned in the list of reordering codes given. Anything that is after OTHERS
|
|
|
|
* will go at the very end of the reordering in the order given.
|
|
|
|
* <p>The special reorder code DEFAULT will reset the reordering for this collator
|
|
|
|
* to the default for this collator. The default reordering may be the DUCET/CLDR order or may be a reordering that
|
|
|
|
* was specified when this collator was created from resource data or from rules. The
|
|
|
|
* DEFAULT code <b>must</b> be the sole code supplied when it used. If not
|
2014-02-25 21:21:49 +00:00
|
|
|
* that will result in a U_ILLEGAL_ARGUMENT_ERROR being set.
|
2011-05-09 23:54:46 +00:00
|
|
|
* <p>The special reorder code NONE will remove any reordering for this collator.
|
2011-12-01 23:13:47 +00:00
|
|
|
* The result of setting no reordering will be to have the DUCET/CLDR ordering used. The
|
2011-05-09 23:54:46 +00:00
|
|
|
* NONE code <b>must</b> be the sole code supplied when it used.
|
2010-10-27 18:02:52 +00:00
|
|
|
* @param coll The UCollator to set.
|
2011-03-18 22:52:30 +00:00
|
|
|
* @param reorderCodes An array of script codes in the new order. This can be NULL if the
|
|
|
|
* length is also set to 0. An empty array will clear any reordering codes on the collator.
|
2010-11-03 02:41:22 +00:00
|
|
|
* @param reorderCodesLength The length of reorderCodes.
|
2011-03-18 22:52:30 +00:00
|
|
|
* @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
|
|
|
|
* failure before the function call.
|
2010-11-03 02:41:22 +00:00
|
|
|
* @see ucol_getReorderCodes
|
2011-03-18 22:52:30 +00:00
|
|
|
* @see ucol_getEquivalentReorderCodes
|
2011-12-01 23:13:47 +00:00
|
|
|
* @see UScriptCode
|
|
|
|
* @see UColReorderCode
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-05-09 23:54:46 +00:00
|
|
|
*/
|
2012-10-17 05:48:18 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2010-11-03 02:41:22 +00:00
|
|
|
ucol_setReorderCodes(UCollator* coll,
|
|
|
|
const int32_t* reorderCodes,
|
2010-11-04 20:12:39 +00:00
|
|
|
int32_t reorderCodesLength,
|
2010-11-02 02:21:57 +00:00
|
|
|
UErrorCode *pErrorCode);
|
2011-03-18 22:52:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the reorder codes that are grouped with the given reorder code. Some reorder
|
|
|
|
* codes will be grouped and must reorder together.
|
|
|
|
* @param reorderCode The reorder code to determine equivalence for.
|
|
|
|
* @param dest The array to fill with the script ordering.
|
|
|
|
* @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
|
|
|
|
* will only return the length of the result without writing any of the result string (pre-flighting).
|
|
|
|
* @param pErrorCode Must be a valid pointer to an error code value, which must not indicate
|
|
|
|
* a failure before the function call.
|
|
|
|
* @return The number of reordering codes written to the dest array.
|
|
|
|
* @see ucol_setReorderCodes
|
|
|
|
* @see ucol_getReorderCodes
|
2011-12-01 23:13:47 +00:00
|
|
|
* @see UScriptCode
|
|
|
|
* @see UColReorderCode
|
2012-02-20 04:28:17 +00:00
|
|
|
* @stable ICU 4.8
|
2011-03-18 22:52:30 +00:00
|
|
|
*/
|
2012-10-08 05:16:32 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2011-03-18 22:52:30 +00:00
|
|
|
ucol_getEquivalentReorderCodes(int32_t reorderCode,
|
|
|
|
int32_t* dest,
|
|
|
|
int32_t destCapacity,
|
|
|
|
UErrorCode *pErrorCode);
|
2010-10-27 18:02:52 +00:00
|
|
|
|
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.
|
2014-02-25 21:21:49 +00:00
|
|
|
* @param status A pointer to a UErrorCode to receive any errors
|
1999-12-28 23:57:50 +00:00
|
|
|
* @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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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.
|
2009-04-01 05:57:09 +00:00
|
|
|
* @param localeIndex The index of the desired locale.
|
1999-12-28 23:57:50 +00:00
|
|
|
* @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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const char* U_EXPORT2
|
2009-04-01 05:57:09 +00:00
|
|
|
ucol_getAvailable(int32_t localeIndex);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine how many locales have collation rules available.
|
|
|
|
* This function is most useful as determining the loop ending condition for
|
2004-06-09 21:30:50 +00:00
|
|
|
* calls to {@link #ucol_getAvailable }.
|
1999-12-28 23:57:50 +00:00
|
|
|
* @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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
ucol_countAvailable(void);
|
|
|
|
|
2004-07-18 01:37:13 +00:00
|
|
|
#if !UCONFIG_NO_SERVICE
|
2004-04-16 21:06:52 +00:00
|
|
|
/**
|
2004-05-04 23:54:53 +00:00
|
|
|
* Create a string enumerator of all locales for which a valid
|
|
|
|
* collator may be opened.
|
2004-04-16 21:06:52 +00:00
|
|
|
* @param status input-output error code
|
2004-04-24 02:58:01 +00:00
|
|
|
* @return a string enumeration over locale strings. The caller is
|
|
|
|
* responsible for closing the result.
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-04-16 21:06:52 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE UEnumeration* U_EXPORT2
|
2004-04-16 21:06:52 +00:00
|
|
|
ucol_openAvailableLocales(UErrorCode *status);
|
2004-07-18 01:37:13 +00:00
|
|
|
#endif
|
2004-04-16 21:06:52 +00:00
|
|
|
|
|
|
|
/**
|
2004-05-04 23:54:53 +00:00
|
|
|
* Create a string enumerator of all possible keywords that are relevant to
|
2004-04-24 02:58:01 +00:00
|
|
|
* collation. At this point, the only recognized keyword for this
|
|
|
|
* service is "collation".
|
|
|
|
* @param status input-output error code
|
|
|
|
* @return a string enumeration over locale strings. The caller is
|
|
|
|
* responsible for closing the result.
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-04-24 02:58:01 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE UEnumeration* U_EXPORT2
|
2004-04-24 02:58:01 +00:00
|
|
|
ucol_getKeywords(UErrorCode *status);
|
|
|
|
|
|
|
|
/**
|
2004-05-04 23:54:53 +00:00
|
|
|
* Given a keyword, create a string enumeration of all values
|
|
|
|
* for that keyword that are currently in use.
|
2004-04-24 02:58:01 +00:00
|
|
|
* @param keyword a particular keyword as enumerated by
|
|
|
|
* ucol_getKeywords. If any other keyword is passed in, *status is set
|
|
|
|
* to U_ILLEGAL_ARGUMENT_ERROR.
|
2004-04-16 21:06:52 +00:00
|
|
|
* @param status input-output error code
|
|
|
|
* @return a string enumeration over collation keyword values, or NULL
|
2004-04-24 02:58:01 +00:00
|
|
|
* upon error. The caller is responsible for closing the result.
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-04-16 21:06:52 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE UEnumeration* U_EXPORT2
|
2004-04-16 21:06:52 +00:00
|
|
|
ucol_getKeywordValues(const char *keyword, UErrorCode *status);
|
|
|
|
|
2009-02-14 02:32:41 +00:00
|
|
|
/**
|
|
|
|
* Given a key and a locale, returns an array of string values in a preferred
|
|
|
|
* order that would make a difference. These are all and only those values where
|
|
|
|
* the open (creation) of the service with the locale formed from the input locale
|
|
|
|
* plus input keyword and that value has different behavior than creation with the
|
|
|
|
* input locale alone.
|
|
|
|
* @param key one of the keys supported by this service. For now, only
|
|
|
|
* "collation" is supported.
|
|
|
|
* @param locale the locale
|
|
|
|
* @param commonlyUsed if set to true it will return only commonly used values
|
|
|
|
* with the given locale in preferred order. Otherwise,
|
|
|
|
* it will return all the available values for the locale.
|
2009-03-17 01:47:25 +00:00
|
|
|
* @param status error status
|
2009-02-14 02:32:41 +00:00
|
|
|
* @return a string enumeration over keyword values for the given key and the locale.
|
2010-01-28 21:09:53 +00:00
|
|
|
* @stable ICU 4.2
|
2009-02-14 02:32:41 +00:00
|
|
|
*/
|
2010-01-23 06:36:03 +00:00
|
|
|
U_STABLE UEnumeration* U_EXPORT2
|
2009-02-14 02:32:41 +00:00
|
|
|
ucol_getKeywordValuesForLocale(const char* key,
|
|
|
|
const char* locale,
|
|
|
|
UBool commonlyUsed,
|
|
|
|
UErrorCode* status);
|
|
|
|
|
2004-04-24 02:58:01 +00:00
|
|
|
/**
|
2004-05-04 23:54:53 +00:00
|
|
|
* 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 <a
|
2014-02-25 21:21:49 +00:00
|
|
|
* href="http://userguide.icu-project.org/locale#TOC-Locales-and-Services">
|
2004-05-04 23:54:53 +00:00
|
|
|
* Locales and Services</a> section of the ICU User Guide.
|
2004-04-24 02:58:01 +00:00
|
|
|
* @param result fillin for the functionally equivalent locale
|
|
|
|
* @param resultCapacity capacity of the fillin buffer
|
2004-05-03 18:15:13 +00:00
|
|
|
* @param keyword a particular keyword as enumerated by
|
|
|
|
* ucol_getKeywords.
|
2004-04-24 02:58:01 +00:00
|
|
|
* @param locale the requested locale
|
|
|
|
* @param isAvailable if non-NULL, pointer to a fillin parameter that
|
|
|
|
* indicates whether the requested locale was 'available' to the
|
|
|
|
* collation service. A locale is defined as 'available' if it
|
|
|
|
* physically exists within the collation locale data.
|
|
|
|
* @param status pointer to input-output error code
|
|
|
|
* @return the actual buffer size needed for the locale. If greater
|
|
|
|
* than resultCapacity, the returned full name will be truncated and
|
|
|
|
* an error code will be returned.
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-04-24 02:58:01 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2004-04-24 02:58:01 +00:00
|
|
|
ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
|
2004-05-03 18:15:13 +00:00
|
|
|
const char* keyword, const char* locale,
|
|
|
|
UBool* isAvailable, UErrorCode* status);
|
2004-04-24 02:58:01 +00:00
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
2012-08-28 00:06:05 +00:00
|
|
|
* Get the collation tailoring rules from a UCollator.
|
1999-12-28 23:57:50 +00:00
|
|
|
* 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
|
2012-08-28 00:06:05 +00:00
|
|
|
* @return The collation tailoring rules.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const UChar* U_EXPORT2
|
1999-12-28 23:57:50 +00:00
|
|
|
ucol_getRules( const UCollator *coll,
|
|
|
|
int32_t *length);
|
|
|
|
|
2004-05-08 16:03:58 +00:00
|
|
|
/** 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
|
2014-02-25 21:21:49 +00:00
|
|
|
* a collator with the same attributes using the ucol_openFromShortString API.
|
2004-05-08 16:03:58 +00:00
|
|
|
* This string will be normalized.
|
|
|
|
* The structure and the syntax of the string is defined in the "Naming collators"
|
|
|
|
* section of the users guide:
|
2014-02-25 21:21:49 +00:00
|
|
|
* http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
|
2004-05-08 16:03:58 +00:00
|
|
|
* This API supports preflighting.
|
|
|
|
* @param coll a collator
|
2004-06-14 21:00:06 +00:00
|
|
|
* @param locale a locale that will appear as a collators locale in the resulting
|
|
|
|
* short string definition. If NULL, the locale will be harvested
|
|
|
|
* from the collator.
|
2004-05-08 16:03:58 +00:00
|
|
|
* @param buffer space to hold the resulting string
|
|
|
|
* @param capacity capacity of the buffer
|
2004-05-25 03:23:31 +00:00
|
|
|
* @param status for returning errors. All the preflighting errors are featured
|
2004-05-08 16:03:58 +00:00
|
|
|
* @return length of the resulting string
|
|
|
|
* @see ucol_openFromShortString
|
|
|
|
* @see ucol_normalizeShortDefinitionString
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-05-08 16:03:58 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2004-05-08 16:03:58 +00:00
|
|
|
ucol_getShortDefinitionString(const UCollator *coll,
|
|
|
|
const char *locale,
|
|
|
|
char *buffer,
|
|
|
|
int32_t capacity,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
|
|
/** 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.
|
|
|
|
* @param source definition string
|
|
|
|
* @param destination space to hold the resulting string
|
|
|
|
* @param capacity capacity of the buffer
|
|
|
|
* @param parseError if not NULL, structure that will get filled with error's pre
|
|
|
|
* and post context in case of error.
|
|
|
|
* @param status Error code. This API will return an error if an invalid attribute
|
|
|
|
* or attribute/value combination is specified. All the preflighting
|
|
|
|
* errors are also featured
|
2004-06-14 21:00:06 +00:00
|
|
|
* @return length of the resulting normalized string.
|
2004-05-08 16:03:58 +00:00
|
|
|
*
|
|
|
|
* @see ucol_openFromShortString
|
|
|
|
* @see ucol_getShortDefinitionString
|
|
|
|
*
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.0
|
2004-05-08 16:03:58 +00:00
|
|
|
*/
|
|
|
|
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2004-05-08 16:03:58 +00:00
|
|
|
ucol_normalizeShortDefinitionString(const char *source,
|
|
|
|
char *destination,
|
|
|
|
int32_t capacity,
|
|
|
|
UParseError *parseError,
|
|
|
|
UErrorCode *status);
|
2008-02-19 20:10:55 +00:00
|
|
|
|
2004-05-08 16:03:58 +00:00
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* 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>.
|
2010-06-15 16:24:45 +00:00
|
|
|
*
|
|
|
|
* Like ICU functions that write to an output buffer, the buffer contents
|
|
|
|
* is undefined if the buffer capacity (resultLength parameter) is too small.
|
|
|
|
* Unlike ICU functions that write a string to an output buffer,
|
|
|
|
* the terminating zero byte is counted in the sort key length.
|
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.
|
2008-02-19 20:10:55 +00:00
|
|
|
* @return The size needed to fully store the sort key.
|
|
|
|
* If there was an internal error generating the sort key,
|
2008-02-23 07:21:00 +00:00
|
|
|
* a zero value is returned.
|
1999-12-28 23:57:50 +00:00
|
|
|
* @see ucol_keyHashCode
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
2012-09-19 23:55:58 +00:00
|
|
|
* the number of requested bytes.
|
|
|
|
*
|
|
|
|
* The generated sort key may or may not be compatible with
|
|
|
|
* sort keys generated using ucol_getSortKey().
|
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.
|
2004-11-03 01:25:51 +00:00
|
|
|
* @stable ICU 2.6
|
2003-01-23 01:52:34 +00:00
|
|
|
*/
|
2004-11-03 01:25:51 +00:00
|
|
|
U_STABLE 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2000-05-15 19:48:26 +00:00
|
|
|
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
|
2005-06-22 23:38:06 +00:00
|
|
|
* @stable ICU 2.8
|
2003-11-12 04:17:35 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2003-11-12 04:17:35 +00:00
|
|
|
ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
|
2000-05-18 21:25:51 +00:00
|
|
|
|
2012-11-09 01:04:05 +00:00
|
|
|
/**
|
|
|
|
* Merges two sort keys. The levels are merged with their corresponding counterparts
|
2001-11-13 22:55:57 +00:00
|
|
|
* (primaries with primaries, secondaries with secondaries etc.). Between the values
|
|
|
|
* from the same level a separator is inserted.
|
2012-11-09 01:04:05 +00:00
|
|
|
*
|
|
|
|
* This is useful, for example, for combining sort keys from first and last names
|
|
|
|
* to sort such pairs.
|
|
|
|
* It is possible to merge multiple sort keys by consecutively merging
|
|
|
|
* another one with the intermediate result.
|
|
|
|
*
|
|
|
|
* The length of the merge result is the sum of the lengths of the input sort keys.
|
|
|
|
*
|
|
|
|
* Example (uncompressed):
|
|
|
|
* <pre>191B1D 01 050505 01 910505 00
|
|
|
|
* 1F2123 01 050505 01 910505 00</pre>
|
2001-11-13 22:55:57 +00:00
|
|
|
* will be merged as
|
2012-11-09 01:04:05 +00:00
|
|
|
* <pre>191B1D 02 1F2123 01 050505 02 050505 01 910505 02 910505 00</pre>
|
|
|
|
*
|
|
|
|
* If the destination buffer is not big enough, then its contents are undefined.
|
|
|
|
* If any of source lengths are zero or any of the source pointers are NULL/undefined,
|
|
|
|
* the result is of size zero.
|
|
|
|
*
|
|
|
|
* @param src1 the first sort key
|
|
|
|
* @param src1Length the length of the first sort key, including the zero byte at the end;
|
|
|
|
* can be -1 if the function is to find the length
|
|
|
|
* @param src2 the second sort key
|
|
|
|
* @param src2Length the length of the second sort key, including the zero byte at the end;
|
|
|
|
* can be -1 if the function is to find the length
|
|
|
|
* @param dest the buffer where the merged sort key is written,
|
|
|
|
* can be NULL if destCapacity==0
|
|
|
|
* @param destCapacity the number of bytes in the dest buffer
|
|
|
|
* @return the length of the merged sort key, src1Length+src2Length;
|
|
|
|
* can be larger than destCapacity, or 0 if an error occurs (only for illegal arguments),
|
|
|
|
* in which cases the contents of dest is undefined
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:55:57 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UColAttributeValue U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
#ifndef U_HIDE_DRAFT_API
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the variable top to the top of the specified reordering group.
|
|
|
|
* The variable top determines the highest-sorting character
|
|
|
|
* which is affected by UCOL_ALTERNATE_HANDLING.
|
|
|
|
* If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect.
|
|
|
|
* @param coll the collator
|
|
|
|
* @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION,
|
|
|
|
* UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY;
|
|
|
|
* or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group
|
|
|
|
* @param pErrorCode Standard ICU error code. Its input value must
|
|
|
|
* pass the U_SUCCESS() test, or else the function returns
|
|
|
|
* immediately. Check for U_FAILURE() on output or use with
|
|
|
|
* function chaining. (See User Guide for details.)
|
|
|
|
* @see ucol_getMaxVariable
|
|
|
|
* @draft ICU 53
|
|
|
|
*/
|
|
|
|
U_DRAFT void U_EXPORT2
|
|
|
|
ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
|
|
|
|
* @param coll the collator
|
|
|
|
* @return the maximum variable reordering group.
|
|
|
|
* @see ucol_setMaxVariable
|
|
|
|
* @draft ICU 53
|
|
|
|
*/
|
|
|
|
U_DRAFT UColReorderCode U_EXPORT2
|
|
|
|
ucol_getMaxVariable(const UCollator *coll);
|
|
|
|
|
|
|
|
#endif /* U_HIDE_DRAFT_API */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the variable top to the primary weight of the specified string.
|
|
|
|
*
|
|
|
|
* Beginning with ICU 53, the variable top is pinned to
|
|
|
|
* the top of one of the supported reordering groups,
|
|
|
|
* and it must not be beyond the last of those groups.
|
|
|
|
* See ucol_setMaxVariable().
|
|
|
|
* @param coll the collator
|
2001-06-26 22:24:10 +00:00
|
|
|
* @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.
|
2014-02-25 21:21:49 +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 contraction<br>
|
|
|
|
* U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
|
|
|
|
* the last reordering group supported by ucol_setMaxVariable()
|
|
|
|
* @return variable top primary weight
|
2001-11-17 02:01:44 +00:00
|
|
|
* @see ucol_getVariableTop
|
|
|
|
* @see ucol_restoreVariableTop
|
2014-02-25 21:21:49 +00:00
|
|
|
* @deprecated ICU 53 Call ucol_setMaxVariable() instead.
|
2001-06-26 22:24:10 +00:00
|
|
|
*/
|
2014-02-25 21:21:49 +00:00
|
|
|
U_DEPRECATED uint32_t U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
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.
|
|
|
|
* @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.
|
2014-02-25 21:21:49 +00:00
|
|
|
* @return the variable top primary weight
|
|
|
|
* @see ucol_getMaxVariable
|
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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
|
2001-06-26 22:24:10 +00:00
|
|
|
|
2014-02-25 21:21:49 +00:00
|
|
|
/**
|
|
|
|
* Sets the variable top to the specified primary weight.
|
|
|
|
*
|
|
|
|
* Beginning with ICU 53, the variable top is pinned to
|
|
|
|
* the top of one of the supported reordering groups,
|
|
|
|
* and it must not be beyond the last of those groups.
|
|
|
|
* See ucol_setMaxVariable().
|
|
|
|
* @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop
|
|
|
|
* @param status error code
|
2001-11-17 02:01:44 +00:00
|
|
|
* @see ucol_getVariableTop
|
|
|
|
* @see ucol_setVariableTop
|
2014-02-25 21:21:49 +00:00
|
|
|
* @deprecated ICU 53 Call ucol_setMaxVariable() instead.
|
2001-06-26 22:24:10 +00:00
|
|
|
*/
|
2014-02-25 21:21:49 +00:00
|
|
|
U_DEPRECATED void U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
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
|
2013-09-17 19:48:50 +00:00
|
|
|
* @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br>
|
|
|
|
* user allocated space for the new clone.
|
2001-11-17 02:01:44 +00:00
|
|
|
* 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.
|
2013-09-17 19:48:50 +00:00
|
|
|
* Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
|
|
|
|
* @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.</em><br>
|
|
|
|
* 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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UCollator* U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
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
|
|
|
|
2013-09-17 19:48:50 +00:00
|
|
|
#ifndef U_HIDE_DEPRECATED_API
|
|
|
|
|
|
|
|
/** default memory size for the new clone.
|
|
|
|
* @deprecated ICU 52. Do not rely on ucol_safeClone() cloning into any provided buffer.
|
2002-12-11 23:57:33 +00:00
|
|
|
*/
|
2013-09-17 19:48:50 +00:00
|
|
|
#define U_COL_SAFECLONE_BUFFERSIZE 1
|
|
|
|
|
|
|
|
#endif /* U_HIDE_DEPRECATED_API */
|
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.
|
2012-09-20 05:37:31 +00:00
|
|
|
*
|
|
|
|
* ucol_getRules() should normally be used instead.
|
|
|
|
* See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
|
2000-11-17 23:32:32 +00:00
|
|
|
* @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.
|
2012-09-20 05:37:31 +00:00
|
|
|
* @param bufferLen length of buffer to store rules in. If less than 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
|
2012-09-20 05:37:31 +00:00
|
|
|
* @see UCOL_FULL_RULES
|
2000-11-17 23:32:32 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2001-11-21 01:08:55 +00:00
|
|
|
ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
|
2000-11-17 23:32:32 +00:00
|
|
|
|
2011-08-01 02:20:46 +00:00
|
|
|
#ifndef U_HIDE_DEPRECATED_API
|
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
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_DEPRECATED const char * U_EXPORT2
|
2002-08-21 19:12:24 +00:00
|
|
|
ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
2011-08-01 02:20:46 +00:00
|
|
|
#endif /* U_HIDE_DEPRECATED_API */
|
2002-08-21 19:12:24 +00:00
|
|
|
|
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.
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 2.8
|
2003-11-14 21:33:44 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE const char * U_EXPORT2
|
2003-11-14 21:33:44 +00:00
|
|
|
ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
|
|
|
|
2002-09-04 06:08:04 +00:00
|
|
|
/**
|
2014-02-25 21:21:49 +00:00
|
|
|
* Get a Unicode set that contains all the characters and sequences tailored in
|
2002-09-04 06:08:04 +00:00
|
|
|
* 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
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-09-04 06:08:04 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE USet * U_EXPORT2
|
2002-09-04 06:08:04 +00:00
|
|
|
ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
|
|
|
|
|
2011-08-01 02:20:46 +00:00
|
|
|
#ifndef U_HIDE_INTERNAL_API
|
2004-05-24 22:11:31 +00:00
|
|
|
/** Calculates the set of unsafe code points, given a collator.
|
2005-04-27 16:03:17 +00:00
|
|
|
* 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.
|
2004-05-24 22:11:31 +00:00
|
|
|
* @param coll Collator
|
|
|
|
* @param unsafe a fill-in set to receive the unsafe points
|
|
|
|
* @param status for catching errors
|
|
|
|
* @return number of elements in the set
|
|
|
|
* @internal ICU 3.0
|
|
|
|
*/
|
2004-06-12 00:56:53 +00:00
|
|
|
U_INTERNAL int32_t U_EXPORT2
|
2004-05-24 22:11:31 +00:00
|
|
|
ucol_getUnsafeSet( const UCollator *coll,
|
|
|
|
USet *unsafe,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
2005-06-21 21:07:20 +00:00
|
|
|
/** Touches all resources needed for instantiating a collator from a short string definition,
|
|
|
|
* thus filling up the cache.
|
|
|
|
* @param definition A short string containing a locale and a set of attributes.
|
|
|
|
* Attributes not explicitly mentioned are left at the default
|
|
|
|
* state for a locale.
|
|
|
|
* @param parseError if not NULL, structure that will get filled with error's pre
|
|
|
|
* and post context in case of error.
|
|
|
|
* @param forceDefaults if FALSE, the settings that are the same as the collator
|
|
|
|
* default settings will not be applied (for example, setting
|
|
|
|
* French secondary on a French collator would not be executed).
|
|
|
|
* If TRUE, all the settings will be applied regardless of the
|
|
|
|
* collator default value. If the definition
|
|
|
|
* strings are to be cached, should be set to FALSE.
|
|
|
|
* @param status Error code. Apart from regular error conditions connected to
|
|
|
|
* instantiating collators (like out of memory or similar), this
|
|
|
|
* API will return an error if an invalid attribute or attribute/value
|
|
|
|
* combination is specified.
|
|
|
|
* @see ucol_openFromShortString
|
|
|
|
* @internal ICU 3.2.1
|
|
|
|
*/
|
|
|
|
U_INTERNAL void U_EXPORT2
|
|
|
|
ucol_prepareShortStringOpen( const char *definition,
|
|
|
|
UBool forceDefaults,
|
|
|
|
UParseError *parseError,
|
|
|
|
UErrorCode *status);
|
2011-08-01 02:20:46 +00:00
|
|
|
#endif /* U_HIDE_INTERNAL_API */
|
2005-06-21 21:07:20 +00:00
|
|
|
|
2004-10-27 00:31:04 +00:00
|
|
|
/** 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.
|
|
|
|
* @param coll Collator
|
|
|
|
* @param buffer a fill-in buffer to receive the binary image
|
|
|
|
* @param capacity capacity of the destination buffer
|
|
|
|
* @param status for catching errors
|
|
|
|
* @return size of the image
|
|
|
|
* @see ucol_openBinary
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.2
|
2004-10-27 00:31:04 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2004-10-27 00:31:04 +00:00
|
|
|
ucol_cloneBinary(const UCollator *coll,
|
|
|
|
uint8_t *buffer, int32_t capacity,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
|
|
/** 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
|
2014-02-25 21:21:49 +00:00
|
|
|
* which usually should be the root collator.
|
2004-10-27 00:31:04 +00:00
|
|
|
* @param bin binary image owned by the user and required through the
|
|
|
|
* lifetime of the collator
|
|
|
|
* @param length size of the image. If negative, the API will try to
|
|
|
|
* figure out the length of the image
|
2014-02-25 21:21:49 +00:00
|
|
|
* @param base fallback collator, usually the root collator. Base is required to be
|
2004-10-27 00:31:04 +00:00
|
|
|
* present through the lifetime of the collator. Currently
|
|
|
|
* it cannot be NULL.
|
|
|
|
* @param status for catching errors
|
|
|
|
* @return newly created collator
|
|
|
|
* @see ucol_cloneBinary
|
2006-01-18 04:19:45 +00:00
|
|
|
* @stable ICU 3.2
|
2004-10-27 00:31:04 +00:00
|
|
|
*/
|
2006-01-18 04:19:45 +00:00
|
|
|
U_STABLE UCollator* U_EXPORT2
|
2004-10-27 00:31:04 +00:00
|
|
|
ucol_openBinary(const uint8_t *bin, int32_t length,
|
|
|
|
const UCollator *base,
|
|
|
|
UErrorCode *status);
|
|
|
|
|
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_COLLATION */
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#endif
|