1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 *   Copyright (C) 2009-2015, International Business Machines
7 *   Corporation and others.  All Rights Reserved.
8 *
9 *******************************************************************************
10 *   file name:  unorm2.h
11 *   encoding:   UTF-8
12 *   tab size:   8 (not used)
13 *   indentation:4
14 *
15 *   created on: 2009dec15
16 *   created by: Markus W. Scherer
17 */
18 
19 #ifndef __UNORM2_H__
20 #define __UNORM2_H__
21 
22 /**
23  * \file
24  * \brief C API: New API for Unicode Normalization.
25  *
26  * Unicode normalization functionality for standard Unicode normalization or
27  * for using custom mapping tables.
28  * All instances of UNormalizer2 are unmodifiable/immutable.
29  * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller.
30  * For more details see the Normalizer2 C++ class.
31  */
32 
33 #include "unicode/utypes.h"
34 #include "unicode/stringoptions.h"
35 #include "unicode/uset.h"
36 
37 #if U_SHOW_CPLUSPLUS_API
38 #include "unicode/localpointer.h"
39 #endif   // U_SHOW_CPLUSPLUS_API
40 
41 /**
42  * Constants for normalization modes.
43  * For details about standard Unicode normalization forms
44  * and about the algorithms which are also used with custom mapping tables
45  * see http://www.unicode.org/unicode/reports/tr15/
46  * @stable ICU 4.4
47  */
48 typedef enum {
49     /**
50      * Decomposition followed by composition.
51      * Same as standard NFC when using an "nfc" instance.
52      * Same as standard NFKC when using an "nfkc" instance.
53      * For details about standard Unicode normalization forms
54      * see http://www.unicode.org/unicode/reports/tr15/
55      * @stable ICU 4.4
56      */
57     UNORM2_COMPOSE,
58     /**
59      * Map, and reorder canonically.
60      * Same as standard NFD when using an "nfc" instance.
61      * Same as standard NFKD when using an "nfkc" instance.
62      * For details about standard Unicode normalization forms
63      * see http://www.unicode.org/unicode/reports/tr15/
64      * @stable ICU 4.4
65      */
66     UNORM2_DECOMPOSE,
67     /**
68      * "Fast C or D" form.
69      * If a string is in this form, then further decomposition <i>without reordering</i>
70      * would yield the same form as DECOMPOSE.
71      * Text in "Fast C or D" form can be processed efficiently with data tables
72      * that are "canonically closed", that is, that provide equivalent data for
73      * equivalent text, without having to be fully normalized.
74      * Not a standard Unicode normalization form.
75      * Not a unique form: Different FCD strings can be canonically equivalent.
76      * For details see http://www.unicode.org/notes/tn5/#FCD
77      * @stable ICU 4.4
78      */
79     UNORM2_FCD,
80     /**
81      * Compose only contiguously.
82      * Also known as "FCC" or "Fast C Contiguous".
83      * The result will often but not always be in NFC.
84      * The result will conform to FCD which is useful for processing.
85      * Not a standard Unicode normalization form.
86      * For details see http://www.unicode.org/notes/tn5/#FCC
87      * @stable ICU 4.4
88      */
89     UNORM2_COMPOSE_CONTIGUOUS
90 } UNormalization2Mode;
91 
92 /**
93  * Result values for normalization quick check functions.
94  * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
95  * @stable ICU 2.0
96  */
97 typedef enum UNormalizationCheckResult {
98   /**
99    * The input string is not in the normalization form.
100    * @stable ICU 2.0
101    */
102   UNORM_NO,
103   /**
104    * The input string is in the normalization form.
105    * @stable ICU 2.0
106    */
107   UNORM_YES,
108   /**
109    * The input string may or may not be in the normalization form.
110    * This value is only returned for composition forms like NFC and FCC,
111    * when a backward-combining character is found for which the surrounding text
112    * would have to be analyzed further.
113    * @stable ICU 2.0
114    */
115   UNORM_MAYBE
116 } UNormalizationCheckResult;
117 
118 /**
119  * Opaque C service object type for the new normalization API.
120  * @stable ICU 4.4
121  */
122 struct UNormalizer2;
123 typedef struct UNormalizer2 UNormalizer2;  /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */
124 
125 #if !UCONFIG_NO_NORMALIZATION
126 
127 /**
128  * Returns a UNormalizer2 instance for Unicode NFC normalization.
129  * Same as unorm2_getInstance(NULL, "nfc", UNORM2_COMPOSE, pErrorCode).
130  * Returns an unmodifiable singleton instance. Do not delete it.
131  * @param pErrorCode Standard ICU error code. Its input value must
132  *                  pass the U_SUCCESS() test, or else the function returns
133  *                  immediately. Check for U_FAILURE() on output or use with
134  *                  function chaining. (See User Guide for details.)
135  * @return the requested Normalizer2, if successful
136  * @stable ICU 49
137  */
138 U_CAPI const UNormalizer2 * U_EXPORT2
139 unorm2_getNFCInstance(UErrorCode *pErrorCode);
140 
141 /**
142  * Returns a UNormalizer2 instance for Unicode NFD normalization.
143  * Same as unorm2_getInstance(NULL, "nfc", UNORM2_DECOMPOSE, pErrorCode).
144  * Returns an unmodifiable singleton instance. Do not delete it.
145  * @param pErrorCode Standard ICU error code. Its input value must
146  *                  pass the U_SUCCESS() test, or else the function returns
147  *                  immediately. Check for U_FAILURE() on output or use with
148  *                  function chaining. (See User Guide for details.)
149  * @return the requested Normalizer2, if successful
150  * @stable ICU 49
151  */
152 U_CAPI const UNormalizer2 * U_EXPORT2
153 unorm2_getNFDInstance(UErrorCode *pErrorCode);
154 
155 /**
156  * Returns a UNormalizer2 instance for Unicode NFKC normalization.
157  * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_COMPOSE, pErrorCode).
158  * Returns an unmodifiable singleton instance. Do not delete it.
159  * @param pErrorCode Standard ICU error code. Its input value must
160  *                  pass the U_SUCCESS() test, or else the function returns
161  *                  immediately. Check for U_FAILURE() on output or use with
162  *                  function chaining. (See User Guide for details.)
163  * @return the requested Normalizer2, if successful
164  * @stable ICU 49
165  */
166 U_CAPI const UNormalizer2 * U_EXPORT2
167 unorm2_getNFKCInstance(UErrorCode *pErrorCode);
168 
169 /**
170  * Returns a UNormalizer2 instance for Unicode NFKD normalization.
171  * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, pErrorCode).
172  * Returns an unmodifiable singleton instance. Do not delete it.
173  * @param pErrorCode Standard ICU error code. Its input value must
174  *                  pass the U_SUCCESS() test, or else the function returns
175  *                  immediately. Check for U_FAILURE() on output or use with
176  *                  function chaining. (See User Guide for details.)
177  * @return the requested Normalizer2, if successful
178  * @stable ICU 49
179  */
180 U_CAPI const UNormalizer2 * U_EXPORT2
181 unorm2_getNFKDInstance(UErrorCode *pErrorCode);
182 
183 /**
184  * Returns a UNormalizer2 instance for Unicode NFKC_Casefold normalization.
185  * Same as unorm2_getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, pErrorCode).
186  * Returns an unmodifiable singleton instance. Do not delete it.
187  * @param pErrorCode Standard ICU error code. Its input value must
188  *                  pass the U_SUCCESS() test, or else the function returns
189  *                  immediately. Check for U_FAILURE() on output or use with
190  *                  function chaining. (See User Guide for details.)
191  * @return the requested Normalizer2, if successful
192  * @stable ICU 49
193  */
194 U_CAPI const UNormalizer2 * U_EXPORT2
195 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode);
196 
197 /**
198  * Returns a UNormalizer2 instance which uses the specified data file
199  * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
200  * and which composes or decomposes text according to the specified mode.
201  * Returns an unmodifiable singleton instance. Do not delete it.
202  *
203  * Use packageName=NULL for data files that are part of ICU's own data.
204  * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
205  * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
206  * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
207  *
208  * @param packageName NULL for ICU built-in data, otherwise application data package name
209  * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
210  * @param mode normalization mode (compose or decompose etc.)
211  * @param pErrorCode Standard ICU error code. Its input value must
212  *                  pass the U_SUCCESS() test, or else the function returns
213  *                  immediately. Check for U_FAILURE() on output or use with
214  *                  function chaining. (See User Guide for details.)
215  * @return the requested UNormalizer2, if successful
216  * @stable ICU 4.4
217  */
218 U_CAPI const UNormalizer2 * U_EXPORT2
219 unorm2_getInstance(const char *packageName,
220                    const char *name,
221                    UNormalization2Mode mode,
222                    UErrorCode *pErrorCode);
223 
224 /**
225  * Constructs a filtered normalizer wrapping any UNormalizer2 instance
226  * and a filter set.
227  * Both are aliased and must not be modified or deleted while this object
228  * is used.
229  * The filter set should be frozen; otherwise the performance will suffer greatly.
230  * @param norm2 wrapped UNormalizer2 instance
231  * @param filterSet USet which determines the characters to be normalized
232  * @param pErrorCode Standard ICU error code. Its input value must
233  *                   pass the U_SUCCESS() test, or else the function returns
234  *                   immediately. Check for U_FAILURE() on output or use with
235  *                   function chaining. (See User Guide for details.)
236  * @return the requested UNormalizer2, if successful
237  * @stable ICU 4.4
238  */
239 U_CAPI UNormalizer2 * U_EXPORT2
240 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
241 
242 /**
243  * Closes a UNormalizer2 instance from unorm2_openFiltered().
244  * Do not close instances from unorm2_getInstance()!
245  * @param norm2 UNormalizer2 instance to be closed
246  * @stable ICU 4.4
247  */
248 U_CAPI void U_EXPORT2
249 unorm2_close(UNormalizer2 *norm2);
250 
251 #if U_SHOW_CPLUSPLUS_API
252 
253 U_NAMESPACE_BEGIN
254 
255 /**
256  * \class LocalUNormalizer2Pointer
257  * "Smart pointer" class, closes a UNormalizer2 via unorm2_close().
258  * For most methods see the LocalPointerBase base class.
259  *
260  * @see LocalPointerBase
261  * @see LocalPointer
262  * @stable ICU 4.4
263  */
264 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
265 
266 U_NAMESPACE_END
267 
268 #endif
269 
270 /**
271  * Writes the normalized form of the source string to the destination string
272  * (replacing its contents) and returns the length of the destination string.
273  * The source and destination strings must be different buffers.
274  * @param norm2 UNormalizer2 instance
275  * @param src source string
276  * @param length length of the source string, or -1 if NUL-terminated
277  * @param dest destination string; its contents is replaced with normalized src
278  * @param capacity number of UChars that can be written to dest
279  * @param pErrorCode Standard ICU error code. Its input value must
280  *                   pass the U_SUCCESS() test, or else the function returns
281  *                   immediately. Check for U_FAILURE() on output or use with
282  *                   function chaining. (See User Guide for details.)
283  * @return dest
284  * @stable ICU 4.4
285  */
286 U_CAPI int32_t U_EXPORT2
287 unorm2_normalize(const UNormalizer2 *norm2,
288                  const UChar *src, int32_t length,
289                  UChar *dest, int32_t capacity,
290                  UErrorCode *pErrorCode);
291 /**
292  * Appends the normalized form of the second string to the first string
293  * (merging them at the boundary) and returns the length of the first string.
294  * The result is normalized if the first string was normalized.
295  * The first and second strings must be different buffers.
296  * @param norm2 UNormalizer2 instance
297  * @param first string, should be normalized
298  * @param firstLength length of the first string, or -1 if NUL-terminated
299  * @param firstCapacity number of UChars that can be written to first
300  * @param second string, will be normalized
301  * @param secondLength length of the source string, or -1 if NUL-terminated
302  * @param pErrorCode Standard ICU error code. Its input value must
303  *                   pass the U_SUCCESS() test, or else the function returns
304  *                   immediately. Check for U_FAILURE() on output or use with
305  *                   function chaining. (See User Guide for details.)
306  * @return first
307  * @stable ICU 4.4
308  */
309 U_CAPI int32_t U_EXPORT2
310 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
311                                 UChar *first, int32_t firstLength, int32_t firstCapacity,
312                                 const UChar *second, int32_t secondLength,
313                                 UErrorCode *pErrorCode);
314 /**
315  * Appends the second string to the first string
316  * (merging them at the boundary) and returns the length of the first string.
317  * The result is normalized if both the strings were normalized.
318  * The first and second strings must be different buffers.
319  * @param norm2 UNormalizer2 instance
320  * @param first string, should be normalized
321  * @param firstLength length of the first string, or -1 if NUL-terminated
322  * @param firstCapacity number of UChars that can be written to first
323  * @param second string, should be normalized
324  * @param secondLength length of the source string, or -1 if NUL-terminated
325  * @param pErrorCode Standard ICU error code. Its input value must
326  *                   pass the U_SUCCESS() test, or else the function returns
327  *                   immediately. Check for U_FAILURE() on output or use with
328  *                   function chaining. (See User Guide for details.)
329  * @return first
330  * @stable ICU 4.4
331  */
332 U_CAPI int32_t U_EXPORT2
333 unorm2_append(const UNormalizer2 *norm2,
334               UChar *first, int32_t firstLength, int32_t firstCapacity,
335               const UChar *second, int32_t secondLength,
336               UErrorCode *pErrorCode);
337 
338 /**
339  * Gets the decomposition mapping of c.
340  * Roughly equivalent to normalizing the String form of c
341  * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster, and except that this function
342  * returns a negative value and does not write a string
343  * if c does not have a decomposition mapping in this instance's data.
344  * This function is independent of the mode of the UNormalizer2.
345  * @param norm2 UNormalizer2 instance
346  * @param c code point
347  * @param decomposition String buffer which will be set to c's
348  *                      decomposition mapping, if there is one.
349  * @param capacity number of UChars that can be written to decomposition
350  * @param pErrorCode Standard ICU error code. Its input value must
351  *                   pass the U_SUCCESS() test, or else the function returns
352  *                   immediately. Check for U_FAILURE() on output or use with
353  *                   function chaining. (See User Guide for details.)
354  * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value
355  * @stable ICU 4.6
356  */
357 U_CAPI int32_t U_EXPORT2
358 unorm2_getDecomposition(const UNormalizer2 *norm2,
359                         UChar32 c, UChar *decomposition, int32_t capacity,
360                         UErrorCode *pErrorCode);
361 
362 /**
363  * Gets the raw decomposition mapping of c.
364  *
365  * This is similar to the unorm2_getDecomposition() function but returns the
366  * raw decomposition mapping as specified in UnicodeData.txt or
367  * (for custom data) in the mapping files processed by the gennorm2 tool.
368  * By contrast, unorm2_getDecomposition() returns the processed,
369  * recursively-decomposed version of this mapping.
370  *
371  * When used on a standard NFKC Normalizer2 instance,
372  * unorm2_getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property.
373  *
374  * When used on a standard NFC Normalizer2 instance,
375  * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can);
376  * in this case, the result contains either one or two code points (=1..4 UChars).
377  *
378  * This function is independent of the mode of the UNormalizer2.
379  * @param norm2 UNormalizer2 instance
380  * @param c code point
381  * @param decomposition String buffer which will be set to c's
382  *                      raw decomposition mapping, if there is one.
383  * @param capacity number of UChars that can be written to decomposition
384  * @param pErrorCode Standard ICU error code. Its input value must
385  *                   pass the U_SUCCESS() test, or else the function returns
386  *                   immediately. Check for U_FAILURE() on output or use with
387  *                   function chaining. (See User Guide for details.)
388  * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value
389  * @stable ICU 49
390  */
391 U_CAPI int32_t U_EXPORT2
392 unorm2_getRawDecomposition(const UNormalizer2 *norm2,
393                            UChar32 c, UChar *decomposition, int32_t capacity,
394                            UErrorCode *pErrorCode);
395 
396 /**
397  * Performs pairwise composition of a & b and returns the composite if there is one.
398  *
399  * Returns a composite code point c only if c has a two-way mapping to a+b.
400  * In standard Unicode normalization, this means that
401  * c has a canonical decomposition to a+b
402  * and c does not have the Full_Composition_Exclusion property.
403  *
404  * This function is independent of the mode of the UNormalizer2.
405  * @param norm2 UNormalizer2 instance
406  * @param a A (normalization starter) code point.
407  * @param b Another code point.
408  * @return The non-negative composite code point if there is one; otherwise a negative value.
409  * @stable ICU 49
410  */
411 U_CAPI UChar32 U_EXPORT2
412 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b);
413 
414 /**
415  * Gets the combining class of c.
416  * The default implementation returns 0
417  * but all standard implementations return the Unicode Canonical_Combining_Class value.
418  * @param norm2 UNormalizer2 instance
419  * @param c code point
420  * @return c's combining class
421  * @stable ICU 49
422  */
423 U_CAPI uint8_t U_EXPORT2
424 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c);
425 
426 /**
427  * Tests if the string is normalized.
428  * Internally, in cases where the quickCheck() method would return "maybe"
429  * (which is only possible for the two COMPOSE modes) this method
430  * resolves to "yes" or "no" to provide a definitive result,
431  * at the cost of doing more work in those cases.
432  * @param norm2 UNormalizer2 instance
433  * @param s input string
434  * @param length length of the string, or -1 if NUL-terminated
435  * @param pErrorCode Standard ICU error code. Its input value must
436  *                   pass the U_SUCCESS() test, or else the function returns
437  *                   immediately. Check for U_FAILURE() on output or use with
438  *                   function chaining. (See User Guide for details.)
439  * @return true if s is normalized
440  * @stable ICU 4.4
441  */
442 U_CAPI UBool U_EXPORT2
443 unorm2_isNormalized(const UNormalizer2 *norm2,
444                     const UChar *s, int32_t length,
445                     UErrorCode *pErrorCode);
446 
447 /**
448  * Tests if the string is normalized.
449  * For the two COMPOSE modes, the result could be "maybe" in cases that
450  * would take a little more work to resolve definitively.
451  * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
452  * combination of quick check + normalization, to avoid
453  * re-checking the "yes" prefix.
454  * @param norm2 UNormalizer2 instance
455  * @param s input string
456  * @param length length of the string, or -1 if NUL-terminated
457  * @param pErrorCode Standard ICU error code. Its input value must
458  *                   pass the U_SUCCESS() test, or else the function returns
459  *                   immediately. Check for U_FAILURE() on output or use with
460  *                   function chaining. (See User Guide for details.)
461  * @return UNormalizationCheckResult
462  * @stable ICU 4.4
463  */
464 U_CAPI UNormalizationCheckResult U_EXPORT2
465 unorm2_quickCheck(const UNormalizer2 *norm2,
466                   const UChar *s, int32_t length,
467                   UErrorCode *pErrorCode);
468 
469 /**
470  * Returns the end of the normalized substring of the input string.
471  * In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
472  * the substring <code>UnicodeString(s, 0, end)</code>
473  * will pass the quick check with a "yes" result.
474  *
475  * The returned end index is usually one or more characters before the
476  * "no" or "maybe" character: The end index is at a normalization boundary.
477  * (See the class documentation for more about normalization boundaries.)
478  *
479  * When the goal is a normalized string and most input strings are expected
480  * to be normalized already, then call this method,
481  * and if it returns a prefix shorter than the input string,
482  * copy that prefix and use normalizeSecondAndAppend() for the remainder.
483  * @param norm2 UNormalizer2 instance
484  * @param s input string
485  * @param length length of the string, or -1 if NUL-terminated
486  * @param pErrorCode Standard ICU error code. Its input value must
487  *                   pass the U_SUCCESS() test, or else the function returns
488  *                   immediately. Check for U_FAILURE() on output or use with
489  *                   function chaining. (See User Guide for details.)
490  * @return "yes" span end index
491  * @stable ICU 4.4
492  */
493 U_CAPI int32_t U_EXPORT2
494 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
495                          const UChar *s, int32_t length,
496                          UErrorCode *pErrorCode);
497 
498 /**
499  * Tests if the character always has a normalization boundary before it,
500  * regardless of context.
501  * For details see the Normalizer2 base class documentation.
502  * @param norm2 UNormalizer2 instance
503  * @param c character to test
504  * @return true if c has a normalization boundary before it
505  * @stable ICU 4.4
506  */
507 U_CAPI UBool U_EXPORT2
508 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
509 
510 /**
511  * Tests if the character always has a normalization boundary after it,
512  * regardless of context.
513  * For details see the Normalizer2 base class documentation.
514  * @param norm2 UNormalizer2 instance
515  * @param c character to test
516  * @return true if c has a normalization boundary after it
517  * @stable ICU 4.4
518  */
519 U_CAPI UBool U_EXPORT2
520 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
521 
522 /**
523  * Tests if the character is normalization-inert.
524  * For details see the Normalizer2 base class documentation.
525  * @param norm2 UNormalizer2 instance
526  * @param c character to test
527  * @return true if c is normalization-inert
528  * @stable ICU 4.4
529  */
530 U_CAPI UBool U_EXPORT2
531 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
532 
533 /**
534  * Compares two strings for canonical equivalence.
535  * Further options include case-insensitive comparison and
536  * code point order (as opposed to code unit order).
537  *
538  * Canonical equivalence between two strings is defined as their normalized
539  * forms (NFD or NFC) being identical.
540  * This function compares strings incrementally instead of normalizing
541  * (and optionally case-folding) both strings entirely,
542  * improving performance significantly.
543  *
544  * Bulk normalization is only necessary if the strings do not fulfill the FCD
545  * conditions. Only in this case, and only if the strings are relatively long,
546  * is memory allocated temporarily.
547  * For FCD strings and short non-FCD strings there is no memory allocation.
548  *
549  * Semantically, this is equivalent to
550  *   strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
551  * where code point order and foldCase are all optional.
552  *
553  * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
554  * the case folding must be performed first, then the normalization.
555  *
556  * @param s1 First source string.
557  * @param length1 Length of first source string, or -1 if NUL-terminated.
558  *
559  * @param s2 Second source string.
560  * @param length2 Length of second source string, or -1 if NUL-terminated.
561  *
562  * @param options A bit set of options:
563  *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
564  *     Case-sensitive comparison in code unit order, and the input strings
565  *     are quick-checked for FCD.
566  *
567  *   - UNORM_INPUT_IS_FCD
568  *     Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
569  *     If not set, the function will quickCheck for FCD
570  *     and normalize if necessary.
571  *
572  *   - U_COMPARE_CODE_POINT_ORDER
573  *     Set to choose code point order instead of code unit order
574  *     (see u_strCompare for details).
575  *
576  *   - U_COMPARE_IGNORE_CASE
577  *     Set to compare strings case-insensitively using case folding,
578  *     instead of case-sensitively.
579  *     If set, then the following case folding options are used.
580  *
581  *   - Options as used with case-insensitive comparisons, currently:
582  *
583  *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
584  *    (see u_strCaseCompare for details)
585  *
586  *   - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
587  *
588  * @param pErrorCode ICU error code in/out parameter.
589  *                   Must fulfill U_SUCCESS before the function call.
590  * @return <0 or 0 or >0 as usual for string comparisons
591  *
592  * @see unorm_normalize
593  * @see UNORM_FCD
594  * @see u_strCompare
595  * @see u_strCaseCompare
596  *
597  * @stable ICU 2.2
598  */
599 U_CAPI int32_t U_EXPORT2
600 unorm_compare(const UChar *s1, int32_t length1,
601               const UChar *s2, int32_t length2,
602               uint32_t options,
603               UErrorCode *pErrorCode);
604 
605 #endif  /* !UCONFIG_NO_NORMALIZATION */
606 #endif  /* __UNORM2_H__ */
607