From ab9d557dfe362094fe03a3e111a855dc1d95ae99 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Thu, 13 Mar 2003 23:01:42 +0000 Subject: [PATCH] ICU-2481 make UNORM_UNICODE_3_2 and related public X-SVN-Rev: 11302 --- icu4c/source/common/strprep.cpp | 1 - icu4c/source/common/unicode/normlzr.h | 65 +++++++++++++--------- icu4c/source/common/unormimp.h | 36 ------------ icu4c/source/test/perf/normperf/normperf.h | 3 - 4 files changed, 40 insertions(+), 65 deletions(-) diff --git a/icu4c/source/common/strprep.cpp b/icu4c/source/common/strprep.cpp index 8e7713b97ea..ffa762dc27a 100644 --- a/icu4c/source/common/strprep.cpp +++ b/icu4c/source/common/strprep.cpp @@ -21,7 +21,6 @@ #include "sprpimpl.h" #include "nameprep.h" #include "ustr_imp.h" -#include "unormimp.h" #include "unicode/unorm.h" #include "unicode/udata.h" #include "unicode/ustring.h" diff --git a/icu4c/source/common/unicode/normlzr.h b/icu4c/source/common/unicode/normlzr.h index dd238d72851..de5a7e0b5dd 100644 --- a/icu4c/source/common/unicode/normlzr.h +++ b/icu4c/source/common/unicode/normlzr.h @@ -14,10 +14,9 @@ #include "unicode/unistr.h" #include "unicode/chariter.h" #include "unicode/unorm.h" -#include "unormimp.h" // ### TODO remove when prototyping is done!! struct UCharIterator; -typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @draft ICU 2.1 */ +typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */ U_NAMESPACE_BEGIN /** @@ -181,13 +180,10 @@ public: /** * Normalizes a UnicodeString according to the specified normalization mode. * This is a wrapper for unorm_normalize(), using UnicodeString's. - *

+ * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. - * Currently the only available option is obsolete. - * If you want the default behavior corresponding to one of the standard - * Unicode Normalization Forms, use 0 for this argument. - *

+ * * @param source the input string to be normalized. * @param mode the normalization mode * @param options the optional features to be enabled (0 for no options) @@ -204,14 +200,10 @@ public: * Compose a UnicodeString. * This is equivalent to normalize() with mode UNORM_NFC or UNORM_NFKC. * This is a wrapper for unorm_normalize(), using UnicodeString's. - *

+ * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. - * Currently the only available option is obsolete. - * If you want the default behavior corresponding - * to Unicode Normalization Form C or KC, - * use 0 for this argument. - *

+ * * @param source the string to be composed. * @param compat Perform compatibility decomposition before composition. * If this argument is FALSE, only canonical @@ -230,15 +222,10 @@ public: * Static method to decompose a UnicodeString. * This is equivalent to normalize() with mode UNORM_NFD or UNORM_NFKD. * This is a wrapper for unorm_normalize(), using UnicodeString's. - *

+ * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. - * Currently the only available option is obsolete. - * The desired options should be OR'ed together to determine the value - * of this argument. If you want the default behavior corresponding - * to Unicode Normalization Form D or KD, - * use 0 for this argument. - *

+ * * @param source the string to be decomposed. * @param compat Perform compatibility decomposition. * If this argument is FALSE, only canonical @@ -276,7 +263,19 @@ public: static inline UNormalizationCheckResult quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status); - /** ### TODO @draft ICU 2.6 */ + /** + * Performing quick check on a string; same as the other version of quickCheck + * but takes an extra options parameter like most normalization functions. + * + * @param source string for determining if it is in a normalized format + * @paran mode normalization format + * @param options the optional features to be enabled (0 for no options) + * @param status A reference to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see isNormalized + * @draft ICU 2.6 + */ static inline UNormalizationCheckResult quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status); @@ -303,7 +302,21 @@ public: static inline UBool isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode); - /** ### TODO @draft ICU 2.6 */ + /** + * Test if a string is in a given normalization form; same as the other version of isNormalized + * but takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @paran mode Which normalization form to test for. + * @param options the optional features to be enabled (0 for no options) + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see quickCheck + * @draft ICU 2.6 + */ static inline UBool isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); @@ -311,11 +324,11 @@ public: * Concatenate normalized strings, making sure that the result is normalized as well. * * If both the left and the right strings are in - * the normalization form according to "mode", + * the normalization form according to "mode/options", * then the result will be * * \code - * dest=normalize(left+right, mode) + * dest=normalize(left+right, mode, options) * \endcode * * For details see unorm_concatenate in unorm.h. @@ -334,7 +347,7 @@ public: * @see unorm_next * @see unorm_previous * - * @draft ICU 2.1 + * @stable ICU 2.1 */ static UnicodeString & concatenate(UnicodeString &left, UnicodeString &right, @@ -392,6 +405,8 @@ public: * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * (see u_strCaseCompare for details) * + * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT + * * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return <0 or 0 or >0 as usual for string comparisons diff --git a/icu4c/source/common/unormimp.h b/icu4c/source/common/unormimp.h index d11616c2c1c..e77d1cc9f7f 100644 --- a/icu4c/source/common/unormimp.h +++ b/icu4c/source/common/unormimp.h @@ -168,44 +168,8 @@ enum { UNORM_NX_HANGUL=1, /** Options bit 1, do not decompose CJK compatibility characters. @draft ICU 2.6 */ UNORM_NX_CJK_COMPAT=2, - - /** - * Options bit set value to select Unicode 3.2 normalization (except NormalizationCorrections). - * At most one Unicode version can be selected at a time. - * @draft ICU 2.6 - */ - UNORM_UNICODE_3_2=0x20 }; -/** - * Lowest-order bit number of unorm_compare() options bits corresponding to - * normalization options bits. - * - * The options parameter for unorm_compare() uses most bits for - * itself and for various comparison and folding flags. - * The most significant bits, however, are shifted down and passed on - * to the normalization implementation. - * (options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT) - * - * @draft ICU 2.6 - */ -#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 - -/** - * ### TODO prototype, see unorm.cpp - * @draft ICU 2.6 - */ -U_CAPI UNormalizationCheckResult U_EXPORT2 -unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, - UNormalizationMode mode, int32_t options, - UErrorCode *pErrorCode); - -/** ### TODO @draft ICU 2.6 */ -U_CAPI UBool U_EXPORT2 -unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, - UNormalizationMode mode, int32_t options, - UErrorCode *pErrorCode); - /** * Is the normalizer data loaded? * This is used internally before other internal normalizer functions diff --git a/icu4c/source/test/perf/normperf/normperf.h b/icu4c/source/test/perf/normperf/normperf.h index f09419828d7..e067790e495 100644 --- a/icu4c/source/test/perf/normperf/normperf.h +++ b/icu4c/source/test/perf/normperf/normperf.h @@ -12,9 +12,6 @@ #include "unicode/unorm.h" #include "unicode/ustring.h" -// ### currently internal for prototype for unorm_quickCheckTailored() -#include "unormimp.h" - // Stubs for Windows API functions when building on UNIXes. // #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)