1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
31b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert* Copyright (c) 1996-2015, International Business Machines Corporation and others.
4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* All Rights Reserved.
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*******************************************************************************
6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef UCOL_H
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define UCOL_H
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h"
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/unorm.h"
1650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/localpointer.h"
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/parseerr.h"
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uloc.h"
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uset.h"
20b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho#include "unicode/uscript.h"
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file
24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C API: Collator
25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <h2> Collator C API </h2>
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The C API for Collator performs locale-sensitive
29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string comparison. You use this service to build
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * searching and sorting routines for natural language text.
31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more information about the collation service see
33fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * <a href="http://userguide.icu-project.org/collation">the User Guide</a>.
34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Collation service provides correct sorting orders for most locales supported in ICU.
36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If specific data for a locale is not available, the orders eventually falls back
37fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * to the <a href="http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Collation">CLDR root sort order</a>.
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sort ordering may be customized by providing your own set of rules. For more on
40fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * this subject see the <a href="http://userguide.icu-project.org/collation/customization">
41fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Collation Customization</a> section of the User Guide.
42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see         UCollationResult
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see         UNormalizationMode
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see         UCollationStrength
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see         UCollationElements
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** A collator.
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*  For usage in C programs.
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustruct UCollator;
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** structure representing a collator object instance
54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef struct UCollator UCollator;
57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_LESS is returned if source string is compared to be less than target
6159d709d503bab6e2b61931737e662dd293b40578ccornelius * string in the ucol_strcoll() method.
62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_EQUAL is returned if source string is compared to be equal to target
6359d709d503bab6e2b61931737e662dd293b40578ccornelius * string in the ucol_strcoll() method.
64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_GREATER is returned if source string is compared to be greater than
6559d709d503bab6e2b61931737e662dd293b40578ccornelius * target string in the ucol_strcoll() method.
6659d709d503bab6e2b61931737e662dd293b40578ccornelius * @see ucol_strcoll()
67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Possible values for a comparison result
69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** string a == string b */
73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_EQUAL    = 0,
74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** string a > string b */
75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_GREATER    = 1,
76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** string a < string b */
77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_LESS    = -1
78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UCollationResult ;
79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Enum containing attribute values for controling collation behavior.
82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Here are all the allowable values. Not every attribute can take every value. The only
83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined
84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value for that locale
85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** accepted by most attributes */
89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_DEFAULT = -1,
90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Primary collation strength */
92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_PRIMARY = 0,
93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Secondary collation strength */
94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_SECONDARY = 1,
95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Tertiary collation strength */
96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_TERTIARY = 2,
97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Default collation strength */
98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_CE_STRENGTH_LIMIT,
100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Quaternary collation strength */
101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_QUATERNARY=3,
102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Identical collation strength */
103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_IDENTICAL=15,
104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_STRENGTH_LIMIT,
105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Turn the feature off - works for UCOL_FRENCH_COLLATION,
107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      & UCOL_DECOMPOSITION_MODE*/
109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_OFF = 16,
110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Turn the feature on - works for UCOL_FRENCH_COLLATION,
111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      & UCOL_DECOMPOSITION_MODE*/
113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_ON = 17,
114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_SHIFTED = 20,
117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_NON_IGNORABLE = 21,
119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** Valid for UCOL_CASE_FIRST -
121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      lower case sorts before upper case */
122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_LOWER_FIRST = 24,
123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** upper case sorts before lower case */
124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_UPPER_FIRST = 25,
125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_ATTRIBUTE_VALUE_COUNT
127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UColAttributeValue;
129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
130103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/**
131b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Enum containing the codes for reordering segments of the collation table that are not script
132b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * codes. These reordering codes are to be used in conjunction with the script codes.
133b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_getReorderCodes
134b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_setReorderCodes
135b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_getEquivalentReorderCodes
136103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UScriptCode
137103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8
13827f654740f2a26ad62a5c155af9199af9e69b889claireho */
139b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho typedef enum {
140b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
141b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * A special reordering code that is used to specify the default
142b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * reordering codes for a locale.
143103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
144b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
145b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_DEFAULT       = -1,
146b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
147b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * A special reordering code that is used to specify no reordering codes.
148103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
149b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
150b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_NONE          = USCRIPT_UNKNOWN,
151b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
152b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * A special reordering code that is used to specify all other codes used for
153b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * reordering except for the codes lised as UColReorderCode values and those
154b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * listed explicitly in a reordering.
155103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
156b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
157b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_OTHERS        = USCRIPT_UNKNOWN,
158b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
159b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * Characters with the space property.
160103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * This is equivalent to the rule value "space".
161103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
162b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
163b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_SPACE         = 0x1000,
164b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
165103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * The first entry in the enumeration of reordering groups. This is intended for use in
166103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * range checking and enumeration of the reorder codes.
167103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
168b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
169b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_FIRST         = UCOL_REORDER_CODE_SPACE,
170b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
171b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * Characters with the punctuation property.
172103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * This is equivalent to the rule value "punct".
173103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
174b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
175b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_PUNCTUATION   = 0x1001,
176b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
177b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * Characters with the symbol property.
178103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * This is equivalent to the rule value "symbol".
179103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
180b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
181b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_SYMBOL        = 0x1002,
182b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
183b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * Characters with the currency property.
184103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * This is equivalent to the rule value "currency".
185103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
186b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
187b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_CURRENCY      = 0x1003,
188b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
189b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    * Characters with the digit property.
190103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * This is equivalent to the rule value "digit".
191103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
192b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
193b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_DIGIT         = 0x1004,
194b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   /**
195103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * The limit of the reorder codes. This is intended for use in range checking
196103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * and enumeration of the reorder codes.
197103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    * @stable ICU 4.8
198b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    */
199b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    UCOL_REORDER_CODE_LIMIT         = 0x1005
20027f654740f2a26ad62a5c155af9199af9e69b889claireho} UColReorderCode;
20127f654740f2a26ad62a5c155af9199af9e69b889claireho
202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Base letter represents a primary difference.  Set comparison
204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Use this to set the strength of a Collator object.
206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Example of primary difference, "abc" &lt; "abd"
207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Diacritical differences on the same base letter represent a secondary
209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * difference.  Set comparison level to UCOL_SECONDARY to ignore tertiary
210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * differences. Use this to set the strength of a Collator object.
211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Example of secondary difference, "&auml;" >> "a".
212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Uppercase and lowercase versions of the same character represents a
214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * tertiary difference.  Set comparison level to UCOL_TERTIARY to include
215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * all comparison differences. Use this to set the strength of a Collator
216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * object.
217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Two characters are considered "identical" when they have the same
220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unicode spellings.  UCOL_IDENTICAL.
221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For example, "&auml;" == "&auml;".
222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCollationStrength is also used to determine the strength of sort keys
224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * generated from UCollator objects
225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * These values can be now found in the UColAttributeValue enum.
226b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru **/
228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef UColAttributeValue UCollationStrength;
229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value, as well as the values specific to each one.
232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
23554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     /** Attribute for direction of secondary weights - used in Canadian French.
236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Acceptable values are UCOL_ON, which results in secondary weights
237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * being considered backwards and UCOL_OFF which treats secondary
23854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * weights in the order they appear.
23954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
24054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_FRENCH_COLLATION,
242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** Attribute for handling variable elements.
243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Acceptable values are UCOL_NON_IGNORABLE (default)
244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * which treats all the codepoints with non-ignorable
245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * primary weights in the same way,
246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * and UCOL_SHIFTED which causes codepoints with primary
247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * weights that are equal or below the variable top value
248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * to be ignored on primary level and moved to the quaternary
24954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * level.
25054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
25154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_ALTERNATE_HANDLING,
253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** Controls the ordering of upper and lower case letters.
254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * Acceptable values are UCOL_OFF (default), which orders
255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * upper and lower case letters in accordance to their tertiary
256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * weights, UCOL_UPPER_FIRST which forces upper case letters to
257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * sort before lower case letters, and UCOL_LOWER_FIRST which does
25854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * the opposite.
25954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
26054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_CASE_FIRST,
262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** Controls whether an extra case level (positioned before the third
263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * level) is generated or not. Acceptable values are UCOL_OFF (default),
264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * when case level is not generated, and UCOL_ON which causes the case
265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * level to be generated. Contents of the case level are affected by
266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * the value of UCOL_CASE_FIRST attribute. A simple way to ignore
267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * accent differences in a string is to set the strength to UCOL_PRIMARY
26854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * and enable case level.
26954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
27054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_CASE_LEVEL,
272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** Controls whether the normalization check and necessary normalizations
273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * are performed. When set to UCOL_OFF (default) no normalization check
274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * is performed. The correctness of the result is guaranteed only if the
275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * input data is in so-called FCD form (see users manual for more info).
276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * When set to UCOL_ON, an incremental check is performed to see whether
277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * the input data is in the FCD form. If the data is not in the FCD form,
27854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * incremental NFD normalization is performed.
27954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
28054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_NORMALIZATION_MODE,
28254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     /** An alias for UCOL_NORMALIZATION_MODE attribute.
28354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
28454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
288fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * for most locales (except Japanese) is tertiary.
289fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
290fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * Quaternary strength
291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * is useful when combined with shifted setting for alternate handling
292fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * attribute and for JIS X 4061 collation, when it is used to distinguish
293fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * between Katakana and Hiragana.
294fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * Otherwise, quaternary level
295fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * is affected only by the number of non-ignorable code points in
296fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * the string.
297fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
298fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * Identical strength is rarely useful, as it amounts
29954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * to codepoints of the NFD form of the string.
30054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
30154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_STRENGTH,
30359d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_DEPRECATED_API
304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     /** When turned on, this attribute positions Hiragana before all
305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      * non-ignorables on quaternary level This is a sneaky way to produce JIS
30654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * sort order.
30754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      *
308fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * This attribute was an implementation detail of the CLDR Japanese tailoring.
30954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * Since ICU 50, this attribute is not settable any more via API functions.
310fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * Since CLDR 25/ICU 53, explicit quaternary relations are used
311fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * to achieve the same Japanese sort order.
312fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
313fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * @deprecated ICU 50 Implementation detail, cannot be set via API, was removed from implementation.
31454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
31559d709d503bab6e2b61931737e662dd293b40578ccornelius     UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
31659d709d503bab6e2b61931737e662dd293b40578ccornelius#endif  /* U_HIDE_DEPRECATED_API */
317fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     /**
318fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * When turned on, this attribute makes
319fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * substrings of digits sort according to their numeric values.
320fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
32150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho      * This is a way to get '100' to sort AFTER '2'. Note that the longest
322fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * digit substring that can be treated as a single unit is
32350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho      * 254 digits (not counting leading zeros). If a digit substring is
32450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho      * longer than that, the digits beyond the limit will be treated as a
325fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * separate digit substring.
326fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
327fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * A "digit" in this sense is a code point with General_Category=Nd,
328fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * which does not include circled numbers, roman numerals, etc.
329fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * Only a contiguous digit substring is considered, that is,
330fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * non-negative integers without separators.
331fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      * There is no support for plus/minus signs, decimals, exponents, etc.
332fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius      *
33354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.8
33454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
33559d709d503bab6e2b61931737e662dd293b40578ccornelius     UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
33654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     /**
33754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * The number of UColAttribute constants.
33854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      * @stable ICU 2.0
33954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius      */
340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru     UCOL_ATTRIBUTE_COUNT
341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UColAttribute;
342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Options for retrieving the rule string
344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @stable ICU 2.0
345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
34754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius  /**
34854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * Retrieves the tailoring rules only.
34954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * Same as calling the version of getRules() without UColRuleOption.
35054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * @stable ICU 2.0
35154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   */
352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_TAILORING_ONLY,
35354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius  /**
35454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * Retrieves the "UCA rules" concatenated with the tailoring rules.
35554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * The "UCA rules" are an <i>approximation</i> of the root collator's sort order.
35654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * They are almost never used or useful at runtime and can be removed from the data.
35754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
35854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   * @stable ICU 2.0
35954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius   */
360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_FULL_RULES
361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UColRuleOption ;
362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Open a UCollator for comparing strings.
365dbc22bd174be483711cea006f3189d8289835830ccornelius *
366dbc22bd174be483711cea006f3189d8289835830ccornelius * For some languages, multiple collation types are available;
367dbc22bd174be483711cea006f3189d8289835830ccornelius * for example, "de@collation=phonebook".
368dbc22bd174be483711cea006f3189d8289835830ccornelius * Starting with ICU 54, collation attributes can be specified via locale keywords as well,
369dbc22bd174be483711cea006f3189d8289835830ccornelius * in the old locale extension syntax ("el@colCaseFirst=upper")
370dbc22bd174be483711cea006f3189d8289835830ccornelius * or in language tag syntax ("el-u-kf-upper").
371dbc22bd174be483711cea006f3189d8289835830ccornelius * See <a href="http://userguide.icu-project.org/collation/api">User Guide: Collation API</a>.
372dbc22bd174be483711cea006f3189d8289835830ccornelius *
373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The UCollator pointer is used in all the calls to the Collation
374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * service. After finished, collator must be disposed of by calling
375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * {@link #ucol_close }.
376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param loc The locale containing the required collation rules.
377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *            Special values for locales can be passed in -
378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *            if NULL is passed for the locale, the default locale
379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *            collation rules will be used. If empty string ("") or
380fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *            "root" are passed, the root collator will be returned.
381fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors
382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to a UCollator, or 0 if an error occurred.
383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openRules
384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_safeClone
385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_close
386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollator* U_EXPORT2
389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_open(const char *loc, UErrorCode *status);
390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
392fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Produce a UCollator instance according to the rules supplied.
393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The rules are used to change the default ordering, defined in the
394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCA in a process called tailoring. The resulting UCollator pointer
395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rules A string describing the collation rules. For the syntax
397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *              of the rules please see users guide.
398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param rulesLength The length of rules, or -1 if null-terminated.
399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param normalizationMode The normalization mode: One of
400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             UCOL_OFF     (expect the text to not need normalization),
401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             UCOL_ON      (normalize), or
402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             UCOL_DEFAULT (set the mode according to the rules)
403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError  A pointer to UParseError to recieve information about errors
406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    occurred during parsing. This argument can currently be set
407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    to NULL, but at users own risk. Please provide a real structure.
408fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors
409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         of error - please use status argument to check for errors.
411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_open
412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_safeClone
413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_close
414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollator* U_EXPORT2
417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_openRules( const UChar        *rules,
418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                int32_t            rulesLength,
419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UColAttributeValue normalizationMode,
420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UCollationStrength strength,
421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UParseError        *parseError,
422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode         *status);
423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
424f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DEPRECATED_API
425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Open a collator defined by a short form string.
427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The structure and the syntax of the string is defined in the "Naming collators"
428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * section of the users guide:
429fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * strength will be 3. 3066bis locale overrides individual locale parts.
432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The call to this function is equivalent to a call to ucol_open, followed by a
433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * series of calls to ucol_setAttribute and ucol_setVariableTop.
434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param definition A short string containing a locale and a set of attributes.
435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   Attributes not explicitly mentioned are left at the default
436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   state for a locale.
437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError if not NULL, structure that will get filled with error's pre
438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   and post context in case of error.
439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param forceDefaults if FALSE, the settings that are the same as the collator
440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   default settings will not be applied (for example, setting
441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   French secondary on a French collator would not be executed).
442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   If TRUE, all the settings will be applied regardless of the
443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   collator default value. If the definition
444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   strings are to be cached, should be set to FALSE.
445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status     Error code. Apart from regular error conditions connected to
446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   instantiating collators (like out of memory or similar), this
447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   API will return an error if an invalid attribute or attribute/value
448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   combination is specified.
449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return           A pointer to a UCollator or 0 if an error occured (including an
450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   invalid attribute).
451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_open
452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setAttribute
453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setVariableTop
454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getShortDefinitionString
455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_normalizeShortDefinitionString
456f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @deprecated ICU 54 Use ucol_open() with language tag collation keywords instead.
457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
458f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusU_DEPRECATED UCollator* U_EXPORT2
459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_openFromShortString( const char *definition,
460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UBool forceDefaults,
461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UParseError *parseError,
462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UErrorCode *status);
463f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DEPRECATED_API */
464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
465103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API
466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get a set containing the contractions defined by the collator. The set includes
468fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * both the root collator's contractions and the contractions defined by the collator. This set
469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will contain only strings. If a tailoring explicitly suppresses contractions from
470fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * the root collator (like Russian), removed contractions will not be in the resulting set.
471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator
472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param conts the set to hold the result. It gets emptied before
473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *              contractions are added.
474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to hold the error code
475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the size of the contraction set
476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_DEPRECATED int32_t U_EXPORT2
480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getContractions( const UCollator *coll,
481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  USet *conts,
482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode *status);
483103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif  /* U_HIDE_DEPRECATED_API */
484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get a set containing the expansions defined by the collator. The set includes
487fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * both the root collator's expansions and the expansions defined by the tailoring
488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator
489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param contractions if not NULL, the set to hold the contractions
490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param expansions if not NULL, the set to hold the expansions
491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param addPrefixes add the prefix contextual elements to contractions
492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to hold the error code
493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.4
495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getContractionsAndExpansions( const UCollator *coll,
498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  USet *contractions, USet *expansions,
499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UBool addPrefixes, UErrorCode *status);
500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Close a UCollator.
503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Once closed, a UCollator should not be used. Every open collator should
504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * be closed. Otherwise, a memory leak will result.
505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to close.
506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_open
507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openRules
508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_safeClone
509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_close(UCollator *coll);
513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
51450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if U_SHOW_CPLUSPLUS_API
51550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
51650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_BEGIN
51750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
51850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
51950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \class LocalUCollatorPointer
52050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * "Smart pointer" class, closes a UCollator via ucol_close().
52150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * For most methods see the LocalPointerBase base class.
52250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
52350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointerBase
52450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointer
52527f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4
52650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */
52750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
52850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
52950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_END
53050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
53150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif
53250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings.
535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The strings will be compared using the options already specified.
536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the comparison rules.
537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The source string.
538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target The target string.
540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param targetLength The length of target, or -1 if null-terminated.
541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The result of comparing the strings; one of UCOL_EQUAL,
542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_GREATER, UCOL_LESS
543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greater
544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greaterOrEqual
545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_equal
546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollationResult U_EXPORT2
549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_strcoll(    const    UCollator    *coll,
550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        const    UChar        *source,
551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t            sourceLength,
552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        const    UChar        *target,
553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t            targetLength);
554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
55554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius/**
55654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* Compare two strings in UTF-8.
55754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* The strings will be compared using the options already specified.
55854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* Note: When input string contains malformed a UTF-8 byte sequence,
55954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* this function treats these bytes as REPLACEMENT CHARACTER (U+FFFD).
56054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @param coll The UCollator containing the comparison rules.
56154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @param source The source UTF-8 string.
56254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @param sourceLength The length of source, or -1 if null-terminated.
56354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @param target The target UTF-8 string.
56454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @param targetLength The length of target, or -1 if null-terminated.
565fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius* @param status A pointer to a UErrorCode to receive any errors
56654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @return The result of comparing the strings; one of UCOL_EQUAL,
56754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* UCOL_GREATER, UCOL_LESS
56854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @see ucol_greater
56954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @see ucol_greaterOrEqual
57054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius* @see ucol_equal
57159d709d503bab6e2b61931737e662dd293b40578ccornelius* @stable ICU 50
57254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius*/
57359d709d503bab6e2b61931737e662dd293b40578ccorneliusU_STABLE UCollationResult U_EXPORT2
57454dcd9b6a06071f647dac967e9e267abb9410720Craig Corneliusucol_strcollUTF8(
57554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        const UCollator *coll,
57654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        const char      *source,
57754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        int32_t         sourceLength,
57854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        const char      *target,
57954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        int32_t         targetLength,
58054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius        UErrorCode      *status);
58154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Determine if one string is greater than another.
584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the comparison rules.
586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The source string.
587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target The target string.
589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param targetLength The length of target, or -1 if null-terminated.
590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return TRUE if source is greater than target, FALSE otherwise.
591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_strcoll
592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greaterOrEqual
593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_equal
594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_greater(const UCollator *coll,
598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             const UChar     *source, int32_t sourceLength,
599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             const UChar     *target, int32_t targetLength);
600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Determine if one string is greater than or equal to another.
603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the comparison rules.
605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The source string.
606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target The target string.
608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param targetLength The length of target, or -1 if null-terminated.
609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return TRUE if source is greater than or equal to target, FALSE otherwise.
610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_strcoll
611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greater
612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_equal
613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_greaterOrEqual(const UCollator *coll,
617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    const UChar     *source, int32_t sourceLength,
618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    const UChar     *target, int32_t targetLength);
619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two strings for equality.
622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the comparison rules.
624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The source string.
625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param target The target string.
627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param targetLength The length of target, or -1 if null-terminated.
628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return TRUE if source is equal to target, FALSE otherwise
629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_strcoll
630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greater
631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_greaterOrEqual
632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_equal(const UCollator *coll,
636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           const UChar     *source, int32_t sourceLength,
637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           const UChar     *target, int32_t targetLength);
638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Compare two UTF-8 encoded trings.
641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The strings will be compared using the options already specified.
642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the comparison rules.
643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sIter The source string iterator.
644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param tIter The target string iterator.
645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The result of comparing the strings; one of UCOL_EQUAL,
646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_GREATER, UCOL_LESS
647fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors
648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_strcoll
649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6
650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollationResult U_EXPORT2
652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_strcollIter(  const    UCollator    *coll,
653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UCharIterator *sIter,
654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UCharIterator *tIter,
655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode *status);
656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get the collation strength used in a UCollator.
659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The strength influences how strings are compared.
660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to query.
661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setStrength
664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollationStrength U_EXPORT2
667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getStrength(const UCollator *coll);
668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set the collation strength used in a UCollator.
671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The strength influences how strings are compared.
672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to set.
673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param strength The desired collation strength; one of UCOL_PRIMARY,
674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getStrength
676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_setStrength(UCollator *coll,
680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 UCollationStrength strength);
681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
683b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Retrieves the reordering codes for this collator.
684b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * These reordering codes are a combination of UScript codes and UColReorderCode entries.
68527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param coll The UCollator to query.
68627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest The array to fill with the script ordering.
687b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
6881b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * will only return the length of the result without writing any codes (pre-flighting).
689b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
690b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * failure before the function call.
691b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The number of reordering codes written to the dest array.
69227f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ucol_setReorderCodes
693b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_getEquivalentReorderCodes
694103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UScriptCode
695103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UColReorderCode
696103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8
69727f654740f2a26ad62a5c155af9199af9e69b889claireho */
69854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
69927f654740f2a26ad62a5c155af9199af9e69b889clairehoucol_getReorderCodes(const UCollator* coll,
70027f654740f2a26ad62a5c155af9199af9e69b889claireho                    int32_t* dest,
70127f654740f2a26ad62a5c155af9199af9e69b889claireho                    int32_t destCapacity,
70227f654740f2a26ad62a5c155af9199af9e69b889claireho                    UErrorCode *pErrorCode);
703b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho/**
704b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Sets the reordering codes for this collator.
7051b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * Collation reordering allows scripts and some other groups of characters
7061b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * to be moved relative to each other. This reordering is done on top of
707b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * the DUCET/CLDR standard collation order. Reordering can specify groups to be placed
708b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * at the start and/or the end of the collation order. These groups are specified using
709b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * UScript codes and UColReorderCode entries.
7101b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
711b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p>By default, reordering codes specified for the start of the order are placed in the
7121b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * order given after several special non-script blocks. These special groups of characters
713b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * are space, punctuation, symbol, currency, and digit. These special groups are represented with
714b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * UColReorderCode entries. Script groups can be intermingled with
7151b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * these special non-script groups if those special groups are explicitly specified in the reordering.
7161b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
717b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p>The special code OTHERS stands for any script that is not explicitly
718b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * mentioned in the list of reordering codes given. Anything that is after OTHERS
719b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * will go at the very end of the reordering in the order given.
7201b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
721b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p>The special reorder code DEFAULT will reset the reordering for this collator
722b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * to the default for this collator. The default reordering may be the DUCET/CLDR order or may be a reordering that
723b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * was specified when this collator was created from resource data or from rules. The
7241b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * DEFAULT code <b>must</b> be the sole code supplied when it is used.
7251b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * If not, then U_ILLEGAL_ARGUMENT_ERROR will be set.
7261b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
727b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p>The special reorder code NONE will remove any reordering for this collator.
728103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * The result of setting no reordering will be to have the DUCET/CLDR ordering used. The
7291b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * NONE code <b>must</b> be the sole code supplied when it is used.
7301b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
73127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param coll The UCollator to set.
732b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param reorderCodes An array of script codes in the new order. This can be NULL if the
733b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * length is also set to 0. An empty array will clear any reordering codes on the collator.
73427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param reorderCodesLength The length of reorderCodes.
735b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
736b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * failure before the function call.
73727f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ucol_getReorderCodes
738b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_getEquivalentReorderCodes
739103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UScriptCode
740103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UColReorderCode
741103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8
742b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */
74354dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
74427f654740f2a26ad62a5c155af9199af9e69b889clairehoucol_setReorderCodes(UCollator* coll,
74527f654740f2a26ad62a5c155af9199af9e69b889claireho                    const int32_t* reorderCodes,
74627f654740f2a26ad62a5c155af9199af9e69b889claireho                    int32_t reorderCodesLength,
74727f654740f2a26ad62a5c155af9199af9e69b889claireho                    UErrorCode *pErrorCode);
748b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
749b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho/**
750b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder
751b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * codes will be grouped and must reorder together.
7521b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * Beginning with ICU 55, scripts only reorder together if they are primary-equal,
7531b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * for example Hiragana and Katakana.
7541b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert *
755b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param reorderCode The reorder code to determine equivalence for.
756b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param dest The array to fill with the script ordering.
757b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
7581b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * will only return the length of the result without writing any codes (pre-flighting).
759b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate
760b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * a failure before the function call.
761b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The number of reordering codes written to the dest array.
762b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_setReorderCodes
763b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @see ucol_getReorderCodes
764103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UScriptCode
765103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @see UColReorderCode
766103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.8
767b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho */
76854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
769b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2clairehoucol_getEquivalentReorderCodes(int32_t reorderCode,
770b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                    int32_t* dest,
771b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                    int32_t destCapacity,
772b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                    UErrorCode *pErrorCode);
77327f654740f2a26ad62a5c155af9199af9e69b889claireho
77427f654740f2a26ad62a5c155af9199af9e69b889claireho/**
775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get the display name for a UCollator.
776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The display name is suitable for presentation to a user.
777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param objLoc The locale of the collator in question.
778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dispLoc The locale for display.
779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result A pointer to a buffer to receive the attribute.
780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength The maximum size of result.
781fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status A pointer to a UErrorCode to receive any errors
782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The total buffer size needed; if greater than resultLength,
783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the output was truncated.
784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getDisplayName(    const    char        *objLoc,
788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            const    char        *dispLoc,
789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            UChar             *result,
790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            int32_t         resultLength,
791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            UErrorCode        *status);
792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get a locale for which collation rules are available.
795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * A UCollator in a locale returned by this function will perform the correct
796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation for the locale.
797b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param localeIndex The index of the desired locale.
798b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A locale for which collation rules are available, or 0 if none.
799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_countAvailable
800b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* U_EXPORT2
803b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruucol_getAvailable(int32_t localeIndex);
804b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
805b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
806b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Determine how many locales have collation rules available.
807b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function is most useful as determining the loop ending condition for
808b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * calls to {@link #ucol_getAvailable }.
809b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of locales for which collation rules are available.
810b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getAvailable
811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
813b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
814b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_countAvailable(void);
815b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
816b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_SERVICE
817b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
818b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Create a string enumerator of all locales for which a valid
819b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collator may be opened.
820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status input-output error code
821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a string enumeration over locale strings. The caller is
822b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * responsible for closing the result.
823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration* U_EXPORT2
826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_openAvailableLocales(UErrorCode *status);
827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif
828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Create a string enumerator of all possible keywords that are relevant to
831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * collation. At this point, the only recognized keyword for this
832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * service is "collation".
833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status input-output error code
834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a string enumeration over locale strings. The caller is
835b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * responsible for closing the result.
836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
838b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration* U_EXPORT2
839b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getKeywords(UErrorCode *status);
840b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
841b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
842b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Given a keyword, create a string enumeration of all values
843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for that keyword that are currently in use.
844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keyword a particular keyword as enumerated by
845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ucol_getKeywords. If any other keyword is passed in, *status is set
846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to U_ILLEGAL_ARGUMENT_ERROR.
847b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status input-output error code
848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a string enumeration over collation keyword values, or NULL
849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * upon error. The caller is responsible for closing the result.
850b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
851b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
852b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration* U_EXPORT2
853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getKeywordValues(const char *keyword, UErrorCode *status);
854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
855b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
856b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Given a key and a locale, returns an array of string values in a preferred
857b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * order that would make a difference. These are all and only those values where
858b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the open (creation) of the service with the locale formed from the input locale
859b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * plus input keyword and that value has different behavior than creation with the
860b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * input locale alone.
861b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param key           one of the keys supported by this service.  For now, only
862b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru *                      "collation" is supported.
863b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param locale        the locale
864b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param commonlyUsed  if set to true it will return only commonly used values
865b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru *                      with the given locale in preferred order.  Otherwise,
866b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru *                      it will return all the available values for the locale.
867b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param status error status
868b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return a string enumeration over keyword values for the given key and the locale.
86950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2
870b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */
87150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UEnumeration* U_EXPORT2
872b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruucol_getKeywordValuesForLocale(const char* key,
873b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                               const char* locale,
874b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                               UBool commonlyUsed,
875b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru                               UErrorCode* status);
876b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru
877b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/**
878f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * Return the functionally equivalent locale for the specified
879f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * input locale, with respect to given keyword, for the
880f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * collation service. If two different input locale + keyword
881f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * combinations produce the same result locale, then collators
882f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * instantiated for these two different input locales will behave
883f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * equivalently. The converse is not always true; two collators
884b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * may in fact be equivalent, but return different results, due to
885f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * internal details. The return result has no other meaning than
886b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that stated above, and implies nothing as to the relationship
887f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * between the two locales. This is intended for use by
888b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * applications who wish to cache collators, or otherwise reuse
889f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * collators when possible. The functional equivalent may change
890f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * over time. For more information, please see the <a
891fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * href="http://userguide.icu-project.org/locale#TOC-Locales-and-Services">
892b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Locales and Services</a> section of the ICU User Guide.
893f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @param result fillin for the functionally equivalent result locale
894b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultCapacity capacity of the fillin buffer
895b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keyword a particular keyword as enumerated by
896b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ucol_getKeywords.
897f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @param locale the specified input locale
898b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param isAvailable if non-NULL, pointer to a fillin parameter that
899f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * on return indicates whether the specified input locale was 'available'
900f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * to the collation service. A locale is defined as 'available' if it
901b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * physically exists within the collation locale data.
902b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status pointer to input-output error code
903f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * @return the actual buffer size needed for the locale. If greater
904b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than resultCapacity, the returned full name will be truncated and
905b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * an error code will be returned.
906b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
907b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
908b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
909b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
910b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                             const char* keyword, const char* locale,
911b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                             UBool* isAvailable, UErrorCode* status);
912b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
913b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
91454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Get the collation tailoring rules from a UCollator.
915b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The rules will follow the rule syntax.
916b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to query.
917b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length
91854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return The collation tailoring rules.
919b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
920b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
921b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const UChar* U_EXPORT2
922b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getRules(    const    UCollator    *coll,
923b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t            *length);
924b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
925f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DEPRECATED_API
926b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Get the short definition string for a collator. This API harvests the collator's
927b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  locale and the attribute set and produces a string that can be used for opening
928fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *  a collator with the same attributes using the ucol_openFromShortString API.
929b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  This string will be normalized.
930b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  The structure and the syntax of the string is defined in the "Naming collators"
931b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  section of the users guide:
932fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *  http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
933b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  This API supports preflighting.
934b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param coll a collator
935b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param locale a locale that will appear as a collators locale in the resulting
936b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                short string definition. If NULL, the locale will be harvested
937b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                from the collator.
938b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param buffer space to hold the resulting string
939b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param capacity capacity of the buffer
940b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status for returning errors. All the preflighting errors are featured
941b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return length of the resulting string
942b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_openFromShortString
943b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_normalizeShortDefinitionString
944f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *  @deprecated ICU 54
945b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
946f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusU_DEPRECATED int32_t U_EXPORT2
947b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getShortDefinitionString(const UCollator *coll,
948b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                              const char *locale,
949b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                              char *buffer,
950b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                              int32_t capacity,
951b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                              UErrorCode *status);
952b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
953b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Verifies and normalizes short definition string.
954b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  Normalized short definition string has all the option sorted by the argument name,
955b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  so that equivalent definition strings are the same.
956b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  This API supports preflighting.
957b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param source definition string
958b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param destination space to hold the resulting string
959b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param capacity capacity of the buffer
960b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param parseError if not NULL, structure that will get filled with error's pre
961b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   and post context in case of error.
962b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status     Error code. This API will return an error if an invalid attribute
963b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    or attribute/value combination is specified. All the preflighting
964b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    errors are also featured
965b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return length of the resulting normalized string.
966b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
967b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_openFromShortString
968b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_getShortDefinitionString
969b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
970f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *  @deprecated ICU 54
971b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
972b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
973f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusU_DEPRECATED int32_t U_EXPORT2
974b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_normalizeShortDefinitionString(const char *source,
975b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                    char *destination,
976b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                    int32_t capacity,
977b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                    UParseError *parseError,
978b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                                    UErrorCode *status);
979f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DEPRECATED_API */
980c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
981b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
982b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
983b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get a sort key for a string from a UCollator.
984b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sort keys may be compared using <TT>strcmp</TT>.
98527f654740f2a26ad62a5c155af9199af9e69b889claireho *
986f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * Note that sort keys are often less efficient than simply doing comparison.
987f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * For more details, see the ICU User Guide.
988f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *
98927f654740f2a26ad62a5c155af9199af9e69b889claireho * Like ICU functions that write to an output buffer, the buffer contents
99027f654740f2a26ad62a5c155af9199af9e69b889claireho * is undefined if the buffer capacity (resultLength parameter) is too small.
99127f654740f2a26ad62a5c155af9199af9e69b889claireho * Unlike ICU functions that write a string to an output buffer,
99227f654740f2a26ad62a5c155af9199af9e69b889claireho * the terminating zero byte is counted in the sort key length.
993b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator containing the collation rules.
994b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The string to transform.
995b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
996b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result A pointer to a buffer to receive the attribute.
997b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength The maximum size of result.
998c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return The size needed to fully store the sort key.
999c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *      If there was an internal error generating the sort key,
1000c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *      a zero value is returned.
1001b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_keyHashCode
1002b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1003b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1004b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1005b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getSortKey(const    UCollator    *coll,
1006b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        const    UChar        *source,
1007b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t        sourceLength,
1008b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        uint8_t        *result,
1009b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t        resultLength);
1010b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1011b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1012b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Gets the next count bytes of a sort key. Caller needs
1013b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  to preserve state array between calls and to provide
1014b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  the same type of UCharIterator set with the same string.
1015b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  The destination buffer provided must be big enough to store
101654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius *  the number of requested bytes.
101754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius *
101854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius *  The generated sort key may or may not be compatible with
101954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius *  sort keys generated using ucol_getSortKey().
1020b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param coll The UCollator containing the collation rules.
1021b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param iter UCharIterator containing the string we need
1022b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *              the sort key to be calculated for.
1023b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param state Opaque state of sortkey iteration.
1024b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param dest Buffer to hold the resulting sortkey part
1025b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param count number of sort key bytes required.
1026b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status error code indicator.
1027b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return the actual number of bytes of a sortkey. It can be
1028b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *          smaller than count if we have reached the end of
1029b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *          the sort key.
1030b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @stable ICU 2.6
1031b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1032b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1033b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_nextSortKeyPart(const UCollator *coll,
1034b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     UCharIterator *iter,
1035b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     uint32_t state[2],
1036b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     uint8_t *dest, int32_t count,
1037b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                     UErrorCode *status);
1038b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1039b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** enum that is taken by ucol_getBound API
1040b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See below for explanation
1041b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * do not change the values assigned to the
1042b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * members of this enum. Underlying code
1043b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * depends on them having these numbers
1044b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1045b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1046b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum {
1047b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** lower bound */
1048b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_BOUND_LOWER = 0,
1049b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** upper bound that will match strings of exact size */
1050b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_BOUND_UPPER = 1,
1051b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  /** upper bound that will match all the strings that have the same initial substring as the given string */
1052b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_BOUND_UPPER_LONG = 2,
1053b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  UCOL_BOUND_VALUE_COUNT
1054b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UColBoundMode;
1055b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1056b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1057b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Produce a bound for a given sortkey and a number of levels.
1058b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Return value is always the number of bytes needed, regardless of
1059b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * whether the result buffer was big enough or even valid.<br>
1060b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resulting bounds can be used to produce a range of strings that are
1061b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * between upper and lower bounds. For example, if bounds are produced
1062b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for a sortkey of string "smith", strings between upper and lower
1063b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
1064b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
1065b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is produced, strings matched would be as above. However, if bound
1066b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
1067b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * also match "Smithsonian" and similar.<br>
1068b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For more on usage, see example in cintltst/capitst.c in procedure
1069b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * TestBounds.
1070b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sort keys may be compared using <TT>strcmp</TT>.
1071b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param source The source sortkey.
1072b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param sourceLength The length of source, or -1 if null-terminated.
1073b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                     (If an unmodified sortkey is passed, it is always null
1074b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                      terminated).
1075b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
1076b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                  produces a lower inclusive bound, UCOL_BOUND_UPPER, that
1077b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                  produces upper bound that matches strings of the same length
1078b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                  or UCOL_BOUND_UPPER_LONG that matches strings that have the
1079b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                  same starting substring as the source string.
1080b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param noOfLevels  Number of levels required in the resulting bound (for most
1081b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    uses, the recommended value is 1). See users guide for
1082b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                    explanation on number of levels a sortkey can have.
1083b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result A pointer to a buffer to receive the resulting sortkey.
1084b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultLength The maximum size of result.
1085b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Used for returning error code if something went wrong. If the
1086b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *               number of levels requested is higher than the number of levels
1087b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *               in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
1088b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *               issued.
1089b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The size needed to fully store the bound.
1090b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_keyHashCode
1091b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.1
1092b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1093b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1094b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getBound(const uint8_t       *source,
1095b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t             sourceLength,
1096b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        UColBoundMode       boundType,
1097b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        uint32_t            noOfLevels,
1098b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        uint8_t             *result,
1099b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        int32_t             resultLength,
1100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru        UErrorCode          *status);
1101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the version information for a Collator. Version is currently
1104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * an opaque 32-bit number which depends, among other things, on major
1105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * versions of the collator tailoring and UCA.
1106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to query.
1107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param info the version # information, the result will be filled in
1108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
1111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getVersion(const UCollator* coll, UVersionInfo info);
1112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the UCA version information for a Collator. Version is the
1115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UCA version number (3.1.1, 4.0).
1116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator to query.
1117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param info the version # information, the result will be filled in
1118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8
1119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
1121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
1122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
11238393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius/**
11248393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * Merges two sort keys. The levels are merged with their corresponding counterparts
1125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * (primaries with primaries, secondaries with secondaries etc.). Between the values
1126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from the same level a separator is inserted.
11278393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *
11288393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * This is useful, for example, for combining sort keys from first and last names
11298393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * to sort such pairs.
1130f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * See http://www.unicode.org/reports/tr10/#Merging_Sort_Keys
1131f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *
1132f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * The recommended way to achieve "merged" sorting is by
1133f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * concatenating strings with U+FFFE between them.
1134f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * The concatenation has the same sort order as the merged sort keys,
1135f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\uFFFE' + str2).
1136f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * Using strings with U+FFFE may yield shorter sort keys.
1137f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *
1138f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * For details about Sort Key Features see
1139f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius * http://userguide.icu-project.org/collation/api#TOC-Sort-Key-Features
1140f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *
11418393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * It is possible to merge multiple sort keys by consecutively merging
11428393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * another one with the intermediate result.
11438393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *
11448393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * The length of the merge result is the sum of the lengths of the input sort keys.
11458393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *
11468393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * Example (uncompressed):
11478393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * <pre>191B1D 01 050505 01 910505 00
11488393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * 1F2123 01 050505 01 910505 00</pre>
1149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be merged as
11508393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * <pre>191B1D 02 1F2123 01 050505 02 050505 01 910505 02 910505 00</pre>
11518393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *
11528393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * If the destination buffer is not big enough, then its contents are undefined.
11538393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * If any of source lengths are zero or any of the source pointers are NULL/undefined,
11548393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * the result is of size zero.
11558393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *
11568393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param src1 the first sort key
11578393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param src1Length the length of the first sort key, including the zero byte at the end;
11588393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *        can be -1 if the function is to find the length
11598393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param src2 the second sort key
11608393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param src2Length the length of the second sort key, including the zero byte at the end;
11618393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *        can be -1 if the function is to find the length
11628393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param dest the buffer where the merged sort key is written,
11638393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *        can be NULL if destCapacity==0
11648393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @param destCapacity the number of bytes in the dest buffer
11658393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @return the length of the merged sort key, src1Length+src2Length;
11668393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *         can be larger than destCapacity, or 0 if an error occurs (only for illegal arguments),
11678393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius *         in which cases the contents of dest is undefined
1168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
1172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   const uint8_t *src2, int32_t src2Length,
1173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                   uint8_t *dest, int32_t destCapacity);
1174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Universal attribute setter
1177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator which attributes are to be changed
1178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param attr attribute type
1179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param value attribute value
1180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to indicate whether the operation went on smoothly or there were errors
1181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UColAttribute
1182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UColAttributeValue
1183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getAttribute
1184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
1187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
1188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Universal attribute getter
1191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator which attributes are to be changed
1192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param attr attribute type
1193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return attribute value
1194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to indicate whether the operation went on smoothly or there were errors
1195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UColAttribute
1196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UColAttributeValue
1197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setAttribute
1198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UColAttributeValue  U_EXPORT2
1201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
1202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1203fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/**
1204fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Sets the variable top to the top of the specified reordering group.
1205fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * The variable top determines the highest-sorting character
1206fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * which is affected by UCOL_ALTERNATE_HANDLING.
1207fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect.
1208fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param coll the collator
1209fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION,
1210fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *              UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY;
1211fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *              or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group
1212fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param pErrorCode Standard ICU error code. Its input value must
1213fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *                   pass the U_SUCCESS() test, or else the function returns
1214fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *                   immediately. Check for U_FAILURE() on output or use with
1215fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *                   function chaining. (See User Guide for details.)
1216fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @see ucol_getMaxVariable
12171b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * @stable ICU 53
1218fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */
12191b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_STABLE void U_EXPORT2
1220fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
1221fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
1222fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/**
1223fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
1224fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param coll the collator
1225fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @return the maximum variable reordering group.
1226fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @see ucol_setMaxVariable
12271b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert * @stable ICU 53
1228fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius */
12291b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_STABLE UColReorderCode U_EXPORT2
1230fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusucol_getMaxVariable(const UCollator *coll);
1231fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
1232f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DEPRECATED_API
1233fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/**
1234fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Sets the variable top to the primary weight of the specified string.
1235fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *
1236fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Beginning with ICU 53, the variable top is pinned to
1237fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * the top of one of the supported reordering groups,
1238fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * and it must not be beyond the last of those groups.
1239fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * See ucol_setMaxVariable().
1240fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param coll the collator
1241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param varTop one or more (if contraction) UChars to which the variable top should be set
1242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len length of variable top string. If -1 it is considered to be zero terminated.
1243fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status error code. If error code is set, the return value is undefined.
1244fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *               Errors set by this function are:<br>
1245fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *    U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
1246fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *    U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
1247fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *    the last reordering group supported by ucol_setMaxVariable()
1248fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @return variable top primary weight
1249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getVariableTop
1250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_restoreVariableTop
1251fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @deprecated ICU 53 Call ucol_setMaxVariable() instead.
1252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1253fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusU_DEPRECATED uint32_t U_EXPORT2
1254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_setVariableTop(UCollator *coll,
1255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    const UChar *varTop, int32_t len,
1256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode *status);
1257f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DEPRECATED_API */
1258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the variable top value of a Collator.
1261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator which variable top needs to be retrieved
1262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code (not changed by function). If error code is set,
1263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *               the return value is undefined.
1264fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @return the variable top primary weight
1265fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @see ucol_getMaxVariable
1266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setVariableTop
1267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_restoreVariableTop
1268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
1271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1272fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius/**
1273fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Sets the variable top to the specified primary weight.
1274fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius *
1275fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Beginning with ICU 53, the variable top is pinned to
1276fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * the top of one of the supported reordering groups,
1277fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * and it must not be beyond the last of those groups.
1278fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * See ucol_setMaxVariable().
1279fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop
1280fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @param status error code
1281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_getVariableTop
1282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_setVariableTop
1283fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * @deprecated ICU 53 Call ucol_setMaxVariable() instead.
1284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1285fceb39872958b9fa2505e63f8b8699a9e0f882f4ccorneliusU_DEPRECATED void U_EXPORT2
1286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
1287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Thread safe cloning operation. The result is a clone of a given collator.
1290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator to be cloned
129159d709d503bab6e2b61931737e662dd293b40578ccornelius * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br>
129259d709d503bab6e2b61931737e662dd293b40578ccornelius * user allocated space for the new clone.
1293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If NULL new memory will be allocated.
1294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  If buffer is not large enough, new memory will be allocated.
129559d709d503bab6e2b61931737e662dd293b40578ccornelius *  Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
129659d709d503bab6e2b61931737e662dd293b40578ccornelius * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.</em><br>
129759d709d503bab6e2b61931737e662dd293b40578ccornelius *  pointer to size of allocated space.
1298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  If *pBufferSize == 0, a sufficient size for use in cloning will
1299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  be returned ('pre-flighting')
1300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  If *pBufferSize is not enough for a stack-based safe clone,
1301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  new memory will be allocated.
1302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status to indicate whether the operation went on smoothly or there were errors
1303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *    An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
1304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * allocations were necessary.
1305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return pointer to the new clone
1306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_open
1307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openRules
1308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_close
1309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
1310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollator* U_EXPORT2
1312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_safeClone(const UCollator *coll,
1313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               void            *stackBuffer,
1314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               int32_t         *pBufferSize,
1315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               UErrorCode      *status);
1316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
131759d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_DEPRECATED_API
131859d709d503bab6e2b61931737e662dd293b40578ccornelius
131959d709d503bab6e2b61931737e662dd293b40578ccornelius/** default memory size for the new clone.
132059d709d503bab6e2b61931737e662dd293b40578ccornelius * @deprecated ICU 52. Do not rely on ucol_safeClone() cloning into any provided buffer.
1321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
132259d709d503bab6e2b61931737e662dd293b40578ccornelius#define U_COL_SAFECLONE_BUFFERSIZE 1
132359d709d503bab6e2b61931737e662dd293b40578ccornelius
132459d709d503bab6e2b61931737e662dd293b40578ccornelius#endif /* U_HIDE_DEPRECATED_API */
1325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns current rules. Delta defines whether full rules are returned or just the tailoring.
1328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough
1329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to store rules, will store up to available space.
133054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius *
133154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * ucol_getRules() should normally be used instead.
133254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
1333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll collator to get the rules from
1334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
1335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffer buffer to store the result in. If NULL, you'll get no rules.
133654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param bufferLen length of buffer to store rules in. If less than needed you'll get only the part that fits in.
1337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return current rules
1338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0
133954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @see UCOL_FULL_RULES
1340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
1343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1344103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API
1345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * gets the locale name of the collator. If the collator
1347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is instantiated from the rules, then this function returns
1348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NULL.
1349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator for which the locale is needed
1350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param type You can choose between requested, valid and actual
1351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             locale. For description see the definition of
1352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             ULocDataLocaleType in uloc.h
1353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code of the operation
1354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return real locale name from which the collation data comes.
1355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         If the collator was instantiated from rules, returns
1356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         NULL.
1357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
1358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_DEPRECATED const char * U_EXPORT2
1360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1361103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif  /* U_HIDE_DEPRECATED_API */
1362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * gets the locale name of the collator. If the collator
1365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is instantiated from the rules, then this function returns
1366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NULL.
1367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll The UCollator for which the locale is needed
1368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param type You can choose between requested, valid and actual
1369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             locale. For description see the definition of
1370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             ULocDataLocaleType in uloc.h
1371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code of the operation
1372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return real locale name from which the collation data comes.
1373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         If the collator was instantiated from rules, returns
1374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *         NULL.
1375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8
1376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char * U_EXPORT2
1378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
1379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1381fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius * Get a Unicode set that contains all the characters and sequences tailored in
1382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * this collator. The result must be disposed of by using uset_close.
1383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param coll        The UCollator for which we want to get tailored chars
1384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status      error code of the operation
1385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to newly created USet. Must be be disposed by using uset_close
1386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openRules
1387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see uset_close
1388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4
1389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE USet * U_EXPORT2
1391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
1392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1393103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API
1394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Calculates the set of unsafe code points, given a collator.
1395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   A character is unsafe if you could append any character and cause the ordering to alter significantly.
1396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
1397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   Thus if you have a character like a_umlaut, and you add a lower_dot to it,
1398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *   then it normalizes to a_lower_dot + umlaut, and sorts differently.
1399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param coll Collator
1400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param unsafe a fill-in set to receive the unsafe points
1401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status for catching errors
1402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return number of elements in the set
1403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @internal ICU 3.0
1404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_INTERNAL int32_t U_EXPORT2
1406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_getUnsafeSet( const UCollator *coll,
1407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  USet *unsafe,
1408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode *status);
1409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Touches all resources needed for instantiating a collator from a short string definition,
1411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  thus filling up the cache.
1412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param definition A short string containing a locale and a set of attributes.
1413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   Attributes not explicitly mentioned are left at the default
1414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   state for a locale.
1415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parseError if not NULL, structure that will get filled with error's pre
1416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   and post context in case of error.
1417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param forceDefaults if FALSE, the settings that are the same as the collator
1418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   default settings will not be applied (for example, setting
1419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   French secondary on a French collator would not be executed).
1420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   If TRUE, all the settings will be applied regardless of the
1421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   collator default value. If the definition
1422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   strings are to be cached, should be set to FALSE.
1423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status     Error code. Apart from regular error conditions connected to
1424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   instantiating collators (like out of memory or similar), this
1425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   API will return an error if an invalid attribute or attribute/value
1426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   combination is specified.
1427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ucol_openFromShortString
1428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @internal ICU 3.2.1
1429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_INTERNAL void U_EXPORT2
1431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_prepareShortStringOpen( const char *definition,
1432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UBool forceDefaults,
1433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UParseError *parseError,
1434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                          UErrorCode *status);
1435103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif  /* U_HIDE_INTERNAL_API */
1436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Creates a binary image of a collator. This binary image can be stored and
1438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  later used to instantiate a collator using ucol_openBinary.
1439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  This API supports preflighting.
1440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param coll Collator
1441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param buffer a fill-in buffer to receive the binary image
1442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param capacity capacity of the destination buffer
1443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status for catching errors
1444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return size of the image
1445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_openBinary
1446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @stable ICU 3.2
1447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_cloneBinary(const UCollator *coll,
1450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 uint8_t *buffer, int32_t capacity,
1451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 UErrorCode *status);
1452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Opens a collator from a collator binary image created using
1454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  ucol_cloneBinary. Binary image used in instantiation of the
1455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  collator remains owned by the user and should stay around for
1456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  the lifetime of the collator. The API also takes a base collator
1457f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *  which must be the root collator.
1458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param bin binary image owned by the user and required through the
1459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *             lifetime of the collator
1460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param length size of the image. If negative, the API will try to
1461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                figure out the length of the image
1462f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *  @param base Base collator, for lookup of untailored characters.
1463f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *              Must be the root collator, must not be NULL.
1464f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius *              The base is required to be present through the lifetime of the collator.
1465b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @param status for catching errors
1466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @return newly created collator
1467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @see ucol_cloneBinary
1468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  @stable ICU 3.2
1469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
1470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UCollator* U_EXPORT2
1471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruucol_openBinary(const uint8_t *bin, int32_t length,
1472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                const UCollator *base,
1473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode *status);
1474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */
1477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif
1479