Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: source/common/unicode/unorm.h

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/common/unicode/unistr.h ('k') | source/common/unicode/unorm2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * Copyright (c) 1996-2010, International Business Machines Corporation 3 * Copyright (c) 1996-2015, International Business Machines Corporation
4 * and others. All Rights Reserved. 4 * and others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 * File unorm.h 6 * File unorm.h
7 * 7 *
8 * Created by: Vladimir Weinstein 12052000 8 * Created by: Vladimir Weinstein 12052000
9 * 9 *
10 * Modification history : 10 * Modification history :
11 * 11 *
12 * Date Name Description 12 * Date Name Description
13 * 02/01/01 synwee Added normalization quickcheck enum and method. 13 * 02/01/01 synwee Added normalization quickcheck enum and method.
14 */ 14 */
15 #ifndef UNORM_H 15 #ifndef UNORM_H
16 #define UNORM_H 16 #define UNORM_H
17 17
18 #include "unicode/utypes.h" 18 #include "unicode/utypes.h"
19 19
20 #if !UCONFIG_NO_NORMALIZATION 20 #if !UCONFIG_NO_NORMALIZATION
21 21
22 #include "unicode/uiter.h" 22 #include "unicode/uiter.h"
23 #include "unicode/unorm2.h" 23 #include "unicode/unorm2.h"
24 24
25 #ifndef U_HIDE_DEPRECATED_API
26
25 /** 27 /**
26 * \file 28 * \file
27 * \brief C API: Unicode Normalization 29 * \brief C API: Unicode Normalization
28 * 30 *
29 * <h2>Unicode normalization API</h2> 31 * Old Unicode normalization API.
30 * 32 *
31 * Note: This API has been replaced by the unorm2.h API and is only available 33 * This API has been replaced by the unorm2.h API and is only available
32 * for backward compatibility. The functions here simply delegate to the 34 * for backward compatibility. The functions here simply delegate to the
33 * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). 35 * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize().
34 * There is one exception: The new API does not provide a replacement for unorm_ compare(). 36 * There is one exception: The new API does not provide a replacement for unorm_ compare().
37 * Its declaration has been moved to unorm2.h.
35 * 38 *
36 * <code>unorm_normalize</code> transforms Unicode text into an equivalent compo sed or 39 * <code>unorm_normalize</code> transforms Unicode text into an equivalent compo sed or
37 * decomposed form, allowing for easier sorting and searching of text. 40 * decomposed form, allowing for easier sorting and searching of text.
38 * <code>unorm_normalize</code> supports the standard normalization forms descri bed in 41 * <code>unorm_normalize</code> supports the standard normalization forms descri bed in
39 * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> 42 * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
40 * Unicode Standard Annex #15: Unicode Normalization Forms</a>. 43 * Unicode Standard Annex #15: Unicode Normalization Forms</a>.
41 * 44 *
42 * Characters with accents or other adornments can be encoded in 45 * Characters with accents or other adornments can be encoded in
43 * several different ways in Unicode. For example, take the character A-acute. 46 * several different ways in Unicode. For example, take the character A-acute.
44 * In Unicode, this can be encoded as a single character (the 47 * In Unicode, this can be encoded as a single character (the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * Beyond collation and string search, normalized strings may be useful for stri ng equivalence comparisons, 122 * Beyond collation and string search, normalized strings may be useful for stri ng equivalence comparisons,
120 * transliteration/transcription, unique representations, etc. 123 * transliteration/transcription, unique representations, etc.
121 * 124 *
122 * The W3C generally recommends to exchange texts in NFC. 125 * The W3C generally recommends to exchange texts in NFC.
123 * Note also that most legacy character encodings use only precomposed forms and often do not 126 * Note also that most legacy character encodings use only precomposed forms and often do not
124 * encode any combining marks by themselves. For conversion to such character en codings the 127 * encode any combining marks by themselves. For conversion to such character en codings the
125 * Unicode text needs to be normalized to NFC. 128 * Unicode text needs to be normalized to NFC.
126 * For more usage examples, see the Unicode Standard Annex. 129 * For more usage examples, see the Unicode Standard Annex.
127 */ 130 */
128 131
132 #ifndef U_HIDE_DEPRECATED_API
129 /** 133 /**
130 * Constants for normalization modes. 134 * Constants for normalization modes.
131 * @stable ICU 2.0 135 * @deprecated ICU 56 Use unorm2.h instead.
132 */ 136 */
133 typedef enum { 137 typedef enum {
134 /** No decomposition/composition. @stable ICU 2.0 */ 138 /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */
135 UNORM_NONE = 1, 139 UNORM_NONE = 1,
136 /** Canonical decomposition. @stable ICU 2.0 */ 140 /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */
137 UNORM_NFD = 2, 141 UNORM_NFD = 2,
138 /** Compatibility decomposition. @stable ICU 2.0 */ 142 /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */
139 UNORM_NFKD = 3, 143 UNORM_NFKD = 3,
140 /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */ 144 /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */
141 UNORM_NFC = 4, 145 UNORM_NFC = 4,
142 /** Default normalization. @stable ICU 2.0 */ 146 /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */
143 UNORM_DEFAULT = UNORM_NFC, 147 UNORM_DEFAULT = UNORM_NFC,
144 /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */ 148 /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */
145 UNORM_NFKC =5, 149 UNORM_NFKC =5,
146 /** "Fast C or D" form. @stable ICU 2.0 */ 150 /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */
147 UNORM_FCD = 6, 151 UNORM_FCD = 6,
148 152
149 /** One more than the highest normalization mode constant. @stable ICU 2.0 */ 153 /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */
150 UNORM_MODE_COUNT 154 UNORM_MODE_COUNT
151 } UNormalizationMode; 155 } UNormalizationMode;
156 #endif /* U_HIDE_DEPRECATED_API */
152 157
153 /** 158 /**
154 * Constants for options flags for normalization. 159 * Constants for options flags for normalization.
155 * Use 0 for default options, 160 * Use 0 for default options,
156 * including normalization according to the Unicode version 161 * including normalization according to the Unicode version
157 * that is currently supported by ICU (see u_getUnicodeVersion). 162 * that is currently supported by ICU (see u_getUnicodeVersion).
158 * @stable ICU 2.6 163 * @deprecated ICU 56 Use unorm2.h instead.
159 */ 164 */
160 enum { 165 enum {
161 /** 166 /**
162 * Options bit set value to select Unicode 3.2 normalization 167 * Options bit set value to select Unicode 3.2 normalization
163 * (except NormalizationCorrections). 168 * (except NormalizationCorrections).
164 * At most one Unicode version can be selected at a time. 169 * At most one Unicode version can be selected at a time.
165 * @stable ICU 2.6 170 * @deprecated ICU 56 Use unorm2.h instead.
166 */ 171 */
167 UNORM_UNICODE_3_2=0x20 172 UNORM_UNICODE_3_2=0x20
168 }; 173 };
169 174
170 /** 175 /**
171 * Lowest-order bit number of unorm_compare() options bits corresponding to 176 * Lowest-order bit number of unorm_compare() options bits corresponding to
172 * normalization options bits. 177 * normalization options bits.
173 * 178 *
174 * The options parameter for unorm_compare() uses most bits for 179 * The options parameter for unorm_compare() uses most bits for
175 * itself and for various comparison and folding flags. 180 * itself and for various comparison and folding flags.
176 * The most significant bits, however, are shifted down and passed on 181 * The most significant bits, however, are shifted down and passed on
177 * to the normalization implementation. 182 * to the normalization implementation.
178 * (That is, from unorm_compare(..., options, ...), 183 * (That is, from unorm_compare(..., options, ...),
179 * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the 184 * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the
180 * internal normalization functions.) 185 * internal normalization functions.)
181 * 186 *
182 * @see unorm_compare 187 * @see unorm_compare
183 * @stable ICU 2.6 188 * @deprecated ICU 56 Use unorm2.h instead.
184 */ 189 */
185 #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 190 #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
186 191
187 /** 192 /**
188 * Normalize a string. 193 * Normalize a string.
189 * The string will be normalized according the specified normalization mode 194 * The string will be normalized according the specified normalization mode
190 * and options. 195 * and options.
191 * The source and result buffers must not be the same, nor overlap. 196 * The source and result buffers must not be the same, nor overlap.
192 * 197 *
193 * @param source The string to normalize. 198 * @param source The string to normalize.
194 * @param sourceLength The length of source, or -1 if NUL-terminated. 199 * @param sourceLength The length of source, or -1 if NUL-terminated.
195 * @param mode The normalization mode; one of UNORM_NONE, 200 * @param mode The normalization mode; one of UNORM_NONE,
196 * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. 201 * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT.
197 * @param options The normalization options, ORed together (0 for no options). 202 * @param options The normalization options, ORed together (0 for no options).
198 * @param result A pointer to a buffer to receive the result string. 203 * @param result A pointer to a buffer to receive the result string.
199 * The result string is NUL-terminated if possible. 204 * The result string is NUL-terminated if possible.
200 * @param resultLength The maximum size of result. 205 * @param resultLength The maximum size of result.
201 * @param status A pointer to a UErrorCode to receive any errors. 206 * @param status A pointer to a UErrorCode to receive any errors.
202 * @return The total buffer size needed; if greater than resultLength, 207 * @return The total buffer size needed; if greater than resultLength,
203 * the output was truncated, and the error code is set to U_BUFFER_OVERF LOW_ERROR. 208 * the output was truncated, and the error code is set to U_BUFFER_OVERF LOW_ERROR.
204 * @stable ICU 2.0 209 * @deprecated ICU 56 Use unorm2.h instead.
205 */ 210 */
206 U_STABLE int32_t U_EXPORT2 211 U_STABLE int32_t U_EXPORT2
207 unorm_normalize(const UChar *source, int32_t sourceLength, 212 unorm_normalize(const UChar *source, int32_t sourceLength,
208 UNormalizationMode mode, int32_t options, 213 UNormalizationMode mode, int32_t options,
209 UChar *result, int32_t resultLength, 214 UChar *result, int32_t resultLength,
210 UErrorCode *status); 215 UErrorCode *status);
211 216
212 /** 217 /**
213 * Performing quick check on a string, to quickly determine if the string is 218 * Performing quick check on a string, to quickly determine if the string is
214 * in a particular normalization format. 219 * in a particular normalization format.
215 * Three types of result can be returned UNORM_YES, UNORM_NO or 220 * Three types of result can be returned UNORM_YES, UNORM_NO or
216 * UNORM_MAYBE. Result UNORM_YES indicates that the argument 221 * UNORM_MAYBE. Result UNORM_YES indicates that the argument
217 * string is in the desired normalized format, UNORM_NO determines that 222 * string is in the desired normalized format, UNORM_NO determines that
218 * argument string is not in the desired normalized format. A 223 * argument string is not in the desired normalized format. A
219 * UNORM_MAYBE result indicates that a more thorough check is required, 224 * UNORM_MAYBE result indicates that a more thorough check is required,
220 * the user may have to put the string in its normalized form and compare the 225 * the user may have to put the string in its normalized form and compare the
221 * results. 226 * results.
222 * 227 *
223 * @param source string for determining if it is in a normalized format 228 * @param source string for determining if it is in a normalized format
224 * @param sourcelength length of source to test, or -1 if NUL-terminated 229 * @param sourcelength length of source to test, or -1 if NUL-terminated
225 * @param mode which normalization form to test for 230 * @param mode which normalization form to test for
226 * @param status a pointer to a UErrorCode to receive any errors 231 * @param status a pointer to a UErrorCode to receive any errors
227 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE 232 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
228 * 233 *
229 * @see unorm_isNormalized 234 * @see unorm_isNormalized
230 * @stable ICU 2.0 235 * @deprecated ICU 56 Use unorm2.h instead.
231 */ 236 */
232 U_STABLE UNormalizationCheckResult U_EXPORT2 237 U_STABLE UNormalizationCheckResult U_EXPORT2
233 unorm_quickCheck(const UChar *source, int32_t sourcelength, 238 unorm_quickCheck(const UChar *source, int32_t sourcelength,
234 UNormalizationMode mode, 239 UNormalizationMode mode,
235 UErrorCode *status); 240 UErrorCode *status);
236 241
237 /** 242 /**
238 * Performing quick check on a string; same as unorm_quickCheck but 243 * Performing quick check on a string; same as unorm_quickCheck but
239 * takes an extra options parameter like most normalization functions. 244 * takes an extra options parameter like most normalization functions.
240 * 245 *
241 * @param src String that is to be tested if it is in a normalization for mat. 246 * @param src String that is to be tested if it is in a normalization for mat.
242 * @param srcLength Length of source to test, or -1 if NUL-terminated. 247 * @param srcLength Length of source to test, or -1 if NUL-terminated.
243 * @param mode Which normalization form to test for. 248 * @param mode Which normalization form to test for.
244 * @param options The normalization options, ORed together (0 for no options) . 249 * @param options The normalization options, ORed together (0 for no options) .
245 * @param pErrorCode ICU error code in/out parameter. 250 * @param pErrorCode ICU error code in/out parameter.
246 * Must fulfill U_SUCCESS before the function call. 251 * Must fulfill U_SUCCESS before the function call.
247 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE 252 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
248 * 253 *
249 * @see unorm_quickCheck 254 * @see unorm_quickCheck
250 * @see unorm_isNormalized 255 * @see unorm_isNormalized
251 * @stable ICU 2.6 256 * @deprecated ICU 56 Use unorm2.h instead.
252 */ 257 */
253 U_STABLE UNormalizationCheckResult U_EXPORT2 258 U_STABLE UNormalizationCheckResult U_EXPORT2
254 unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, 259 unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
255 UNormalizationMode mode, int32_t options, 260 UNormalizationMode mode, int32_t options,
256 UErrorCode *pErrorCode); 261 UErrorCode *pErrorCode);
257 262
258 /** 263 /**
259 * Test if a string is in a given normalization form. 264 * Test if a string is in a given normalization form.
260 * This is semantically equivalent to source.equals(normalize(source, mode)) . 265 * This is semantically equivalent to source.equals(normalize(source, mode)) .
261 * 266 *
262 * Unlike unorm_quickCheck(), this function returns a definitive result, 267 * Unlike unorm_quickCheck(), this function returns a definitive result,
263 * never a "maybe". 268 * never a "maybe".
264 * For NFD, NFKD, and FCD, both functions work exactly the same. 269 * For NFD, NFKD, and FCD, both functions work exactly the same.
265 * For NFC and NFKC where quickCheck may return "maybe", this function will 270 * For NFC and NFKC where quickCheck may return "maybe", this function will
266 * perform further tests to arrive at a TRUE/FALSE result. 271 * perform further tests to arrive at a TRUE/FALSE result.
267 * 272 *
268 * @param src String that is to be tested if it is in a normalization for mat. 273 * @param src String that is to be tested if it is in a normalization for mat.
269 * @param srcLength Length of source to test, or -1 if NUL-terminated. 274 * @param srcLength Length of source to test, or -1 if NUL-terminated.
270 * @param mode Which normalization form to test for. 275 * @param mode Which normalization form to test for.
271 * @param pErrorCode ICU error code in/out parameter. 276 * @param pErrorCode ICU error code in/out parameter.
272 * Must fulfill U_SUCCESS before the function call. 277 * Must fulfill U_SUCCESS before the function call.
273 * @return Boolean value indicating whether the source string is in the 278 * @return Boolean value indicating whether the source string is in the
274 * "mode" normalization form. 279 * "mode" normalization form.
275 * 280 *
276 * @see unorm_quickCheck 281 * @see unorm_quickCheck
277 * @stable ICU 2.2 282 * @deprecated ICU 56 Use unorm2.h instead.
278 */ 283 */
279 U_STABLE UBool U_EXPORT2 284 U_STABLE UBool U_EXPORT2
280 unorm_isNormalized(const UChar *src, int32_t srcLength, 285 unorm_isNormalized(const UChar *src, int32_t srcLength,
281 UNormalizationMode mode, 286 UNormalizationMode mode,
282 UErrorCode *pErrorCode); 287 UErrorCode *pErrorCode);
283 288
284 /** 289 /**
285 * Test if a string is in a given normalization form; same as unorm_isNormalized but 290 * Test if a string is in a given normalization form; same as unorm_isNormalized but
286 * takes an extra options parameter like most normalization functions. 291 * takes an extra options parameter like most normalization functions.
287 * 292 *
288 * @param src String that is to be tested if it is in a normalization for mat. 293 * @param src String that is to be tested if it is in a normalization for mat.
289 * @param srcLength Length of source to test, or -1 if NUL-terminated. 294 * @param srcLength Length of source to test, or -1 if NUL-terminated.
290 * @param mode Which normalization form to test for. 295 * @param mode Which normalization form to test for.
291 * @param options The normalization options, ORed together (0 for no options) . 296 * @param options The normalization options, ORed together (0 for no options) .
292 * @param pErrorCode ICU error code in/out parameter. 297 * @param pErrorCode ICU error code in/out parameter.
293 * Must fulfill U_SUCCESS before the function call. 298 * Must fulfill U_SUCCESS before the function call.
294 * @return Boolean value indicating whether the source string is in the 299 * @return Boolean value indicating whether the source string is in the
295 * "mode/options" normalization form. 300 * "mode/options" normalization form.
296 * 301 *
297 * @see unorm_quickCheck 302 * @see unorm_quickCheck
298 * @see unorm_isNormalized 303 * @see unorm_isNormalized
299 * @stable ICU 2.6 304 * @deprecated ICU 56 Use unorm2.h instead.
300 */ 305 */
301 U_STABLE UBool U_EXPORT2 306 U_STABLE UBool U_EXPORT2
302 unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, 307 unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
303 UNormalizationMode mode, int32_t options, 308 UNormalizationMode mode, int32_t options,
304 UErrorCode *pErrorCode); 309 UErrorCode *pErrorCode);
305 310
306 /** 311 /**
307 * Iterative normalization forward. 312 * Iterative normalization forward.
308 * This function (together with unorm_previous) is somewhat 313 * This function (together with unorm_previous) is somewhat
309 * similar to the C++ Normalizer class (see its non-static functions). 314 * similar to the C++ Normalizer class (see its non-static functions).
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 * different text from the input. 372 * different text from the input.
368 * Not defined if an error occurs including buffer ove rflow. 373 * Not defined if an error occurs including buffer ove rflow.
369 * Always FALSE if !doNormalize. 374 * Always FALSE if !doNormalize.
370 * @param pErrorCode ICU error code in/out parameter. 375 * @param pErrorCode ICU error code in/out parameter.
371 * Must fulfill U_SUCCESS before the function call. 376 * Must fulfill U_SUCCESS before the function call.
372 * @return Length of output (number of UChars) when successful or buffer overflo w. 377 * @return Length of output (number of UChars) when successful or buffer overflo w.
373 * 378 *
374 * @see unorm_previous 379 * @see unorm_previous
375 * @see unorm_normalize 380 * @see unorm_normalize
376 * 381 *
377 * @stable ICU 2.1 382 * @deprecated ICU 56 Use unorm2.h instead.
378 */ 383 */
379 U_STABLE int32_t U_EXPORT2 384 U_STABLE int32_t U_EXPORT2
380 unorm_next(UCharIterator *src, 385 unorm_next(UCharIterator *src,
381 UChar *dest, int32_t destCapacity, 386 UChar *dest, int32_t destCapacity,
382 UNormalizationMode mode, int32_t options, 387 UNormalizationMode mode, int32_t options,
383 UBool doNormalize, UBool *pNeededToNormalize, 388 UBool doNormalize, UBool *pNeededToNormalize,
384 UErrorCode *pErrorCode); 389 UErrorCode *pErrorCode);
385 390
386 /** 391 /**
387 * Iterative normalization backward. 392 * Iterative normalization backward.
(...skipping 12 matching lines...) Expand all
400 * different text from the input. 405 * different text from the input.
401 * Not defined if an error occurs including buffer ove rflow. 406 * Not defined if an error occurs including buffer ove rflow.
402 * Always FALSE if !doNormalize. 407 * Always FALSE if !doNormalize.
403 * @param pErrorCode ICU error code in/out parameter. 408 * @param pErrorCode ICU error code in/out parameter.
404 * Must fulfill U_SUCCESS before the function call. 409 * Must fulfill U_SUCCESS before the function call.
405 * @return Length of output (number of UChars) when successful or buffer overflo w. 410 * @return Length of output (number of UChars) when successful or buffer overflo w.
406 * 411 *
407 * @see unorm_next 412 * @see unorm_next
408 * @see unorm_normalize 413 * @see unorm_normalize
409 * 414 *
410 * @stable ICU 2.1 415 * @deprecated ICU 56 Use unorm2.h instead.
411 */ 416 */
412 U_STABLE int32_t U_EXPORT2 417 U_STABLE int32_t U_EXPORT2
413 unorm_previous(UCharIterator *src, 418 unorm_previous(UCharIterator *src,
414 UChar *dest, int32_t destCapacity, 419 UChar *dest, int32_t destCapacity,
415 UNormalizationMode mode, int32_t options, 420 UNormalizationMode mode, int32_t options,
416 UBool doNormalize, UBool *pNeededToNormalize, 421 UBool doNormalize, UBool *pNeededToNormalize,
417 UErrorCode *pErrorCode); 422 UErrorCode *pErrorCode);
418 423
419 /** 424 /**
420 * Concatenate normalized strings, making sure that the result is normalized as well. 425 * Concatenate normalized strings, making sure that the result is normalized as well.
(...skipping 23 matching lines...) Expand all
444 * @param mode The normalization mode. 449 * @param mode The normalization mode.
445 * @param options The normalization options, ORed together (0 for no options). 450 * @param options The normalization options, ORed together (0 for no options).
446 * @param pErrorCode ICU error code in/out parameter. 451 * @param pErrorCode ICU error code in/out parameter.
447 * Must fulfill U_SUCCESS before the function call. 452 * Must fulfill U_SUCCESS before the function call.
448 * @return Length of output (number of UChars) when successful or buffer overflo w. 453 * @return Length of output (number of UChars) when successful or buffer overflo w.
449 * 454 *
450 * @see unorm_normalize 455 * @see unorm_normalize
451 * @see unorm_next 456 * @see unorm_next
452 * @see unorm_previous 457 * @see unorm_previous
453 * 458 *
454 * @stable ICU 2.1 459 * @deprecated ICU 56 Use unorm2.h instead.
455 */ 460 */
456 U_STABLE int32_t U_EXPORT2 461 U_STABLE int32_t U_EXPORT2
457 unorm_concatenate(const UChar *left, int32_t leftLength, 462 unorm_concatenate(const UChar *left, int32_t leftLength,
458 const UChar *right, int32_t rightLength, 463 const UChar *right, int32_t rightLength,
459 UChar *dest, int32_t destCapacity, 464 UChar *dest, int32_t destCapacity,
460 UNormalizationMode mode, int32_t options, 465 UNormalizationMode mode, int32_t options,
461 UErrorCode *pErrorCode); 466 UErrorCode *pErrorCode);
462 467
463 /** 468 #endif /* U_HIDE_DEPRECATED_API */
464 * Option bit for unorm_compare: 469 #endif /* #if !UCONFIG_NO_NORMALIZATION */
465 * Both input strings are assumed to fulfill FCD conditions.
466 * @stable ICU 2.2
467 */
468 #define UNORM_INPUT_IS_FCD 0x20000
469
470 /**
471 * Option bit for unorm_compare:
472 * Perform case-insensitive comparison.
473 * @stable ICU 2.2
474 */
475 #define U_COMPARE_IGNORE_CASE 0x10000
476
477 #ifndef U_COMPARE_CODE_POINT_ORDER
478 /* see also unistr.h and ustring.h */
479 /**
480 * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
481 * Compare strings in code point order instead of code unit order.
482 * @stable ICU 2.2
483 */
484 #define U_COMPARE_CODE_POINT_ORDER 0x8000
485 #endif 470 #endif
486
487 /**
488 * Compare two strings for canonical equivalence.
489 * Further options include case-insensitive comparison and
490 * code point order (as opposed to code unit order).
491 *
492 * Canonical equivalence between two strings is defined as their normalized
493 * forms (NFD or NFC) being identical.
494 * This function compares strings incrementally instead of normalizing
495 * (and optionally case-folding) both strings entirely,
496 * improving performance significantly.
497 *
498 * Bulk normalization is only necessary if the strings do not fulfill the FCD
499 * conditions. Only in this case, and only if the strings are relatively long,
500 * is memory allocated temporarily.
501 * For FCD strings and short non-FCD strings there is no memory allocation.
502 *
503 * Semantically, this is equivalent to
504 * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
505 * where code point order and foldCase are all optional.
506 *
507 * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
508 * the case folding must be performed first, then the normalization.
509 *
510 * @param s1 First source string.
511 * @param length1 Length of first source string, or -1 if NUL-terminated.
512 *
513 * @param s2 Second source string.
514 * @param length2 Length of second source string, or -1 if NUL-terminated.
515 *
516 * @param options A bit set of options:
517 * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
518 * Case-sensitive comparison in code unit order, and the input strings
519 * are quick-checked for FCD.
520 *
521 * - UNORM_INPUT_IS_FCD
522 * Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
523 * If not set, the function will quickCheck for FCD
524 * and normalize if necessary.
525 *
526 * - U_COMPARE_CODE_POINT_ORDER
527 * Set to choose code point order instead of code unit order
528 * (see u_strCompare for details).
529 *
530 * - U_COMPARE_IGNORE_CASE
531 * Set to compare strings case-insensitively using case folding,
532 * instead of case-sensitively.
533 * If set, then the following case folding options are used.
534 *
535 * - Options as used with case-insensitive comparisons, currently:
536 *
537 * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
538 * (see u_strCaseCompare for details)
539 *
540 * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_ SHIFT
541 *
542 * @param pErrorCode ICU error code in/out parameter.
543 * Must fulfill U_SUCCESS before the function call.
544 * @return <0 or 0 or >0 as usual for string comparisons
545 *
546 * @see unorm_normalize
547 * @see UNORM_FCD
548 * @see u_strCompare
549 * @see u_strCaseCompare
550 *
551 * @stable ICU 2.2
552 */
553 U_STABLE int32_t U_EXPORT2
554 unorm_compare(const UChar *s1, int32_t length1,
555 const UChar *s2, int32_t length2,
556 uint32_t options,
557 UErrorCode *pErrorCode);
558
559 #endif /* #if !UCONFIG_NO_NORMALIZATION */
560
561 #endif
OLDNEW
« no previous file with comments | « source/common/unicode/unistr.h ('k') | source/common/unicode/unorm2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698