Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-31 08:38:30

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 *******************************************************************************
0005 *
0006 *   Copyright (C) 2009-2015, International Business Machines
0007 *   Corporation and others.  All Rights Reserved.
0008 *
0009 *******************************************************************************
0010 *   file name:  unorm2.h
0011 *   encoding:   UTF-8
0012 *   tab size:   8 (not used)
0013 *   indentation:4
0014 *
0015 *   created on: 2009dec15
0016 *   created by: Markus W. Scherer
0017 */
0018 
0019 #ifndef __UNORM2_H__
0020 #define __UNORM2_H__
0021 
0022 /**
0023  * \file
0024  * \brief C API: New API for Unicode Normalization.
0025  *
0026  * Unicode normalization functionality for standard Unicode normalization or
0027  * for using custom mapping tables.
0028  * All instances of UNormalizer2 are unmodifiable/immutable.
0029  * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller.
0030  * For more details see the Normalizer2 C++ class.
0031  */
0032 
0033 #include "unicode/utypes.h"
0034 #include "unicode/stringoptions.h"
0035 #include "unicode/uset.h"
0036 
0037 #if U_SHOW_CPLUSPLUS_API
0038 #include "unicode/localpointer.h"
0039 #endif   // U_SHOW_CPLUSPLUS_API
0040 
0041 /**
0042  * Constants for normalization modes.
0043  * For details about standard Unicode normalization forms
0044  * and about the algorithms which are also used with custom mapping tables
0045  * see http://www.unicode.org/unicode/reports/tr15/
0046  * @stable ICU 4.4
0047  */
0048 typedef enum {
0049     /**
0050      * Decomposition followed by composition.
0051      * Same as standard NFC when using an "nfc" instance.
0052      * Same as standard NFKC when using an "nfkc" instance.
0053      * For details about standard Unicode normalization forms
0054      * see http://www.unicode.org/unicode/reports/tr15/
0055      * @stable ICU 4.4
0056      */
0057     UNORM2_COMPOSE,
0058     /**
0059      * Map, and reorder canonically.
0060      * Same as standard NFD when using an "nfc" instance.
0061      * Same as standard NFKD when using an "nfkc" instance.
0062      * For details about standard Unicode normalization forms
0063      * see http://www.unicode.org/unicode/reports/tr15/
0064      * @stable ICU 4.4
0065      */
0066     UNORM2_DECOMPOSE,
0067     /**
0068      * "Fast C or D" form.
0069      * If a string is in this form, then further decomposition <i>without reordering</i>
0070      * would yield the same form as DECOMPOSE.
0071      * Text in "Fast C or D" form can be processed efficiently with data tables
0072      * that are "canonically closed", that is, that provide equivalent data for
0073      * equivalent text, without having to be fully normalized.
0074      * Not a standard Unicode normalization form.
0075      * Not a unique form: Different FCD strings can be canonically equivalent.
0076      * For details see http://www.unicode.org/notes/tn5/#FCD
0077      * @stable ICU 4.4
0078      */
0079     UNORM2_FCD,
0080     /**
0081      * Compose only contiguously.
0082      * Also known as "FCC" or "Fast C Contiguous".
0083      * The result will often but not always be in NFC.
0084      * The result will conform to FCD which is useful for processing.
0085      * Not a standard Unicode normalization form.
0086      * For details see http://www.unicode.org/notes/tn5/#FCC
0087      * @stable ICU 4.4
0088      */
0089     UNORM2_COMPOSE_CONTIGUOUS
0090 } UNormalization2Mode;
0091 
0092 /**
0093  * Result values for normalization quick check functions.
0094  * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
0095  * @stable ICU 2.0
0096  */
0097 typedef enum UNormalizationCheckResult {
0098   /**
0099    * The input string is not in the normalization form.
0100    * @stable ICU 2.0
0101    */
0102   UNORM_NO,
0103   /**
0104    * The input string is in the normalization form.
0105    * @stable ICU 2.0
0106    */
0107   UNORM_YES,
0108   /**
0109    * The input string may or may not be in the normalization form.
0110    * This value is only returned for composition forms like NFC and FCC,
0111    * when a backward-combining character is found for which the surrounding text
0112    * would have to be analyzed further.
0113    * @stable ICU 2.0
0114    */
0115   UNORM_MAYBE
0116 } UNormalizationCheckResult;
0117 
0118 /**
0119  * Opaque C service object type for the new normalization API.
0120  * @stable ICU 4.4
0121  */
0122 struct UNormalizer2;
0123 typedef struct UNormalizer2 UNormalizer2;  /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */
0124 
0125 #if !UCONFIG_NO_NORMALIZATION
0126 
0127 /**
0128  * Returns a UNormalizer2 instance for Unicode NFC normalization.
0129  * Same as unorm2_getInstance(NULL, "nfc", UNORM2_COMPOSE, pErrorCode).
0130  * Returns an unmodifiable singleton instance. Do not delete it.
0131  * @param pErrorCode Standard ICU error code. Its input value must
0132  *                  pass the U_SUCCESS() test, or else the function returns
0133  *                  immediately. Check for U_FAILURE() on output or use with
0134  *                  function chaining. (See User Guide for details.)
0135  * @return the requested Normalizer2, if successful
0136  * @stable ICU 49
0137  */
0138 U_CAPI const UNormalizer2 * U_EXPORT2
0139 unorm2_getNFCInstance(UErrorCode *pErrorCode);
0140 
0141 /**
0142  * Returns a UNormalizer2 instance for Unicode NFD normalization.
0143  * Same as unorm2_getInstance(NULL, "nfc", UNORM2_DECOMPOSE, pErrorCode).
0144  * Returns an unmodifiable singleton instance. Do not delete it.
0145  * @param pErrorCode Standard ICU error code. Its input value must
0146  *                  pass the U_SUCCESS() test, or else the function returns
0147  *                  immediately. Check for U_FAILURE() on output or use with
0148  *                  function chaining. (See User Guide for details.)
0149  * @return the requested Normalizer2, if successful
0150  * @stable ICU 49
0151  */
0152 U_CAPI const UNormalizer2 * U_EXPORT2
0153 unorm2_getNFDInstance(UErrorCode *pErrorCode);
0154 
0155 /**
0156  * Returns a UNormalizer2 instance for Unicode NFKC normalization.
0157  * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_COMPOSE, pErrorCode).
0158  * Returns an unmodifiable singleton instance. Do not delete it.
0159  * @param pErrorCode Standard ICU error code. Its input value must
0160  *                  pass the U_SUCCESS() test, or else the function returns
0161  *                  immediately. Check for U_FAILURE() on output or use with
0162  *                  function chaining. (See User Guide for details.)
0163  * @return the requested Normalizer2, if successful
0164  * @stable ICU 49
0165  */
0166 U_CAPI const UNormalizer2 * U_EXPORT2
0167 unorm2_getNFKCInstance(UErrorCode *pErrorCode);
0168 
0169 /**
0170  * Returns a UNormalizer2 instance for Unicode NFKD normalization.
0171  * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, pErrorCode).
0172  * Returns an unmodifiable singleton instance. Do not delete it.
0173  * @param pErrorCode Standard ICU error code. Its input value must
0174  *                  pass the U_SUCCESS() test, or else the function returns
0175  *                  immediately. Check for U_FAILURE() on output or use with
0176  *                  function chaining. (See User Guide for details.)
0177  * @return the requested Normalizer2, if successful
0178  * @stable ICU 49
0179  */
0180 U_CAPI const UNormalizer2 * U_EXPORT2
0181 unorm2_getNFKDInstance(UErrorCode *pErrorCode);
0182 
0183 /**
0184  * Returns a UNormalizer2 instance for Unicode toNFKC_Casefold() normalization
0185  * which is equivalent to applying the NFKC_Casefold mappings and then NFC.
0186  * See https://www.unicode.org/reports/tr44/#NFKC_Casefold
0187  *
0188  * Same as unorm2_getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, pErrorCode).
0189  * Returns an unmodifiable singleton instance. Do not delete it.
0190  * @param pErrorCode Standard ICU error code. Its input value must
0191  *                  pass the U_SUCCESS() test, or else the function returns
0192  *                  immediately. Check for U_FAILURE() on output or use with
0193  *                  function chaining. (See User Guide for details.)
0194  * @return the requested Normalizer2, if successful
0195  * @stable ICU 49
0196  */
0197 U_CAPI const UNormalizer2 * U_EXPORT2
0198 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode);
0199 
0200 /**
0201  * Returns a UNormalizer2 instance for a variant of Unicode toNFKC_Casefold() normalization
0202  * which is equivalent to applying the NFKC_Simple_Casefold mappings and then NFC.
0203  * See https://www.unicode.org/reports/tr44/#NFKC_Simple_Casefold
0204  *
0205  * Same as unorm2_getInstance(NULL, "nfkc_scf", UNORM2_COMPOSE, pErrorCode).
0206  * Returns an unmodifiable singleton instance. Do not delete it.
0207  * @param pErrorCode Standard ICU error code. Its input value must
0208  *                  pass the U_SUCCESS() test, or else the function returns
0209  *                  immediately. Check for U_FAILURE() on output or use with
0210  *                  function chaining. (See User Guide for details.)
0211  * @return the requested Normalizer2, if successful
0212  * @stable ICU 74
0213  */
0214 U_CAPI const UNormalizer2 * U_EXPORT2
0215 unorm2_getNFKCSimpleCasefoldInstance(UErrorCode *pErrorCode);
0216 
0217 /**
0218  * Returns a UNormalizer2 instance which uses the specified data file
0219  * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
0220  * and which composes or decomposes text according to the specified mode.
0221  * Returns an unmodifiable singleton instance. Do not delete it.
0222  *
0223  * Use packageName=NULL for data files that are part of ICU's own data.
0224  * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
0225  * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
0226  * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
0227  *
0228  * @param packageName NULL for ICU built-in data, otherwise application data package name
0229  * @param name "nfc" or "nfkc" or "nfkc_cf" or "nfkc_scf" or name of custom data file
0230  * @param mode normalization mode (compose or decompose etc.)
0231  * @param pErrorCode Standard ICU error code. Its input value must
0232  *                  pass the U_SUCCESS() test, or else the function returns
0233  *                  immediately. Check for U_FAILURE() on output or use with
0234  *                  function chaining. (See User Guide for details.)
0235  * @return the requested UNormalizer2, if successful
0236  * @stable ICU 4.4
0237  */
0238 U_CAPI const UNormalizer2 * U_EXPORT2
0239 unorm2_getInstance(const char *packageName,
0240                    const char *name,
0241                    UNormalization2Mode mode,
0242                    UErrorCode *pErrorCode);
0243 
0244 /**
0245  * Constructs a filtered normalizer wrapping any UNormalizer2 instance
0246  * and a filter set.
0247  * Both are aliased and must not be modified or deleted while this object
0248  * is used.
0249  * The filter set should be frozen; otherwise the performance will suffer greatly.
0250  * @param norm2 wrapped UNormalizer2 instance
0251  * @param filterSet USet which determines the characters to be normalized
0252  * @param pErrorCode Standard ICU error code. Its input value must
0253  *                   pass the U_SUCCESS() test, or else the function returns
0254  *                   immediately. Check for U_FAILURE() on output or use with
0255  *                   function chaining. (See User Guide for details.)
0256  * @return the requested UNormalizer2, if successful
0257  * @stable ICU 4.4
0258  */
0259 U_CAPI UNormalizer2 * U_EXPORT2
0260 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
0261 
0262 /**
0263  * Closes a UNormalizer2 instance from unorm2_openFiltered().
0264  * Do not close instances from unorm2_getInstance()!
0265  * @param norm2 UNormalizer2 instance to be closed
0266  * @stable ICU 4.4
0267  */
0268 U_CAPI void U_EXPORT2
0269 unorm2_close(UNormalizer2 *norm2);
0270 
0271 #if U_SHOW_CPLUSPLUS_API
0272 
0273 U_NAMESPACE_BEGIN
0274 
0275 /**
0276  * \class LocalUNormalizer2Pointer
0277  * "Smart pointer" class, closes a UNormalizer2 via unorm2_close().
0278  * For most methods see the LocalPointerBase base class.
0279  *
0280  * @see LocalPointerBase
0281  * @see LocalPointer
0282  * @stable ICU 4.4
0283  */
0284 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
0285 
0286 U_NAMESPACE_END
0287 
0288 #endif
0289 
0290 /**
0291  * Writes the normalized form of the source string to the destination string
0292  * (replacing its contents) and returns the length of the destination string.
0293  * The source and destination strings must be different buffers.
0294  * @param norm2 UNormalizer2 instance
0295  * @param src source string
0296  * @param length length of the source string, or -1 if NUL-terminated
0297  * @param dest destination string; its contents is replaced with normalized src
0298  * @param capacity number of UChars that can be written to dest
0299  * @param pErrorCode Standard ICU error code. Its input value must
0300  *                   pass the U_SUCCESS() test, or else the function returns
0301  *                   immediately. Check for U_FAILURE() on output or use with
0302  *                   function chaining. (See User Guide for details.)
0303  * @return dest
0304  * @stable ICU 4.4
0305  */
0306 U_CAPI int32_t U_EXPORT2
0307 unorm2_normalize(const UNormalizer2 *norm2,
0308                  const UChar *src, int32_t length,
0309                  UChar *dest, int32_t capacity,
0310                  UErrorCode *pErrorCode);
0311 /**
0312  * Appends the normalized form of the second string to the first string
0313  * (merging them at the boundary) and returns the length of the first string.
0314  * The result is normalized if the first string was normalized.
0315  * The first and second strings must be different buffers.
0316  * @param norm2 UNormalizer2 instance
0317  * @param first string, should be normalized
0318  * @param firstLength length of the first string, or -1 if NUL-terminated
0319  * @param firstCapacity number of UChars that can be written to first
0320  * @param second string, will be normalized
0321  * @param secondLength length of the source string, or -1 if NUL-terminated
0322  * @param pErrorCode Standard ICU error code. Its input value must
0323  *                   pass the U_SUCCESS() test, or else the function returns
0324  *                   immediately. Check for U_FAILURE() on output or use with
0325  *                   function chaining. (See User Guide for details.)
0326  * @return first
0327  * @stable ICU 4.4
0328  */
0329 U_CAPI int32_t U_EXPORT2
0330 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
0331                                 UChar *first, int32_t firstLength, int32_t firstCapacity,
0332                                 const UChar *second, int32_t secondLength,
0333                                 UErrorCode *pErrorCode);
0334 /**
0335  * Appends the second string to the first string
0336  * (merging them at the boundary) and returns the length of the first string.
0337  * The result is normalized if both the strings were normalized.
0338  * The first and second strings must be different buffers.
0339  * @param norm2 UNormalizer2 instance
0340  * @param first string, should be normalized
0341  * @param firstLength length of the first string, or -1 if NUL-terminated
0342  * @param firstCapacity number of UChars that can be written to first
0343  * @param second string, should be normalized
0344  * @param secondLength length of the source string, or -1 if NUL-terminated
0345  * @param pErrorCode Standard ICU error code. Its input value must
0346  *                   pass the U_SUCCESS() test, or else the function returns
0347  *                   immediately. Check for U_FAILURE() on output or use with
0348  *                   function chaining. (See User Guide for details.)
0349  * @return first
0350  * @stable ICU 4.4
0351  */
0352 U_CAPI int32_t U_EXPORT2
0353 unorm2_append(const UNormalizer2 *norm2,
0354               UChar *first, int32_t firstLength, int32_t firstCapacity,
0355               const UChar *second, int32_t secondLength,
0356               UErrorCode *pErrorCode);
0357 
0358 /**
0359  * Gets the decomposition mapping of c.
0360  * Roughly equivalent to normalizing the String form of c
0361  * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster, and except that this function
0362  * returns a negative value and does not write a string
0363  * if c does not have a decomposition mapping in this instance's data.
0364  * This function is independent of the mode of the UNormalizer2.
0365  * @param norm2 UNormalizer2 instance
0366  * @param c code point
0367  * @param decomposition String buffer which will be set to c's
0368  *                      decomposition mapping, if there is one.
0369  * @param capacity number of UChars that can be written to decomposition
0370  * @param pErrorCode Standard ICU error code. Its input value must
0371  *                   pass the U_SUCCESS() test, or else the function returns
0372  *                   immediately. Check for U_FAILURE() on output or use with
0373  *                   function chaining. (See User Guide for details.)
0374  * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value
0375  * @stable ICU 4.6
0376  */
0377 U_CAPI int32_t U_EXPORT2
0378 unorm2_getDecomposition(const UNormalizer2 *norm2,
0379                         UChar32 c, UChar *decomposition, int32_t capacity,
0380                         UErrorCode *pErrorCode);
0381 
0382 /**
0383  * Gets the raw decomposition mapping of c.
0384  *
0385  * This is similar to the unorm2_getDecomposition() function but returns the
0386  * raw decomposition mapping as specified in UnicodeData.txt or
0387  * (for custom data) in the mapping files processed by the gennorm2 tool.
0388  * By contrast, unorm2_getDecomposition() returns the processed,
0389  * recursively-decomposed version of this mapping.
0390  *
0391  * When used on a standard NFKC Normalizer2 instance,
0392  * unorm2_getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property.
0393  *
0394  * When used on a standard NFC Normalizer2 instance,
0395  * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can);
0396  * in this case, the result contains either one or two code points (=1..4 UChars).
0397  *
0398  * This function is independent of the mode of the UNormalizer2.
0399  * @param norm2 UNormalizer2 instance
0400  * @param c code point
0401  * @param decomposition String buffer which will be set to c's
0402  *                      raw decomposition mapping, if there is one.
0403  * @param capacity number of UChars that can be written to decomposition
0404  * @param pErrorCode Standard ICU error code. Its input value must
0405  *                   pass the U_SUCCESS() test, or else the function returns
0406  *                   immediately. Check for U_FAILURE() on output or use with
0407  *                   function chaining. (See User Guide for details.)
0408  * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value
0409  * @stable ICU 49
0410  */
0411 U_CAPI int32_t U_EXPORT2
0412 unorm2_getRawDecomposition(const UNormalizer2 *norm2,
0413                            UChar32 c, UChar *decomposition, int32_t capacity,
0414                            UErrorCode *pErrorCode);
0415 
0416 /**
0417  * Performs pairwise composition of a & b and returns the composite if there is one.
0418  *
0419  * Returns a composite code point c only if c has a two-way mapping to a+b.
0420  * In standard Unicode normalization, this means that
0421  * c has a canonical decomposition to a+b
0422  * and c does not have the Full_Composition_Exclusion property.
0423  *
0424  * This function is independent of the mode of the UNormalizer2.
0425  * @param norm2 UNormalizer2 instance
0426  * @param a A (normalization starter) code point.
0427  * @param b Another code point.
0428  * @return The non-negative composite code point if there is one; otherwise a negative value.
0429  * @stable ICU 49
0430  */
0431 U_CAPI UChar32 U_EXPORT2
0432 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b);
0433 
0434 /**
0435  * Gets the combining class of c.
0436  * The default implementation returns 0
0437  * but all standard implementations return the Unicode Canonical_Combining_Class value.
0438  * @param norm2 UNormalizer2 instance
0439  * @param c code point
0440  * @return c's combining class
0441  * @stable ICU 49
0442  */
0443 U_CAPI uint8_t U_EXPORT2
0444 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c);
0445 
0446 /**
0447  * Tests if the string is normalized.
0448  * Internally, in cases where the quickCheck() method would return "maybe"
0449  * (which is only possible for the two COMPOSE modes) this method
0450  * resolves to "yes" or "no" to provide a definitive result,
0451  * at the cost of doing more work in those cases.
0452  * @param norm2 UNormalizer2 instance
0453  * @param s input string
0454  * @param length length of the string, or -1 if NUL-terminated
0455  * @param pErrorCode Standard ICU error code. Its input value must
0456  *                   pass the U_SUCCESS() test, or else the function returns
0457  *                   immediately. Check for U_FAILURE() on output or use with
0458  *                   function chaining. (See User Guide for details.)
0459  * @return true if s is normalized
0460  * @stable ICU 4.4
0461  */
0462 U_CAPI UBool U_EXPORT2
0463 unorm2_isNormalized(const UNormalizer2 *norm2,
0464                     const UChar *s, int32_t length,
0465                     UErrorCode *pErrorCode);
0466 
0467 /**
0468  * Tests if the string is normalized.
0469  * For the two COMPOSE modes, the result could be "maybe" in cases that
0470  * would take a little more work to resolve definitively.
0471  * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
0472  * combination of quick check + normalization, to avoid
0473  * re-checking the "yes" prefix.
0474  * @param norm2 UNormalizer2 instance
0475  * @param s input string
0476  * @param length length of the string, or -1 if NUL-terminated
0477  * @param pErrorCode Standard ICU error code. Its input value must
0478  *                   pass the U_SUCCESS() test, or else the function returns
0479  *                   immediately. Check for U_FAILURE() on output or use with
0480  *                   function chaining. (See User Guide for details.)
0481  * @return UNormalizationCheckResult
0482  * @stable ICU 4.4
0483  */
0484 U_CAPI UNormalizationCheckResult U_EXPORT2
0485 unorm2_quickCheck(const UNormalizer2 *norm2,
0486                   const UChar *s, int32_t length,
0487                   UErrorCode *pErrorCode);
0488 
0489 /**
0490  * Returns the end of the normalized substring of the input string.
0491  * In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
0492  * the substring <code>UnicodeString(s, 0, end)</code>
0493  * will pass the quick check with a "yes" result.
0494  *
0495  * The returned end index is usually one or more characters before the
0496  * "no" or "maybe" character: The end index is at a normalization boundary.
0497  * (See the class documentation for more about normalization boundaries.)
0498  *
0499  * When the goal is a normalized string and most input strings are expected
0500  * to be normalized already, then call this method,
0501  * and if it returns a prefix shorter than the input string,
0502  * copy that prefix and use normalizeSecondAndAppend() for the remainder.
0503  * @param norm2 UNormalizer2 instance
0504  * @param s input string
0505  * @param length length of the string, or -1 if NUL-terminated
0506  * @param pErrorCode Standard ICU error code. Its input value must
0507  *                   pass the U_SUCCESS() test, or else the function returns
0508  *                   immediately. Check for U_FAILURE() on output or use with
0509  *                   function chaining. (See User Guide for details.)
0510  * @return "yes" span end index
0511  * @stable ICU 4.4
0512  */
0513 U_CAPI int32_t U_EXPORT2
0514 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
0515                          const UChar *s, int32_t length,
0516                          UErrorCode *pErrorCode);
0517 
0518 /**
0519  * Tests if the character always has a normalization boundary before it,
0520  * regardless of context.
0521  * For details see the Normalizer2 base class documentation.
0522  * @param norm2 UNormalizer2 instance
0523  * @param c character to test
0524  * @return true if c has a normalization boundary before it
0525  * @stable ICU 4.4
0526  */
0527 U_CAPI UBool U_EXPORT2
0528 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
0529 
0530 /**
0531  * Tests if the character always has a normalization boundary after it,
0532  * regardless of context.
0533  * For details see the Normalizer2 base class documentation.
0534  * @param norm2 UNormalizer2 instance
0535  * @param c character to test
0536  * @return true if c has a normalization boundary after it
0537  * @stable ICU 4.4
0538  */
0539 U_CAPI UBool U_EXPORT2
0540 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
0541 
0542 /**
0543  * Tests if the character is normalization-inert.
0544  * For details see the Normalizer2 base class documentation.
0545  * @param norm2 UNormalizer2 instance
0546  * @param c character to test
0547  * @return true if c is normalization-inert
0548  * @stable ICU 4.4
0549  */
0550 U_CAPI UBool U_EXPORT2
0551 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
0552 
0553 /**
0554  * Compares two strings for canonical equivalence.
0555  * Further options include case-insensitive comparison and
0556  * code point order (as opposed to code unit order).
0557  *
0558  * Canonical equivalence between two strings is defined as their normalized
0559  * forms (NFD or NFC) being identical.
0560  * This function compares strings incrementally instead of normalizing
0561  * (and optionally case-folding) both strings entirely,
0562  * improving performance significantly.
0563  *
0564  * Bulk normalization is only necessary if the strings do not fulfill the FCD
0565  * conditions. Only in this case, and only if the strings are relatively long,
0566  * is memory allocated temporarily.
0567  * For FCD strings and short non-FCD strings there is no memory allocation.
0568  *
0569  * Semantically, this is equivalent to
0570  *   strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2))))
0571  * where code point order and foldCase are all optional.
0572  *
0573  * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
0574  * the case folding must be performed first, then the normalization.
0575  *
0576  * @param s1 First source string.
0577  * @param length1 Length of first source string, or -1 if NUL-terminated.
0578  *
0579  * @param s2 Second source string.
0580  * @param length2 Length of second source string, or -1 if NUL-terminated.
0581  *
0582  * @param options A bit set of options:
0583  *   - U_FOLD_CASE_DEFAULT or 0 is used for default options:
0584  *     Case-sensitive comparison in code unit order, and the input strings
0585  *     are quick-checked for FCD.
0586  *
0587  *   - UNORM_INPUT_IS_FCD
0588  *     Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
0589  *     If not set, the function will quickCheck for FCD
0590  *     and normalize if necessary.
0591  *
0592  *   - U_COMPARE_CODE_POINT_ORDER
0593  *     Set to choose code point order instead of code unit order
0594  *     (see u_strCompare for details).
0595  *
0596  *   - U_COMPARE_IGNORE_CASE
0597  *     Set to compare strings case-insensitively using case folding,
0598  *     instead of case-sensitively.
0599  *     If set, then the following case folding options are used.
0600  *
0601  *   - Options as used with case-insensitive comparisons, currently:
0602  *
0603  *   - U_FOLD_CASE_EXCLUDE_SPECIAL_I
0604  *    (see u_strCaseCompare for details)
0605  *
0606  *   - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
0607  *
0608  * @param pErrorCode ICU error code in/out parameter.
0609  *                   Must fulfill U_SUCCESS before the function call.
0610  * @return <0 or 0 or >0 as usual for string comparisons
0611  *
0612  * @see unorm_normalize
0613  * @see UNORM_FCD
0614  * @see u_strCompare
0615  * @see u_strCaseCompare
0616  *
0617  * @stable ICU 2.2
0618  */
0619 U_CAPI int32_t U_EXPORT2
0620 unorm_compare(const UChar *s1, int32_t length1,
0621               const UChar *s2, int32_t length2,
0622               uint32_t options,
0623               UErrorCode *pErrorCode);
0624 
0625 #endif  /* !UCONFIG_NO_NORMALIZATION */
0626 #endif  /* __UNORM2_H__ */