#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"
if (edits != nullptr) {
edits->addUnchanged(length);
}
- if ((options & UCASEMAP_OMIT_UNCHANGED_TEXT) ==0) {
+ if ((options & U_OMIT_UNCHANGED_TEXT) ==0) {
sink.Append(reinterpret_cast<const char *>(s), length);
}
}
/* (not) original code point */
if(edits!=NULL) {
edits->addUnchanged(cpLength);
- if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) {
+ if(options & U_OMIT_UNCHANGED_TEXT) {
return destIndex;
}
}
if(length>0) {
if(edits!=NULL) {
edits->addUnchanged(length);
- if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) {
+ if(options & U_OMIT_UNCHANGED_TEXT) {
return destIndex;
}
}
edits->addUnchanged(oldLength);
}
// Write unchanged text?
- change = (options & UCASEMAP_OMIT_UNCHANGED_TEXT) == 0;
+ change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
}
}
* 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
* 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
* 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())
* 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.
* 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
* 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
* 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())
* 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.
* (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.
#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
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)) {
/* (not) original code point */
if(edits!=NULL) {
edits->addUnchanged(cpLength);
- if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) {
+ if(options & U_OMIT_UNCHANGED_TEXT) {
return destIndex;
}
}
if(length>0) {
if(edits!=NULL) {
edits->addUnchanged(length);
- if(options & UCASEMAP_OMIT_UNCHANGED_TEXT) {
+ if(options & U_OMIT_UNCHANGED_TEXT) {
return destIndex;
}
}
edits->addUnchanged(oldLength);
}
// Write unchanged text?
- change = (options & UCASEMAP_OMIT_UNCHANGED_TEXT) == 0;
+ change = (options & U_OMIT_UNCHANGED_TEXT) == 0;
}
}
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[] = {
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[] = {
#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,
#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[] = {
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)));
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)));
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,
#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)));
#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"
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",