From 3975adb5648ffb5ef6e569e1ed7c031d80f408be Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Thu, 8 Jun 2017 19:36:34 +0000 Subject: [PATCH] ICU-13234 rename UCASEMAP_OMIT_UNCHANGED_TEXT to U_OMIT_UNCHANGED_TEXT X-SVN-Rev: 40161 --- icu4c/source/common/normalizer2impl.cpp | 4 ++-- icu4c/source/common/ucasemap.cpp | 6 +++--- icu4c/source/common/unicode/casemap.h | 16 ++++++++-------- icu4c/source/common/unicode/normalizer2.h | 2 +- icu4c/source/common/unicode/ucasemap.h | 6 +++--- icu4c/source/common/unistr_case.cpp | 2 +- icu4c/source/common/ustrcase.cpp | 6 +++--- icu4c/source/test/intltest/strcase.cpp | 16 ++++++++-------- icu4c/source/test/intltest/tstnorm.cpp | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/icu4c/source/common/normalizer2impl.cpp b/icu4c/source/common/normalizer2impl.cpp index 757a0c3f6bd..5e3103eca70 100644 --- a/icu4c/source/common/normalizer2impl.cpp +++ b/icu4c/source/common/normalizer2impl.cpp @@ -23,7 +23,7 @@ #include "unicode/bytestream.h" #include "unicode/edits.h" #include "unicode/normalizer2.h" -#include "unicode/ucasemap.h" // UCASEMAP_OMIT_UNCHANGED_TEXT +#include "unicode/ucasemap.h" // U_OMIT_UNCHANGED_TEXT #include "unicode/udata.h" #include "unicode/ustring.h" #include "unicode/utf16.h" @@ -199,7 +199,7 @@ appendUnchanged(const uint8_t *s, const uint8_t *limit, if (edits != nullptr) { edits->addUnchanged(length); } - if ((options & UCASEMAP_OMIT_UNCHANGED_TEXT) ==0) { + if ((options & U_OMIT_UNCHANGED_TEXT) ==0) { sink.Append(reinterpret_cast(s), length); } } diff --git a/icu4c/source/common/ucasemap.cpp b/icu4c/source/common/ucasemap.cpp index 1523cb6d9db..c21c4453b76 100644 --- a/icu4c/source/common/ucasemap.cpp +++ b/icu4c/source/common/ucasemap.cpp @@ -164,7 +164,7 @@ appendResult(uint8_t *dest, int32_t destIndex, int32_t destCapacity, /* (not) original code point */ if(edits!=NULL) { edits->addUnchanged(cpLength); - if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) { + if(options & U_OMIT_UNCHANGED_TEXT) { return destIndex; } } @@ -282,7 +282,7 @@ appendUnchanged(uint8_t *dest, int32_t destIndex, int32_t destCapacity, if(length>0) { if(edits!=NULL) { edits->addUnchanged(length); - if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) { + if(options & U_OMIT_UNCHANGED_TEXT) { return destIndex; } } @@ -666,7 +666,7 @@ int32_t toUpper(uint32_t options, edits->addUnchanged(oldLength); } // Write unchanged text? - change = (options & UCASEMAP_OMIT_UNCHANGED_TEXT) == 0; + change = (options & U_OMIT_UNCHANGED_TEXT) == 0; } } diff --git a/icu4c/source/common/unicode/casemap.h b/icu4c/source/common/unicode/casemap.h index 98184820d53..1b8af69a26f 100644 --- a/icu4c/source/common/unicode/casemap.h +++ b/icu4c/source/common/unicode/casemap.h @@ -36,7 +36,7 @@ public: * The source string and the destination buffer must not overlap. * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT. + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param dest A buffer for the result string. The result will be NUL-terminated if @@ -71,7 +71,7 @@ public: * The source string and the destination buffer must not overlap. * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT. + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param dest A buffer for the result string. The result will be NUL-terminated if @@ -112,7 +112,7 @@ public: * all others. (This can be modified with options bits.) * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, * U_TITLECASE_NO_LOWERCASE, U_TITLECASE_NO_BREAK_ADJUSTMENT. * @param iter A break iterator to find the first characters of words that are to be titlecased. * It is set to the source string (setText()) @@ -159,7 +159,7 @@ public: * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. @@ -195,7 +195,7 @@ public: * The source string and the destination buffer must not overlap. * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT. + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param dest A buffer for the result string. The result will be NUL-terminated if @@ -230,7 +230,7 @@ public: * The source string and the destination buffer must not overlap. * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT. + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param dest A buffer for the result string. The result will be NUL-terminated if @@ -271,7 +271,7 @@ public: * all others. (This can be modified with options bits.) * * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, * U_TITLECASE_NO_LOWERCASE, U_TITLECASE_NO_BREAK_ADJUSTMENT. * @param iter A break iterator to find the first characters of words that are to be titlecased. * It is set to the source string (setText()) @@ -317,7 +317,7 @@ public: * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. diff --git a/icu4c/source/common/unicode/normalizer2.h b/icu4c/source/common/unicode/normalizer2.h index bb43439c2ca..f0d77978804 100644 --- a/icu4c/source/common/unicode/normalizer2.h +++ b/icu4c/source/common/unicode/normalizer2.h @@ -228,7 +228,7 @@ public: * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). * Otherwise currently converts to & from UTF-16 and does not support edits. * - * @param options Options bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT. + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT. * @param src Source UTF-8 string. * @param sink A ByteSink to which the normalized UTF-8 result string is written. * sink.Flush() is called at the end. diff --git a/icu4c/source/common/unicode/ucasemap.h b/icu4c/source/common/unicode/ucasemap.h index 18e6c2ba0b9..15f508af20c 100644 --- a/icu4c/source/common/unicode/ucasemap.h +++ b/icu4c/source/common/unicode/ucasemap.h @@ -186,13 +186,13 @@ ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); #define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 /** - * Omit unchanged text when case-mapping with Edits. + * Omit unchanged text when case-mapping or normalizing with Edits. * * @see CaseMap * @see Edits - * @draft ICU 59 + * @draft ICU 60 */ -#define UCASEMAP_OMIT_UNCHANGED_TEXT 0x4000 +#define U_OMIT_UNCHANGED_TEXT 0x4000 #if !UCONFIG_NO_BREAK_ITERATION diff --git a/icu4c/source/common/unistr_case.cpp b/icu4c/source/common/unistr_case.cpp index 48c122fcddd..2138d60c01c 100644 --- a/icu4c/source/common/unistr_case.cpp +++ b/icu4c/source/common/unistr_case.cpp @@ -162,7 +162,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER iter->setText(oldString); } #endif - stringCaseMapper(caseLocale, options | UCASEMAP_OMIT_UNCHANGED_TEXT, UCASEMAP_BREAK_ITERATOR + stringCaseMapper(caseLocale, options | U_OMIT_UNCHANGED_TEXT, UCASEMAP_BREAK_ITERATOR replacementChars, UPRV_LENGTHOF(replacementChars), oldArray, oldLength, &edits, errorCode); if (U_SUCCESS(errorCode)) { diff --git a/icu4c/source/common/ustrcase.cpp b/icu4c/source/common/ustrcase.cpp index b12e7a7c0b3..57f6c8b755c 100644 --- a/icu4c/source/common/ustrcase.cpp +++ b/icu4c/source/common/ustrcase.cpp @@ -72,7 +72,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity, /* (not) original code point */ if(edits!=NULL) { edits->addUnchanged(cpLength); - if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) { + if(options & U_OMIT_UNCHANGED_TEXT) { return destIndex; } } @@ -149,7 +149,7 @@ appendUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity, if(length>0) { if(edits!=NULL) { edits->addUnchanged(length); - if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) { + if(options & U_OMIT_UNCHANGED_TEXT) { return destIndex; } } @@ -965,7 +965,7 @@ int32_t toUpper(uint32_t options, edits->addUnchanged(oldLength); } // Write unchanged text? - change = (options & UCASEMAP_OMIT_UNCHANGED_TEXT) == 0; + change = (options & U_OMIT_UNCHANGED_TEXT) == 0; } } diff --git a/icu4c/source/test/intltest/strcase.cpp b/icu4c/source/test/intltest/strcase.cpp index 255855ce8d2..3edad8e6987 100644 --- a/icu4c/source/test/intltest/strcase.cpp +++ b/icu4c/source/test/intltest/strcase.cpp @@ -911,7 +911,7 @@ void StringCaseTest::TestCaseMapWithEdits() { UChar dest[20]; Edits edits; - int32_t length = CaseMap::toLower("tr", UCASEMAP_OMIT_UNCHANGED_TEXT, + int32_t length = CaseMap::toLower("tr", U_OMIT_UNCHANGED_TEXT, u"IstanBul", 8, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"toLower(IstanBul)", UnicodeString(u"ıb"), UnicodeString(TRUE, dest, length)); static const EditChange lowerExpectedChanges[] = { @@ -926,7 +926,7 @@ void StringCaseTest::TestCaseMapWithEdits() { TRUE, errorCode); edits.reset(); - length = CaseMap::toUpper("el", UCASEMAP_OMIT_UNCHANGED_TEXT, + length = CaseMap::toUpper("el", U_OMIT_UNCHANGED_TEXT, u"Πατάτα", 6, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"toUpper(Πατάτα)", UnicodeString(u"ΑΤΑΤΑ"), UnicodeString(TRUE, dest, length)); static const EditChange upperExpectedChanges[] = { @@ -946,7 +946,7 @@ void StringCaseTest::TestCaseMapWithEdits() { #if !UCONFIG_NO_BREAK_ITERATION length = CaseMap::toTitle("nl", - UCASEMAP_OMIT_UNCHANGED_TEXT | + U_OMIT_UNCHANGED_TEXT | U_TITLECASE_NO_BREAK_ADJUSTMENT | U_TITLECASE_NO_LOWERCASE, NULL, u"IjssEL IglOo", 12, @@ -964,7 +964,7 @@ void StringCaseTest::TestCaseMapWithEdits() { #endif edits.reset(); - length = CaseMap::fold(UCASEMAP_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, + length = CaseMap::fold(U_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, u"IßtanBul", 8, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"foldCase(IßtanBul)", UnicodeString(u"ıssb"), UnicodeString(TRUE, dest, length)); static const EditChange foldExpectedChanges[] = { @@ -985,7 +985,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { char dest[50]; Edits edits; - int32_t length = CaseMap::utf8ToLower("tr", UCASEMAP_OMIT_UNCHANGED_TEXT, + int32_t length = CaseMap::utf8ToLower("tr", U_OMIT_UNCHANGED_TEXT, u8"IstanBul", 8, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"toLower(IstanBul)", UnicodeString(u"ıb"), UnicodeString::fromUTF8(StringPiece(dest, length))); @@ -1001,7 +1001,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { TRUE, errorCode); edits.reset(); - length = CaseMap::utf8ToUpper("el", UCASEMAP_OMIT_UNCHANGED_TEXT, + length = CaseMap::utf8ToUpper("el", U_OMIT_UNCHANGED_TEXT, u8"Πατάτα", 6 * 2, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"toUpper(Πατάτα)", UnicodeString(u"ΑΤΑΤΑ"), UnicodeString::fromUTF8(StringPiece(dest, length))); @@ -1021,7 +1021,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { edits.reset(); #if !UCONFIG_NO_BREAK_ITERATION length = CaseMap::utf8ToTitle("nl", - UCASEMAP_OMIT_UNCHANGED_TEXT | + U_OMIT_UNCHANGED_TEXT | U_TITLECASE_NO_BREAK_ADJUSTMENT | U_TITLECASE_NO_LOWERCASE, NULL, u8"IjssEL IglOo", 12, @@ -1040,7 +1040,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { #endif edits.reset(); - length = CaseMap::utf8Fold(UCASEMAP_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, + length = CaseMap::utf8Fold(U_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, u8"IßtanBul", 1 + 2 + 6, dest, UPRV_LENGTHOF(dest), &edits, errorCode); assertEquals(u"foldCase(IßtanBul)", UnicodeString(u"ıssb"), UnicodeString::fromUTF8(StringPiece(dest, length))); diff --git a/icu4c/source/test/intltest/tstnorm.cpp b/icu4c/source/test/intltest/tstnorm.cpp index f0861baf057..199554d9402 100644 --- a/icu4c/source/test/intltest/tstnorm.cpp +++ b/icu4c/source/test/intltest/tstnorm.cpp @@ -13,7 +13,7 @@ #include "unicode/uchar.h" #include "unicode/errorcode.h" #include "unicode/normlzr.h" -#include "unicode/ucasemap.h" // UCASEMAP_OMIT_UNCHANGED_TEXT +#include "unicode/ucasemap.h" // U_OMIT_UNCHANGED_TEXT #include "unicode/uniset.h" #include "unicode/usetiter.h" #include "unicode/schriter.h" @@ -1561,7 +1561,7 @@ BasicNormalizerTest::TestNormalizeUTF8WithEdits() { expected = u8"aääạ\u0308ạ\u0308가각갃"; result.clear(); edits.reset(); - nfkc_cf->normalizeUTF8(UCASEMAP_OMIT_UNCHANGED_TEXT, src, sink, &edits, errorCode); + nfkc_cf->normalizeUTF8(U_OMIT_UNCHANGED_TEXT, src, sink, &edits, errorCode); assertSuccess("normalizeUTF8 omit unchanged", errorCode.get()); assertEquals("normalizeUTF8 omit unchanged", expected.c_str(), result.c_str()); TestUtility::checkEditsIter(*this, u"normalizeUTF8 omit unchanged", -- 2.40.0