jpayne@69
|
1 // © 2016 and later: Unicode, Inc. and others.
|
jpayne@69
|
2 // License & terms of use: http://www.unicode.org/copyright.html
|
jpayne@69
|
3 /*
|
jpayne@69
|
4 *******************************************************************************
|
jpayne@69
|
5 * Copyright (c) 1996-2015, International Business Machines Corporation and others.
|
jpayne@69
|
6 * All Rights Reserved.
|
jpayne@69
|
7 *******************************************************************************
|
jpayne@69
|
8 */
|
jpayne@69
|
9
|
jpayne@69
|
10 #ifndef UCOL_H
|
jpayne@69
|
11 #define UCOL_H
|
jpayne@69
|
12
|
jpayne@69
|
13 #include "unicode/utypes.h"
|
jpayne@69
|
14
|
jpayne@69
|
15 #if !UCONFIG_NO_COLLATION
|
jpayne@69
|
16
|
jpayne@69
|
17 #include "unicode/unorm.h"
|
jpayne@69
|
18 #include "unicode/localpointer.h"
|
jpayne@69
|
19 #include "unicode/parseerr.h"
|
jpayne@69
|
20 #include "unicode/uloc.h"
|
jpayne@69
|
21 #include "unicode/uset.h"
|
jpayne@69
|
22 #include "unicode/uscript.h"
|
jpayne@69
|
23
|
jpayne@69
|
24 /**
|
jpayne@69
|
25 * \file
|
jpayne@69
|
26 * \brief C API: Collator
|
jpayne@69
|
27 *
|
jpayne@69
|
28 * <h2> Collator C API </h2>
|
jpayne@69
|
29 *
|
jpayne@69
|
30 * The C API for Collator performs locale-sensitive
|
jpayne@69
|
31 * string comparison. You use this service to build
|
jpayne@69
|
32 * searching and sorting routines for natural language text.
|
jpayne@69
|
33 * <p>
|
jpayne@69
|
34 * For more information about the collation service see
|
jpayne@69
|
35 * <a href="http://userguide.icu-project.org/collation">the User Guide</a>.
|
jpayne@69
|
36 * <p>
|
jpayne@69
|
37 * Collation service provides correct sorting orders for most locales supported in ICU.
|
jpayne@69
|
38 * If specific data for a locale is not available, the orders eventually falls back
|
jpayne@69
|
39 * to the <a href="http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Collation">CLDR root sort order</a>.
|
jpayne@69
|
40 * <p>
|
jpayne@69
|
41 * Sort ordering may be customized by providing your own set of rules. For more on
|
jpayne@69
|
42 * this subject see the <a href="http://userguide.icu-project.org/collation/customization">
|
jpayne@69
|
43 * Collation Customization</a> section of the User Guide.
|
jpayne@69
|
44 * <p>
|
jpayne@69
|
45 * @see UCollationResult
|
jpayne@69
|
46 * @see UNormalizationMode
|
jpayne@69
|
47 * @see UCollationStrength
|
jpayne@69
|
48 * @see UCollationElements
|
jpayne@69
|
49 */
|
jpayne@69
|
50
|
jpayne@69
|
51 /** A collator.
|
jpayne@69
|
52 * For usage in C programs.
|
jpayne@69
|
53 */
|
jpayne@69
|
54 struct UCollator;
|
jpayne@69
|
55 /** structure representing a collator object instance
|
jpayne@69
|
56 * @stable ICU 2.0
|
jpayne@69
|
57 */
|
jpayne@69
|
58 typedef struct UCollator UCollator;
|
jpayne@69
|
59
|
jpayne@69
|
60
|
jpayne@69
|
61 /**
|
jpayne@69
|
62 * UCOL_LESS is returned if source string is compared to be less than target
|
jpayne@69
|
63 * string in the ucol_strcoll() method.
|
jpayne@69
|
64 * UCOL_EQUAL is returned if source string is compared to be equal to target
|
jpayne@69
|
65 * string in the ucol_strcoll() method.
|
jpayne@69
|
66 * UCOL_GREATER is returned if source string is compared to be greater than
|
jpayne@69
|
67 * target string in the ucol_strcoll() method.
|
jpayne@69
|
68 * @see ucol_strcoll()
|
jpayne@69
|
69 * <p>
|
jpayne@69
|
70 * Possible values for a comparison result
|
jpayne@69
|
71 * @stable ICU 2.0
|
jpayne@69
|
72 */
|
jpayne@69
|
73 typedef enum {
|
jpayne@69
|
74 /** string a == string b */
|
jpayne@69
|
75 UCOL_EQUAL = 0,
|
jpayne@69
|
76 /** string a > string b */
|
jpayne@69
|
77 UCOL_GREATER = 1,
|
jpayne@69
|
78 /** string a < string b */
|
jpayne@69
|
79 UCOL_LESS = -1
|
jpayne@69
|
80 } UCollationResult ;
|
jpayne@69
|
81
|
jpayne@69
|
82
|
jpayne@69
|
83 /** Enum containing attribute values for controling collation behavior.
|
jpayne@69
|
84 * Here are all the allowable values. Not every attribute can take every value. The only
|
jpayne@69
|
85 * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined
|
jpayne@69
|
86 * value for that locale
|
jpayne@69
|
87 * @stable ICU 2.0
|
jpayne@69
|
88 */
|
jpayne@69
|
89 typedef enum {
|
jpayne@69
|
90 /** accepted by most attributes */
|
jpayne@69
|
91 UCOL_DEFAULT = -1,
|
jpayne@69
|
92
|
jpayne@69
|
93 /** Primary collation strength */
|
jpayne@69
|
94 UCOL_PRIMARY = 0,
|
jpayne@69
|
95 /** Secondary collation strength */
|
jpayne@69
|
96 UCOL_SECONDARY = 1,
|
jpayne@69
|
97 /** Tertiary collation strength */
|
jpayne@69
|
98 UCOL_TERTIARY = 2,
|
jpayne@69
|
99 /** Default collation strength */
|
jpayne@69
|
100 UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
|
jpayne@69
|
101 UCOL_CE_STRENGTH_LIMIT,
|
jpayne@69
|
102 /** Quaternary collation strength */
|
jpayne@69
|
103 UCOL_QUATERNARY=3,
|
jpayne@69
|
104 /** Identical collation strength */
|
jpayne@69
|
105 UCOL_IDENTICAL=15,
|
jpayne@69
|
106 UCOL_STRENGTH_LIMIT,
|
jpayne@69
|
107
|
jpayne@69
|
108 /** Turn the feature off - works for UCOL_FRENCH_COLLATION,
|
jpayne@69
|
109 UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
|
jpayne@69
|
110 & UCOL_DECOMPOSITION_MODE*/
|
jpayne@69
|
111 UCOL_OFF = 16,
|
jpayne@69
|
112 /** Turn the feature on - works for UCOL_FRENCH_COLLATION,
|
jpayne@69
|
113 UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
|
jpayne@69
|
114 & UCOL_DECOMPOSITION_MODE*/
|
jpayne@69
|
115 UCOL_ON = 17,
|
jpayne@69
|
116
|
jpayne@69
|
117 /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
|
jpayne@69
|
118 UCOL_SHIFTED = 20,
|
jpayne@69
|
119 /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
|
jpayne@69
|
120 UCOL_NON_IGNORABLE = 21,
|
jpayne@69
|
121
|
jpayne@69
|
122 /** Valid for UCOL_CASE_FIRST -
|
jpayne@69
|
123 lower case sorts before upper case */
|
jpayne@69
|
124 UCOL_LOWER_FIRST = 24,
|
jpayne@69
|
125 /** upper case sorts before lower case */
|
jpayne@69
|
126 UCOL_UPPER_FIRST = 25,
|
jpayne@69
|
127
|
jpayne@69
|
128 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
129 /**
|
jpayne@69
|
130 * One more than the highest normal UColAttributeValue value.
|
jpayne@69
|
131 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
jpayne@69
|
132 */
|
jpayne@69
|
133 UCOL_ATTRIBUTE_VALUE_COUNT
|
jpayne@69
|
134 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
135 } UColAttributeValue;
|
jpayne@69
|
136
|
jpayne@69
|
137 /**
|
jpayne@69
|
138 * Enum containing the codes for reordering segments of the collation table that are not script
|
jpayne@69
|
139 * codes. These reordering codes are to be used in conjunction with the script codes.
|
jpayne@69
|
140 * @see ucol_getReorderCodes
|
jpayne@69
|
141 * @see ucol_setReorderCodes
|
jpayne@69
|
142 * @see ucol_getEquivalentReorderCodes
|
jpayne@69
|
143 * @see UScriptCode
|
jpayne@69
|
144 * @stable ICU 4.8
|
jpayne@69
|
145 */
|
jpayne@69
|
146 typedef enum {
|
jpayne@69
|
147 /**
|
jpayne@69
|
148 * A special reordering code that is used to specify the default
|
jpayne@69
|
149 * reordering codes for a locale.
|
jpayne@69
|
150 * @stable ICU 4.8
|
jpayne@69
|
151 */
|
jpayne@69
|
152 UCOL_REORDER_CODE_DEFAULT = -1,
|
jpayne@69
|
153 /**
|
jpayne@69
|
154 * A special reordering code that is used to specify no reordering codes.
|
jpayne@69
|
155 * @stable ICU 4.8
|
jpayne@69
|
156 */
|
jpayne@69
|
157 UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN,
|
jpayne@69
|
158 /**
|
jpayne@69
|
159 * A special reordering code that is used to specify all other codes used for
|
jpayne@69
|
160 * reordering except for the codes lised as UColReorderCode values and those
|
jpayne@69
|
161 * listed explicitly in a reordering.
|
jpayne@69
|
162 * @stable ICU 4.8
|
jpayne@69
|
163 */
|
jpayne@69
|
164 UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN,
|
jpayne@69
|
165 /**
|
jpayne@69
|
166 * Characters with the space property.
|
jpayne@69
|
167 * This is equivalent to the rule value "space".
|
jpayne@69
|
168 * @stable ICU 4.8
|
jpayne@69
|
169 */
|
jpayne@69
|
170 UCOL_REORDER_CODE_SPACE = 0x1000,
|
jpayne@69
|
171 /**
|
jpayne@69
|
172 * The first entry in the enumeration of reordering groups. This is intended for use in
|
jpayne@69
|
173 * range checking and enumeration of the reorder codes.
|
jpayne@69
|
174 * @stable ICU 4.8
|
jpayne@69
|
175 */
|
jpayne@69
|
176 UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE,
|
jpayne@69
|
177 /**
|
jpayne@69
|
178 * Characters with the punctuation property.
|
jpayne@69
|
179 * This is equivalent to the rule value "punct".
|
jpayne@69
|
180 * @stable ICU 4.8
|
jpayne@69
|
181 */
|
jpayne@69
|
182 UCOL_REORDER_CODE_PUNCTUATION = 0x1001,
|
jpayne@69
|
183 /**
|
jpayne@69
|
184 * Characters with the symbol property.
|
jpayne@69
|
185 * This is equivalent to the rule value "symbol".
|
jpayne@69
|
186 * @stable ICU 4.8
|
jpayne@69
|
187 */
|
jpayne@69
|
188 UCOL_REORDER_CODE_SYMBOL = 0x1002,
|
jpayne@69
|
189 /**
|
jpayne@69
|
190 * Characters with the currency property.
|
jpayne@69
|
191 * This is equivalent to the rule value "currency".
|
jpayne@69
|
192 * @stable ICU 4.8
|
jpayne@69
|
193 */
|
jpayne@69
|
194 UCOL_REORDER_CODE_CURRENCY = 0x1003,
|
jpayne@69
|
195 /**
|
jpayne@69
|
196 * Characters with the digit property.
|
jpayne@69
|
197 * This is equivalent to the rule value "digit".
|
jpayne@69
|
198 * @stable ICU 4.8
|
jpayne@69
|
199 */
|
jpayne@69
|
200 UCOL_REORDER_CODE_DIGIT = 0x1004,
|
jpayne@69
|
201 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
202 /**
|
jpayne@69
|
203 * One more than the highest normal UColReorderCode value.
|
jpayne@69
|
204 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
jpayne@69
|
205 */
|
jpayne@69
|
206 UCOL_REORDER_CODE_LIMIT = 0x1005
|
jpayne@69
|
207 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
208 } UColReorderCode;
|
jpayne@69
|
209
|
jpayne@69
|
210 /**
|
jpayne@69
|
211 * Base letter represents a primary difference. Set comparison
|
jpayne@69
|
212 * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
|
jpayne@69
|
213 * Use this to set the strength of a Collator object.
|
jpayne@69
|
214 * Example of primary difference, "abc" < "abd"
|
jpayne@69
|
215 *
|
jpayne@69
|
216 * Diacritical differences on the same base letter represent a secondary
|
jpayne@69
|
217 * difference. Set comparison level to UCOL_SECONDARY to ignore tertiary
|
jpayne@69
|
218 * differences. Use this to set the strength of a Collator object.
|
jpayne@69
|
219 * Example of secondary difference, "ä" >> "a".
|
jpayne@69
|
220 *
|
jpayne@69
|
221 * Uppercase and lowercase versions of the same character represents a
|
jpayne@69
|
222 * tertiary difference. Set comparison level to UCOL_TERTIARY to include
|
jpayne@69
|
223 * all comparison differences. Use this to set the strength of a Collator
|
jpayne@69
|
224 * object.
|
jpayne@69
|
225 * Example of tertiary difference, "abc" <<< "ABC".
|
jpayne@69
|
226 *
|
jpayne@69
|
227 * Two characters are considered "identical" when they have the same
|
jpayne@69
|
228 * unicode spellings. UCOL_IDENTICAL.
|
jpayne@69
|
229 * For example, "ä" == "ä".
|
jpayne@69
|
230 *
|
jpayne@69
|
231 * UCollationStrength is also used to determine the strength of sort keys
|
jpayne@69
|
232 * generated from UCollator objects
|
jpayne@69
|
233 * These values can be now found in the UColAttributeValue enum.
|
jpayne@69
|
234 * @stable ICU 2.0
|
jpayne@69
|
235 **/
|
jpayne@69
|
236 typedef UColAttributeValue UCollationStrength;
|
jpayne@69
|
237
|
jpayne@69
|
238 /** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
|
jpayne@69
|
239 * value, as well as the values specific to each one.
|
jpayne@69
|
240 * @stable ICU 2.0
|
jpayne@69
|
241 */
|
jpayne@69
|
242 typedef enum {
|
jpayne@69
|
243 /** Attribute for direction of secondary weights - used in Canadian French.
|
jpayne@69
|
244 * Acceptable values are UCOL_ON, which results in secondary weights
|
jpayne@69
|
245 * being considered backwards and UCOL_OFF which treats secondary
|
jpayne@69
|
246 * weights in the order they appear.
|
jpayne@69
|
247 * @stable ICU 2.0
|
jpayne@69
|
248 */
|
jpayne@69
|
249 UCOL_FRENCH_COLLATION,
|
jpayne@69
|
250 /** Attribute for handling variable elements.
|
jpayne@69
|
251 * Acceptable values are UCOL_NON_IGNORABLE (default)
|
jpayne@69
|
252 * which treats all the codepoints with non-ignorable
|
jpayne@69
|
253 * primary weights in the same way,
|
jpayne@69
|
254 * and UCOL_SHIFTED which causes codepoints with primary
|
jpayne@69
|
255 * weights that are equal or below the variable top value
|
jpayne@69
|
256 * to be ignored on primary level and moved to the quaternary
|
jpayne@69
|
257 * level.
|
jpayne@69
|
258 * @stable ICU 2.0
|
jpayne@69
|
259 */
|
jpayne@69
|
260 UCOL_ALTERNATE_HANDLING,
|
jpayne@69
|
261 /** Controls the ordering of upper and lower case letters.
|
jpayne@69
|
262 * Acceptable values are UCOL_OFF (default), which orders
|
jpayne@69
|
263 * upper and lower case letters in accordance to their tertiary
|
jpayne@69
|
264 * weights, UCOL_UPPER_FIRST which forces upper case letters to
|
jpayne@69
|
265 * sort before lower case letters, and UCOL_LOWER_FIRST which does
|
jpayne@69
|
266 * the opposite.
|
jpayne@69
|
267 * @stable ICU 2.0
|
jpayne@69
|
268 */
|
jpayne@69
|
269 UCOL_CASE_FIRST,
|
jpayne@69
|
270 /** Controls whether an extra case level (positioned before the third
|
jpayne@69
|
271 * level) is generated or not. Acceptable values are UCOL_OFF (default),
|
jpayne@69
|
272 * when case level is not generated, and UCOL_ON which causes the case
|
jpayne@69
|
273 * level to be generated. Contents of the case level are affected by
|
jpayne@69
|
274 * the value of UCOL_CASE_FIRST attribute. A simple way to ignore
|
jpayne@69
|
275 * accent differences in a string is to set the strength to UCOL_PRIMARY
|
jpayne@69
|
276 * and enable case level.
|
jpayne@69
|
277 * @stable ICU 2.0
|
jpayne@69
|
278 */
|
jpayne@69
|
279 UCOL_CASE_LEVEL,
|
jpayne@69
|
280 /** Controls whether the normalization check and necessary normalizations
|
jpayne@69
|
281 * are performed. When set to UCOL_OFF (default) no normalization check
|
jpayne@69
|
282 * is performed. The correctness of the result is guaranteed only if the
|
jpayne@69
|
283 * input data is in so-called FCD form (see users manual for more info).
|
jpayne@69
|
284 * When set to UCOL_ON, an incremental check is performed to see whether
|
jpayne@69
|
285 * the input data is in the FCD form. If the data is not in the FCD form,
|
jpayne@69
|
286 * incremental NFD normalization is performed.
|
jpayne@69
|
287 * @stable ICU 2.0
|
jpayne@69
|
288 */
|
jpayne@69
|
289 UCOL_NORMALIZATION_MODE,
|
jpayne@69
|
290 /** An alias for UCOL_NORMALIZATION_MODE attribute.
|
jpayne@69
|
291 * @stable ICU 2.0
|
jpayne@69
|
292 */
|
jpayne@69
|
293 UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
|
jpayne@69
|
294 /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
|
jpayne@69
|
295 * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
|
jpayne@69
|
296 * for most locales (except Japanese) is tertiary.
|
jpayne@69
|
297 *
|
jpayne@69
|
298 * Quaternary strength
|
jpayne@69
|
299 * is useful when combined with shifted setting for alternate handling
|
jpayne@69
|
300 * attribute and for JIS X 4061 collation, when it is used to distinguish
|
jpayne@69
|
301 * between Katakana and Hiragana.
|
jpayne@69
|
302 * Otherwise, quaternary level
|
jpayne@69
|
303 * is affected only by the number of non-ignorable code points in
|
jpayne@69
|
304 * the string.
|
jpayne@69
|
305 *
|
jpayne@69
|
306 * Identical strength is rarely useful, as it amounts
|
jpayne@69
|
307 * to codepoints of the NFD form of the string.
|
jpayne@69
|
308 * @stable ICU 2.0
|
jpayne@69
|
309 */
|
jpayne@69
|
310 UCOL_STRENGTH,
|
jpayne@69
|
311 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
312 /** When turned on, this attribute positions Hiragana before all
|
jpayne@69
|
313 * non-ignorables on quaternary level This is a sneaky way to produce JIS
|
jpayne@69
|
314 * sort order.
|
jpayne@69
|
315 *
|
jpayne@69
|
316 * This attribute was an implementation detail of the CLDR Japanese tailoring.
|
jpayne@69
|
317 * Since ICU 50, this attribute is not settable any more via API functions.
|
jpayne@69
|
318 * Since CLDR 25/ICU 53, explicit quaternary relations are used
|
jpayne@69
|
319 * to achieve the same Japanese sort order.
|
jpayne@69
|
320 *
|
jpayne@69
|
321 * @deprecated ICU 50 Implementation detail, cannot be set via API, was removed from implementation.
|
jpayne@69
|
322 */
|
jpayne@69
|
323 UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1,
|
jpayne@69
|
324 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
325 /**
|
jpayne@69
|
326 * When turned on, this attribute makes
|
jpayne@69
|
327 * substrings of digits sort according to their numeric values.
|
jpayne@69
|
328 *
|
jpayne@69
|
329 * This is a way to get '100' to sort AFTER '2'. Note that the longest
|
jpayne@69
|
330 * digit substring that can be treated as a single unit is
|
jpayne@69
|
331 * 254 digits (not counting leading zeros). If a digit substring is
|
jpayne@69
|
332 * longer than that, the digits beyond the limit will be treated as a
|
jpayne@69
|
333 * separate digit substring.
|
jpayne@69
|
334 *
|
jpayne@69
|
335 * A "digit" in this sense is a code point with General_Category=Nd,
|
jpayne@69
|
336 * which does not include circled numbers, roman numerals, etc.
|
jpayne@69
|
337 * Only a contiguous digit substring is considered, that is,
|
jpayne@69
|
338 * non-negative integers without separators.
|
jpayne@69
|
339 * There is no support for plus/minus signs, decimals, exponents, etc.
|
jpayne@69
|
340 *
|
jpayne@69
|
341 * @stable ICU 2.8
|
jpayne@69
|
342 */
|
jpayne@69
|
343 UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2,
|
jpayne@69
|
344
|
jpayne@69
|
345 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
|
jpayne@69
|
346 * it is needed for layout of RuleBasedCollator object. */
|
jpayne@69
|
347 #ifndef U_FORCE_HIDE_DEPRECATED_API
|
jpayne@69
|
348 /**
|
jpayne@69
|
349 * One more than the highest normal UColAttribute value.
|
jpayne@69
|
350 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
jpayne@69
|
351 */
|
jpayne@69
|
352 UCOL_ATTRIBUTE_COUNT
|
jpayne@69
|
353 #endif // U_FORCE_HIDE_DEPRECATED_API
|
jpayne@69
|
354 } UColAttribute;
|
jpayne@69
|
355
|
jpayne@69
|
356 /** Options for retrieving the rule string
|
jpayne@69
|
357 * @stable ICU 2.0
|
jpayne@69
|
358 */
|
jpayne@69
|
359 typedef enum {
|
jpayne@69
|
360 /**
|
jpayne@69
|
361 * Retrieves the tailoring rules only.
|
jpayne@69
|
362 * Same as calling the version of getRules() without UColRuleOption.
|
jpayne@69
|
363 * @stable ICU 2.0
|
jpayne@69
|
364 */
|
jpayne@69
|
365 UCOL_TAILORING_ONLY,
|
jpayne@69
|
366 /**
|
jpayne@69
|
367 * Retrieves the "UCA rules" concatenated with the tailoring rules.
|
jpayne@69
|
368 * The "UCA rules" are an <i>approximation</i> of the root collator's sort order.
|
jpayne@69
|
369 * They are almost never used or useful at runtime and can be removed from the data.
|
jpayne@69
|
370 * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
|
jpayne@69
|
371 * @stable ICU 2.0
|
jpayne@69
|
372 */
|
jpayne@69
|
373 UCOL_FULL_RULES
|
jpayne@69
|
374 } UColRuleOption ;
|
jpayne@69
|
375
|
jpayne@69
|
376 /**
|
jpayne@69
|
377 * Open a UCollator for comparing strings.
|
jpayne@69
|
378 *
|
jpayne@69
|
379 * For some languages, multiple collation types are available;
|
jpayne@69
|
380 * for example, "de@collation=phonebook".
|
jpayne@69
|
381 * Starting with ICU 54, collation attributes can be specified via locale keywords as well,
|
jpayne@69
|
382 * in the old locale extension syntax ("el@colCaseFirst=upper")
|
jpayne@69
|
383 * or in language tag syntax ("el-u-kf-upper").
|
jpayne@69
|
384 * See <a href="http://userguide.icu-project.org/collation/api">User Guide: Collation API</a>.
|
jpayne@69
|
385 *
|
jpayne@69
|
386 * The UCollator pointer is used in all the calls to the Collation
|
jpayne@69
|
387 * service. After finished, collator must be disposed of by calling
|
jpayne@69
|
388 * {@link #ucol_close }.
|
jpayne@69
|
389 * @param loc The locale containing the required collation rules.
|
jpayne@69
|
390 * Special values for locales can be passed in -
|
jpayne@69
|
391 * if NULL is passed for the locale, the default locale
|
jpayne@69
|
392 * collation rules will be used. If empty string ("") or
|
jpayne@69
|
393 * "root" are passed, the root collator will be returned.
|
jpayne@69
|
394 * @param status A pointer to a UErrorCode to receive any errors
|
jpayne@69
|
395 * @return A pointer to a UCollator, or 0 if an error occurred.
|
jpayne@69
|
396 * @see ucol_openRules
|
jpayne@69
|
397 * @see ucol_safeClone
|
jpayne@69
|
398 * @see ucol_close
|
jpayne@69
|
399 * @stable ICU 2.0
|
jpayne@69
|
400 */
|
jpayne@69
|
401 U_STABLE UCollator* U_EXPORT2
|
jpayne@69
|
402 ucol_open(const char *loc, UErrorCode *status);
|
jpayne@69
|
403
|
jpayne@69
|
404 /**
|
jpayne@69
|
405 * Produce a UCollator instance according to the rules supplied.
|
jpayne@69
|
406 * The rules are used to change the default ordering, defined in the
|
jpayne@69
|
407 * UCA in a process called tailoring. The resulting UCollator pointer
|
jpayne@69
|
408 * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
|
jpayne@69
|
409 * @param rules A string describing the collation rules. For the syntax
|
jpayne@69
|
410 * of the rules please see users guide.
|
jpayne@69
|
411 * @param rulesLength The length of rules, or -1 if null-terminated.
|
jpayne@69
|
412 * @param normalizationMode The normalization mode: One of
|
jpayne@69
|
413 * UCOL_OFF (expect the text to not need normalization),
|
jpayne@69
|
414 * UCOL_ON (normalize), or
|
jpayne@69
|
415 * UCOL_DEFAULT (set the mode according to the rules)
|
jpayne@69
|
416 * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
|
jpayne@69
|
417 * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
|
jpayne@69
|
418 * @param parseError A pointer to UParseError to recieve information about errors
|
jpayne@69
|
419 * occurred during parsing. This argument can currently be set
|
jpayne@69
|
420 * to NULL, but at users own risk. Please provide a real structure.
|
jpayne@69
|
421 * @param status A pointer to a UErrorCode to receive any errors
|
jpayne@69
|
422 * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
|
jpayne@69
|
423 * of error - please use status argument to check for errors.
|
jpayne@69
|
424 * @see ucol_open
|
jpayne@69
|
425 * @see ucol_safeClone
|
jpayne@69
|
426 * @see ucol_close
|
jpayne@69
|
427 * @stable ICU 2.0
|
jpayne@69
|
428 */
|
jpayne@69
|
429 U_STABLE UCollator* U_EXPORT2
|
jpayne@69
|
430 ucol_openRules( const UChar *rules,
|
jpayne@69
|
431 int32_t rulesLength,
|
jpayne@69
|
432 UColAttributeValue normalizationMode,
|
jpayne@69
|
433 UCollationStrength strength,
|
jpayne@69
|
434 UParseError *parseError,
|
jpayne@69
|
435 UErrorCode *status);
|
jpayne@69
|
436
|
jpayne@69
|
437 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
438 /**
|
jpayne@69
|
439 * Open a collator defined by a short form string.
|
jpayne@69
|
440 * The structure and the syntax of the string is defined in the "Naming collators"
|
jpayne@69
|
441 * section of the users guide:
|
jpayne@69
|
442 * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
|
jpayne@69
|
443 * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
|
jpayne@69
|
444 * strength will be 3. 3066bis locale overrides individual locale parts.
|
jpayne@69
|
445 * The call to this function is equivalent to a call to ucol_open, followed by a
|
jpayne@69
|
446 * series of calls to ucol_setAttribute and ucol_setVariableTop.
|
jpayne@69
|
447 * @param definition A short string containing a locale and a set of attributes.
|
jpayne@69
|
448 * Attributes not explicitly mentioned are left at the default
|
jpayne@69
|
449 * state for a locale.
|
jpayne@69
|
450 * @param parseError if not NULL, structure that will get filled with error's pre
|
jpayne@69
|
451 * and post context in case of error.
|
jpayne@69
|
452 * @param forceDefaults if FALSE, the settings that are the same as the collator
|
jpayne@69
|
453 * default settings will not be applied (for example, setting
|
jpayne@69
|
454 * French secondary on a French collator would not be executed).
|
jpayne@69
|
455 * If TRUE, all the settings will be applied regardless of the
|
jpayne@69
|
456 * collator default value. If the definition
|
jpayne@69
|
457 * strings are to be cached, should be set to FALSE.
|
jpayne@69
|
458 * @param status Error code. Apart from regular error conditions connected to
|
jpayne@69
|
459 * instantiating collators (like out of memory or similar), this
|
jpayne@69
|
460 * API will return an error if an invalid attribute or attribute/value
|
jpayne@69
|
461 * combination is specified.
|
jpayne@69
|
462 * @return A pointer to a UCollator or 0 if an error occured (including an
|
jpayne@69
|
463 * invalid attribute).
|
jpayne@69
|
464 * @see ucol_open
|
jpayne@69
|
465 * @see ucol_setAttribute
|
jpayne@69
|
466 * @see ucol_setVariableTop
|
jpayne@69
|
467 * @see ucol_getShortDefinitionString
|
jpayne@69
|
468 * @see ucol_normalizeShortDefinitionString
|
jpayne@69
|
469 * @deprecated ICU 54 Use ucol_open() with language tag collation keywords instead.
|
jpayne@69
|
470 */
|
jpayne@69
|
471 U_DEPRECATED UCollator* U_EXPORT2
|
jpayne@69
|
472 ucol_openFromShortString( const char *definition,
|
jpayne@69
|
473 UBool forceDefaults,
|
jpayne@69
|
474 UParseError *parseError,
|
jpayne@69
|
475 UErrorCode *status);
|
jpayne@69
|
476 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
477
|
jpayne@69
|
478 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
479 /**
|
jpayne@69
|
480 * Get a set containing the contractions defined by the collator. The set includes
|
jpayne@69
|
481 * both the root collator's contractions and the contractions defined by the collator. This set
|
jpayne@69
|
482 * will contain only strings. If a tailoring explicitly suppresses contractions from
|
jpayne@69
|
483 * the root collator (like Russian), removed contractions will not be in the resulting set.
|
jpayne@69
|
484 * @param coll collator
|
jpayne@69
|
485 * @param conts the set to hold the result. It gets emptied before
|
jpayne@69
|
486 * contractions are added.
|
jpayne@69
|
487 * @param status to hold the error code
|
jpayne@69
|
488 * @return the size of the contraction set
|
jpayne@69
|
489 *
|
jpayne@69
|
490 * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
|
jpayne@69
|
491 */
|
jpayne@69
|
492 U_DEPRECATED int32_t U_EXPORT2
|
jpayne@69
|
493 ucol_getContractions( const UCollator *coll,
|
jpayne@69
|
494 USet *conts,
|
jpayne@69
|
495 UErrorCode *status);
|
jpayne@69
|
496 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
497
|
jpayne@69
|
498 /**
|
jpayne@69
|
499 * Get a set containing the expansions defined by the collator. The set includes
|
jpayne@69
|
500 * both the root collator's expansions and the expansions defined by the tailoring
|
jpayne@69
|
501 * @param coll collator
|
jpayne@69
|
502 * @param contractions if not NULL, the set to hold the contractions
|
jpayne@69
|
503 * @param expansions if not NULL, the set to hold the expansions
|
jpayne@69
|
504 * @param addPrefixes add the prefix contextual elements to contractions
|
jpayne@69
|
505 * @param status to hold the error code
|
jpayne@69
|
506 *
|
jpayne@69
|
507 * @stable ICU 3.4
|
jpayne@69
|
508 */
|
jpayne@69
|
509 U_STABLE void U_EXPORT2
|
jpayne@69
|
510 ucol_getContractionsAndExpansions( const UCollator *coll,
|
jpayne@69
|
511 USet *contractions, USet *expansions,
|
jpayne@69
|
512 UBool addPrefixes, UErrorCode *status);
|
jpayne@69
|
513
|
jpayne@69
|
514 /**
|
jpayne@69
|
515 * Close a UCollator.
|
jpayne@69
|
516 * Once closed, a UCollator should not be used. Every open collator should
|
jpayne@69
|
517 * be closed. Otherwise, a memory leak will result.
|
jpayne@69
|
518 * @param coll The UCollator to close.
|
jpayne@69
|
519 * @see ucol_open
|
jpayne@69
|
520 * @see ucol_openRules
|
jpayne@69
|
521 * @see ucol_safeClone
|
jpayne@69
|
522 * @stable ICU 2.0
|
jpayne@69
|
523 */
|
jpayne@69
|
524 U_STABLE void U_EXPORT2
|
jpayne@69
|
525 ucol_close(UCollator *coll);
|
jpayne@69
|
526
|
jpayne@69
|
527 #if U_SHOW_CPLUSPLUS_API
|
jpayne@69
|
528
|
jpayne@69
|
529 U_NAMESPACE_BEGIN
|
jpayne@69
|
530
|
jpayne@69
|
531 /**
|
jpayne@69
|
532 * \class LocalUCollatorPointer
|
jpayne@69
|
533 * "Smart pointer" class, closes a UCollator via ucol_close().
|
jpayne@69
|
534 * For most methods see the LocalPointerBase base class.
|
jpayne@69
|
535 *
|
jpayne@69
|
536 * @see LocalPointerBase
|
jpayne@69
|
537 * @see LocalPointer
|
jpayne@69
|
538 * @stable ICU 4.4
|
jpayne@69
|
539 */
|
jpayne@69
|
540 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
|
jpayne@69
|
541
|
jpayne@69
|
542 U_NAMESPACE_END
|
jpayne@69
|
543
|
jpayne@69
|
544 #endif
|
jpayne@69
|
545
|
jpayne@69
|
546 /**
|
jpayne@69
|
547 * Compare two strings.
|
jpayne@69
|
548 * The strings will be compared using the options already specified.
|
jpayne@69
|
549 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
550 * @param source The source string.
|
jpayne@69
|
551 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
552 * @param target The target string.
|
jpayne@69
|
553 * @param targetLength The length of target, or -1 if null-terminated.
|
jpayne@69
|
554 * @return The result of comparing the strings; one of UCOL_EQUAL,
|
jpayne@69
|
555 * UCOL_GREATER, UCOL_LESS
|
jpayne@69
|
556 * @see ucol_greater
|
jpayne@69
|
557 * @see ucol_greaterOrEqual
|
jpayne@69
|
558 * @see ucol_equal
|
jpayne@69
|
559 * @stable ICU 2.0
|
jpayne@69
|
560 */
|
jpayne@69
|
561 U_STABLE UCollationResult U_EXPORT2
|
jpayne@69
|
562 ucol_strcoll( const UCollator *coll,
|
jpayne@69
|
563 const UChar *source,
|
jpayne@69
|
564 int32_t sourceLength,
|
jpayne@69
|
565 const UChar *target,
|
jpayne@69
|
566 int32_t targetLength);
|
jpayne@69
|
567
|
jpayne@69
|
568 /**
|
jpayne@69
|
569 * Compare two strings in UTF-8.
|
jpayne@69
|
570 * The strings will be compared using the options already specified.
|
jpayne@69
|
571 * Note: When input string contains malformed a UTF-8 byte sequence,
|
jpayne@69
|
572 * this function treats these bytes as REPLACEMENT CHARACTER (U+FFFD).
|
jpayne@69
|
573 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
574 * @param source The source UTF-8 string.
|
jpayne@69
|
575 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
576 * @param target The target UTF-8 string.
|
jpayne@69
|
577 * @param targetLength The length of target, or -1 if null-terminated.
|
jpayne@69
|
578 * @param status A pointer to a UErrorCode to receive any errors
|
jpayne@69
|
579 * @return The result of comparing the strings; one of UCOL_EQUAL,
|
jpayne@69
|
580 * UCOL_GREATER, UCOL_LESS
|
jpayne@69
|
581 * @see ucol_greater
|
jpayne@69
|
582 * @see ucol_greaterOrEqual
|
jpayne@69
|
583 * @see ucol_equal
|
jpayne@69
|
584 * @stable ICU 50
|
jpayne@69
|
585 */
|
jpayne@69
|
586 U_STABLE UCollationResult U_EXPORT2
|
jpayne@69
|
587 ucol_strcollUTF8(
|
jpayne@69
|
588 const UCollator *coll,
|
jpayne@69
|
589 const char *source,
|
jpayne@69
|
590 int32_t sourceLength,
|
jpayne@69
|
591 const char *target,
|
jpayne@69
|
592 int32_t targetLength,
|
jpayne@69
|
593 UErrorCode *status);
|
jpayne@69
|
594
|
jpayne@69
|
595 /**
|
jpayne@69
|
596 * Determine if one string is greater than another.
|
jpayne@69
|
597 * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
|
jpayne@69
|
598 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
599 * @param source The source string.
|
jpayne@69
|
600 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
601 * @param target The target string.
|
jpayne@69
|
602 * @param targetLength The length of target, or -1 if null-terminated.
|
jpayne@69
|
603 * @return TRUE if source is greater than target, FALSE otherwise.
|
jpayne@69
|
604 * @see ucol_strcoll
|
jpayne@69
|
605 * @see ucol_greaterOrEqual
|
jpayne@69
|
606 * @see ucol_equal
|
jpayne@69
|
607 * @stable ICU 2.0
|
jpayne@69
|
608 */
|
jpayne@69
|
609 U_STABLE UBool U_EXPORT2
|
jpayne@69
|
610 ucol_greater(const UCollator *coll,
|
jpayne@69
|
611 const UChar *source, int32_t sourceLength,
|
jpayne@69
|
612 const UChar *target, int32_t targetLength);
|
jpayne@69
|
613
|
jpayne@69
|
614 /**
|
jpayne@69
|
615 * Determine if one string is greater than or equal to another.
|
jpayne@69
|
616 * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
|
jpayne@69
|
617 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
618 * @param source The source string.
|
jpayne@69
|
619 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
620 * @param target The target string.
|
jpayne@69
|
621 * @param targetLength The length of target, or -1 if null-terminated.
|
jpayne@69
|
622 * @return TRUE if source is greater than or equal to target, FALSE otherwise.
|
jpayne@69
|
623 * @see ucol_strcoll
|
jpayne@69
|
624 * @see ucol_greater
|
jpayne@69
|
625 * @see ucol_equal
|
jpayne@69
|
626 * @stable ICU 2.0
|
jpayne@69
|
627 */
|
jpayne@69
|
628 U_STABLE UBool U_EXPORT2
|
jpayne@69
|
629 ucol_greaterOrEqual(const UCollator *coll,
|
jpayne@69
|
630 const UChar *source, int32_t sourceLength,
|
jpayne@69
|
631 const UChar *target, int32_t targetLength);
|
jpayne@69
|
632
|
jpayne@69
|
633 /**
|
jpayne@69
|
634 * Compare two strings for equality.
|
jpayne@69
|
635 * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
|
jpayne@69
|
636 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
637 * @param source The source string.
|
jpayne@69
|
638 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
639 * @param target The target string.
|
jpayne@69
|
640 * @param targetLength The length of target, or -1 if null-terminated.
|
jpayne@69
|
641 * @return TRUE if source is equal to target, FALSE otherwise
|
jpayne@69
|
642 * @see ucol_strcoll
|
jpayne@69
|
643 * @see ucol_greater
|
jpayne@69
|
644 * @see ucol_greaterOrEqual
|
jpayne@69
|
645 * @stable ICU 2.0
|
jpayne@69
|
646 */
|
jpayne@69
|
647 U_STABLE UBool U_EXPORT2
|
jpayne@69
|
648 ucol_equal(const UCollator *coll,
|
jpayne@69
|
649 const UChar *source, int32_t sourceLength,
|
jpayne@69
|
650 const UChar *target, int32_t targetLength);
|
jpayne@69
|
651
|
jpayne@69
|
652 /**
|
jpayne@69
|
653 * Compare two UTF-8 encoded trings.
|
jpayne@69
|
654 * The strings will be compared using the options already specified.
|
jpayne@69
|
655 * @param coll The UCollator containing the comparison rules.
|
jpayne@69
|
656 * @param sIter The source string iterator.
|
jpayne@69
|
657 * @param tIter The target string iterator.
|
jpayne@69
|
658 * @return The result of comparing the strings; one of UCOL_EQUAL,
|
jpayne@69
|
659 * UCOL_GREATER, UCOL_LESS
|
jpayne@69
|
660 * @param status A pointer to a UErrorCode to receive any errors
|
jpayne@69
|
661 * @see ucol_strcoll
|
jpayne@69
|
662 * @stable ICU 2.6
|
jpayne@69
|
663 */
|
jpayne@69
|
664 U_STABLE UCollationResult U_EXPORT2
|
jpayne@69
|
665 ucol_strcollIter( const UCollator *coll,
|
jpayne@69
|
666 UCharIterator *sIter,
|
jpayne@69
|
667 UCharIterator *tIter,
|
jpayne@69
|
668 UErrorCode *status);
|
jpayne@69
|
669
|
jpayne@69
|
670 /**
|
jpayne@69
|
671 * Get the collation strength used in a UCollator.
|
jpayne@69
|
672 * The strength influences how strings are compared.
|
jpayne@69
|
673 * @param coll The UCollator to query.
|
jpayne@69
|
674 * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
|
jpayne@69
|
675 * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
|
jpayne@69
|
676 * @see ucol_setStrength
|
jpayne@69
|
677 * @stable ICU 2.0
|
jpayne@69
|
678 */
|
jpayne@69
|
679 U_STABLE UCollationStrength U_EXPORT2
|
jpayne@69
|
680 ucol_getStrength(const UCollator *coll);
|
jpayne@69
|
681
|
jpayne@69
|
682 /**
|
jpayne@69
|
683 * Set the collation strength used in a UCollator.
|
jpayne@69
|
684 * The strength influences how strings are compared.
|
jpayne@69
|
685 * @param coll The UCollator to set.
|
jpayne@69
|
686 * @param strength The desired collation strength; one of UCOL_PRIMARY,
|
jpayne@69
|
687 * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
|
jpayne@69
|
688 * @see ucol_getStrength
|
jpayne@69
|
689 * @stable ICU 2.0
|
jpayne@69
|
690 */
|
jpayne@69
|
691 U_STABLE void U_EXPORT2
|
jpayne@69
|
692 ucol_setStrength(UCollator *coll,
|
jpayne@69
|
693 UCollationStrength strength);
|
jpayne@69
|
694
|
jpayne@69
|
695 /**
|
jpayne@69
|
696 * Retrieves the reordering codes for this collator.
|
jpayne@69
|
697 * These reordering codes are a combination of UScript codes and UColReorderCode entries.
|
jpayne@69
|
698 * @param coll The UCollator to query.
|
jpayne@69
|
699 * @param dest The array to fill with the script ordering.
|
jpayne@69
|
700 * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
|
jpayne@69
|
701 * will only return the length of the result without writing any codes (pre-flighting).
|
jpayne@69
|
702 * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
|
jpayne@69
|
703 * failure before the function call.
|
jpayne@69
|
704 * @return The number of reordering codes written to the dest array.
|
jpayne@69
|
705 * @see ucol_setReorderCodes
|
jpayne@69
|
706 * @see ucol_getEquivalentReorderCodes
|
jpayne@69
|
707 * @see UScriptCode
|
jpayne@69
|
708 * @see UColReorderCode
|
jpayne@69
|
709 * @stable ICU 4.8
|
jpayne@69
|
710 */
|
jpayne@69
|
711 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
712 ucol_getReorderCodes(const UCollator* coll,
|
jpayne@69
|
713 int32_t* dest,
|
jpayne@69
|
714 int32_t destCapacity,
|
jpayne@69
|
715 UErrorCode *pErrorCode);
|
jpayne@69
|
716 /**
|
jpayne@69
|
717 * Sets the reordering codes for this collator.
|
jpayne@69
|
718 * Collation reordering allows scripts and some other groups of characters
|
jpayne@69
|
719 * to be moved relative to each other. This reordering is done on top of
|
jpayne@69
|
720 * the DUCET/CLDR standard collation order. Reordering can specify groups to be placed
|
jpayne@69
|
721 * at the start and/or the end of the collation order. These groups are specified using
|
jpayne@69
|
722 * UScript codes and UColReorderCode entries.
|
jpayne@69
|
723 *
|
jpayne@69
|
724 * <p>By default, reordering codes specified for the start of the order are placed in the
|
jpayne@69
|
725 * order given after several special non-script blocks. These special groups of characters
|
jpayne@69
|
726 * are space, punctuation, symbol, currency, and digit. These special groups are represented with
|
jpayne@69
|
727 * UColReorderCode entries. Script groups can be intermingled with
|
jpayne@69
|
728 * these special non-script groups if those special groups are explicitly specified in the reordering.
|
jpayne@69
|
729 *
|
jpayne@69
|
730 * <p>The special code OTHERS stands for any script that is not explicitly
|
jpayne@69
|
731 * mentioned in the list of reordering codes given. Anything that is after OTHERS
|
jpayne@69
|
732 * will go at the very end of the reordering in the order given.
|
jpayne@69
|
733 *
|
jpayne@69
|
734 * <p>The special reorder code DEFAULT will reset the reordering for this collator
|
jpayne@69
|
735 * to the default for this collator. The default reordering may be the DUCET/CLDR order or may be a reordering that
|
jpayne@69
|
736 * was specified when this collator was created from resource data or from rules. The
|
jpayne@69
|
737 * DEFAULT code <b>must</b> be the sole code supplied when it is used.
|
jpayne@69
|
738 * If not, then U_ILLEGAL_ARGUMENT_ERROR will be set.
|
jpayne@69
|
739 *
|
jpayne@69
|
740 * <p>The special reorder code NONE will remove any reordering for this collator.
|
jpayne@69
|
741 * The result of setting no reordering will be to have the DUCET/CLDR ordering used. The
|
jpayne@69
|
742 * NONE code <b>must</b> be the sole code supplied when it is used.
|
jpayne@69
|
743 *
|
jpayne@69
|
744 * @param coll The UCollator to set.
|
jpayne@69
|
745 * @param reorderCodes An array of script codes in the new order. This can be NULL if the
|
jpayne@69
|
746 * length is also set to 0. An empty array will clear any reordering codes on the collator.
|
jpayne@69
|
747 * @param reorderCodesLength The length of reorderCodes.
|
jpayne@69
|
748 * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a
|
jpayne@69
|
749 * failure before the function call.
|
jpayne@69
|
750 * @see ucol_getReorderCodes
|
jpayne@69
|
751 * @see ucol_getEquivalentReorderCodes
|
jpayne@69
|
752 * @see UScriptCode
|
jpayne@69
|
753 * @see UColReorderCode
|
jpayne@69
|
754 * @stable ICU 4.8
|
jpayne@69
|
755 */
|
jpayne@69
|
756 U_STABLE void U_EXPORT2
|
jpayne@69
|
757 ucol_setReorderCodes(UCollator* coll,
|
jpayne@69
|
758 const int32_t* reorderCodes,
|
jpayne@69
|
759 int32_t reorderCodesLength,
|
jpayne@69
|
760 UErrorCode *pErrorCode);
|
jpayne@69
|
761
|
jpayne@69
|
762 /**
|
jpayne@69
|
763 * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder
|
jpayne@69
|
764 * codes will be grouped and must reorder together.
|
jpayne@69
|
765 * Beginning with ICU 55, scripts only reorder together if they are primary-equal,
|
jpayne@69
|
766 * for example Hiragana and Katakana.
|
jpayne@69
|
767 *
|
jpayne@69
|
768 * @param reorderCode The reorder code to determine equivalence for.
|
jpayne@69
|
769 * @param dest The array to fill with the script ordering.
|
jpayne@69
|
770 * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
|
jpayne@69
|
771 * will only return the length of the result without writing any codes (pre-flighting).
|
jpayne@69
|
772 * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate
|
jpayne@69
|
773 * a failure before the function call.
|
jpayne@69
|
774 * @return The number of reordering codes written to the dest array.
|
jpayne@69
|
775 * @see ucol_setReorderCodes
|
jpayne@69
|
776 * @see ucol_getReorderCodes
|
jpayne@69
|
777 * @see UScriptCode
|
jpayne@69
|
778 * @see UColReorderCode
|
jpayne@69
|
779 * @stable ICU 4.8
|
jpayne@69
|
780 */
|
jpayne@69
|
781 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
782 ucol_getEquivalentReorderCodes(int32_t reorderCode,
|
jpayne@69
|
783 int32_t* dest,
|
jpayne@69
|
784 int32_t destCapacity,
|
jpayne@69
|
785 UErrorCode *pErrorCode);
|
jpayne@69
|
786
|
jpayne@69
|
787 /**
|
jpayne@69
|
788 * Get the display name for a UCollator.
|
jpayne@69
|
789 * The display name is suitable for presentation to a user.
|
jpayne@69
|
790 * @param objLoc The locale of the collator in question.
|
jpayne@69
|
791 * @param dispLoc The locale for display.
|
jpayne@69
|
792 * @param result A pointer to a buffer to receive the attribute.
|
jpayne@69
|
793 * @param resultLength The maximum size of result.
|
jpayne@69
|
794 * @param status A pointer to a UErrorCode to receive any errors
|
jpayne@69
|
795 * @return The total buffer size needed; if greater than resultLength,
|
jpayne@69
|
796 * the output was truncated.
|
jpayne@69
|
797 * @stable ICU 2.0
|
jpayne@69
|
798 */
|
jpayne@69
|
799 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
800 ucol_getDisplayName( const char *objLoc,
|
jpayne@69
|
801 const char *dispLoc,
|
jpayne@69
|
802 UChar *result,
|
jpayne@69
|
803 int32_t resultLength,
|
jpayne@69
|
804 UErrorCode *status);
|
jpayne@69
|
805
|
jpayne@69
|
806 /**
|
jpayne@69
|
807 * Get a locale for which collation rules are available.
|
jpayne@69
|
808 * A UCollator in a locale returned by this function will perform the correct
|
jpayne@69
|
809 * collation for the locale.
|
jpayne@69
|
810 * @param localeIndex The index of the desired locale.
|
jpayne@69
|
811 * @return A locale for which collation rules are available, or 0 if none.
|
jpayne@69
|
812 * @see ucol_countAvailable
|
jpayne@69
|
813 * @stable ICU 2.0
|
jpayne@69
|
814 */
|
jpayne@69
|
815 U_STABLE const char* U_EXPORT2
|
jpayne@69
|
816 ucol_getAvailable(int32_t localeIndex);
|
jpayne@69
|
817
|
jpayne@69
|
818 /**
|
jpayne@69
|
819 * Determine how many locales have collation rules available.
|
jpayne@69
|
820 * This function is most useful as determining the loop ending condition for
|
jpayne@69
|
821 * calls to {@link #ucol_getAvailable }.
|
jpayne@69
|
822 * @return The number of locales for which collation rules are available.
|
jpayne@69
|
823 * @see ucol_getAvailable
|
jpayne@69
|
824 * @stable ICU 2.0
|
jpayne@69
|
825 */
|
jpayne@69
|
826 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
827 ucol_countAvailable(void);
|
jpayne@69
|
828
|
jpayne@69
|
829 #if !UCONFIG_NO_SERVICE
|
jpayne@69
|
830 /**
|
jpayne@69
|
831 * Create a string enumerator of all locales for which a valid
|
jpayne@69
|
832 * collator may be opened.
|
jpayne@69
|
833 * @param status input-output error code
|
jpayne@69
|
834 * @return a string enumeration over locale strings. The caller is
|
jpayne@69
|
835 * responsible for closing the result.
|
jpayne@69
|
836 * @stable ICU 3.0
|
jpayne@69
|
837 */
|
jpayne@69
|
838 U_STABLE UEnumeration* U_EXPORT2
|
jpayne@69
|
839 ucol_openAvailableLocales(UErrorCode *status);
|
jpayne@69
|
840 #endif
|
jpayne@69
|
841
|
jpayne@69
|
842 /**
|
jpayne@69
|
843 * Create a string enumerator of all possible keywords that are relevant to
|
jpayne@69
|
844 * collation. At this point, the only recognized keyword for this
|
jpayne@69
|
845 * service is "collation".
|
jpayne@69
|
846 * @param status input-output error code
|
jpayne@69
|
847 * @return a string enumeration over locale strings. The caller is
|
jpayne@69
|
848 * responsible for closing the result.
|
jpayne@69
|
849 * @stable ICU 3.0
|
jpayne@69
|
850 */
|
jpayne@69
|
851 U_STABLE UEnumeration* U_EXPORT2
|
jpayne@69
|
852 ucol_getKeywords(UErrorCode *status);
|
jpayne@69
|
853
|
jpayne@69
|
854 /**
|
jpayne@69
|
855 * Given a keyword, create a string enumeration of all values
|
jpayne@69
|
856 * for that keyword that are currently in use.
|
jpayne@69
|
857 * @param keyword a particular keyword as enumerated by
|
jpayne@69
|
858 * ucol_getKeywords. If any other keyword is passed in, *status is set
|
jpayne@69
|
859 * to U_ILLEGAL_ARGUMENT_ERROR.
|
jpayne@69
|
860 * @param status input-output error code
|
jpayne@69
|
861 * @return a string enumeration over collation keyword values, or NULL
|
jpayne@69
|
862 * upon error. The caller is responsible for closing the result.
|
jpayne@69
|
863 * @stable ICU 3.0
|
jpayne@69
|
864 */
|
jpayne@69
|
865 U_STABLE UEnumeration* U_EXPORT2
|
jpayne@69
|
866 ucol_getKeywordValues(const char *keyword, UErrorCode *status);
|
jpayne@69
|
867
|
jpayne@69
|
868 /**
|
jpayne@69
|
869 * Given a key and a locale, returns an array of string values in a preferred
|
jpayne@69
|
870 * order that would make a difference. These are all and only those values where
|
jpayne@69
|
871 * the open (creation) of the service with the locale formed from the input locale
|
jpayne@69
|
872 * plus input keyword and that value has different behavior than creation with the
|
jpayne@69
|
873 * input locale alone.
|
jpayne@69
|
874 * @param key one of the keys supported by this service. For now, only
|
jpayne@69
|
875 * "collation" is supported.
|
jpayne@69
|
876 * @param locale the locale
|
jpayne@69
|
877 * @param commonlyUsed if set to true it will return only commonly used values
|
jpayne@69
|
878 * with the given locale in preferred order. Otherwise,
|
jpayne@69
|
879 * it will return all the available values for the locale.
|
jpayne@69
|
880 * @param status error status
|
jpayne@69
|
881 * @return a string enumeration over keyword values for the given key and the locale.
|
jpayne@69
|
882 * @stable ICU 4.2
|
jpayne@69
|
883 */
|
jpayne@69
|
884 U_STABLE UEnumeration* U_EXPORT2
|
jpayne@69
|
885 ucol_getKeywordValuesForLocale(const char* key,
|
jpayne@69
|
886 const char* locale,
|
jpayne@69
|
887 UBool commonlyUsed,
|
jpayne@69
|
888 UErrorCode* status);
|
jpayne@69
|
889
|
jpayne@69
|
890 /**
|
jpayne@69
|
891 * Return the functionally equivalent locale for the specified
|
jpayne@69
|
892 * input locale, with respect to given keyword, for the
|
jpayne@69
|
893 * collation service. If two different input locale + keyword
|
jpayne@69
|
894 * combinations produce the same result locale, then collators
|
jpayne@69
|
895 * instantiated for these two different input locales will behave
|
jpayne@69
|
896 * equivalently. The converse is not always true; two collators
|
jpayne@69
|
897 * may in fact be equivalent, but return different results, due to
|
jpayne@69
|
898 * internal details. The return result has no other meaning than
|
jpayne@69
|
899 * that stated above, and implies nothing as to the relationship
|
jpayne@69
|
900 * between the two locales. This is intended for use by
|
jpayne@69
|
901 * applications who wish to cache collators, or otherwise reuse
|
jpayne@69
|
902 * collators when possible. The functional equivalent may change
|
jpayne@69
|
903 * over time. For more information, please see the <a
|
jpayne@69
|
904 * href="http://userguide.icu-project.org/locale#TOC-Locales-and-Services">
|
jpayne@69
|
905 * Locales and Services</a> section of the ICU User Guide.
|
jpayne@69
|
906 * @param result fillin for the functionally equivalent result locale
|
jpayne@69
|
907 * @param resultCapacity capacity of the fillin buffer
|
jpayne@69
|
908 * @param keyword a particular keyword as enumerated by
|
jpayne@69
|
909 * ucol_getKeywords.
|
jpayne@69
|
910 * @param locale the specified input locale
|
jpayne@69
|
911 * @param isAvailable if non-NULL, pointer to a fillin parameter that
|
jpayne@69
|
912 * on return indicates whether the specified input locale was 'available'
|
jpayne@69
|
913 * to the collation service. A locale is defined as 'available' if it
|
jpayne@69
|
914 * physically exists within the collation locale data.
|
jpayne@69
|
915 * @param status pointer to input-output error code
|
jpayne@69
|
916 * @return the actual buffer size needed for the locale. If greater
|
jpayne@69
|
917 * than resultCapacity, the returned full name will be truncated and
|
jpayne@69
|
918 * an error code will be returned.
|
jpayne@69
|
919 * @stable ICU 3.0
|
jpayne@69
|
920 */
|
jpayne@69
|
921 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
922 ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
|
jpayne@69
|
923 const char* keyword, const char* locale,
|
jpayne@69
|
924 UBool* isAvailable, UErrorCode* status);
|
jpayne@69
|
925
|
jpayne@69
|
926 /**
|
jpayne@69
|
927 * Get the collation tailoring rules from a UCollator.
|
jpayne@69
|
928 * The rules will follow the rule syntax.
|
jpayne@69
|
929 * @param coll The UCollator to query.
|
jpayne@69
|
930 * @param length
|
jpayne@69
|
931 * @return The collation tailoring rules.
|
jpayne@69
|
932 * @stable ICU 2.0
|
jpayne@69
|
933 */
|
jpayne@69
|
934 U_STABLE const UChar* U_EXPORT2
|
jpayne@69
|
935 ucol_getRules( const UCollator *coll,
|
jpayne@69
|
936 int32_t *length);
|
jpayne@69
|
937
|
jpayne@69
|
938 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
939 /** Get the short definition string for a collator. This API harvests the collator's
|
jpayne@69
|
940 * locale and the attribute set and produces a string that can be used for opening
|
jpayne@69
|
941 * a collator with the same attributes using the ucol_openFromShortString API.
|
jpayne@69
|
942 * This string will be normalized.
|
jpayne@69
|
943 * The structure and the syntax of the string is defined in the "Naming collators"
|
jpayne@69
|
944 * section of the users guide:
|
jpayne@69
|
945 * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme
|
jpayne@69
|
946 * This API supports preflighting.
|
jpayne@69
|
947 * @param coll a collator
|
jpayne@69
|
948 * @param locale a locale that will appear as a collators locale in the resulting
|
jpayne@69
|
949 * short string definition. If NULL, the locale will be harvested
|
jpayne@69
|
950 * from the collator.
|
jpayne@69
|
951 * @param buffer space to hold the resulting string
|
jpayne@69
|
952 * @param capacity capacity of the buffer
|
jpayne@69
|
953 * @param status for returning errors. All the preflighting errors are featured
|
jpayne@69
|
954 * @return length of the resulting string
|
jpayne@69
|
955 * @see ucol_openFromShortString
|
jpayne@69
|
956 * @see ucol_normalizeShortDefinitionString
|
jpayne@69
|
957 * @deprecated ICU 54
|
jpayne@69
|
958 */
|
jpayne@69
|
959 U_DEPRECATED int32_t U_EXPORT2
|
jpayne@69
|
960 ucol_getShortDefinitionString(const UCollator *coll,
|
jpayne@69
|
961 const char *locale,
|
jpayne@69
|
962 char *buffer,
|
jpayne@69
|
963 int32_t capacity,
|
jpayne@69
|
964 UErrorCode *status);
|
jpayne@69
|
965
|
jpayne@69
|
966 /** Verifies and normalizes short definition string.
|
jpayne@69
|
967 * Normalized short definition string has all the option sorted by the argument name,
|
jpayne@69
|
968 * so that equivalent definition strings are the same.
|
jpayne@69
|
969 * This API supports preflighting.
|
jpayne@69
|
970 * @param source definition string
|
jpayne@69
|
971 * @param destination space to hold the resulting string
|
jpayne@69
|
972 * @param capacity capacity of the buffer
|
jpayne@69
|
973 * @param parseError if not NULL, structure that will get filled with error's pre
|
jpayne@69
|
974 * and post context in case of error.
|
jpayne@69
|
975 * @param status Error code. This API will return an error if an invalid attribute
|
jpayne@69
|
976 * or attribute/value combination is specified. All the preflighting
|
jpayne@69
|
977 * errors are also featured
|
jpayne@69
|
978 * @return length of the resulting normalized string.
|
jpayne@69
|
979 *
|
jpayne@69
|
980 * @see ucol_openFromShortString
|
jpayne@69
|
981 * @see ucol_getShortDefinitionString
|
jpayne@69
|
982 *
|
jpayne@69
|
983 * @deprecated ICU 54
|
jpayne@69
|
984 */
|
jpayne@69
|
985
|
jpayne@69
|
986 U_DEPRECATED int32_t U_EXPORT2
|
jpayne@69
|
987 ucol_normalizeShortDefinitionString(const char *source,
|
jpayne@69
|
988 char *destination,
|
jpayne@69
|
989 int32_t capacity,
|
jpayne@69
|
990 UParseError *parseError,
|
jpayne@69
|
991 UErrorCode *status);
|
jpayne@69
|
992 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
993
|
jpayne@69
|
994
|
jpayne@69
|
995 /**
|
jpayne@69
|
996 * Get a sort key for a string from a UCollator.
|
jpayne@69
|
997 * Sort keys may be compared using <TT>strcmp</TT>.
|
jpayne@69
|
998 *
|
jpayne@69
|
999 * Note that sort keys are often less efficient than simply doing comparison.
|
jpayne@69
|
1000 * For more details, see the ICU User Guide.
|
jpayne@69
|
1001 *
|
jpayne@69
|
1002 * Like ICU functions that write to an output buffer, the buffer contents
|
jpayne@69
|
1003 * is undefined if the buffer capacity (resultLength parameter) is too small.
|
jpayne@69
|
1004 * Unlike ICU functions that write a string to an output buffer,
|
jpayne@69
|
1005 * the terminating zero byte is counted in the sort key length.
|
jpayne@69
|
1006 * @param coll The UCollator containing the collation rules.
|
jpayne@69
|
1007 * @param source The string to transform.
|
jpayne@69
|
1008 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
1009 * @param result A pointer to a buffer to receive the attribute.
|
jpayne@69
|
1010 * @param resultLength The maximum size of result.
|
jpayne@69
|
1011 * @return The size needed to fully store the sort key.
|
jpayne@69
|
1012 * If there was an internal error generating the sort key,
|
jpayne@69
|
1013 * a zero value is returned.
|
jpayne@69
|
1014 * @see ucol_keyHashCode
|
jpayne@69
|
1015 * @stable ICU 2.0
|
jpayne@69
|
1016 */
|
jpayne@69
|
1017 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1018 ucol_getSortKey(const UCollator *coll,
|
jpayne@69
|
1019 const UChar *source,
|
jpayne@69
|
1020 int32_t sourceLength,
|
jpayne@69
|
1021 uint8_t *result,
|
jpayne@69
|
1022 int32_t resultLength);
|
jpayne@69
|
1023
|
jpayne@69
|
1024
|
jpayne@69
|
1025 /** Gets the next count bytes of a sort key. Caller needs
|
jpayne@69
|
1026 * to preserve state array between calls and to provide
|
jpayne@69
|
1027 * the same type of UCharIterator set with the same string.
|
jpayne@69
|
1028 * The destination buffer provided must be big enough to store
|
jpayne@69
|
1029 * the number of requested bytes.
|
jpayne@69
|
1030 *
|
jpayne@69
|
1031 * The generated sort key may or may not be compatible with
|
jpayne@69
|
1032 * sort keys generated using ucol_getSortKey().
|
jpayne@69
|
1033 * @param coll The UCollator containing the collation rules.
|
jpayne@69
|
1034 * @param iter UCharIterator containing the string we need
|
jpayne@69
|
1035 * the sort key to be calculated for.
|
jpayne@69
|
1036 * @param state Opaque state of sortkey iteration.
|
jpayne@69
|
1037 * @param dest Buffer to hold the resulting sortkey part
|
jpayne@69
|
1038 * @param count number of sort key bytes required.
|
jpayne@69
|
1039 * @param status error code indicator.
|
jpayne@69
|
1040 * @return the actual number of bytes of a sortkey. It can be
|
jpayne@69
|
1041 * smaller than count if we have reached the end of
|
jpayne@69
|
1042 * the sort key.
|
jpayne@69
|
1043 * @stable ICU 2.6
|
jpayne@69
|
1044 */
|
jpayne@69
|
1045 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1046 ucol_nextSortKeyPart(const UCollator *coll,
|
jpayne@69
|
1047 UCharIterator *iter,
|
jpayne@69
|
1048 uint32_t state[2],
|
jpayne@69
|
1049 uint8_t *dest, int32_t count,
|
jpayne@69
|
1050 UErrorCode *status);
|
jpayne@69
|
1051
|
jpayne@69
|
1052 /** enum that is taken by ucol_getBound API
|
jpayne@69
|
1053 * See below for explanation
|
jpayne@69
|
1054 * do not change the values assigned to the
|
jpayne@69
|
1055 * members of this enum. Underlying code
|
jpayne@69
|
1056 * depends on them having these numbers
|
jpayne@69
|
1057 * @stable ICU 2.0
|
jpayne@69
|
1058 */
|
jpayne@69
|
1059 typedef enum {
|
jpayne@69
|
1060 /** lower bound */
|
jpayne@69
|
1061 UCOL_BOUND_LOWER = 0,
|
jpayne@69
|
1062 /** upper bound that will match strings of exact size */
|
jpayne@69
|
1063 UCOL_BOUND_UPPER = 1,
|
jpayne@69
|
1064 /** upper bound that will match all the strings that have the same initial substring as the given string */
|
jpayne@69
|
1065 UCOL_BOUND_UPPER_LONG = 2,
|
jpayne@69
|
1066 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
1067 /**
|
jpayne@69
|
1068 * One more than the highest normal UColBoundMode value.
|
jpayne@69
|
1069 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
jpayne@69
|
1070 */
|
jpayne@69
|
1071 UCOL_BOUND_VALUE_COUNT
|
jpayne@69
|
1072 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
1073 } UColBoundMode;
|
jpayne@69
|
1074
|
jpayne@69
|
1075 /**
|
jpayne@69
|
1076 * Produce a bound for a given sortkey and a number of levels.
|
jpayne@69
|
1077 * Return value is always the number of bytes needed, regardless of
|
jpayne@69
|
1078 * whether the result buffer was big enough or even valid.<br>
|
jpayne@69
|
1079 * Resulting bounds can be used to produce a range of strings that are
|
jpayne@69
|
1080 * between upper and lower bounds. For example, if bounds are produced
|
jpayne@69
|
1081 * for a sortkey of string "smith", strings between upper and lower
|
jpayne@69
|
1082 * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
|
jpayne@69
|
1083 * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
|
jpayne@69
|
1084 * is produced, strings matched would be as above. However, if bound
|
jpayne@69
|
1085 * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
|
jpayne@69
|
1086 * also match "Smithsonian" and similar.<br>
|
jpayne@69
|
1087 * For more on usage, see example in cintltst/capitst.c in procedure
|
jpayne@69
|
1088 * TestBounds.
|
jpayne@69
|
1089 * Sort keys may be compared using <TT>strcmp</TT>.
|
jpayne@69
|
1090 * @param source The source sortkey.
|
jpayne@69
|
1091 * @param sourceLength The length of source, or -1 if null-terminated.
|
jpayne@69
|
1092 * (If an unmodified sortkey is passed, it is always null
|
jpayne@69
|
1093 * terminated).
|
jpayne@69
|
1094 * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
|
jpayne@69
|
1095 * produces a lower inclusive bound, UCOL_BOUND_UPPER, that
|
jpayne@69
|
1096 * produces upper bound that matches strings of the same length
|
jpayne@69
|
1097 * or UCOL_BOUND_UPPER_LONG that matches strings that have the
|
jpayne@69
|
1098 * same starting substring as the source string.
|
jpayne@69
|
1099 * @param noOfLevels Number of levels required in the resulting bound (for most
|
jpayne@69
|
1100 * uses, the recommended value is 1). See users guide for
|
jpayne@69
|
1101 * explanation on number of levels a sortkey can have.
|
jpayne@69
|
1102 * @param result A pointer to a buffer to receive the resulting sortkey.
|
jpayne@69
|
1103 * @param resultLength The maximum size of result.
|
jpayne@69
|
1104 * @param status Used for returning error code if something went wrong. If the
|
jpayne@69
|
1105 * number of levels requested is higher than the number of levels
|
jpayne@69
|
1106 * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
|
jpayne@69
|
1107 * issued.
|
jpayne@69
|
1108 * @return The size needed to fully store the bound.
|
jpayne@69
|
1109 * @see ucol_keyHashCode
|
jpayne@69
|
1110 * @stable ICU 2.1
|
jpayne@69
|
1111 */
|
jpayne@69
|
1112 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1113 ucol_getBound(const uint8_t *source,
|
jpayne@69
|
1114 int32_t sourceLength,
|
jpayne@69
|
1115 UColBoundMode boundType,
|
jpayne@69
|
1116 uint32_t noOfLevels,
|
jpayne@69
|
1117 uint8_t *result,
|
jpayne@69
|
1118 int32_t resultLength,
|
jpayne@69
|
1119 UErrorCode *status);
|
jpayne@69
|
1120
|
jpayne@69
|
1121 /**
|
jpayne@69
|
1122 * Gets the version information for a Collator. Version is currently
|
jpayne@69
|
1123 * an opaque 32-bit number which depends, among other things, on major
|
jpayne@69
|
1124 * versions of the collator tailoring and UCA.
|
jpayne@69
|
1125 * @param coll The UCollator to query.
|
jpayne@69
|
1126 * @param info the version # information, the result will be filled in
|
jpayne@69
|
1127 * @stable ICU 2.0
|
jpayne@69
|
1128 */
|
jpayne@69
|
1129 U_STABLE void U_EXPORT2
|
jpayne@69
|
1130 ucol_getVersion(const UCollator* coll, UVersionInfo info);
|
jpayne@69
|
1131
|
jpayne@69
|
1132 /**
|
jpayne@69
|
1133 * Gets the UCA version information for a Collator. Version is the
|
jpayne@69
|
1134 * UCA version number (3.1.1, 4.0).
|
jpayne@69
|
1135 * @param coll The UCollator to query.
|
jpayne@69
|
1136 * @param info the version # information, the result will be filled in
|
jpayne@69
|
1137 * @stable ICU 2.8
|
jpayne@69
|
1138 */
|
jpayne@69
|
1139 U_STABLE void U_EXPORT2
|
jpayne@69
|
1140 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
|
jpayne@69
|
1141
|
jpayne@69
|
1142 /**
|
jpayne@69
|
1143 * Merges two sort keys. The levels are merged with their corresponding counterparts
|
jpayne@69
|
1144 * (primaries with primaries, secondaries with secondaries etc.). Between the values
|
jpayne@69
|
1145 * from the same level a separator is inserted.
|
jpayne@69
|
1146 *
|
jpayne@69
|
1147 * This is useful, for example, for combining sort keys from first and last names
|
jpayne@69
|
1148 * to sort such pairs.
|
jpayne@69
|
1149 * See http://www.unicode.org/reports/tr10/#Merging_Sort_Keys
|
jpayne@69
|
1150 *
|
jpayne@69
|
1151 * The recommended way to achieve "merged" sorting is by
|
jpayne@69
|
1152 * concatenating strings with U+FFFE between them.
|
jpayne@69
|
1153 * The concatenation has the same sort order as the merged sort keys,
|
jpayne@69
|
1154 * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\\uFFFE' + str2).
|
jpayne@69
|
1155 * Using strings with U+FFFE may yield shorter sort keys.
|
jpayne@69
|
1156 *
|
jpayne@69
|
1157 * For details about Sort Key Features see
|
jpayne@69
|
1158 * http://userguide.icu-project.org/collation/api#TOC-Sort-Key-Features
|
jpayne@69
|
1159 *
|
jpayne@69
|
1160 * It is possible to merge multiple sort keys by consecutively merging
|
jpayne@69
|
1161 * another one with the intermediate result.
|
jpayne@69
|
1162 *
|
jpayne@69
|
1163 * The length of the merge result is the sum of the lengths of the input sort keys.
|
jpayne@69
|
1164 *
|
jpayne@69
|
1165 * Example (uncompressed):
|
jpayne@69
|
1166 * <pre>191B1D 01 050505 01 910505 00
|
jpayne@69
|
1167 * 1F2123 01 050505 01 910505 00</pre>
|
jpayne@69
|
1168 * will be merged as
|
jpayne@69
|
1169 * <pre>191B1D 02 1F2123 01 050505 02 050505 01 910505 02 910505 00</pre>
|
jpayne@69
|
1170 *
|
jpayne@69
|
1171 * If the destination buffer is not big enough, then its contents are undefined.
|
jpayne@69
|
1172 * If any of source lengths are zero or any of the source pointers are NULL/undefined,
|
jpayne@69
|
1173 * the result is of size zero.
|
jpayne@69
|
1174 *
|
jpayne@69
|
1175 * @param src1 the first sort key
|
jpayne@69
|
1176 * @param src1Length the length of the first sort key, including the zero byte at the end;
|
jpayne@69
|
1177 * can be -1 if the function is to find the length
|
jpayne@69
|
1178 * @param src2 the second sort key
|
jpayne@69
|
1179 * @param src2Length the length of the second sort key, including the zero byte at the end;
|
jpayne@69
|
1180 * can be -1 if the function is to find the length
|
jpayne@69
|
1181 * @param dest the buffer where the merged sort key is written,
|
jpayne@69
|
1182 * can be NULL if destCapacity==0
|
jpayne@69
|
1183 * @param destCapacity the number of bytes in the dest buffer
|
jpayne@69
|
1184 * @return the length of the merged sort key, src1Length+src2Length;
|
jpayne@69
|
1185 * can be larger than destCapacity, or 0 if an error occurs (only for illegal arguments),
|
jpayne@69
|
1186 * in which cases the contents of dest is undefined
|
jpayne@69
|
1187 * @stable ICU 2.0
|
jpayne@69
|
1188 */
|
jpayne@69
|
1189 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1190 ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
|
jpayne@69
|
1191 const uint8_t *src2, int32_t src2Length,
|
jpayne@69
|
1192 uint8_t *dest, int32_t destCapacity);
|
jpayne@69
|
1193
|
jpayne@69
|
1194 /**
|
jpayne@69
|
1195 * Universal attribute setter
|
jpayne@69
|
1196 * @param coll collator which attributes are to be changed
|
jpayne@69
|
1197 * @param attr attribute type
|
jpayne@69
|
1198 * @param value attribute value
|
jpayne@69
|
1199 * @param status to indicate whether the operation went on smoothly or there were errors
|
jpayne@69
|
1200 * @see UColAttribute
|
jpayne@69
|
1201 * @see UColAttributeValue
|
jpayne@69
|
1202 * @see ucol_getAttribute
|
jpayne@69
|
1203 * @stable ICU 2.0
|
jpayne@69
|
1204 */
|
jpayne@69
|
1205 U_STABLE void U_EXPORT2
|
jpayne@69
|
1206 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
|
jpayne@69
|
1207
|
jpayne@69
|
1208 /**
|
jpayne@69
|
1209 * Universal attribute getter
|
jpayne@69
|
1210 * @param coll collator which attributes are to be changed
|
jpayne@69
|
1211 * @param attr attribute type
|
jpayne@69
|
1212 * @return attribute value
|
jpayne@69
|
1213 * @param status to indicate whether the operation went on smoothly or there were errors
|
jpayne@69
|
1214 * @see UColAttribute
|
jpayne@69
|
1215 * @see UColAttributeValue
|
jpayne@69
|
1216 * @see ucol_setAttribute
|
jpayne@69
|
1217 * @stable ICU 2.0
|
jpayne@69
|
1218 */
|
jpayne@69
|
1219 U_STABLE UColAttributeValue U_EXPORT2
|
jpayne@69
|
1220 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
|
jpayne@69
|
1221
|
jpayne@69
|
1222 /**
|
jpayne@69
|
1223 * Sets the variable top to the top of the specified reordering group.
|
jpayne@69
|
1224 * The variable top determines the highest-sorting character
|
jpayne@69
|
1225 * which is affected by UCOL_ALTERNATE_HANDLING.
|
jpayne@69
|
1226 * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect.
|
jpayne@69
|
1227 * @param coll the collator
|
jpayne@69
|
1228 * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION,
|
jpayne@69
|
1229 * UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY;
|
jpayne@69
|
1230 * or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group
|
jpayne@69
|
1231 * @param pErrorCode Standard ICU error code. Its input value must
|
jpayne@69
|
1232 * pass the U_SUCCESS() test, or else the function returns
|
jpayne@69
|
1233 * immediately. Check for U_FAILURE() on output or use with
|
jpayne@69
|
1234 * function chaining. (See User Guide for details.)
|
jpayne@69
|
1235 * @see ucol_getMaxVariable
|
jpayne@69
|
1236 * @stable ICU 53
|
jpayne@69
|
1237 */
|
jpayne@69
|
1238 U_STABLE void U_EXPORT2
|
jpayne@69
|
1239 ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode);
|
jpayne@69
|
1240
|
jpayne@69
|
1241 /**
|
jpayne@69
|
1242 * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING.
|
jpayne@69
|
1243 * @param coll the collator
|
jpayne@69
|
1244 * @return the maximum variable reordering group.
|
jpayne@69
|
1245 * @see ucol_setMaxVariable
|
jpayne@69
|
1246 * @stable ICU 53
|
jpayne@69
|
1247 */
|
jpayne@69
|
1248 U_STABLE UColReorderCode U_EXPORT2
|
jpayne@69
|
1249 ucol_getMaxVariable(const UCollator *coll);
|
jpayne@69
|
1250
|
jpayne@69
|
1251 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
1252 /**
|
jpayne@69
|
1253 * Sets the variable top to the primary weight of the specified string.
|
jpayne@69
|
1254 *
|
jpayne@69
|
1255 * Beginning with ICU 53, the variable top is pinned to
|
jpayne@69
|
1256 * the top of one of the supported reordering groups,
|
jpayne@69
|
1257 * and it must not be beyond the last of those groups.
|
jpayne@69
|
1258 * See ucol_setMaxVariable().
|
jpayne@69
|
1259 * @param coll the collator
|
jpayne@69
|
1260 * @param varTop one or more (if contraction) UChars to which the variable top should be set
|
jpayne@69
|
1261 * @param len length of variable top string. If -1 it is considered to be zero terminated.
|
jpayne@69
|
1262 * @param status error code. If error code is set, the return value is undefined.
|
jpayne@69
|
1263 * Errors set by this function are:<br>
|
jpayne@69
|
1264 * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br>
|
jpayne@69
|
1265 * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond
|
jpayne@69
|
1266 * the last reordering group supported by ucol_setMaxVariable()
|
jpayne@69
|
1267 * @return variable top primary weight
|
jpayne@69
|
1268 * @see ucol_getVariableTop
|
jpayne@69
|
1269 * @see ucol_restoreVariableTop
|
jpayne@69
|
1270 * @deprecated ICU 53 Call ucol_setMaxVariable() instead.
|
jpayne@69
|
1271 */
|
jpayne@69
|
1272 U_DEPRECATED uint32_t U_EXPORT2
|
jpayne@69
|
1273 ucol_setVariableTop(UCollator *coll,
|
jpayne@69
|
1274 const UChar *varTop, int32_t len,
|
jpayne@69
|
1275 UErrorCode *status);
|
jpayne@69
|
1276 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
1277
|
jpayne@69
|
1278 /**
|
jpayne@69
|
1279 * Gets the variable top value of a Collator.
|
jpayne@69
|
1280 * @param coll collator which variable top needs to be retrieved
|
jpayne@69
|
1281 * @param status error code (not changed by function). If error code is set,
|
jpayne@69
|
1282 * the return value is undefined.
|
jpayne@69
|
1283 * @return the variable top primary weight
|
jpayne@69
|
1284 * @see ucol_getMaxVariable
|
jpayne@69
|
1285 * @see ucol_setVariableTop
|
jpayne@69
|
1286 * @see ucol_restoreVariableTop
|
jpayne@69
|
1287 * @stable ICU 2.0
|
jpayne@69
|
1288 */
|
jpayne@69
|
1289 U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
|
jpayne@69
|
1290
|
jpayne@69
|
1291 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
1292 /**
|
jpayne@69
|
1293 * Sets the variable top to the specified primary weight.
|
jpayne@69
|
1294 *
|
jpayne@69
|
1295 * Beginning with ICU 53, the variable top is pinned to
|
jpayne@69
|
1296 * the top of one of the supported reordering groups,
|
jpayne@69
|
1297 * and it must not be beyond the last of those groups.
|
jpayne@69
|
1298 * See ucol_setMaxVariable().
|
jpayne@69
|
1299 * @param coll collator to be set
|
jpayne@69
|
1300 * @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop
|
jpayne@69
|
1301 * @param status error code
|
jpayne@69
|
1302 * @see ucol_getVariableTop
|
jpayne@69
|
1303 * @see ucol_setVariableTop
|
jpayne@69
|
1304 * @deprecated ICU 53 Call ucol_setMaxVariable() instead.
|
jpayne@69
|
1305 */
|
jpayne@69
|
1306 U_DEPRECATED void U_EXPORT2
|
jpayne@69
|
1307 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
|
jpayne@69
|
1308 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
1309
|
jpayne@69
|
1310 /**
|
jpayne@69
|
1311 * Thread safe cloning operation. The result is a clone of a given collator.
|
jpayne@69
|
1312 * @param coll collator to be cloned
|
jpayne@69
|
1313 * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br>
|
jpayne@69
|
1314 * user allocated space for the new clone.
|
jpayne@69
|
1315 * If NULL new memory will be allocated.
|
jpayne@69
|
1316 * If buffer is not large enough, new memory will be allocated.
|
jpayne@69
|
1317 * Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
|
jpayne@69
|
1318 * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.</em><br>
|
jpayne@69
|
1319 * pointer to size of allocated space.
|
jpayne@69
|
1320 * If *pBufferSize == 0, a sufficient size for use in cloning will
|
jpayne@69
|
1321 * be returned ('pre-flighting')
|
jpayne@69
|
1322 * If *pBufferSize is not enough for a stack-based safe clone,
|
jpayne@69
|
1323 * new memory will be allocated.
|
jpayne@69
|
1324 * @param status to indicate whether the operation went on smoothly or there were errors
|
jpayne@69
|
1325 * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
|
jpayne@69
|
1326 * allocations were necessary.
|
jpayne@69
|
1327 * @return pointer to the new clone
|
jpayne@69
|
1328 * @see ucol_open
|
jpayne@69
|
1329 * @see ucol_openRules
|
jpayne@69
|
1330 * @see ucol_close
|
jpayne@69
|
1331 * @stable ICU 2.0
|
jpayne@69
|
1332 */
|
jpayne@69
|
1333 U_STABLE UCollator* U_EXPORT2
|
jpayne@69
|
1334 ucol_safeClone(const UCollator *coll,
|
jpayne@69
|
1335 void *stackBuffer,
|
jpayne@69
|
1336 int32_t *pBufferSize,
|
jpayne@69
|
1337 UErrorCode *status);
|
jpayne@69
|
1338
|
jpayne@69
|
1339 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
1340
|
jpayne@69
|
1341 /** default memory size for the new clone.
|
jpayne@69
|
1342 * @deprecated ICU 52. Do not rely on ucol_safeClone() cloning into any provided buffer.
|
jpayne@69
|
1343 */
|
jpayne@69
|
1344 #define U_COL_SAFECLONE_BUFFERSIZE 1
|
jpayne@69
|
1345
|
jpayne@69
|
1346 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
1347
|
jpayne@69
|
1348 /**
|
jpayne@69
|
1349 * Returns current rules. Delta defines whether full rules are returned or just the tailoring.
|
jpayne@69
|
1350 * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough
|
jpayne@69
|
1351 * to store rules, will store up to available space.
|
jpayne@69
|
1352 *
|
jpayne@69
|
1353 * ucol_getRules() should normally be used instead.
|
jpayne@69
|
1354 * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales
|
jpayne@69
|
1355 * @param coll collator to get the rules from
|
jpayne@69
|
1356 * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
|
jpayne@69
|
1357 * @param buffer buffer to store the result in. If NULL, you'll get no rules.
|
jpayne@69
|
1358 * @param bufferLen length of buffer to store rules in. If less than needed you'll get only the part that fits in.
|
jpayne@69
|
1359 * @return current rules
|
jpayne@69
|
1360 * @stable ICU 2.0
|
jpayne@69
|
1361 * @see UCOL_FULL_RULES
|
jpayne@69
|
1362 */
|
jpayne@69
|
1363 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1364 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
|
jpayne@69
|
1365
|
jpayne@69
|
1366 #ifndef U_HIDE_DEPRECATED_API
|
jpayne@69
|
1367 /**
|
jpayne@69
|
1368 * gets the locale name of the collator. If the collator
|
jpayne@69
|
1369 * is instantiated from the rules, then this function returns
|
jpayne@69
|
1370 * NULL.
|
jpayne@69
|
1371 * @param coll The UCollator for which the locale is needed
|
jpayne@69
|
1372 * @param type You can choose between requested, valid and actual
|
jpayne@69
|
1373 * locale. For description see the definition of
|
jpayne@69
|
1374 * ULocDataLocaleType in uloc.h
|
jpayne@69
|
1375 * @param status error code of the operation
|
jpayne@69
|
1376 * @return real locale name from which the collation data comes.
|
jpayne@69
|
1377 * If the collator was instantiated from rules, returns
|
jpayne@69
|
1378 * NULL.
|
jpayne@69
|
1379 * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
|
jpayne@69
|
1380 */
|
jpayne@69
|
1381 U_DEPRECATED const char * U_EXPORT2
|
jpayne@69
|
1382 ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
jpayne@69
|
1383 #endif /* U_HIDE_DEPRECATED_API */
|
jpayne@69
|
1384
|
jpayne@69
|
1385 /**
|
jpayne@69
|
1386 * gets the locale name of the collator. If the collator
|
jpayne@69
|
1387 * is instantiated from the rules, then this function returns
|
jpayne@69
|
1388 * NULL.
|
jpayne@69
|
1389 * @param coll The UCollator for which the locale is needed
|
jpayne@69
|
1390 * @param type You can choose between requested, valid and actual
|
jpayne@69
|
1391 * locale. For description see the definition of
|
jpayne@69
|
1392 * ULocDataLocaleType in uloc.h
|
jpayne@69
|
1393 * @param status error code of the operation
|
jpayne@69
|
1394 * @return real locale name from which the collation data comes.
|
jpayne@69
|
1395 * If the collator was instantiated from rules, returns
|
jpayne@69
|
1396 * NULL.
|
jpayne@69
|
1397 * @stable ICU 2.8
|
jpayne@69
|
1398 */
|
jpayne@69
|
1399 U_STABLE const char * U_EXPORT2
|
jpayne@69
|
1400 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
|
jpayne@69
|
1401
|
jpayne@69
|
1402 /**
|
jpayne@69
|
1403 * Get a Unicode set that contains all the characters and sequences tailored in
|
jpayne@69
|
1404 * this collator. The result must be disposed of by using uset_close.
|
jpayne@69
|
1405 * @param coll The UCollator for which we want to get tailored chars
|
jpayne@69
|
1406 * @param status error code of the operation
|
jpayne@69
|
1407 * @return a pointer to newly created USet. Must be be disposed by using uset_close
|
jpayne@69
|
1408 * @see ucol_openRules
|
jpayne@69
|
1409 * @see uset_close
|
jpayne@69
|
1410 * @stable ICU 2.4
|
jpayne@69
|
1411 */
|
jpayne@69
|
1412 U_STABLE USet * U_EXPORT2
|
jpayne@69
|
1413 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
|
jpayne@69
|
1414
|
jpayne@69
|
1415 #ifndef U_HIDE_INTERNAL_API
|
jpayne@69
|
1416 /** Calculates the set of unsafe code points, given a collator.
|
jpayne@69
|
1417 * A character is unsafe if you could append any character and cause the ordering to alter significantly.
|
jpayne@69
|
1418 * Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
|
jpayne@69
|
1419 * Thus if you have a character like a_umlaut, and you add a lower_dot to it,
|
jpayne@69
|
1420 * then it normalizes to a_lower_dot + umlaut, and sorts differently.
|
jpayne@69
|
1421 * @param coll Collator
|
jpayne@69
|
1422 * @param unsafe a fill-in set to receive the unsafe points
|
jpayne@69
|
1423 * @param status for catching errors
|
jpayne@69
|
1424 * @return number of elements in the set
|
jpayne@69
|
1425 * @internal ICU 3.0
|
jpayne@69
|
1426 */
|
jpayne@69
|
1427 U_INTERNAL int32_t U_EXPORT2
|
jpayne@69
|
1428 ucol_getUnsafeSet( const UCollator *coll,
|
jpayne@69
|
1429 USet *unsafe,
|
jpayne@69
|
1430 UErrorCode *status);
|
jpayne@69
|
1431
|
jpayne@69
|
1432 /** Touches all resources needed for instantiating a collator from a short string definition,
|
jpayne@69
|
1433 * thus filling up the cache.
|
jpayne@69
|
1434 * @param definition A short string containing a locale and a set of attributes.
|
jpayne@69
|
1435 * Attributes not explicitly mentioned are left at the default
|
jpayne@69
|
1436 * state for a locale.
|
jpayne@69
|
1437 * @param parseError if not NULL, structure that will get filled with error's pre
|
jpayne@69
|
1438 * and post context in case of error.
|
jpayne@69
|
1439 * @param forceDefaults if FALSE, the settings that are the same as the collator
|
jpayne@69
|
1440 * default settings will not be applied (for example, setting
|
jpayne@69
|
1441 * French secondary on a French collator would not be executed).
|
jpayne@69
|
1442 * If TRUE, all the settings will be applied regardless of the
|
jpayne@69
|
1443 * collator default value. If the definition
|
jpayne@69
|
1444 * strings are to be cached, should be set to FALSE.
|
jpayne@69
|
1445 * @param status Error code. Apart from regular error conditions connected to
|
jpayne@69
|
1446 * instantiating collators (like out of memory or similar), this
|
jpayne@69
|
1447 * API will return an error if an invalid attribute or attribute/value
|
jpayne@69
|
1448 * combination is specified.
|
jpayne@69
|
1449 * @see ucol_openFromShortString
|
jpayne@69
|
1450 * @internal ICU 3.2.1
|
jpayne@69
|
1451 */
|
jpayne@69
|
1452 U_INTERNAL void U_EXPORT2
|
jpayne@69
|
1453 ucol_prepareShortStringOpen( const char *definition,
|
jpayne@69
|
1454 UBool forceDefaults,
|
jpayne@69
|
1455 UParseError *parseError,
|
jpayne@69
|
1456 UErrorCode *status);
|
jpayne@69
|
1457 #endif /* U_HIDE_INTERNAL_API */
|
jpayne@69
|
1458
|
jpayne@69
|
1459 /** Creates a binary image of a collator. This binary image can be stored and
|
jpayne@69
|
1460 * later used to instantiate a collator using ucol_openBinary.
|
jpayne@69
|
1461 * This API supports preflighting.
|
jpayne@69
|
1462 * @param coll Collator
|
jpayne@69
|
1463 * @param buffer a fill-in buffer to receive the binary image
|
jpayne@69
|
1464 * @param capacity capacity of the destination buffer
|
jpayne@69
|
1465 * @param status for catching errors
|
jpayne@69
|
1466 * @return size of the image
|
jpayne@69
|
1467 * @see ucol_openBinary
|
jpayne@69
|
1468 * @stable ICU 3.2
|
jpayne@69
|
1469 */
|
jpayne@69
|
1470 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
1471 ucol_cloneBinary(const UCollator *coll,
|
jpayne@69
|
1472 uint8_t *buffer, int32_t capacity,
|
jpayne@69
|
1473 UErrorCode *status);
|
jpayne@69
|
1474
|
jpayne@69
|
1475 /** Opens a collator from a collator binary image created using
|
jpayne@69
|
1476 * ucol_cloneBinary. Binary image used in instantiation of the
|
jpayne@69
|
1477 * collator remains owned by the user and should stay around for
|
jpayne@69
|
1478 * the lifetime of the collator. The API also takes a base collator
|
jpayne@69
|
1479 * which must be the root collator.
|
jpayne@69
|
1480 * @param bin binary image owned by the user and required through the
|
jpayne@69
|
1481 * lifetime of the collator
|
jpayne@69
|
1482 * @param length size of the image. If negative, the API will try to
|
jpayne@69
|
1483 * figure out the length of the image
|
jpayne@69
|
1484 * @param base Base collator, for lookup of untailored characters.
|
jpayne@69
|
1485 * Must be the root collator, must not be NULL.
|
jpayne@69
|
1486 * The base is required to be present through the lifetime of the collator.
|
jpayne@69
|
1487 * @param status for catching errors
|
jpayne@69
|
1488 * @return newly created collator
|
jpayne@69
|
1489 * @see ucol_cloneBinary
|
jpayne@69
|
1490 * @stable ICU 3.2
|
jpayne@69
|
1491 */
|
jpayne@69
|
1492 U_STABLE UCollator* U_EXPORT2
|
jpayne@69
|
1493 ucol_openBinary(const uint8_t *bin, int32_t length,
|
jpayne@69
|
1494 const UCollator *base,
|
jpayne@69
|
1495 UErrorCode *status);
|
jpayne@69
|
1496
|
jpayne@69
|
1497
|
jpayne@69
|
1498 #endif /* #if !UCONFIG_NO_COLLATION */
|
jpayne@69
|
1499
|
jpayne@69
|
1500 #endif
|