WebKit Bugzilla
Attachment 340062 Details for
Bug 185502
: Update ICU headers for macOS to v60
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185502-20180509201015.patch (text/plain), 882.51 KB, created by
Andy VanWagoner
on 2018-05-09 19:10:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy VanWagoner
Created:
2018-05-09 19:10:28 PDT
Size:
882.51 KB
patch
obsolete
>Subversion Revision: 231623 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 09117e09fff39f98d27758b7f4952872c15ef4c4..8919165d3f63bce680e64b453027ecf432c04d85 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,220 @@ >+2018-05-09 Andy VanWagoner <andy@vanwagoner.family> >+ >+ Update ICU headers for macOS to v60 >+ https://bugs.webkit.org/show_bug.cgi?id=185502 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * icu/README: >+ * icu/unicode/alphaindex.h: >+ * icu/unicode/appendable.h: >+ * icu/unicode/basictz.h: >+ * icu/unicode/brkiter.h: >+ * icu/unicode/bytestream.h: >+ (StringByteSink::StringByteSink): >+ * icu/unicode/bytestrie.h: >+ * icu/unicode/bytestriebuilder.h: >+ * icu/unicode/calendar.h: >+ * icu/unicode/caniter.h: >+ * icu/unicode/chariter.h: >+ * icu/unicode/choicfmt.h: >+ * icu/unicode/coleitr.h: >+ * icu/unicode/coll.h: >+ * icu/unicode/compactdecimalformat.h: >+ * icu/unicode/curramt.h: >+ (CurrencyAmount::getISOCurrency const): >+ * icu/unicode/currpinf.h: >+ * icu/unicode/currunit.h: >+ (CurrencyUnit::getISOCurrency const): >+ * icu/unicode/datefmt.h: >+ * icu/unicode/dbbi.h: >+ * icu/unicode/dcfmtsym.h: >+ (DecimalFormatSymbols::setSymbol): >+ * icu/unicode/decimfmt.h: >+ (DecimalFormat::getConstSymbol const): Deleted. >+ * icu/unicode/docmain.h: >+ * icu/unicode/dtfmtsym.h: >+ * icu/unicode/dtintrv.h: >+ * icu/unicode/dtitvfmt.h: >+ * icu/unicode/dtitvinf.h: >+ * icu/unicode/dtptngen.h: >+ * icu/unicode/dtrule.h: >+ * icu/unicode/enumset.h: >+ * icu/unicode/errorcode.h: >+ * icu/unicode/fieldpos.h: >+ * icu/unicode/filteredbrk.h: >+ * icu/unicode/fmtable.h: >+ * icu/unicode/format.h: >+ * icu/unicode/fpositer.h: >+ * icu/unicode/gender.h: >+ * icu/unicode/gregocal.h: >+ * icu/unicode/icudataver.h: >+ * icu/unicode/icuplug.h: >+ * icu/unicode/idna.h: >+ * icu/unicode/listformatter.h: >+ * icu/unicode/localpointer.h: >+ (LocalPointer::LocalPointer): >+ (LocalPointer::adoptInstead): >+ (LocalPointer::adoptInsteadAndCheckErrorCode): >+ (LocalArray::LocalArray): >+ (LocalArray::adoptInsteadAndCheckErrorCode): >+ * icu/unicode/locdspnm.h: >+ * icu/unicode/locid.h: >+ * icu/unicode/measfmt.h: >+ * icu/unicode/measunit.h: >+ * icu/unicode/measure.h: >+ * icu/unicode/messagepattern.h: >+ * icu/unicode/msgfmt.h: >+ * icu/unicode/normalizer2.h: >+ * icu/unicode/normlzr.h: >+ (Normalizer::compare): >+ * icu/unicode/numfmt.h: >+ * icu/unicode/numsys.h: >+ * icu/unicode/parseerr.h: >+ * icu/unicode/parsepos.h: >+ * icu/unicode/platform.h: >+ * icu/unicode/plurfmt.h: >+ * icu/unicode/plurrule.h: >+ * icu/unicode/ptypes.h: >+ * icu/unicode/putil.h: >+ * icu/unicode/rbbi.h: >+ * icu/unicode/rbnf.h: >+ * icu/unicode/rbtz.h: >+ * icu/unicode/regex.h: >+ * icu/unicode/region.h: >+ * icu/unicode/reldatefmt.h: >+ * icu/unicode/rep.h: >+ * icu/unicode/resbund.h: >+ * icu/unicode/schriter.h: >+ * icu/unicode/scientificnumberformatter.h: >+ * icu/unicode/search.h: >+ * icu/unicode/selfmt.h: >+ * icu/unicode/simpletz.h: >+ * icu/unicode/smpdtfmt.h: >+ * icu/unicode/sortkey.h: >+ * icu/unicode/std_string.h: >+ * icu/unicode/strenum.h: >+ * icu/unicode/stringoptions.h: Added. >+ * icu/unicode/stringpiece.h: >+ * icu/unicode/stringtriebuilder.h: >+ * icu/unicode/stsearch.h: >+ * icu/unicode/symtable.h: >+ * icu/unicode/tblcoll.h: >+ * icu/unicode/timezone.h: >+ * icu/unicode/tmunit.h: >+ * icu/unicode/tmutamt.h: >+ * icu/unicode/tmutfmt.h: >+ * icu/unicode/translit.h: >+ (Transliterator::setID): >+ * icu/unicode/tzfmt.h: >+ * icu/unicode/tznames.h: >+ * icu/unicode/tzrule.h: >+ * icu/unicode/tztrans.h: >+ * icu/unicode/ubidi.h: >+ * icu/unicode/ubiditransform.h: Added. >+ * icu/unicode/ubrk.h: >+ * icu/unicode/ucal.h: >+ * icu/unicode/ucasemap.h: >+ * icu/unicode/ucat.h: >+ * icu/unicode/uchar.h: >+ * icu/unicode/ucharstrie.h: >+ * icu/unicode/ucharstriebuilder.h: >+ * icu/unicode/uchriter.h: >+ * icu/unicode/uclean.h: >+ * icu/unicode/ucnv.h: >+ * icu/unicode/ucnv_cb.h: >+ * icu/unicode/ucnv_err.h: >+ * icu/unicode/ucnvsel.h: >+ * icu/unicode/ucol.h: >+ * icu/unicode/ucoleitr.h: >+ * icu/unicode/uconfig.h: >+ * icu/unicode/ucsdet.h: >+ * icu/unicode/ucurr.h: >+ * icu/unicode/udat.h: >+ * icu/unicode/udata.h: >+ * icu/unicode/udateintervalformat.h: >+ * icu/unicode/udatpg.h: >+ * icu/unicode/udisplaycontext.h: >+ * icu/unicode/uenum.h: >+ * icu/unicode/ufieldpositer.h: >+ * icu/unicode/uformattable.h: >+ * icu/unicode/ugender.h: >+ * icu/unicode/uidna.h: >+ * icu/unicode/uiter.h: >+ * icu/unicode/uldnames.h: >+ * icu/unicode/ulistformatter.h: >+ * icu/unicode/uloc.h: >+ * icu/unicode/ulocdata.h: >+ * icu/unicode/umachine.h: >+ * icu/unicode/umisc.h: >+ * icu/unicode/umsg.h: >+ * icu/unicode/unifilt.h: >+ * icu/unicode/unifunct.h: >+ * icu/unicode/unimatch.h: >+ * icu/unicode/unirepl.h: >+ * icu/unicode/uniset.h: >+ * icu/unicode/unistr.h: >+ (UnicodeString::UnicodeString): >+ (UnicodeString::getBuffer const): >+ (UnicodeString::compare const): >+ (UnicodeString::compareCodePointOrder const): >+ (UnicodeString::caseCompare const): >+ (UnicodeString::indexOf const): >+ (UnicodeString::lastIndexOf const): >+ (UnicodeString::startsWith const): >+ (UnicodeString::endsWith const): >+ (UnicodeString::replace): >+ (UnicodeString::extract const): >+ (UnicodeString::extractBetween const): >+ (UnicodeString::setArray): >+ (UnicodeString::operator= ): >+ (UnicodeString::setTo): >+ (UnicodeString::append): >+ (UnicodeString::operator+= ): >+ (UnicodeString::insert): >+ * icu/unicode/unorm.h: >+ * icu/unicode/unorm2.h: >+ * icu/unicode/unum.h: >+ * icu/unicode/unumsys.h: >+ * icu/unicode/uobject.h: >+ * icu/unicode/upluralrules.h: >+ * icu/unicode/uregex.h: >+ * icu/unicode/uregion.h: >+ * icu/unicode/ureldatefmt.h: Added. >+ * icu/unicode/urename.h: >+ * icu/unicode/urep.h: >+ * icu/unicode/ures.h: >+ (ures_getUnicodeString): >+ (ures_getNextUnicodeString): >+ (ures_getUnicodeStringByIndex): >+ (ures_getUnicodeStringByKey): >+ * icu/unicode/uscript.h: >+ * icu/unicode/usearch.h: >+ * icu/unicode/uset.h: >+ * icu/unicode/usetiter.h: >+ * icu/unicode/ushape.h: >+ * icu/unicode/uspoof.h: >+ * icu/unicode/usprep.h: >+ * icu/unicode/ustring.h: >+ * icu/unicode/ustringtrie.h: >+ * icu/unicode/utext.h: >+ * icu/unicode/utf.h: >+ * icu/unicode/utf16.h: >+ * icu/unicode/utf32.h: >+ * icu/unicode/utf8.h: >+ * icu/unicode/utf_old.h: >+ * icu/unicode/utmscale.h: >+ * icu/unicode/utrace.h: >+ * icu/unicode/utrans.h: >+ * icu/unicode/utypes.h: >+ (operator new): Deleted. >+ (operator new[]): Deleted. >+ (operator delete): Deleted. >+ (operator delete[]): Deleted. >+ * icu/unicode/uvernum.h: >+ * icu/unicode/uversion.h: >+ * icu/unicode/vtzone.h: >+ > 2018-05-09 Michael Catanzaro <mcatanzaro@igalia.com> > > [WPE] Build cleanly with GCC 8 and ICU 60 >diff --git a/Source/WTF/icu/README b/Source/WTF/icu/README >index 326efe1798645095e9a6c4ec3a29cd2d4914b12f..f9ab5012398ce5aba8b4f4d8de90d1159113c3bc 100644 >--- a/Source/WTF/icu/README >+++ b/Source/WTF/icu/README >@@ -4,9 +4,26 @@ The Mac OS X 10.4 and subsequent releases include the ICU binary, but not ICU he > For other platforms, installed ICU headers should be used rather than these. > They are specific to the Mac OS X platform. > >-The headers here are from ICU version 55.1 downloaded from the ICU project. >-http://site.icu-project.org/download/55#TOC-ICU4C-Download >+The headers here are from ICU version 60.2 downloaded from the ICU project. >+http://site.icu-project.org/download/60#TOC-ICU4C-Download > > The following changes are needed again if you update the files: >-utypes.h:62 U_SHOW_CPLUSPLUS_API 0 >-uconfig.h:90 U_DISABLE_RENAMING 1 >+ >+For binary compatibility with system library, disable renaming & C++ apis. >+http://userguide.icu-project.org/design#TOC-ICU-Binary-Compatibility:-Using-ICU-as-an-Operating-System-Level-Library >+ >+uconfig.h:92 U_DISABLE_RENAMING 1 >+utypes.h:64 U_SHOW_CPLUSPLUS_API 0 >+ >+Similar to disabling C++ apis, we want UChar to be defined as if compiling for C. >+ >+umachine:346 #elif 0 >+ >+Don't include these C++ only files: >+ >+casemap.h >+char16ptr.h >+edits.h >+nounit.h >+numberformatter.h >+simpleformatter.h >diff --git a/Source/WTF/icu/unicode/alphaindex.h b/Source/WTF/icu/unicode/alphaindex.h >index 7969962e55de11a79806f1c0a307263b5958fccd..1442f754e46d759f1f10856f3b9e95d3d9d1cabf 100644 >--- a/Source/WTF/icu/unicode/alphaindex.h >+++ b/Source/WTF/icu/unicode/alphaindex.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -13,6 +15,7 @@ > #include "unicode/utypes.h" > #include "unicode/uobject.h" > #include "unicode/locid.h" >+#include "unicode/unistr.h" > > #if !UCONFIG_NO_COLLATION > >diff --git a/Source/WTF/icu/unicode/appendable.h b/Source/WTF/icu/unicode/appendable.h >index a6a83b15cf97193b2dc691f90cbcaa91928ddb7f..8512c2f30311b8d1bc1b8a8e467ddadc3828d42f 100644 >--- a/Source/WTF/icu/unicode/appendable.h >+++ b/Source/WTF/icu/unicode/appendable.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2011-2012, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: appendable.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -17,7 +19,7 @@ > > /** > * \file >- * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (UChars). >+ * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts). > */ > > #include "unicode/utypes.h" >@@ -32,10 +34,10 @@ class UnicodeString; > * Combines elements of Java Appendable and ICU4C ByteSink. > * > * This class can be used in APIs where it does not matter whether the actual destination is >- * a UnicodeString, a UChar[] array, a UnicodeSet, or any other object >+ * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object > * that receives and processes characters and/or strings. > * >- * Implementation classes must implement at least appendCodeUnit(UChar). >+ * Implementation classes must implement at least appendCodeUnit(char16_t). > * The base class provides default implementations for the other methods. > * > * The methods do not take UErrorCode parameters. >@@ -60,11 +62,11 @@ public: > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >- virtual UBool appendCodeUnit(UChar c) = 0; >+ virtual UBool appendCodeUnit(char16_t c) = 0; > > /** > * Appends a code point. >- * The default implementation calls appendCodeUnit(UChar) once or twice. >+ * The default implementation calls appendCodeUnit(char16_t) once or twice. > * @param c code point 0..0x10ffff > * @return TRUE if the operation succeeded > * @stable ICU 4.8 >@@ -73,20 +75,20 @@ public: > > /** > * Appends a string. >- * The default implementation calls appendCodeUnit(UChar) for each code unit. >+ * The default implementation calls appendCodeUnit(char16_t) for each code unit. > * @param s string, must not be NULL if length!=0 > * @param length string length, or -1 if NUL-terminated > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >- virtual UBool appendString(const UChar *s, int32_t length); >+ virtual UBool appendString(const char16_t *s, int32_t length); > > /** > * Tells the object that the caller is going to append roughly >- * appendCapacity UChars. A subclass might use this to pre-allocate >+ * appendCapacity char16_ts. A subclass might use this to pre-allocate > * a larger buffer if necessary. > * The default implementation does nothing. (It always returns TRUE.) >- * @param appendCapacity estimated number of UChars that will be appended >+ * @param appendCapacity estimated number of char16_ts that will be appended > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >@@ -100,19 +102,19 @@ public: > * The returned buffer is only valid until the next operation > * on this Appendable. > * >- * After writing at most *resultCapacity UChars, call appendString() with the >- * pointer returned from this function and the number of UChars written. >- * Many appendString() implementations will avoid copying UChars if this function >+ * After writing at most *resultCapacity char16_ts, call appendString() with the >+ * pointer returned from this function and the number of char16_ts written. >+ * Many appendString() implementations will avoid copying char16_ts if this function > * returned an internal buffer. > * > * Partial usage example: > * \code > * int32_t capacity; >- * UChar* buffer = app.getAppendBuffer(..., &capacity); >- * ... Write n UChars into buffer, with n <= capacity. >+ * char16_t* buffer = app.getAppendBuffer(..., &capacity); >+ * ... Write n char16_ts into buffer, with n <= capacity. > * app.appendString(buffer, n); > * \endcode >- * In many implementations, that call to append will avoid copying UChars. >+ * In many implementations, that call to append will avoid copying char16_ts. > * > * If the Appendable allocates or reallocates an internal buffer, it should use > * the desiredCapacityHint if appropriate. >@@ -136,9 +138,9 @@ public: > * @return a buffer with *resultCapacity>=minCapacity > * @stable ICU 4.8 > */ >- virtual UChar *getAppendBuffer(int32_t minCapacity, >+ virtual char16_t *getAppendBuffer(int32_t minCapacity, > int32_t desiredCapacityHint, >- UChar *scratch, int32_t scratchCapacity, >+ char16_t *scratch, int32_t scratchCapacity, > int32_t *resultCapacity); > }; > >@@ -169,7 +171,7 @@ public: > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >- virtual UBool appendCodeUnit(UChar c); >+ virtual UBool appendCodeUnit(char16_t c); > > /** > * Appends a code point to the string. >@@ -186,12 +188,12 @@ public: > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >- virtual UBool appendString(const UChar *s, int32_t length); >+ virtual UBool appendString(const char16_t *s, int32_t length); > > /** > * Tells the UnicodeString that the caller is going to append roughly >- * appendCapacity UChars. >- * @param appendCapacity estimated number of UChars that will be appended >+ * appendCapacity char16_ts. >+ * @param appendCapacity estimated number of char16_ts that will be appended > * @return TRUE if the operation succeeded > * @stable ICU 4.8 > */ >@@ -218,9 +220,9 @@ public: > * @return a buffer with *resultCapacity>=minCapacity > * @stable ICU 4.8 > */ >- virtual UChar *getAppendBuffer(int32_t minCapacity, >+ virtual char16_t *getAppendBuffer(int32_t minCapacity, > int32_t desiredCapacityHint, >- UChar *scratch, int32_t scratchCapacity, >+ char16_t *scratch, int32_t scratchCapacity, > int32_t *resultCapacity); > > private: >diff --git a/Source/WTF/icu/unicode/basictz.h b/Source/WTF/icu/unicode/basictz.h >index f1e477f4743894386f4dbb85525b73828fb022ff..3541207268ddfb0d8a6aadbb4b6c550f087ef0fd 100644 >--- a/Source/WTF/icu/unicode/basictz.h >+++ b/Source/WTF/icu/unicode/basictz.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2013, International Business Machines Corporation and >diff --git a/Source/WTF/icu/unicode/brkiter.h b/Source/WTF/icu/unicode/brkiter.h >index 4aa5e552796090eaebcd7ce7b7d275aa8b3775b4..c64bb712222c6346e8da32f144c4419191f2e119 100644 >--- a/Source/WTF/icu/unicode/brkiter.h >+++ b/Source/WTF/icu/unicode/brkiter.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 1997-2014, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -168,6 +170,11 @@ public: > /** > * Change the text over which this operates. The text boundary is > * reset to the start. >+ * >+ * The BreakIterator will retain a reference to the supplied string. >+ * The caller must not modify or delete the text while the BreakIterator >+ * retains the reference. >+ * > * @param text The UnicodeString used to change the text. > * @stable ICU 2.0 > */ >@@ -243,7 +250,7 @@ public: > virtual int32_t next(void) = 0; > > /** >- * Return character index of the current interator position within the text. >+ * Return character index of the current iterator position within the text. > * @return The boundary most recently returned. > * @stable ICU 2.0 > */ >@@ -270,7 +277,7 @@ public: > virtual int32_t preceding(int32_t offset) = 0; > > /** >- * Return true if the specfied position is a boundary position. >+ * Return true if the specified position is a boundary position. > * As a side effect, the current position of the iterator is set > * to the first boundary position at or following the specified offset. > * @param offset the offset to check. >@@ -285,13 +292,13 @@ public: > * does nothing. Negative values move to previous boundaries > * and positive values move to later boundaries. > * @return The new iterator position, or >- * DONE if there are fewer than |n| boundaries in the specfied direction. >+ * DONE if there are fewer than |n| boundaries in the specified direction. > * @stable ICU 2.0 > */ > virtual int32_t next(int32_t n) = 0; > > /** >- * For RuleBasedBreakIterators, return the status tag from the >+ * For RuleBasedBreakIterators, return the status tag from the > * break rule that determined the most recently > * returned break position. > * <p> >@@ -307,7 +314,7 @@ public: > virtual int32_t getRuleStatus() const; > > /** >- * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) >+ * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) > * that determined the most recently returned break position. > * <p> > * For break iterator types that do not support rule status, >@@ -324,7 +331,7 @@ public: > * @param fillInVec an array to be filled in with the status values. > * @param capacity the length of the supplied vector. A length of zero causes > * the function to return the number of status values, in the >- * normal way, without attemtping to store any values. >+ * normal way, without attempting to store any values. > * @param status receives error codes. > * @return The number of rule status values from rules that determined > * the most recent boundary returned by the break iterator. >@@ -462,7 +469,7 @@ public: > static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); > > /** >- * Get name of the object for the desired Locale, in the desired langauge. >+ * Get name of the object for the desired Locale, in the desired language. > * @param objectLocale must be from getAvailableLocales. > * @param displayLocale specifies the desired locale for output. > * @param name the fill-in parameter of the return value >@@ -475,7 +482,7 @@ public: > UnicodeString& name); > > /** >- * Get name of the object for the desired Locale, in the langauge of the >+ * Get name of the object for the desired Locale, in the language of the > * default locale. > * @param objectLocale must be from getMatchingLocales > * @param name the fill-in parameter of the return value >@@ -622,20 +629,19 @@ protected: > /** @internal */ > BreakIterator(); > /** @internal */ >- BreakIterator (const BreakIterator &other) : UObject(other) {} >+ BreakIterator (const BreakIterator &other); >+#ifndef U_HIDE_INTERNAL_API > /** @internal */ >- BreakIterator (const Locale& valid, const Locale& actual); >+ BreakIterator (const Locale& valid, const Locale &actual); >+ /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ >+ BreakIterator &operator = (const BreakIterator &other); >+#endif /* U_HIDE_INTERNAL_API */ >+ > private: > > /** @internal */ > char actualLocale[ULOC_FULLNAME_CAPACITY]; > char validLocale[ULOC_FULLNAME_CAPACITY]; >- >- /** >- * The assignment operator has no real implementation. >- * It's provided to make the compiler happy. Do not call. >- */ >- BreakIterator& operator=(const BreakIterator&); > }; > > #ifndef U_HIDE_DEPRECATED_API >@@ -651,5 +657,5 @@ U_NAMESPACE_END > > #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ > >-#endif // _BRKITER >+#endif // BRKITER_H > //eof >diff --git a/Source/WTF/icu/unicode/bytestream.h b/Source/WTF/icu/unicode/bytestream.h >index 174aa38afce0702014aba88e52937efe4abec125..6f61c384f795866b165ce95e9b5a26381f043a21 100644 >--- a/Source/WTF/icu/unicode/bytestream.h >+++ b/Source/WTF/icu/unicode/bytestream.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > // Copyright (C) 2009-2012, International Business Machines > // Corporation and others. All Rights Reserved. > // >@@ -124,8 +126,8 @@ public: > virtual void Flush(); > > private: >- ByteSink(const ByteSink &); // copy constructor not implemented >- ByteSink &operator=(const ByteSink &); // assignment operator not implemented >+ ByteSink(const ByteSink &) = delete; >+ ByteSink &operator=(const ByteSink &) = delete; > }; > > // ------------------------------------------------------------- >@@ -215,12 +217,11 @@ private: > int32_t size_; > int32_t appended_; > UBool overflowed_; >- CheckedArrayByteSink(); ///< default constructor not implemented >- CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor not implemented >- CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assignment operator not implemented >-}; > >-#if U_HAVE_STD_STRING >+ CheckedArrayByteSink() = delete; >+ CheckedArrayByteSink(const CheckedArrayByteSink &) = delete; >+ CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete; >+}; > > /** > * Implementation of ByteSink that writes to a "string". >@@ -236,6 +237,21 @@ class StringByteSink : public ByteSink { > * @stable ICU 4.2 > */ > StringByteSink(StringClass* dest) : dest_(dest) { } >+#ifndef U_HIDE_DRAFT_API >+ /** >+ * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string. >+ * >+ * @param dest pointer to string object to append to >+ * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d >+ * @draft ICU 60 >+ */ >+ StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) { >+ if (initialAppendCapacity > 0 && >+ (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) { >+ dest->reserve(dest->length() + initialAppendCapacity); >+ } >+ } >+#endif // U_HIDE_DRAFT_API > /** > * Append "bytes[0,n-1]" to this. > * @param data the pointer to the bytes >@@ -245,12 +261,11 @@ class StringByteSink : public ByteSink { > virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } > private: > StringClass* dest_; >- StringByteSink(); ///< default constructor not implemented >- StringByteSink(const StringByteSink &); ///< copy constructor not implemented >- StringByteSink &operator=(const StringByteSink &); ///< assignment operator not implemented >-}; > >-#endif >+ StringByteSink() = delete; >+ StringByteSink(const StringByteSink &) = delete; >+ StringByteSink &operator=(const StringByteSink &) = delete; >+}; > > U_NAMESPACE_END > >diff --git a/Source/WTF/icu/unicode/bytestrie.h b/Source/WTF/icu/unicode/bytestrie.h >index 9c7782740dba2752b1f01264d3977ee615402007..c57b8ccfeb59600d9e8fe8ae690bddff9cafb7a8 100644 >--- a/Source/WTF/icu/unicode/bytestrie.h >+++ b/Source/WTF/icu/unicode/bytestrie.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2012, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: bytestrie.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -306,7 +308,7 @@ public: > * @return The NUL-terminated byte sequence for the last successful next(). > * @stable ICU 4.8 > */ >- const StringPiece &getString() const { return sp_; } >+ StringPiece getString() const; > /** > * @return The value for the last successful next(). > * @stable ICU 4.8 >@@ -325,7 +327,6 @@ public: > int32_t initialRemainingMatchLength_; > > CharString *str_; >- StringPiece sp_; > int32_t maxLength_; > int32_t value_; > >diff --git a/Source/WTF/icu/unicode/bytestriebuilder.h b/Source/WTF/icu/unicode/bytestriebuilder.h >index d00ab9b3b0947d0d05c8935f98efe15073da6218..a8412d3d6e833d31a9acf94ad9c7c1274ce7e00d 100644 >--- a/Source/WTF/icu/unicode/bytestriebuilder.h >+++ b/Source/WTF/icu/unicode/bytestriebuilder.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2010-2014, International Business Machines >+* Copyright (C) 2010-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: bytestriebuilder.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -29,7 +31,6 @@ U_NAMESPACE_BEGIN > > class BytesTrieElement; > class CharString; >- > /** > * Builder class for BytesTrie. > * >@@ -65,7 +66,7 @@ public: > * @return *this > * @stable ICU 4.8 > */ >- BytesTrieBuilder &add(const StringPiece &s, int32_t value, UErrorCode &errorCode); >+ BytesTrieBuilder &add(StringPiece s, int32_t value, UErrorCode &errorCode); > > /** > * Builds a BytesTrie for the add()ed data. >@@ -126,14 +127,14 @@ private: > void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode); > > virtual int32_t getElementStringLength(int32_t i) const; >- virtual UChar getElementUnit(int32_t i, int32_t byteIndex) const; >+ virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; > virtual int32_t getElementValue(int32_t i) const; > > virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const; > > virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const; > virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; >- virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, UChar byte) const; >+ virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; > > virtual UBool matchNodesCanHaveValues() const { return FALSE; } > >@@ -152,7 +153,8 @@ private: > private: > const char *s; > }; >- >+ >+ // don't use #ifndef U_HIDE_INTERNAL_API with private class members or virtual methods. > virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length, > Node *nextNode) const; > >diff --git a/Source/WTF/icu/unicode/calendar.h b/Source/WTF/icu/unicode/calendar.h >index bc7f05492defddabd4a47117962265267ae664d8..48021534b422f685fd0c22d00226103a6dd316e3 100644 >--- a/Source/WTF/icu/unicode/calendar.h >+++ b/Source/WTF/icu/unicode/calendar.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2014, International Business Machines >@@ -28,7 +30,7 @@ > #include "unicode/utypes.h" > > /** >- * \file >+ * \file > * \brief C++ API: Calendar object > */ > #if !UCONFIG_NO_FORMATTING >@@ -135,7 +137,7 @@ class BasicTimeZone; > * Calendar resolves the time using the UTC offset before the transition by default. > * In this example, 1:30 AM is interpreted as 1:30 AM standard time (non-exist), > * so the final result will be 2:30 AM daylight time. >- * >+ * > * <p>On the date switching back to standard time, wall clock time is moved back one > * hour at 2:00 AM. So wall clock time from 1:00 AM to 1:59 AM occur twice. In this > * case, the ICU Calendar resolves the time using the UTC offset after the transition >@@ -233,7 +235,7 @@ public: > DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR > YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year > DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized >- >+ > EXTENDED_YEAR, > JULIAN_DAY, > MILLISECONDS_IN_DAY, >@@ -912,7 +914,7 @@ public: > * option for this. When the argument is neither <code>UCAL_WALLTIME_FIRST</code> > * nor <code>UCAL_WALLTIME_LAST</code>, this method has no effect and will keep > * the current setting. >- * >+ * > * @param option the behavior for handling repeating wall time, either > * <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>. > * @see #getRepeatedWallTimeOption >@@ -923,7 +925,7 @@ public: > /** > * Gets the behavior for handling wall time repeating multiple times > * at negative time zone offset transitions. >- * >+ * > * @return the behavior for handling repeating wall time, either > * <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>. > * @see #setRepeatedWallTimeOption >@@ -944,12 +946,12 @@ public: > * <p> > * <b>Note:</b>This option is effective only when this calendar is lenient. > * When the calendar is strict, such non-existing wall time will cause an error. >- * >+ * > * @param option the behavior for handling skipped wall time at positive time zone > * offset transitions, one of <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code> and > * <code>UCAL_WALLTIME_NEXT_VALID</code>. > * @see #getSkippedWallTimeOption >- * >+ * > * @stable ICU 49 > */ > void setSkippedWallTimeOption(UCalendarWallTimeOption option); >@@ -957,7 +959,7 @@ public: > /** > * Gets the behavior for handling skipped wall time at positive time zone offset > * transitions. >- * >+ * > * @return the behavior for handling skipped wall time, one of > * <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code> > * and <code>UCAL_WALLTIME_NEXT_VALID</code>. >@@ -1739,7 +1741,7 @@ protected: > * reflects local zone wall time. > * @internal > */ >- int32_t computeMillisInDay(); >+ double computeMillisInDay(); > > /** > * This method can assume EXTENDED_YEAR has been set. >@@ -1750,7 +1752,7 @@ protected: > * when this function fails. > * @internal > */ >- int32_t computeZoneOffset(double millis, int32_t millisInDay, UErrorCode &ec); >+ int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec); > > > /** >diff --git a/Source/WTF/icu/unicode/caniter.h b/Source/WTF/icu/unicode/caniter.h >index 3bd79f768e0b0577b0f23bd9d40bb3a4a3150222..5a882fb3fb8bcd621a7250f60a2137241ce43c7e 100644 >--- a/Source/WTF/icu/unicode/caniter.h >+++ b/Source/WTF/icu/unicode/caniter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 1996-2014, International Business Machines Corporation and >@@ -185,7 +187,7 @@ private: > UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) > > //Set getEquivalents2(String segment); >- Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status); >+ Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status); > //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); > > /** >@@ -194,7 +196,7 @@ private: > * If so, take the remainder, and return the equivalents > */ > //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); >- Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); >+ Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); > //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); > > void cleanPieces(); >diff --git a/Source/WTF/icu/unicode/chariter.h b/Source/WTF/icu/unicode/chariter.h >index e8d65090a40a6085951c73307f74acf83ba1bbc8..7a4e1a2f48760d7228cb067dd3f5b9f81f487f31 100644 >--- a/Source/WTF/icu/unicode/chariter.h >+++ b/Source/WTF/icu/unicode/chariter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************** > * >@@ -76,7 +78,7 @@ U_NAMESPACE_BEGIN > * } > * > * void function1(ForwardCharacterIterator &it) { >- * UChar c; >+ * char16_t c; > * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) { > * // use c > * } >@@ -147,7 +149,7 @@ public: > * @return the current code unit. > * @stable ICU 2.0 > */ >- virtual UChar nextPostInc(void) = 0; >+ virtual char16_t nextPostInc(void) = 0; > > /** > * Gets the current code point for returning and advances to the next code point >@@ -228,7 +230,7 @@ protected: > * showing a way to convert simple for() loops: > * \code > * void forward2(CharacterIterator &it) { >- * UChar c; >+ * char16_t c; > * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { > * // use c > * } >@@ -247,7 +249,7 @@ protected: > * Backward iteration with a more traditional for() loop: > * \code > * void backward2(CharacterIterator &it) { >- * UChar c; >+ * char16_t c; > * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { > * // use c > * } >@@ -264,7 +266,7 @@ protected: > * // get the position > * int32_t pos=it.getIndex(); > * // get the previous code unit >- * UChar u=it.previous(); >+ * char16_t u=it.previous(); > * // move back one more code unit > * it.move(-1, CharacterIterator::kCurrent); > * // set the position back to where it was >@@ -281,7 +283,7 @@ protected: > * Function processing characters, in this example simple output > * <pre> > * \code >- * void processChar( UChar c ) >+ * void processChar( char16_t c ) > * { > * cout << " " << c; > * } >@@ -292,7 +294,7 @@ protected: > * \code > * void traverseForward(CharacterIterator& iter) > * { >- * for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { >+ * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { > * processChar(c); > * } > * } >@@ -303,7 +305,7 @@ protected: > * \code > * void traverseBackward(CharacterIterator& iter) > * { >- * for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { >+ * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { > * processChar(c); > * } > * } >@@ -315,7 +317,7 @@ protected: > * \code > * void traverseOut(CharacterIterator& iter, int32_t pos) > * { >- * UChar c; >+ * char16_t c; > * for (c = iter.setIndex(pos); > * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); > * c = iter.next()) {} >@@ -384,7 +386,7 @@ public: > * @return the first code unit in its iteration range. > * @stable ICU 2.0 > */ >- virtual UChar first(void) = 0; >+ virtual char16_t first(void) = 0; > > /** > * Sets the iterator to refer to the first code unit in its >@@ -394,7 +396,7 @@ public: > * @return the first code unit in its iteration range. > * @stable ICU 2.0 > */ >- virtual UChar firstPostInc(void); >+ virtual char16_t firstPostInc(void); > > /** > * Sets the iterator to refer to the first code point in its >@@ -433,7 +435,7 @@ public: > * @return the last code unit. > * @stable ICU 2.0 > */ >- virtual UChar last(void) = 0; >+ virtual char16_t last(void) = 0; > > /** > * Sets the iterator to refer to the last code point in its >@@ -461,7 +463,7 @@ public: > * @return the "position"-th code unit. > * @stable ICU 2.0 > */ >- virtual UChar setIndex(int32_t position) = 0; >+ virtual char16_t setIndex(int32_t position) = 0; > > /** > * Sets the iterator to refer to the beginning of the code point >@@ -481,7 +483,7 @@ public: > * @return the current code unit. > * @stable ICU 2.0 > */ >- virtual UChar current(void) const = 0; >+ virtual char16_t current(void) const = 0; > > /** > * Returns the code point the iterator currently refers to. >@@ -497,7 +499,7 @@ public: > * @return the next code unit. > * @stable ICU 2.0 > */ >- virtual UChar next(void) = 0; >+ virtual char16_t next(void) = 0; > > /** > * Advances to the next code point in the iteration range >@@ -518,7 +520,7 @@ public: > * @return the previous code unit. > * @stable ICU 2.0 > */ >- virtual UChar previous(void) = 0; >+ virtual char16_t previous(void) = 0; > > /** > * Advances to the previous code point in the iteration range >@@ -605,6 +607,10 @@ public: > * @return the new position > * @stable ICU 2.0 > */ >+#ifdef move32 >+ // One of the system headers right now is sometimes defining a conflicting macro we don't use >+#undef move32 >+#endif > virtual int32_t move32(int32_t delta, EOrigin origin) = 0; > > /** >diff --git a/Source/WTF/icu/unicode/choicfmt.h b/Source/WTF/icu/unicode/choicfmt.h >index cfd520624dc53aec3ab8c1ad2fe147d003f07fc4..c9f0f1114f89edc41415d68caeef834027d4a245 100644 >--- a/Source/WTF/icu/unicode/choicfmt.h >+++ b/Source/WTF/icu/unicode/choicfmt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2013, International Business Machines >diff --git a/Source/WTF/icu/unicode/coleitr.h b/Source/WTF/icu/unicode/coleitr.h >index 8c5d0e94f58d4328f21dd331015a69c30dcf9406..f2bd2ecc621ac85dbd6813cc614306c1f6d55371 100644 >--- a/Source/WTF/icu/unicode/coleitr.h >+++ b/Source/WTF/icu/unicode/coleitr.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * Copyright (C) 1997-2014, International Business Machines >@@ -45,6 +47,7 @@ U_NAMESPACE_BEGIN > > struct CollationData; > >+class CharacterIterator; > class CollationIterator; > class RuleBasedCollator; > class UCollationPCE; >diff --git a/Source/WTF/icu/unicode/coll.h b/Source/WTF/icu/unicode/coll.h >index add6b5ba368f7b9d99ddd4a03f3619760c215831..d03570509ecebbdfbeb1ca215bd33703785e7f8e 100644 >--- a/Source/WTF/icu/unicode/coll.h >+++ b/Source/WTF/icu/unicode/coll.h >@@ -1,15 +1,17 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** >-* Copyright (C) 1996-2015, International Business Machines >+* Copyright (C) 1996-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ****************************************************************************** > */ > > /** >- * \file >+ * \file > * \brief C++ API: Collation Service. > */ >- >+ > /** > * File coll.h > * >@@ -56,7 +58,7 @@ > > #include "unicode/uobject.h" > #include "unicode/ucol.h" >-#include "unicode/normlzr.h" >+#include "unicode/unorm.h" > #include "unicode/locid.h" > #include "unicode/uniset.h" > #include "unicode/umisc.h" >@@ -156,7 +158,7 @@ class CollationKey; > * @see CollationKey > * @see CollationElementIterator > * @see Locale >-* @see Normalizer >+* @see Normalizer2 > * @version 2.0 11/15/01 > */ > >@@ -199,6 +201,9 @@ public: > IDENTICAL = UCOL_IDENTICAL // 15 > }; > >+ >+ // Cannot use #ifndef U_HIDE_DEPRECATED_API for the following, it is >+ // used by virtual methods that cannot have that conditional. > /** > * LESS is returned if source string is compared to be less than target > * string in the compare() method. >@@ -388,8 +393,8 @@ public: > * is less than, greater than or equal to another string array. > * <p>Example of use: > * <pre> >- * . UChar ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC" >- * . UChar abc[] = {0x61, 0x62, 0x63, 0}; // = "abc" >+ * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC" >+ * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc" > * . UErrorCode status = U_ZERO_ERROR; > * . Collator *myCollation = > * . Collator::createInstance(Locale::getUS(), status); >@@ -415,8 +420,8 @@ public: > * target > * @deprecated ICU 2.6 use the overload with UErrorCode & > */ >- virtual EComparisonResult compare(const UChar* source, int32_t sourceLength, >- const UChar* target, int32_t targetLength) >+ virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength, >+ const char16_t* target, int32_t targetLength) > const; > > /** >@@ -435,8 +440,8 @@ public: > * than target > * @stable ICU 2.6 > */ >- virtual UCollationResult compare(const UChar* source, int32_t sourceLength, >- const UChar* target, int32_t targetLength, >+ virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, >+ const char16_t* target, int32_t targetLength, > UErrorCode &status) const = 0; > > /** >@@ -479,7 +484,7 @@ public: > * generated sort keys. > * If the source string is null, a null collation key will be returned. > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source the source string to be transformed into a sort key. >@@ -501,7 +506,7 @@ public: > * generated sort keys. > * <p>If the source string is null, a null collation key will be returned. > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source the source string to be transformed into a sort key. >@@ -512,7 +517,7 @@ public: > * @see CollationKey#compare > * @stable ICU 2.0 > */ >- virtual CollationKey& getCollationKey(const UChar*source, >+ virtual CollationKey& getCollationKey(const char16_t*source, > int32_t sourceLength, > CollationKey& key, > UErrorCode& status) const = 0; >@@ -616,7 +621,7 @@ public: > * @see Collator#setReorderCodes > * @see UScriptCode > * @see UColReorderCode >- * @stable ICU 4.8 >+ * @stable ICU 4.8 > */ > virtual int32_t getReorderCodes(int32_t *dest, > int32_t destCapacity, >@@ -626,7 +631,7 @@ public: > * Sets the ordering of scripts for this collator. > * > * <p>The reordering codes are a combination of script codes and reorder codes. >- * @param reorderCodes An array of script codes in the new order. This can be NULL if the >+ * @param reorderCodes An array of script codes in the new order. This can be NULL if the > * length is also set to 0. An empty array will clear any reordering codes on the collator. > * @param reorderCodesLength The length of reorderCodes. > * @param status error code >@@ -635,7 +640,7 @@ public: > * @see Collator#getEquivalentReorderCodes > * @see UScriptCode > * @see UColReorderCode >- * @stable ICU 4.8 >+ * @stable ICU 4.8 > */ > virtual void setReorderCodes(const int32_t* reorderCodes, > int32_t reorderCodesLength, >@@ -647,11 +652,11 @@ public: > * Beginning with ICU 55, scripts only reorder together if they are primary-equal, > * for example Hiragana and Katakana. > * >- * @param reorderCode The reorder code to determine equivalence for. >+ * @param reorderCode The reorder code to determine equivalence for. > * @param dest The array to fill with the script equivalence reordering codes. >- * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the >+ * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the > * function will only return the length of the result without writing any codes (pre-flighting). >- * @param status A reference to an error code value, which must not indicate >+ * @param status A reference to an error code value, which must not indicate > * a failure before the function call. > * @return The length of the of the reordering code equivalence array. > * @see ucol_setReorderCodes >@@ -659,7 +664,7 @@ public: > * @see Collator#setReorderCodes > * @see UScriptCode > * @see UColReorderCode >- * @stable ICU 4.8 >+ * @stable ICU 4.8 > */ > static int32_t U_EXPORT2 getEquivalentReorderCodes(int32_t reorderCode, > int32_t* dest, >@@ -667,7 +672,7 @@ public: > UErrorCode& status); > > /** >- * Get name of the object for the desired Locale, in the desired langauge >+ * Get name of the object for the desired Locale, in the desired language > * @param objectLocale must be from getAvailableLocales > * @param displayLocale specifies the desired locale for output > * @param name the fill-in parameter of the return value >@@ -680,7 +685,7 @@ public: > UnicodeString& name); > > /** >- * Get name of the object for the desired Locale, in the langauge of the >+ * Get name of the object for the desired Locale, in the language of the > * default locale. > * @param objectLocale must be from getAvailableLocales > * @param name the fill-in parameter of the return value >@@ -906,7 +911,7 @@ public: > * the top of one of the supported reordering groups, > * and it must not be beyond the last of those groups. > * See setMaxVariable(). >- * @param varTop one or more (if contraction) UChars to which the variable top should be set >+ * @param varTop one or more (if contraction) char16_ts to which the variable top should be set > * @param len length of variable top string. If -1 it is considered to be zero terminated. > * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> > * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> >@@ -915,7 +920,7 @@ public: > * @return variable top primary weight > * @deprecated ICU 53 Call setMaxVariable() instead. > */ >- virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status) = 0; >+ virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0; > > /** > * Sets the variable top to the primary weight of the specified string. >@@ -924,7 +929,7 @@ public: > * the top of one of the supported reordering groups, > * and it must not be beyond the last of those groups. > * See setMaxVariable(). >- * @param varTop a UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set >+ * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set > * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> > * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> > * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond >@@ -981,7 +986,7 @@ public: > * Sort key byte arrays are zero-terminated and can be compared using > * strcmp(). > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source string to be processed. >@@ -997,11 +1002,11 @@ public: > int32_t resultLength) const = 0; > > /** >- * Get the sort key as an array of bytes from a UChar buffer. >+ * Get the sort key as an array of bytes from a char16_t buffer. > * Sort key byte arrays are zero-terminated and can be compared using > * strcmp(). > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source string to be processed. >@@ -1015,7 +1020,7 @@ public: > * @return Number of bytes needed for storing the sort key > * @stable ICU 2.2 > */ >- virtual int32_t getSortKey(const UChar*source, int32_t sourceLength, >+ virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength, > uint8_t*result, int32_t resultLength) const = 0; > > /** >@@ -1111,18 +1116,18 @@ public: > virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale); > > /** Get the short definition string for a collator. This internal API harvests the collator's >- * locale and the attribute set and produces a string that can be used for opening >+ * locale and the attribute set and produces a string that can be used for opening > * a collator with the same attributes using the ucol_openFromShortString API. > * This string will be normalized. > * The structure and the syntax of the string is defined in the "Naming collators" >- * section of the users guide: >+ * section of the users guide: > * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme > * This function supports preflighting. >- * >+ * > * This is internal, and intended to be used with delegate converters. > * > * @param locale a locale that will appear as a collators locale in the resulting >- * short string definition. If NULL, the locale will be harvested >+ * short string definition. If NULL, the locale will be harvested > * from the collator. > * @param buffer space to hold the resulting string > * @param capacity capacity of the buffer >diff --git a/Source/WTF/icu/unicode/compactdecimalformat.h b/Source/WTF/icu/unicode/compactdecimalformat.h >index bd8fdba8e8f23cbc9e7aa91ab2f75b9cebcfeb40..3fbe5da9cee4b23c44ae255fbb41afe01d36a41a 100644 >--- a/Source/WTF/icu/unicode/compactdecimalformat.h >+++ b/Source/WTF/icu/unicode/compactdecimalformat.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 2012-2014, International Business Machines >+* Copyright (C) 2012-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -121,6 +123,23 @@ public: > UnicodeString& appendTo, > FieldPosition& pos) const; > >+ /** >+ * Format a double or long number using base-10 representation. >+ * >+ * @param number The value to be formatted. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @param status >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(double number, >+ UnicodeString& appendTo, >+ FieldPosition& pos, >+ UErrorCode &status) const; >+ > /** > * Format a double or long number using base-10 representation. > * Currently sets status to U_UNSUPPORTED_ERROR. >@@ -140,6 +159,56 @@ public: > FieldPositionIterator* posIter, > UErrorCode& status) const; > >+ /** >+ * Format a long number using base-10 representation. >+ * >+ * @param number The value to be formatted. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @return Reference to 'appendTo' parameter. >+ * @stable ICU 56 >+ */ >+ virtual UnicodeString& format(int32_t number, >+ UnicodeString& appendTo, >+ FieldPosition& pos) const; >+ >+ /** >+ * Format a long number using base-10 representation. >+ * >+ * @param number The value to be formatted. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(int32_t number, >+ UnicodeString& appendTo, >+ FieldPosition& pos, >+ UErrorCode &status) const; >+ >+ /** >+ * Format a long number using base-10 representation. >+ * Currently sets status to U_UNSUPPORTED_ERROR >+ * >+ * @param number The value to be formatted. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param posIter On return, can be used to iterate over positions >+ * of fields generated by this format call. >+ * Can be NULL. >+ * @param status Output param filled with success/failure status. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(int32_t number, >+ UnicodeString& appendTo, >+ FieldPositionIterator* posIter, >+ UErrorCode& status) const; >+ > /** > * Format an int64 number using base-10 representation. > * >@@ -155,6 +224,22 @@ public: > UnicodeString& appendTo, > FieldPosition& pos) const; > >+ /** >+ * Format an int64 number using base-10 representation. >+ * >+ * @param number The value to be formatted. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(int64_t number, >+ UnicodeString& appendTo, >+ FieldPosition& pos, >+ UErrorCode &status) const; >+ > /** > * Format an int64 number using base-10 representation. > * Currently sets status to U_UNSUPPORTED_ERROR >@@ -190,7 +275,7 @@ public: > * @return Reference to 'appendTo' parameter. > * @internal > */ >- virtual UnicodeString& format(const StringPiece &number, >+ virtual UnicodeString& format(StringPiece number, > UnicodeString& appendTo, > FieldPositionIterator* posIter, > UErrorCode& status) const; >@@ -219,7 +304,7 @@ public: > * Format a decimal number. Currently sets status to U_UNSUPPORTED_ERROR. > * The number is a DigitList wrapper onto a floating point decimal number. > * The default implementation in NumberFormat converts the decimal number >- * to a double and formats that. >+ * to a double and formats that. > * > * @param number The number, a DigitList format Decimal Floating Point. > * @param appendTo Output parameter to receive result. >@@ -252,7 +337,7 @@ public: > * CompactDecimalFormat does not support parsing. This implementation > * sets status to U_UNSUPPORTED_ERROR > * >- * @param text Unused. >+ * @param text Unused. > * @param result Does not change. > * @param status Always set to U_UNSUPPORTED_ERROR. > * @stable ICU 51 >diff --git a/Source/WTF/icu/unicode/curramt.h b/Source/WTF/icu/unicode/curramt.h >index c33e6f1f8338bddb747d464ef7f58e5349ca15af..e321df861d251fd52176229faa449ae8bfb52e5c 100644 >--- a/Source/WTF/icu/unicode/curramt.h >+++ b/Source/WTF/icu/unicode/curramt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2004-2006, International Business Machines >@@ -44,7 +46,7 @@ class U_I18N_API CurrencyAmount: public Measure { > * is invalid, then this will be set to a failing value. > * @stable ICU 3.0 > */ >- CurrencyAmount(const Formattable& amount, const UChar* isoCode, >+ CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, > UErrorCode &ec); > > /** >@@ -57,7 +59,7 @@ class U_I18N_API CurrencyAmount: public Measure { > * then this will be set to a failing value. > * @stable ICU 3.0 > */ >- CurrencyAmount(double amount, const UChar* isoCode, >+ CurrencyAmount(double amount, ConstChar16Ptr isoCode, > UErrorCode &ec); > > /** >@@ -113,14 +115,14 @@ class U_I18N_API CurrencyAmount: public Measure { > * Return the ISO currency code of this object. > * @stable ICU 3.0 > */ >- inline const UChar* getISOCurrency() const; >+ inline const char16_t* getISOCurrency() const; > }; > > inline const CurrencyUnit& CurrencyAmount::getCurrency() const { > return (const CurrencyUnit&) getUnit(); > } > >-inline const UChar* CurrencyAmount::getISOCurrency() const { >+inline const char16_t* CurrencyAmount::getISOCurrency() const { > return getCurrency().getISOCurrency(); > } > >diff --git a/Source/WTF/icu/unicode/currpinf.h b/Source/WTF/icu/unicode/currpinf.h >index 9ade99a09e59ada3ccb6aca811a4cbc3d955973f..33c18b08f24c6639c237ed6c073029e8e42722f3 100644 >--- a/Source/WTF/icu/unicode/currpinf.h >+++ b/Source/WTF/icu/unicode/currpinf.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >- * Copyright (C) 2009-2011, International Business Machines Corporation and * >+ * Copyright (C) 2009-2015, International Business Machines Corporation and * > * others. All Rights Reserved. * > ******************************************************************************* > */ >@@ -191,6 +193,7 @@ public: > > private: > friend class DecimalFormat; >+ friend class DecimalFormatImpl; > > void initialize(const Locale& loc, UErrorCode& status); > >diff --git a/Source/WTF/icu/unicode/currunit.h b/Source/WTF/icu/unicode/currunit.h >index d79836bb7495264ebab19219c656cbc524adbcb7..5ad23b1f58a3a85c5208a9cbab2fb26c43cf27fa 100644 >--- a/Source/WTF/icu/unicode/currunit.h >+++ b/Source/WTF/icu/unicode/currunit.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2004-2014, International Business Machines >@@ -26,7 +28,7 @@ U_NAMESPACE_BEGIN > > /** > * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese >- * yen). This class is a thin wrapper over a UChar string that >+ * yen). This class is a thin wrapper over a char16_t string that > * subclasses MeasureUnit, for use with Measure and MeasureFormat. > * > * @author Alan Liu >@@ -34,6 +36,12 @@ U_NAMESPACE_BEGIN > */ > class U_I18N_API CurrencyUnit: public MeasureUnit { > public: >+ /** >+ * Default constructor. Initializes currency code to "XXX" (no currency). >+ * @draft ICU 60 >+ */ >+ CurrencyUnit(); >+ > /** > * Construct an object with the given ISO currency code. > * @param isoCode the 3-letter ISO 4217 currency code; must not be >@@ -42,7 +50,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit { > * then this will be set to a failing value. > * @stable ICU 3.0 > */ >- CurrencyUnit(const UChar* isoCode, UErrorCode &ec); >+ CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec); > > /** > * Copy constructor >@@ -50,6 +58,18 @@ class U_I18N_API CurrencyUnit: public MeasureUnit { > */ > CurrencyUnit(const CurrencyUnit& other); > >+#ifndef U_HIDE_DRAFT_API >+ /** >+ * Copy constructor from MeasureUnit. This constructor allows you to >+ * restore a CurrencyUnit that was sliced to MeasureUnit. >+ * >+ * @param measureUnit The MeasureUnit to copy from. >+ * @param ec Set to a failing value if the MeasureUnit is not a currency. >+ * @draft ICU 60 >+ */ >+ CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec); >+#endif /* U_HIDE_DRAFT_API */ >+ > /** > * Assignment operator > * @stable ICU 3.0 >@@ -91,16 +111,16 @@ class U_I18N_API CurrencyUnit: public MeasureUnit { > * Return the ISO currency code of this object. > * @stable ICU 3.0 > */ >- inline const UChar* getISOCurrency() const; >+ inline const char16_t* getISOCurrency() const; > > private: > /** > * The ISO 4217 code of this object. > */ >- UChar isoCode[4]; >+ char16_t isoCode[4]; > }; > >-inline const UChar* CurrencyUnit::getISOCurrency() const { >+inline const char16_t* CurrencyUnit::getISOCurrency() const { > return isoCode; > } > >diff --git a/Source/WTF/icu/unicode/datefmt.h b/Source/WTF/icu/unicode/datefmt.h >index 983f13635c5ac47b7f26d8fa77c6562d9695e07f..3da0797a09bddb8653161cb86a0dea19f9c7f72d 100644 >--- a/Source/WTF/icu/unicode/datefmt.h >+++ b/Source/WTF/icu/unicode/datefmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >- * Copyright (C) 1997-2015, International Business Machines >+ * Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -571,7 +573,20 @@ public: > EStyle timeStyle = kDefault, > const Locale& aLocale = Locale::getDefault()); > >-#ifndef U_HIDE_DRAFT_API >+#ifndef U_HIDE_INTERNAL_API >+ /** >+ * Returns the best pattern given a skeleton and locale. >+ * @param locale the locale >+ * @param skeleton the skeleton >+ * @param status ICU error returned here >+ * @return the best pattern. >+ * @internal For ICU use only. >+ */ >+ static UnicodeString getBestPattern( >+ const Locale &locale, >+ const UnicodeString &skeleton, >+ UErrorCode &status); >+#endif /* U_HIDE_INTERNAL_API */ > > /** > * Creates a date/time formatter for the given skeleton and >@@ -584,7 +599,7 @@ public: > * order for that locale. > * @param status Any error returned here. > * @return A date/time formatter which the caller owns. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static DateFormat* U_EXPORT2 createInstanceForSkeleton( > const UnicodeString& skeleton, >@@ -601,7 +616,7 @@ public: > * @param locale The given locale. > * @param status Any error returned here. > * @return A date/time formatter which the caller owns. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static DateFormat* U_EXPORT2 createInstanceForSkeleton( > const UnicodeString& skeleton, >@@ -620,7 +635,7 @@ public: > * @param locale The given locale. > * @param status Any error returned here. > * @return A date/time formatter which the caller owns. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static DateFormat* U_EXPORT2 createInstanceForSkeleton( > Calendar *calendarToAdopt, >@@ -628,42 +643,6 @@ public: > const Locale &locale, > UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >- >-#ifndef U_HIDE_INTERNAL_API >- >- /** >- * Creates a date/time formatter for the given skeleton and locale and >- * uses the given DateTimePatternGenerator to convert the skeleton to >- * a format pattern. As creating a DateTimePatternGenerator is >- * expensive, callers can supply it here (if they already have it) to save >- * this method from creating its own. >- * >- * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can >- * be in any order, and this method uses the provided >- * DateTimePatternGenerator to map the skeleton to a >- * pattern that includes appropriate separators with >- * the fields in the appropriate order. >- * @param locale The given locale. >- * @param dpng The user supplied DateTimePatternGenerator. dpng >- * must be created for the same locale as locale. >- * Moreover, the caller must not modify dpng between >- * creating it by locale and calling this method. >- * Although dpng is a non-const reference, the caller >- * must not regard it as an out or in-out parameter. >- * The only reason dpng is a non-const reference is >- * because its method, getBestPattern, which converts >- * a skeleton to a date format pattern is non-const. >- * @return A date/time formatter which the caller owns. >- * @internal For ICU use only >- */ >- static DateFormat* U_EXPORT2 internalCreateInstanceForSkeleton( >- const UnicodeString& skeleton, >- const Locale &locale, >- DateTimePatternGenerator &dpng, >- UErrorCode &status); >- >-#endif /* U_HIDE_INTERNAL_API */ > > /** > * Gets the set of locales for which DateFormats are installed. >@@ -887,6 +866,7 @@ protected: > > > private: >+ > /** > * Gets the date/time formatter with the given formatting styles for the > * given locale. >diff --git a/Source/WTF/icu/unicode/dbbi.h b/Source/WTF/icu/unicode/dbbi.h >index 7187c3c20f9823648e5f33f289e4157025cf4114..a2c3d7d75232e48d63b8e82031779d82208e53e8 100644 >--- a/Source/WTF/icu/unicode/dbbi.h >+++ b/Source/WTF/icu/unicode/dbbi.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2006,2013 IBM Corp. All rights reserved. >diff --git a/Source/WTF/icu/unicode/dcfmtsym.h b/Source/WTF/icu/unicode/dcfmtsym.h >index 46ef22241b31c58789465ee941b44036f51bcd9a..4dc6f950f294ca424a93e221720767280fa439ee 100644 >--- a/Source/WTF/icu/unicode/dcfmtsym.h >+++ b/Source/WTF/icu/unicode/dcfmtsym.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 1997-2015, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -32,7 +34,9 @@ > > #include "unicode/uobject.h" > #include "unicode/locid.h" >+#include "unicode/numsys.h" > #include "unicode/unum.h" >+#include "unicode/unistr.h" > > /** > * \file >@@ -163,12 +167,10 @@ public: > * @stable ICU 4.6 > */ > kNineDigitSymbol, >-#ifndef U_HIDE_DRAFT_API > /** Multiplication sign. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > kExponentMultiplicationSymbol, >-#endif /* U_HIDE_DRAFT_API */ > /** count symbol constants */ > kFormatSymbolCount = kNineDigitSymbol + 2 > }; >@@ -183,6 +185,26 @@ public: > */ > DecimalFormatSymbols(const Locale& locale, UErrorCode& status); > >+#ifndef U_HIDE_DRAFT_API >+ /** >+ * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols >+ * corresponding to the given NumberingSystem. >+ * >+ * This constructor behaves equivalently to the normal constructor called with a locale having a >+ * "numbers=xxxx" keyword specifying the numbering system by name. >+ * >+ * In this constructor, the NumberingSystem argument will be used even if the locale has its own >+ * "numbers=xxxx" keyword. >+ * >+ * @param locale The locale to get symbols for. >+ * @param ns The numbering system. >+ * @param status Input/output parameter, set to success or >+ * failure code upon return. >+ * @draft ICU 60 >+ */ >+ DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status); >+#endif /* U_HIDE_DRAFT_API */ >+ > /** > * Create a DecimalFormatSymbols object for the default locale. > * This constructor will not fail. If the resource file data is >@@ -345,8 +367,11 @@ private: > * @param success Input/output parameter, set to success or > * failure code upon return. > * @param useLastResortData determine if use last resort data >+ * @param ns The NumberingSystem to use; otherwise, fall >+ * back to the locale. > */ >- void initialize(const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE); >+ void initialize(const Locale& locale, UErrorCode& success, >+ UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr); > > /** > * Initialize the symbols with default values. >@@ -356,6 +381,23 @@ private: > void setCurrencyForSymbols(); > > public: >+ >+#ifndef U_HIDE_INTERNAL_API >+ /** >+ * @internal For ICU use only >+ */ >+ inline UBool isCustomCurrencySymbol() const { >+ return fIsCustomCurrencySymbol; >+ } >+ >+ /** >+ * @internal For ICU use only >+ */ >+ inline UBool isCustomIntlCurrencySymbol() const { >+ return fIsCustomIntlCurrencySymbol; >+ } >+#endif /* U_HIDE_INTERNAL_API */ >+ > /** > * _Internal_ function - more efficient version of getSymbol, > * returning a const reference to one of the symbol strings. >@@ -375,7 +417,7 @@ public: > * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API. > * @internal > */ >- inline const UChar* getCurrencyPattern(void) const; >+ inline const char16_t* getCurrencyPattern(void) const; > #endif /* U_HIDE_INTERNAL_API */ > > private: >@@ -406,10 +448,12 @@ private: > > char actualLocale[ULOC_FULLNAME_CAPACITY]; > char validLocale[ULOC_FULLNAME_CAPACITY]; >- const UChar* currPattern; >+ const char16_t* currPattern; > > UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT]; > UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT]; >+ UBool fIsCustomCurrencySymbol; >+ UBool fIsCustomIntlCurrencySymbol; > }; > > // ------------------------------------- >@@ -425,8 +469,7 @@ DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const { > return *strPtr; > } > >-//#ifndef U_HIDE_INTERNAL_API >-// See comments above for this function. Not hidden. >+// See comments above for this function. Not hidden with #ifndef U_HIDE_INTERNAL_API > inline const UnicodeString & > DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { > const UnicodeString *strPtr; >@@ -438,13 +481,16 @@ DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { > return *strPtr; > } > >-//#endif /* U_HIDE_INTERNAL_API */ >- >- > // ------------------------------------- > > inline void > DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits = TRUE) { >+ if (symbol == kCurrencySymbol) { >+ fIsCustomCurrencySymbol = TRUE; >+ } >+ else if (symbol == kIntlCurrencySymbol) { >+ fIsCustomIntlCurrencySymbol = TRUE; >+ } > if(symbol<kFormatSymbolCount) { > fSymbols[symbol]=value; > } >@@ -470,7 +516,7 @@ DecimalFormatSymbols::getLocale() const { > } > > #ifndef U_HIDE_INTERNAL_API >-inline const UChar* >+inline const char16_t* > DecimalFormatSymbols::getCurrencyPattern() const { > return currPattern; > } >diff --git a/Source/WTF/icu/unicode/decimfmt.h b/Source/WTF/icu/unicode/decimfmt.h >index 138855bf0853eeeff5684776bacf19030a4f6604..790053636d59573ff8c47f53ef706ab05094854e 100644 >--- a/Source/WTF/icu/unicode/decimfmt.h >+++ b/Source/WTF/icu/unicode/decimfmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 1997-2015, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -41,6 +43,7 @@ > #include "unicode/curramt.h" > #include "unicode/enumset.h" > >+#ifndef U_HIDE_INTERNAL_API > /** > * \def UNUM_DECIMALFORMAT_INTERNAL_SIZE > * @internal >@@ -48,17 +51,20 @@ > #if UCONFIG_FORMAT_FASTPATHS_49 > #define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16 > #endif >+#endif /* U_HIDE_INTERNAL_API */ > > U_NAMESPACE_BEGIN > > class DigitList; >-class ChoiceFormat; > class CurrencyPluralInfo; > class Hashtable; > class UnicodeSet; > class FieldPositionHandler; > class DecimalFormatStaticSets; > class FixedDecimal; >+class DecimalFormatImpl; >+class PluralRules; >+class VisibleDigitsWithExponent; > > // explicit template instantiation. see digitlst.h > #if defined (_MSC_VER) >@@ -598,7 +604,7 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute, > * including prefix and suffix, determines the format width. For example, in > * the pattern <code>"* #0 o''clock"</code>, the format width is 10. > * >- * <li>The width is counted in 16-bit code units (UChars). >+ * <li>The width is counted in 16-bit code units (char16_ts). > * > * <li>Some parameters which usually do not matter have meaning when padding is > * used, because the pattern width is significant with padding. In the pattern >@@ -662,28 +668,6 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute, > */ > class U_I18N_API DecimalFormat: public NumberFormat { > public: >- /** >- * Rounding mode. >- * @stable ICU 2.4 >- */ >- enum ERoundingMode { >- kRoundCeiling, /**< Round towards positive infinity */ >- kRoundFloor, /**< Round towards negative infinity */ >- kRoundDown, /**< Round towards zero */ >- kRoundUp, /**< Round away from zero */ >- kRoundHalfEven, /**< Round towards the nearest integer, or >- towards the nearest even integer if equidistant */ >- kRoundHalfDown, /**< Round towards the nearest integer, or >- towards zero if equidistant */ >- kRoundHalfUp, /**< Round towards the nearest integer, or >- away from zero if equidistant */ >- /** >- * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. >- * @stable ICU 4.8 >- */ >- kRoundUnnecessary >- }; >- > /** > * Pad position. > * @stable ICU 2.4 >@@ -803,7 +787,7 @@ public: > virtual int32_t getAttribute( UNumberFormatAttribute attr, > UErrorCode &status) const; > >- >+ > /** > * Set whether or not grouping will be used in this format. > * @param newValue True, grouping will be used in this format. >@@ -827,7 +811,7 @@ public: > * @param value The UDisplayContext value to set. > * @param status Input/output status. If at entry this indicates a failure > * status, the function will do nothing; otherwise this will be >- * updated with any new status from the function. >+ * updated with any new status from the function. > * @stable ICU 53 > */ > virtual void setContext(UDisplayContext value, UErrorCode& status); >@@ -964,7 +948,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(double number, > UnicodeString& appendTo, >@@ -1013,7 +997,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(int32_t number, > UnicodeString& appendTo, >@@ -1062,7 +1046,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(int64_t number, > UnicodeString& appendTo, >@@ -1083,9 +1067,9 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ >- virtual UnicodeString& format(const StringPiece &number, >+ virtual UnicodeString& format(StringPiece number, > UnicodeString& appendTo, > FieldPositionIterator* posIter, > UErrorCode& status) const; >@@ -1111,6 +1095,40 @@ public: > FieldPositionIterator* posIter, > UErrorCode& status) const; > >+ /** >+ * Format a decimal number. >+ * @param number The number >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @param status Output param filled with success/failure status. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format( >+ const VisibleDigitsWithExponent &number, >+ UnicodeString& appendTo, >+ FieldPosition& pos, >+ UErrorCode& status) const; >+ >+ /** >+ * Format a decimal number. >+ * @param number The number >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param posIter On return, can be used to iterate over positions >+ * of fields generated by this format call. >+ * @param status Output param filled with success/failure status. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format( >+ const VisibleDigitsWithExponent &number, >+ UnicodeString& appendTo, >+ FieldPositionIterator* posIter, >+ UErrorCode& status) const; >+ > /** > * Format a decimal number. > * The number is a DigitList wrapper onto a floating point decimal number. >@@ -1610,6 +1628,45 @@ public: > */ > virtual void setSecondaryGroupingSize(int32_t newValue); > >+#ifndef U_HIDE_INTERNAL_API >+ >+ /** >+ * Returns the minimum number of grouping digits. >+ * Grouping separators are output if there are at least this many >+ * digits to the left of the first (rightmost) grouping separator, >+ * that is, there are at least (minimum grouping + grouping size) integer digits. >+ * (Subject to isGroupingUsed().) >+ * >+ * For example, if this value is 2, and the grouping size is 3, then >+ * 9999 -> "9999" and 10000 -> "10,000" >+ * >+ * This is a technology preview. This API may change behavior or may be removed. >+ * >+ * The default value for this attribute is 0. >+ * A value of 1, 0, or lower, means that the use of grouping separators >+ * only depends on the grouping size (and on isGroupingUsed()). >+ * Currently, the corresponding CLDR data is not used; this is likely to change. >+ * >+ * @see setMinimumGroupingDigits >+ * @see getGroupingSize >+ * @internal technology preview >+ */ >+ int32_t getMinimumGroupingDigits() const; >+ >+#endif /* U_HIDE_INTERNAL_API */ >+ >+ /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following draft method since it is virtual. */ >+ /** >+ * Sets the minimum grouping digits. Setting to a value less than or >+ * equal to 1 turns off minimum grouping digits. >+ * >+ * @param newValue the new value of minimum grouping digits. >+ * @see getMinimumGroupingDigits >+ * @internal technology preview >+ */ >+ virtual void setMinimumGroupingDigits(int32_t newValue); >+ >+ > /** > * Allows you to get the behavior of the decimal separator with integers. > * (The decimal separator will always appear with decimals.) >@@ -1630,24 +1687,22 @@ public: > */ > virtual void setDecimalSeparatorAlwaysShown(UBool newValue); > >-#ifndef U_HIDE_DRAFT_API > /** > * Allows you to get the parse behavior of the pattern decimal mark. > * > * @return TRUE if input must contain a match to decimal mark in pattern >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UBool isDecimalPatternMatchRequired(void) const; >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Allows you to set the behavior of the pattern decimal mark. >- * >+ * > * if TRUE, the input must have a decimal mark if one was specified in the pattern. When > * FALSE the decimal mark may be omitted from the input. > * > * @param newValue set TRUE if input must contain a match to decimal mark in pattern >- * @draft ICU 54 >+ * @stable ICU 54 > */ > virtual void setDecimalPatternMatchRequired(UBool newValue); > >@@ -1884,41 +1939,37 @@ public: > * @param ec input-output error code > * @stable ICU 3.0 > */ >- virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); >+ virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); > > /** > * Sets the currency used to display currency amounts. See >- * setCurrency(const UChar*, UErrorCode&). >- * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&). >+ * setCurrency(const char16_t*, UErrorCode&). >+ * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&). > */ >- virtual void setCurrency(const UChar* theCurrency); >+ virtual void setCurrency(const char16_t* theCurrency); > >-#ifndef U_HIDE_DRAFT_API > /** > * Sets the <tt>Currency Context</tt> object used to display currency. > * This takes effect immediately, if this format is a >- * currency format. >- * @param currencyContext new currency context object to use. >- * @draft ICU 54 >+ * currency format. >+ * @param currencyContext new currency context object to use. >+ * @stable ICU 54 > */ > void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec); > > /** > * Returns the <tt>Currency Context</tt> object used to display currency >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UCurrencyUsage getCurrencyUsage() const; >-#endif /* U_HIDE_DRAFT_API */ > > >-#ifndef U_HIDE_DEPRECATED_API > /** > * The resource tags we use to retrieve decimal format data from > * locale resource bundles. > * @deprecated ICU 3.4. This string has no public purpose. Please don't use it. > */ > static const char fgNumberPatterns[]; >-#endif /* U_HIDE_DEPRECATED_API */ > > #ifndef U_HIDE_INTERNAL_API > /** >@@ -1944,6 +1995,41 @@ public: > * @internal > */ > FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const; >+ >+ /** >+ * Get a VisibleDigitsWithExponent corresponding to a double >+ * as it would be formatted by this DecimalFormat. >+ * Internal, not intended for public use. >+ * @internal >+ */ >+ VisibleDigitsWithExponent &initVisibleDigitsWithExponent( >+ double number, >+ VisibleDigitsWithExponent &digits, >+ UErrorCode &status) const; >+ >+ /** >+ * Get a VisibleDigitsWithExponent corresponding to a formattable >+ * as it would be formatted by this DecimalFormat. >+ * Internal, not intended for public use. >+ * @internal >+ */ >+ VisibleDigitsWithExponent &initVisibleDigitsWithExponent( >+ const Formattable &number, >+ VisibleDigitsWithExponent &digits, >+ UErrorCode &status) const; >+ >+ /** >+ * Get a VisibleDigitsWithExponent corresponding to a DigitList >+ * as it would be formatted by this DecimalFormat. >+ * Note: the DigitList may be modified. >+ * Internal, not intended for public use. >+ * @internal >+ */ >+ VisibleDigitsWithExponent &initVisibleDigitsWithExponent( >+ DigitList &number, >+ VisibleDigitsWithExponent &digits, >+ UErrorCode &status) const; >+ > #endif /* U_HIDE_INTERNAL_API */ > > public: >@@ -1978,8 +2064,6 @@ private: > > DecimalFormat(); // default constructor not implemented > >- int32_t precision() const; >- > /** > * Initialize all fields of a new DecimalFormatter to a safe default value. > * Common code for use by constructors. >@@ -1995,76 +2079,12 @@ private: > DecimalFormatSymbols* symbolsToAdopt = 0 > ); > >- /** >- * Does the real work of generating a pattern. >- * >- * @param result Output param which will receive the pattern. >- * Previous contents are deleted. >- * @param localized TRUE return localized pattern. >- * @return A reference to 'result'. >- */ >- UnicodeString& toPattern(UnicodeString& result, UBool localized) const; >- >- /** >- * Does the real work of applying a pattern. >- * @param pattern The pattern to be applied. >- * @param localized If true, the pattern is localized; else false. >- * @param parseError Struct to recieve information on position >- * of error if an error is encountered >- * @param status Output param set to success/failure code on >- * exit. If the pattern is invalid, this will be >- * set to a failure result. >- */ >- void applyPattern(const UnicodeString& pattern, >- UBool localized, >- UParseError& parseError, >- UErrorCode& status); >- >- /* >- * similar to applyPattern, but without re-gen affix for currency >- */ >- void applyPatternInternally(const UnicodeString& pluralCount, >- const UnicodeString& pattern, >- UBool localized, >- UParseError& parseError, >- UErrorCode& status); >- >- /* >- * only apply pattern without expand affixes >- */ >- void applyPatternWithoutExpandAffix(const UnicodeString& pattern, >- UBool localized, >- UParseError& parseError, >- UErrorCode& status); >- >- >- /* >- * expand affixes (after apply patter) and re-compute fFormatWidth >- */ >- void expandAffixAdjustWidth(const UnicodeString* pluralCount); >- >- >- /** >- * Do the work of formatting a number, either a double or a long. >- * >- * @param appendTo Output parameter to receive result. >- * Result is appended to existing contents. >- * @param handler Records information about field positions. >- * @param digits the digits to be formatted. >- * @param isInteger if TRUE format the digits as Integer. >- * @return Reference to 'appendTo' parameter. >- */ >- UnicodeString& subformat(UnicodeString& appendTo, >- FieldPositionHandler& handler, >- DigitList& digits, >- UBool isInteger, >- UErrorCode &status) const; >- >+ void handleCurrencySignInPattern(UErrorCode& status); > > void parse(const UnicodeString& text, > Formattable& result, > ParsePosition& pos, >- UChar* currency) const; >+ char16_t* currency) const; > > enum { > fgStatusInfinite, >@@ -2080,7 +2100,7 @@ private: > int8_t type, > ParsePosition& parsePosition, > DigitList& digits, UBool* status, >- UChar* currency) const; >+ char16_t* currency) const; > > // Mixed style parsing for currency. > // It parses against the current currency pattern >@@ -2091,7 +2111,7 @@ private: > ParsePosition& parsePosition, > DigitList& digits, > UBool* status, >- UChar* currency) const; >+ char16_t* currency) const; > > int32_t skipPadding(const UnicodeString& text, int32_t position) const; > >@@ -2102,7 +2122,7 @@ private: > const UnicodeString* affixPat, > UBool complexCurrencyParsing, > int8_t type, >- UChar* currency) const; >+ char16_t* currency) const; > > static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix); > >@@ -2125,7 +2145,7 @@ private: > const UnicodeString& input, > int32_t pos, > int8_t type, >- UChar* currency) const; >+ char16_t* currency) const; > > static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch); > >@@ -2144,231 +2164,45 @@ private: > UChar32 decimalChar, const UnicodeSet *decimalSet, > UChar32 schar); > >- /** >- * Get a decimal format symbol. >- * Returns a const reference to the symbol string. >- * @internal >- */ >- inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const; >- >- int32_t appendAffix(UnicodeString& buf, >- double number, >- FieldPositionHandler& handler, >- UBool isNegative, >- UBool isPrefix) const; >- >- /** >- * Append an affix to the given UnicodeString, using quotes if >- * there are special characters. Single quotes themselves must be >- * escaped in either case. >- */ >- void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix, >- UBool localized) const; >- >- void appendAffixPattern(UnicodeString& appendTo, >- const UnicodeString* affixPattern, >- const UnicodeString& expAffix, UBool localized) const; >- >- void expandAffix(const UnicodeString& pattern, >- UnicodeString& affix, >- double number, >- FieldPositionHandler& handler, >- UBool doFormat, >- const UnicodeString* pluralCount) const; >- >- void expandAffixes(const UnicodeString* pluralCount); >- >- void addPadding(UnicodeString& appendTo, >- FieldPositionHandler& handler, >- int32_t prefixLen, int32_t suffixLen) const; >- >- UBool isGroupingPosition(int32_t pos) const; >- >- void setCurrencyForSymbols(); >- >- // similar to setCurrency without re-compute the affixes for currency. >- // If currency changes, the affix pattern for currency is not changed, >- // but the affix will be changed. So, affixes need to be >- // re-computed in setCurrency(), but not in setCurrencyInternally(). >- virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec); >- > // set up currency affix patterns for mix parsing. > // The patterns saved here are the affix patterns of default currency > // pattern and the unique affix patterns of the plural currency patterns. > // Those patterns are used by parseForCurrency(). > void setupCurrencyAffixPatterns(UErrorCode& status); > >- // set up the currency affixes used in currency plural formatting. >- // It sets up both fAffixesForCurrency for currency pattern if the current >- // pattern contains 3 currency signs, >- // and it sets up fPluralAffixesForCurrency for currency plural patterns. >- void setupCurrencyAffixes(const UnicodeString& pattern, >- UBool setupForCurrentPattern, >- UBool setupForPluralPattern, >- UErrorCode& status); >- > // get the currency rounding with respect to currency usage >- double getCurrencyRounding(const UChar* currency, >+ double getCurrencyRounding(const char16_t* currency, > UErrorCode* ec) const; >- >+ > // get the currency fraction with respect to currency usage >- int getCurrencyFractionDigits(const UChar* currency, >+ int getCurrencyFractionDigits(const char16_t* currency, > UErrorCode* ec) const; > > // hashtable operations > Hashtable* initHashForAffixPattern(UErrorCode& status); >- Hashtable* initHashForAffix(UErrorCode& status); > > void deleteHashForAffixPattern(); >- void deleteHashForAffix(Hashtable*& table); > > void copyHashForAffixPattern(const Hashtable* source, > Hashtable* target, UErrorCode& status); >- void copyHashForAffix(const Hashtable* source, >- Hashtable* target, UErrorCode& status); >- >- UnicodeString& _format(int64_t number, >- UnicodeString& appendTo, >- FieldPositionHandler& handler, >- UErrorCode &status) const; >- UnicodeString& _format(double number, >- UnicodeString& appendTo, >- FieldPositionHandler& handler, >- UErrorCode &status) const; >- UnicodeString& _format(const DigitList &number, >- UnicodeString& appendTo, >- FieldPositionHandler& handler, >- UErrorCode &status) const; > >- /** >- * Constants. >- */ >- >- UnicodeString fPositivePrefix; >- UnicodeString fPositiveSuffix; >- UnicodeString fNegativePrefix; >- UnicodeString fNegativeSuffix; >- UnicodeString* fPosPrefixPattern; >- UnicodeString* fPosSuffixPattern; >- UnicodeString* fNegPrefixPattern; >- UnicodeString* fNegSuffixPattern; >+ DecimalFormatImpl *fImpl; > > /** >- * Formatter for ChoiceFormat-based currency names. If this field >- * is not null, then delegate to it to format currency symbols. >- * @since ICU 2.6 >+ * Constants. > */ >- ChoiceFormat* fCurrencyChoice; >- >- DigitList * fMultiplier; // NULL for multiplier of one >- int32_t fScale; >- int32_t fGroupingSize; >- int32_t fGroupingSize2; >- UBool fDecimalSeparatorAlwaysShown; >- DecimalFormatSymbols* fSymbols; > >- UBool fUseSignificantDigits; >- int32_t fMinSignificantDigits; >- int32_t fMaxSignificantDigits; >- >- UBool fUseExponentialNotation; >- int8_t fMinExponentDigits; >- UBool fExponentSignAlwaysShown; > > EnumSet<UNumberFormatAttribute, > UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, > UNUM_LIMIT_BOOLEAN_ATTRIBUTE> > fBoolFlags; > >- DigitList* fRoundingIncrement; // NULL if no rounding increment specified. >- ERoundingMode fRoundingMode; >- >- UChar32 fPad; >- int32_t fFormatWidth; >- EPadPosition fPadPosition; > >- /* >- * Following are used for currency format >- */ >- // pattern used in this formatter >- UnicodeString fFormatPattern; > // style is only valid when decimal formatter is constructed by > // DecimalFormat(pattern, decimalFormatSymbol, style) > int fStyle; >- /* >- * Represents whether this is a currency format, and which >- * currency format style. >- * 0: not currency format type; >- * 1: currency style -- symbol name, such as "$" for US dollar. >- * 2: currency style -- ISO name, such as USD for US dollar. >- * 3: currency style -- plural long name, such as "US Dollar" for >- * "1.00 US Dollar", or "US Dollars" for >- * "3.00 US Dollars". >- */ >- int fCurrencySignCount; >- >- >- /* For currency parsing purose, >- * Need to remember all prefix patterns and suffix patterns of >- * every currency format pattern, >- * including the pattern of default currecny style >- * and plural currency style. And the patterns are set through applyPattern. >- */ >- // TODO: innerclass? >- /* This is not needed in the class declaration, so it is moved into decimfmp.cpp >- struct AffixPatternsForCurrency : public UMemory { >- // negative prefix pattern >- UnicodeString negPrefixPatternForCurrency; >- // negative suffix pattern >- UnicodeString negSuffixPatternForCurrency; >- // positive prefix pattern >- UnicodeString posPrefixPatternForCurrency; >- // positive suffix pattern >- UnicodeString posSuffixPatternForCurrency; >- int8_t patternType; >- >- AffixPatternsForCurrency(const UnicodeString& negPrefix, >- const UnicodeString& negSuffix, >- const UnicodeString& posPrefix, >- const UnicodeString& posSuffix, >- int8_t type) { >- negPrefixPatternForCurrency = negPrefix; >- negSuffixPatternForCurrency = negSuffix; >- posPrefixPatternForCurrency = posPrefix; >- posSuffixPatternForCurrency = posSuffix; >- patternType = type; >- } >- }; >- */ > >- /* affix for currency formatting when the currency sign in the pattern >- * equals to 3, such as the pattern contains 3 currency sign or >- * the formatter style is currency plural format style. >- */ >- /* This is not needed in the class declaration, so it is moved into decimfmp.cpp >- struct AffixesForCurrency : public UMemory { >- // negative prefix >- UnicodeString negPrefixForCurrency; >- // negative suffix >- UnicodeString negSuffixForCurrency; >- // positive prefix >- UnicodeString posPrefixForCurrency; >- // positive suffix >- UnicodeString posSuffixForCurrency; >- >- int32_t formatWidth; >- >- AffixesForCurrency(const UnicodeString& negPrefix, >- const UnicodeString& negSuffix, >- const UnicodeString& posPrefix, >- const UnicodeString& posSuffix) { >- negPrefixForCurrency = negPrefix; >- negSuffixForCurrency = negSuffix; >- posPrefixForCurrency = posPrefix; >- posSuffixForCurrency = posSuffix; >- } >- }; >- */ > > // Affix pattern set for currency. > // It is a set of AffixPatternsForCurrency, >@@ -2385,16 +2219,6 @@ private: > // count match or not. > Hashtable* fAffixPatternsForCurrency; > >- // Following 2 are affixes for currency. >- // It is a hash map from plural count to AffixesForCurrency. >- // AffixesForCurrency saves the negative prefix, >- // negative suffix, positive prefix, and positive suffix of a pattern. >- // It is used during currency formatting only when the currency sign count >- // is 3. In which case, the affixes are getting from here, not >- // from the fNegativePrefix etc. >- Hashtable* fAffixesForCurrency; // for current pattern >- Hashtable* fPluralAffixesForCurrency; // for plural pattern >- > // Information needed for DecimalFormat to format/parse currency plural. > CurrencyPluralInfo* fCurrencyPluralInfo; > >@@ -2404,9 +2228,6 @@ private: > > // Decimal Format Static Sets singleton. > const DecimalFormatStaticSets *fStaticSets; >- >- // Currency Usage(STANDARD vs CASH) >- UCurrencyUsage fCurrencyUsage; > > protected: > >@@ -2426,7 +2247,7 @@ protected: > * have a capacity of at least 4 > * @internal > */ >- virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; >+ virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; > > /** number of integer digits > * @stable ICU 2.4 >@@ -2449,27 +2270,8 @@ protected: > */ > static const int32_t kMaxScientificIntegerDigits; > >-#if UCONFIG_FORMAT_FASTPATHS_49 >- private: >- /** >- * Internal state. >- * @internal >- */ >- uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE]; >- >- >- /** >- * Called whenever any state changes. Recomputes whether fastpath is OK to use. >- */ >- void handleChanged(); >-#endif > }; > >-inline const UnicodeString & >-DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const { >- return fSymbols->getConstSymbol(symbol); >-} >- > U_NAMESPACE_END > > #endif /* #if !UCONFIG_NO_FORMATTING */ >diff --git a/Source/WTF/icu/unicode/docmain.h b/Source/WTF/icu/unicode/docmain.h >index df3fe842aacf1ddeeb1ec77e1b2d40e3ae5f7576..636931cf25821bfae5c8cdbf3565bb548d6a3023 100644 >--- a/Source/WTF/icu/unicode/docmain.h >+++ b/Source/WTF/icu/unicode/docmain.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /******************************************************************** > * COPYRIGHT: > * Copyright (c) 1997-2012, International Business Machines Corporation and >@@ -96,6 +98,11 @@ > * <td>C API</td> > * </tr> > * <tr> >+ * <td>Codepage Detection</td> >+ * <td>ucsdet.h</td> >+ * <td>C API</td> >+ * </tr> >+ * <tr> > * <td>Unicode Text Compression</td> > * <td>ucnv.h<br/>(encoding name "SCSU" or "BOCU-1")</td> > * <td>C API</td> >@@ -133,7 +140,7 @@ > * <tr> > * <td>Number Formatting</td> > * <td>unum.h</td> >- * <td>icu::NumberFormat</td> >+ * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td> > * </tr> > * <tr> > * <td>Number Spellout<br/>(Rule Based Number Formatting)</td> >@@ -147,7 +154,7 @@ > * </tr> > * <tr> > * <td>Bidirectional Algorithm</td> >- * <td>ubidi.h</td> >+ * <td>ubidi.h, ubiditransform.h</td> > * <td>C API</td> > * </tr> > * <tr> >diff --git a/Source/WTF/icu/unicode/dtfmtsym.h b/Source/WTF/icu/unicode/dtfmtsym.h >index 78d0ceb5a909863cf7b19dc55bd8abe2c2caac02..fe914b461e6249f602e7ee511388836a804a2cdf 100644 >--- a/Source/WTF/icu/unicode/dtfmtsym.h >+++ b/Source/WTF/icu/unicode/dtfmtsym.h >@@ -1,6 +1,8 @@ >-/* >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html >+/* > ******************************************************************************** >-* Copyright (C) 1997-2015, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > * >@@ -14,22 +16,23 @@ > * Changed to match C++ conventions > ******************************************************************************** > */ >- >+ > #ifndef DTFMTSYM_H > #define DTFMTSYM_H >- >+ > #include "unicode/utypes.h" > > #if !UCONFIG_NO_FORMATTING > > #include "unicode/calendar.h" >+#include "unicode/strenum.h" > #include "unicode/uobject.h" > #include "unicode/locid.h" > #include "unicode/udat.h" > #include "unicode/ures.h" > > /** >- * \file >+ * \file > * \brief C++ API: Symbols for formatting dates. > */ > >@@ -115,7 +118,7 @@ public: > * data for the default locale, it will return a last-resort object > * based on hard-coded strings. > * >- * @param type Type of calendar (as returned by Calendar::getType). >+ * @param type Type of calendar (as returned by Calendar::getType). > * Will be used to access the correct set of strings. > * (NULL or empty string defaults to "gregorian".) > * @param status Status code. Failure >@@ -130,7 +133,7 @@ public: > * resources for the given locale, in the default calendar (Gregorian). > * > * @param locale Locale to load format data from. >- * @param type Type of calendar (as returned by Calendar::getType). >+ * @param type Type of calendar (as returned by Calendar::getType). > * Will be used to access the correct set of strings. > * (NULL or empty string defaults to "gregorian".) > * @param status Status code. Failure >@@ -270,9 +273,15 @@ public: > * @stable ICU 3.6 > */ > enum DtContextType { >- FORMAT, >- STANDALONE, >- DT_CONTEXT_COUNT >+ FORMAT, >+ STANDALONE, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal DtContextType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ DT_CONTEXT_COUNT >+#endif // U_HIDE_DEPRECATED_API > }; > > /** >@@ -280,17 +289,21 @@ public: > * @stable ICU 3.6 > */ > enum DtWidthType { >- ABBREVIATED, >- WIDE, >- NARROW, >- /** >- * Short width is currently only supported for weekday names. >- * @stable ICU 51 >- */ >- SHORT, >- /** >- */ >- DT_WIDTH_COUNT = 4 >+ ABBREVIATED, >+ WIDE, >+ NARROW, >+ /** >+ * Short width is currently only supported for weekday names. >+ * @stable ICU 51 >+ */ >+ SHORT, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal DtWidthType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ DT_WIDTH_COUNT = 4 >+#endif // U_HIDE_DEPRECATED_API > }; > > /** >@@ -414,33 +427,30 @@ public: > * doesn't specify any time separator, and always recognized when parsing. > * @internal > */ >- static const UChar DEFAULT_TIME_SEPARATOR = 0x003a; // ':' >+ static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':' > > /** > * This alternate time separator is always recognized when parsing. > * @internal > */ >- static const UChar ALTERNATE_TIME_SEPARATOR = 0x002e; // '.' >-#endif /* U_HIDE_INTERNAL_API */ >+ static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.' > >-#ifndef U_HIDE_DRAFT_API > /** > * Gets the time separator string. For example: ":". > * @param result Output param which will receive the time separator string. > * @return A reference to 'result'. >- * @draft ICU 55 >+ * @internal > */ > UnicodeString& getTimeSeparatorString(UnicodeString& result) const; > > /** > * Sets the time separator string. For example: ":". > * @param newTimeSeparator the new time separator string. >- * @draft ICU 55 >+ * @internal > */ > void setTimeSeparatorString(const UnicodeString& newTimeSeparator); >-#endif /* U_HIDE_DRAFT_API */ >+#endif /* U_HIDE_INTERNAL_API */ > >-#ifndef U_HIDE_DRAFT_API > /** > * Gets cyclic year name strings if the calendar has them, by width and context. > * For example: "jia-zi", "yi-chou", etc. >@@ -449,7 +459,7 @@ public: > * @param width The requested name width: WIDE, ABBREVIATED, NARROW. > * @return The year name strings (DateFormatSymbols retains ownership), > * or null if they are not available for this calendar. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > const UnicodeString* getYearNames(int32_t& count, > DtContextType context, DtWidthType width) const; >@@ -461,7 +471,7 @@ public: > * @param count The length of the array. > * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). > * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). >- * @draft ICU 54 >+ * @stable ICU 54 > */ > void setYearNames(const UnicodeString* yearNames, int32_t count, > DtContextType context, DtWidthType width); >@@ -474,7 +484,7 @@ public: > * @param width The requested name width: WIDE, ABBREVIATED, NARROW. > * @return The zodiac name strings (DateFormatSymbols retains ownership), > * or null if they are not available for this calendar. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > const UnicodeString* getZodiacNames(int32_t& count, > DtContextType context, DtWidthType width) const; >@@ -486,13 +496,11 @@ public: > * @param count The length of the array. > * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). > * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). >- * @draft ICU 54 >+ * @stable ICU 54 > */ > void setZodiacNames(const UnicodeString* zodiacNames, int32_t count, > DtContextType context, DtWidthType width); > >-#endif /* U_HIDE_DRAFT_API */ >- > #ifndef U_HIDE_INTERNAL_API > /** > * Somewhat temporary constants for leap month pattern types, adequate for supporting >@@ -559,7 +567,7 @@ public: > * @return the non-localized date-time pattern characters > * @stable ICU 2.0 > */ >- static const UChar * U_EXPORT2 getPatternUChars(void); >+ static const char16_t * U_EXPORT2 getPatternUChars(void); > > /** > * Gets localized date-time pattern characters. For example: 'u', 't', etc. >@@ -855,6 +863,42 @@ private: > */ > UBool fCapitalization[kCapContextUsageTypeCount][2]; > >+ /** >+ * Abbreviated (== short) day period strings. >+ */ >+ UnicodeString *fAbbreviatedDayPeriods; >+ int32_t fAbbreviatedDayPeriodsCount; >+ >+ /** >+ * Wide day period strings. >+ */ >+ UnicodeString *fWideDayPeriods; >+ int32_t fWideDayPeriodsCount; >+ >+ /** >+ * Narrow day period strings. >+ */ >+ UnicodeString *fNarrowDayPeriods; >+ int32_t fNarrowDayPeriodsCount; >+ >+ /** >+ * Stand-alone abbreviated (== short) day period strings. >+ */ >+ UnicodeString *fStandaloneAbbreviatedDayPeriods; >+ int32_t fStandaloneAbbreviatedDayPeriodsCount; >+ >+ /** >+ * Stand-alone wide day period strings. >+ */ >+ UnicodeString *fStandaloneWideDayPeriods; >+ int32_t fStandaloneWideDayPeriodsCount; >+ >+ /** >+ * Stand-alone narrow day period strings. >+ */ >+ UnicodeString *fStandaloneNarrowDayPeriods; >+ int32_t fStandaloneNarrowDayPeriodsCount; >+ > private: > /** valid/actual locale information > * these are always ICU locales, so the length should not be a problem >@@ -934,7 +978,7 @@ private: > * Returns the date format field index of the pattern character c, > * or UDAT_FIELD_COUNT if c is not a pattern character. > */ >- static UDateFormatField U_EXPORT2 getPatternCharIndex(UChar c); >+ static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c); > > /** > * Returns TRUE if f (with its pattern character repeated count times) is a numeric field. >@@ -944,7 +988,7 @@ private: > /** > * Returns TRUE if c (repeated count times) is the pattern character for a numeric field. > */ >- static UBool U_EXPORT2 isNumericPatternChar(UChar c, int32_t count); >+ static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count); > public: > #ifndef U_HIDE_INTERNAL_API > /** >diff --git a/Source/WTF/icu/unicode/dtintrv.h b/Source/WTF/icu/unicode/dtintrv.h >index 5bacce88446748e03e3b949d9bf5281ea85a5943..10b566a39a8be3b00ebfd9bd42f6dd8c8fd6ed41 100644 >--- a/Source/WTF/icu/unicode/dtintrv.h >+++ b/Source/WTF/icu/unicode/dtintrv.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2008-2009, International Business Machines Corporation and >diff --git a/Source/WTF/icu/unicode/dtitvfmt.h b/Source/WTF/icu/unicode/dtitvfmt.h >index fb27eec48158d2e8bbf1b7584f24c95d82bdd85f..5eaa559d0eaf48a416ecb03406af758f279010af 100644 >--- a/Source/WTF/icu/unicode/dtitvfmt.h >+++ b/Source/WTF/icu/unicode/dtitvfmt.h >@@ -1,5 +1,7 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /******************************************************************************** >-* Copyright (C) 2008-2013, International Business Machines Corporation and >+* Copyright (C) 2008-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > * >@@ -93,9 +95,11 @@ U_NAMESPACE_BEGIN > * > * <P> > * The calendar fields we support for interval formatting are: >- * year, month, date, day-of-week, am-pm, hour, hour-of-day, and minute. >+ * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, and second >+ * (though we do not currently have specific intervalFormat date for skeletons >+ * with seconds). > * Those calendar fields can be defined in the following order: >- * year > month > date > hour (in day) > minute >+ * year > month > date > hour (in day) > minute > second > * > * The largest different calendar fields between 2 calendars is the > * first different calendar field in above order. >@@ -387,6 +391,9 @@ public: > * Result is appended to existing contents. > * @param fieldPosition On input: an alignment field, if desired. > * On output: the offsets of the alignment field. >+ * There may be multiple instances of a given field type >+ * in an interval format; in this case the fieldPosition >+ * offsets refer to the first instance. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. > * @stable ICU 4.0 >@@ -406,6 +413,9 @@ public: > * Result is appended to existing contents. > * @param fieldPosition On input: an alignment field, if desired. > * On output: the offsets of the alignment field. >+ * There may be multiple instances of a given field type >+ * in an interval format; in this case the fieldPosition >+ * offsets refer to the first instance. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. > * @stable ICU 4.0 >@@ -430,6 +440,9 @@ public: > * Result is appended to existing contents. > * @param fieldPosition On input: an alignment field, if desired. > * On output: the offsets of the alignment field. >+ * There may be multiple instances of a given field type >+ * in an interval format; in this case the fieldPosition >+ * offsets refer to the first instance. > * @param status Output param filled with success/failure status. > * Caller needs to make sure it is SUCCESS > * at the function entrance >@@ -493,7 +506,13 @@ public: > > > /** >- * Gets the date formatter >+ * Gets the date formatter. The DateIntervalFormat instance continues to own >+ * the returned DateFormatter object, and will use and possibly modify it >+ * during format operations. In a multi-threaded environment, the returned >+ * DateFormat can only be used if it is certain that no other threads are >+ * concurrently using this DateIntervalFormatter, even for nominally const >+ * functions. >+ * > * @return the date formatter associated with this date interval formatter. > * @stable ICU 4.0 > */ >@@ -598,7 +617,7 @@ private: > > /** > * default constructor >- * @internal ICU 4.0 >+ * @internal (private) > */ > DateIntervalFormat(); > >@@ -642,27 +661,30 @@ private: > UErrorCode& status); > > /** >- * Create a simple date/time formatter from skeleton, given locale, >- * and date time pattern generator. >- * >- * @param skeleton the skeleton on which date format based. >- * @param locale the given locale. >- * @param dtpng the date time pattern generator. >- * @param status Output param to be set to success/failure code. >- * If it is failure, the returned date formatter will >- * be NULL. >- * @return a simple date formatter which the caller owns. >+ * Below are for generating interval patterns local to the formatter > */ >- static SimpleDateFormat* U_EXPORT2 createSDFPatternInstance( >- const UnicodeString& skeleton, >- const Locale& locale, >- DateTimePatternGenerator* dtpng, >- UErrorCode& status); >- > > /** >- * Below are for generating interval patterns local to the formatter >+ * Provide an updated FieldPosition posResult based on two formats, >+ * the FieldPosition values for each of them, and the pattern used >+ * to combine them. The idea is for posResult to indicate the first >+ * instance (if any) of the specified field in the combined result, >+ * with correct offsets. >+ * >+ * @param combiningPattern Pattern used to combine pat0 and pat1 >+ * @param pat0 Formatted date/time value to replace {0} >+ * @param pos0 FieldPosition within pat0 >+ * @param pat1 Formatted date/time value to replace {1} >+ * @param pos1 FieldPosition within pat1 >+ * @param posResult FieldPosition to be set to the correct >+ * position of the first field instance when >+ * pat0 and pat1 are combined using combiningPattern > */ >+ static void >+ adjustPosition(UnicodeString& combiningPattern, // has {0} and {1} in it >+ UnicodeString& pat0, FieldPosition& pos0, // pattern and pos corresponding to {0} >+ UnicodeString& pat1, FieldPosition& pos1, // pattern and pos corresponding to {1} >+ FieldPosition& posResult); > > > /** >@@ -671,19 +693,25 @@ private: > * The full pattern used in this fall-back format is the > * full pattern of the date formatter. > * >+ * gFormatterMutex must already be locked when calling this function. >+ * > * @param fromCalendar calendar set to the from date in date interval > * to be formatted into date interval string > * @param toCalendar calendar set to the to date in date interval > * to be formatted into date interval string >+ * @param fromToOnSameDay TRUE iff from and to dates are on the same day >+ * (any difference is in ampm/hours or below) > * @param appendTo Output parameter to receive result. > * Result is appended to existing contents. > * @param pos On input: an alignment field, if desired. > * On output: the offsets of the alignment field. > * @param status output param set to success/failure code on exit > * @return Reference to 'appendTo' parameter. >+ * @internal (private) > */ > UnicodeString& fallbackFormat(Calendar& fromCalendar, > Calendar& toCalendar, >+ UBool fromToOnSameDay, > UnicodeString& appendTo, > FieldPosition& pos, > UErrorCode& status) const; >@@ -874,13 +902,11 @@ private: > * both time and date. Present the date followed by > * the range expression for the time. > * @param format date and time format >- * @param formatLen format string length > * @param datePattern date pattern > * @param field time calendar field: AM_PM, HOUR, MINUTE > * @param status output param set to success/failure code on exit > */ >- void concatSingleDate2TimeInterval(const UChar* format, >- int32_t formatLen, >+ void concatSingleDate2TimeInterval(UnicodeString& format, > const UnicodeString& datePattern, > UCalendarDateFields field, > UErrorCode& status); >@@ -937,9 +963,40 @@ private: > const UnicodeString* secondPart, > UBool laterDateFirst); > >+ /** >+ * Format 2 Calendars to produce a string. >+ * Implementation of the similar public format function. >+ * Must be called with gFormatterMutex already locked. >+ * >+ * Note: "fromCalendar" and "toCalendar" are not const, >+ * since calendar is not const in SimpleDateFormat::format(Calendar&), >+ * >+ * @param fromCalendar calendar set to the from date in date interval >+ * to be formatted into date interval string >+ * @param toCalendar calendar set to the to date in date interval >+ * to be formatted into date interval string >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param fieldPosition On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * There may be multiple instances of a given field type >+ * in an interval format; in this case the fieldPosition >+ * offsets refer to the first instance. >+ * @param status Output param filled with success/failure status. >+ * Caller needs to make sure it is SUCCESS >+ * at the function entrance >+ * @return Reference to 'appendTo' parameter. >+ * @internal (private) >+ */ >+ UnicodeString& formatImpl(Calendar& fromCalendar, >+ Calendar& toCalendar, >+ UnicodeString& appendTo, >+ FieldPosition& fieldPosition, >+ UErrorCode& status) const ; >+ > > // from calendar field to pattern letter >- static const UChar fgCalendarFieldToPatternLetter[]; >+ static const char16_t fgCalendarFieldToPatternLetter[]; > > > /** >@@ -960,16 +1017,20 @@ private: > Calendar* fFromCalendar; > Calendar* fToCalendar; > >- /** >- * Date time pattern generator >- */ >- DateTimePatternGenerator* fDtpng; >+ Locale fLocale; > > /** >- * Following are interval information relavent (locale) to this formatter. >+ * Following are interval information relevant (locale) to this formatter. > */ > UnicodeString fSkeleton; > PatternInfo fIntervalPatterns[DateIntervalInfo::kIPI_MAX_INDEX]; >+ >+ /** >+ * Patterns for fallback formatting. >+ */ >+ UnicodeString* fDatePattern; >+ UnicodeString* fTimePattern; >+ UnicodeString* fDateTimeFormat; > }; > > inline UBool >diff --git a/Source/WTF/icu/unicode/dtitvinf.h b/Source/WTF/icu/unicode/dtitvinf.h >index 9f6674e70d192a3acde4a605b9b019b671dfe7eb..726e34a745a2ec30ba567b59efb37139f6f13d31 100644 >--- a/Source/WTF/icu/unicode/dtitvinf.h >+++ b/Source/WTF/icu/unicode/dtitvinf.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >- * Copyright (C) 2008-2014, International Business Machines Corporation and >+ * Copyright (C) 2008-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > * >@@ -49,22 +51,22 @@ U_NAMESPACE_BEGIN > * to (date_interval_pattern). > * > * <P> >- * A skeleton >+ * A skeleton > * <ol> > * <li> >- * only keeps the field pattern letter and ignores all other parts >+ * only keeps the field pattern letter and ignores all other parts > * in a pattern, such as space, punctuations, and string literals. > * <li> >- * hides the order of fields. >+ * hides the order of fields. > * <li> > * might hide a field's pattern letter length. > * >- * For those non-digit calendar fields, the pattern letter length is >- * important, such as MMM, MMMM, and MMMMM; EEE and EEEE, >+ * For those non-digit calendar fields, the pattern letter length is >+ * important, such as MMM, MMMM, and MMMMM; EEE and EEEE, > * and the field's pattern letter length is honored. >- * >- * For the digit calendar fields, such as M or MM, d or dd, yy or yyyy, >- * the field pattern length is ignored and the best match, which is defined >+ * >+ * For the digit calendar fields, such as M or MM, d or dd, yy or yyyy, >+ * the field pattern length is ignored and the best match, which is defined > * in date time patterns, will be returned without honor the field pattern > * letter length in skeleton. > * </ol> >@@ -73,21 +75,21 @@ U_NAMESPACE_BEGIN > * The calendar fields we support for interval formatting are: > * year, month, date, day-of-week, am-pm, hour, hour-of-day, and minute. > * Those calendar fields can be defined in the following order: >- * year > month > date > am-pm > hour > minute >- * >+ * year > month > date > am-pm > hour > minute >+ * > * The largest different calendar fields between 2 calendars is the > * first different calendar field in above order. > * >- * For example: the largest different calendar fields between "Jan 10, 2007" >+ * For example: the largest different calendar fields between "Jan 10, 2007" > * and "Feb 20, 2008" is year. >- * >+ * > * <P> > * There is a set of pre-defined static skeleton strings. > * There are pre-defined interval patterns for those pre-defined skeletons > * in locales' resource files. > * For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is "yMMMd", >- * in en_US, if the largest different calendar field between date1 and date2 >- * is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy", >+ * in en_US, if the largest different calendar field between date1 and date2 >+ * is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy", > * such as "Jan 10, 2007 - Jan 10, 2008". > * If the largest different calendar field between date1 and date2 is "month", > * the date interval pattern is "MMM d - MMM d, yyyy", >@@ -95,7 +97,7 @@ U_NAMESPACE_BEGIN > * If the largest different calendar field between date1 and date2 is "day", > * the date interval pattern is "MMM d-d, yyyy", such as "Jan 10-20, 2007". > * >- * For date skeleton, the interval patterns when year, or month, or date is >+ * For date skeleton, the interval patterns when year, or month, or date is > * different are defined in resource files. > * For time skeleton, the interval patterns when am/pm, or hour, or minute is > * different are defined in resource files. >@@ -108,56 +110,55 @@ U_NAMESPACE_BEGIN > * We use fallback format for the default order for the locale. > * For example, if the fallback format is "{0} - {1}", it means > * the first date in the interval pattern for this locale is earlier date. >- * If the fallback format is "{1} - {0}", it means the first date is the >+ * If the fallback format is "{1} - {0}", it means the first date is the > * later date. > * For a particular interval pattern, the default order can be overriden > * by prefixing "latestFirst:" or "earliestFirst:" to the interval pattern. > * For example, if the fallback format is "{0}-{1}", >- * but for skeleton "yMMMd", the interval pattern when day is different is >+ * but for skeleton "yMMMd", the interval pattern when day is different is > * "latestFirst:d-d MMM yy", it means by default, the first date in interval > * pattern is the earlier date. But for skeleton "yMMMd", when day is different, > * the first date in "d-d MMM yy" is the later date. >- * >+ * > * <P> >- * The recommended way to create a DateIntervalFormat object is to pass in >- * the locale. >- * By using a Locale parameter, the DateIntervalFormat object is >- * initialized with the pre-defined interval patterns for a given or >+ * The recommended way to create a DateIntervalFormat object is to pass in >+ * the locale. >+ * By using a Locale parameter, the DateIntervalFormat object is >+ * initialized with the pre-defined interval patterns for a given or > * default locale. > * <P> >- * Users can also create DateIntervalFormat object >+ * Users can also create DateIntervalFormat object > * by supplying their own interval patterns. > * It provides flexibility for power users. > * > * <P> > * After a DateIntervalInfo object is created, clients may modify > * the interval patterns using setIntervalPattern function as so desired. >- * Currently, users can only set interval patterns when the following >- * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, >+ * Currently, users can only set interval patterns when the following >+ * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, > * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, and MINUTE. > * Interval patterns when other calendar fields are different is not supported. > * <P> >- * DateIntervalInfo objects are cloneable. >- * When clients obtain a DateIntervalInfo object, >+ * DateIntervalInfo objects are cloneable. >+ * When clients obtain a DateIntervalInfo object, > * they can feel free to modify it as necessary. > * <P> >- * DateIntervalInfo are not expected to be subclassed. >- * Data for a calendar is loaded out of resource bundles. >+ * DateIntervalInfo are not expected to be subclassed. >+ * Data for a calendar is loaded out of resource bundles. > * Through ICU 4.4, date interval patterns are only supported in the Gregorian >- * calendar; non-Gregorian calendars are supported from ICU 4.4.1. >+ * calendar; non-Gregorian calendars are supported from ICU 4.4.1. > * @stable ICU 4.0 > **/ > > class U_I18N_API DateIntervalInfo U_FINAL : public UObject { > public: >-#ifndef U_HIDE_INTERNAL_API > /** > * Default constructor. > * It does not initialize any interval patterns except > * that it initialize default fall-back pattern as "{0} - {1}", > * which can be reset by setFallbackIntervalPattern(). >- * It should be followed by setFallbackIntervalPattern() and >- * setIntervalPattern(), >+ * It should be followed by setFallbackIntervalPattern() and >+ * setIntervalPattern(), > * and is recommended to be used only for power users who > * wants to create their own interval patterns and use them to create > * date interval formatter. >@@ -165,10 +166,9 @@ public: > * @internal ICU 4.0 > */ > DateIntervalInfo(UErrorCode& status); >-#endif /* U_HIDE_INTERNAL_API */ > > >- /** >+ /** > * Construct DateIntervalInfo for the given locale, > * @param locale the interval patterns are loaded from the appropriate calendar > * data (specified calendar or default calendar) in this locale. >@@ -226,7 +226,7 @@ public: > > > >- /** >+ /** > * Provides a way for client to build interval patterns. > * User could construct DateIntervalInfo by providing a list of skeletons > * and their patterns. >@@ -236,53 +236,53 @@ public: > * UErrorCode status = U_ZERO_ERROR; > * DateIntervalInfo dIntervalInfo = new DateIntervalInfo(); > * dIntervalInfo->setFallbackIntervalPattern("{0} ~ {1}"); >- * dIntervalInfo->setIntervalPattern("yMd", UCAL_YEAR, "'from' yyyy-M-d 'to' yyyy-M-d", status); >+ * dIntervalInfo->setIntervalPattern("yMd", UCAL_YEAR, "'from' yyyy-M-d 'to' yyyy-M-d", status); > * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_MONTH, "'from' yyyy MMM d 'to' MMM d", status); > * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_DAY, "yyyy MMM d-d", status, status); > * </pre> > * >- * Restriction: >- * Currently, users can only set interval patterns when the following >- * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, >+ * Restriction: >+ * Currently, users can only set interval patterns when the following >+ * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, > * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, and MINUTE. >- * Interval patterns when other calendar fields are different are >+ * Interval patterns when other calendar fields are different are > * not supported. > * > * @param skeleton the skeleton on which interval pattern based > * @param lrgDiffCalUnit the largest different calendar unit. > * @param intervalPattern the interval pattern on the largest different > * calendar unit. >- * For example, if lrgDiffCalUnit is >+ * For example, if lrgDiffCalUnit is > * "year", the interval pattern for en_US when year > * is different could be "'from' yyyy 'to' yyyy". > * @param status output param set to success/failure code on exit > * @stable ICU 4.0 > */ >- void setIntervalPattern(const UnicodeString& skeleton, >- UCalendarDateFields lrgDiffCalUnit, >+ void setIntervalPattern(const UnicodeString& skeleton, >+ UCalendarDateFields lrgDiffCalUnit, > const UnicodeString& intervalPattern, > UErrorCode& status); > > /** >- * Get the interval pattern given skeleton and >+ * Get the interval pattern given skeleton and > * the largest different calendar field. > * @param skeleton the skeleton > * @param field the largest different calendar field > * @param result output param to receive the pattern > * @param status output param set to success/failure code on exit > * @return a reference to 'result' >- * @stable ICU 4.0 >+ * @stable ICU 4.0 > */ > UnicodeString& getIntervalPattern(const UnicodeString& skeleton, > UCalendarDateFields field, > UnicodeString& result, >- UErrorCode& status) const; >+ UErrorCode& status) const; > > /** > * Get the fallback interval pattern. > * @param result output param to receive the pattern > * @return a reference to 'result' >- * @stable ICU 4.0 >+ * @stable ICU 4.0 > */ > UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const; > >@@ -298,7 +298,7 @@ public: > * > * @param fallbackPattern fall-back interval pattern. > * @param status output param set to success/failure code on exit >- * @stable ICU 4.0 >+ * @stable ICU 4.0 > */ > void setFallbackIntervalPattern(const UnicodeString& fallbackPattern, > UErrorCode& status); >@@ -308,7 +308,7 @@ public: > or not. > * return default date ordering in interval pattern. TRUE if the first date > * in pattern is later date, FALSE otherwise. >- * @stable ICU 4.0 >+ * @stable ICU 4.0 > */ > UBool getDefaultOrder() const; > >@@ -339,6 +339,11 @@ private: > */ > friend class DateIntervalFormat; > >+ /** >+ * Internal struct used to load resource bundle data. >+ */ >+ struct DateIntervalSink; >+ > /** > * Following is for saving the interval patterns. > * We only support interval patterns on >@@ -353,13 +358,14 @@ private: > kIPI_AM_PM, > kIPI_HOUR, > kIPI_MINUTE, >+ kIPI_SECOND, > kIPI_MAX_INDEX > }; > public: > #ifndef U_HIDE_INTERNAL_API > /** > * Max index for stored interval patterns >- * @internal ICU 4.4 >+ * @internal ICU 4.4 > */ > enum { > kMaxIntervalPatternIndex = kIPI_MAX_INDEX >@@ -368,7 +374,7 @@ public: > private: > > >- /** >+ /** > * Initialize the DateIntervalInfo from locale > * @param locale the given locale. > * @param status output param set to success/failure code on exit >@@ -389,10 +395,10 @@ private: > void setIntervalPatternInternally(const UnicodeString& skeleton, > UCalendarDateFields lrgDiffCalUnit, > const UnicodeString& intervalPattern, >- UErrorCode& status); >+ UErrorCode& status); > > >- /**given an input skeleton, get the best match skeleton >+ /**given an input skeleton, get the best match skeleton > * which has pre-defined interval pattern in resource file. > * Also return the difference between the input skeleton > * and the best match skeleton. >@@ -403,7 +409,7 @@ private: > * @param bestMatchDistanceInfo the difference between input skeleton > * and best match skeleton. > * 0, if there is exact match for input skeleton >- * 1, if there is only field width difference between >+ * 1, if there is only field width difference between > * the best match and the input skeleton > * 2, the only field difference is 'v' and 'z' > * -1, if there is calendar field difference between >@@ -421,7 +427,7 @@ private: > * @param skeleton skeleton to be parsed > * @param skeletonFieldWidth parsed skeleton field width > */ >- static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton, >+ static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton, > int32_t* skeletonFieldWidth); > > >@@ -441,12 +447,12 @@ private: > char patternLetter); > > >- /** >- * Convert calendar field to the interval pattern index in >+ /** >+ * Convert calendar field to the interval pattern index in > * hash table. > * >- * Since we only support the following calendar fields: >- * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK, >+ * Since we only support the following calendar fields: >+ * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK, > * AM_PM, HOUR, HOUR_OF_DAY, and MINUTE, > * We reserve only 4 interval patterns for a skeleton. > * >@@ -488,7 +494,7 @@ private: > > > // data members >- // fallback interval pattern >+ // fallback interval pattern > UnicodeString fFallbackIntervalPattern; > // default order > UBool fFirstDateInPtnIsLaterDate; >diff --git a/Source/WTF/icu/unicode/dtptngen.h b/Source/WTF/icu/unicode/dtptngen.h >index 1907935b337e3203847c630faf560d2201555fb6..5712edbb9ff60721a298c35f45ac521b49399720 100644 >--- a/Source/WTF/icu/unicode/dtptngen.h >+++ b/Source/WTF/icu/unicode/dtptngen.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2007-2015, International Business Machines Corporation and >+* Copyright (C) 2007-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > * >@@ -16,6 +18,7 @@ > #include "unicode/locid.h" > #include "unicode/udat.h" > #include "unicode/udatpg.h" >+#include "unicode/unistr.h" > > U_NAMESPACE_BEGIN > >@@ -25,6 +28,7 @@ U_NAMESPACE_BEGIN > */ > > >+class CharString; > class Hashtable; > class FormatParser; > class DateTimeMatcher; >@@ -34,15 +38,15 @@ class PtnSkeleton; > class SharedDateTimePatternGenerator; > > /** >- * This class provides flexible generation of date format patterns, like "yy-MM-dd". >- * The user can build up the generator by adding successive patterns. Once that >+ * This class provides flexible generation of date format patterns, like "yy-MM-dd". >+ * The user can build up the generator by adding successive patterns. Once that > * is done, a query can be made using a "skeleton", which is a pattern which just >- * includes the desired fields and lengths. The generator will return the "best fit" >+ * includes the desired fields and lengths. The generator will return the "best fit" > * pattern corresponding to that skeleton. > * <p>The main method people will use is getBestPattern(String skeleton), >- * since normally this class is pre-built with data from a particular locale. >+ * since normally this class is pre-built with data from a particular locale. > * However, generators can be built directly from other data as well. >- * <p><i>Issue: may be useful to also have a function that returns the list of >+ * <p><i>Issue: may be useful to also have a function that returns the list of > * fields in a pattern, in order, since we have that internally. > * That would be useful for getting the UI order of field elements.</i> > * @stable ICU 3.8 >@@ -84,7 +88,7 @@ public: > * @stable ICU 3.8 > */ > static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status); >- >+ > /** > * Destructor. > * @stable ICU 3.8 >@@ -92,7 +96,7 @@ public: > virtual ~DateTimePatternGenerator(); > > /** >- * Clone DateTimePatternGenerator object. Clients are responsible for >+ * Clone DateTimePatternGenerator object. Clients are responsible for > * deleting the DateTimePatternGenerator object cloned. > * @stable ICU 3.8 > */ >@@ -106,7 +110,7 @@ public: > * @stable ICU 3.8 > */ > UBool operator==(const DateTimePatternGenerator& other) const; >- >+ > /** > * Return true if another object is semantically unequal to this one. > * >@@ -124,9 +128,28 @@ public: > * @param status Output param set to success/failure code on exit, > * which must not indicate a failure before the function call. > * @return skeleton such as "MMMdd" >+ * @stable ICU 56 >+ */ >+ static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorCode& status); >+ >+ /** >+ * Utility to return a unique skeleton from a given pattern. For example, >+ * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". >+ * getSkeleton() works exactly like staticGetSkeleton(). >+ * Use staticGetSkeleton() instead of getSkeleton(). >+ * >+ * @param pattern Input pattern, such as "dd/MMM" >+ * @param status Output param set to success/failure code on exit, >+ * which must not indicate a failure before the function call. >+ * @return skeleton such as "MMMdd" > * @stable ICU 3.8 > */ >- UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); >+ UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); /* { >+ The function is commented out because it is a stable API calling a draft API. >+ After staticGetSkeleton becomes stable, staticGetSkeleton can be used and >+ these comments and the definition of getSkeleton in dtptngen.cpp should be removed. >+ return staticGetSkeleton(pattern, status); >+ }*/ > > /** > * Utility to return a unique base skeleton from a given pattern. This is >@@ -138,38 +161,60 @@ public: > * @param pattern Input pattern, such as "dd/MMM" > * @param status Output param set to success/failure code on exit, > * which must not indicate a failure before the function call. >- * @return base skeleton, such as "Md" >+ * @return base skeleton, such as "MMMd" >+ * @stable ICU 56 >+ */ >+ static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); >+ >+ /** >+ * Utility to return a unique base skeleton from a given pattern. This is >+ * the same as the skeleton, except that differences in length are minimized >+ * so as to only preserve the difference between string and numeric form. So >+ * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" >+ * (notice the single d). >+ * getBaseSkeleton() works exactly like staticGetBaseSkeleton(). >+ * Use staticGetBaseSkeleton() instead of getBaseSkeleton(). >+ * >+ * @param pattern Input pattern, such as "dd/MMM" >+ * @param status Output param set to success/failure code on exit, >+ * which must not indicate a failure before the function call. >+ * @return base skeleton, such as "MMMd" > * @stable ICU 3.8 > */ >- UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); >+ UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); /* { >+ The function is commented out because it is a stable API calling a draft API. >+ After staticGetBaseSkeleton becomes stable, staticGetBaseSkeleton can be used and >+ these comments and the definition of getBaseSkeleton in dtptngen.cpp should be removed. >+ return staticGetBaseSkeleton(pattern, status); >+ }*/ > > /** > * Adds a pattern to the generator. If the pattern has the same skeleton as > * an existing pattern, and the override parameter is set, then the previous > * value is overriden. Otherwise, the previous value is retained. In either >- * case, the conflicting status is set and previous vale is stored in >+ * case, the conflicting status is set and previous vale is stored in > * conflicting pattern. > * <p> > * Note that single-field patterns (like "MMM") are automatically added, and > * don't need to be added explicitly! > * > * @param pattern Input pattern, such as "dd/MMM" >- * @param override When existing values are to be overridden use true, >+ * @param override When existing values are to be overridden use true, > * otherwise use false. > * @param conflictingPattern Previous pattern with the same skeleton. > * @param status Output param set to success/failure code on exit, > * which must not indicate a failure before the function call. >- * @return conflicting status. The value could be UDATPG_NO_CONFLICT, >+ * @return conflicting status. The value could be UDATPG_NO_CONFLICT, > * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT. > * @stable ICU 3.8 >- * <p> >- * <h4>Sample code</h4> >- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >- * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample >- * <p> >- */ >- UDateTimePatternConflict addPattern(const UnicodeString& pattern, >- UBool override, >+ * <p> >+ * <h4>Sample code</h4> >+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >+ * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample >+ * <p> >+ */ >+ UDateTimePatternConflict addPattern(const UnicodeString& pattern, >+ UBool override, > UnicodeString& conflictingPattern, > UErrorCode& status); > >@@ -268,11 +313,11 @@ public: > * @return bestPattern > * The best pattern found from the given skeleton. > * @stable ICU 3.8 >- * <p> >- * <h4>Sample code</h4> >- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample >- * <p> >+ * <p> >+ * <h4>Sample code</h4> >+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample >+ * <p> > */ > UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status); > >@@ -316,14 +361,14 @@ public: > * which must not indicate a failure before the function call. > * @return pattern adjusted to match the skeleton fields widths and subtypes. > * @stable ICU 3.8 >- * <p> >- * <h4>Sample code</h4> >- * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >- * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample >- * <p> >- */ >- UnicodeString replaceFieldTypes(const UnicodeString& pattern, >- const UnicodeString& skeleton, >+ * <p> >+ * <h4>Sample code</h4> >+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 >+ * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample >+ * <p> >+ */ >+ UnicodeString replaceFieldTypes(const UnicodeString& pattern, >+ const UnicodeString& skeleton, > UErrorCode& status); > > /** >@@ -348,8 +393,8 @@ public: > * @return pattern adjusted to match the skeleton fields widths and subtypes. > * @stable ICU 4.4 > */ >- UnicodeString replaceFieldTypes(const UnicodeString& pattern, >- const UnicodeString& skeleton, >+ UnicodeString replaceFieldTypes(const UnicodeString& pattern, >+ const UnicodeString& skeleton, > UDateTimePatternMatchOptions options, > UErrorCode& status); > >@@ -368,12 +413,12 @@ public: > > /** > * Get the pattern corresponding to a given skeleton. >- * @param skeleton >+ * @param skeleton > * @return pattern corresponding to a given skeleton. > * @stable ICU 3.8 > */ > const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const; >- >+ > /** > * Return a list of all the base skeletons (in canonical form) from this class. > * >@@ -387,11 +432,11 @@ public: > > #ifndef U_HIDE_INTERNAL_API > /** >- * Return a list of redundant patterns are those which if removed, make no >- * difference in the resulting getBestPattern values. This method returns a >- * list of them, to help check the consistency of the patterns used to build >+ * Return a list of redundant patterns are those which if removed, make no >+ * difference in the resulting getBestPattern values. This method returns a >+ * list of them, to help check the consistency of the patterns used to build > * this generator. >- * >+ * > * @param status Output param set to success/failure code on exit, > * which must not indicate a failure before the function call. > * @return a StringEnumeration with the redundant pattern. >@@ -409,7 +454,7 @@ public: > * the decimal string is ",". Then the resulting pattern is modified to be > * "H:mm:ss,SSSS" > * >- * @param decimal >+ * @param decimal > * @stable ICU 3.8 > */ > void setDecimal(const UnicodeString& decimal); >@@ -473,21 +518,25 @@ private: > UnicodeString decimal; > DateTimeMatcher *skipMatcher; > Hashtable *fAvailableFormatKeyHash; >- UnicodeString hackPattern; > UnicodeString emptyString; >- UChar fDefaultHourFormatChar; >- >+ char16_t fDefaultHourFormatChar; >+ >+ int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN. >+ > /* internal flags masks for adjustFieldTypes etc. */ > enum { > kDTPGNoFlags = 0, > kDTPGFixFractionalSeconds = 1, > kDTPGSkeletonUsesCapJ = 2 >+ // with #13183, no longer need flags for b, B > }; > > void initData(const Locale &locale, UErrorCode &status); >- void addCanonicalItems(); >+ void addCanonicalItems(UErrorCode &status); > void addICUPatterns(const Locale& locale, UErrorCode& status); > void hackTimes(const UnicodeString& hackPattern, UErrorCode& status); >+ void getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err); >+ void consumeShortTimePattern(const UnicodeString& shortTimePattern, UErrorCode& status); > void addCLDRData(const Locale& locale, UErrorCode& status); > UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status); > void initHashtable(UErrorCode& status); >@@ -495,7 +544,9 @@ private: > void setDecimalSymbols(const Locale& locale, UErrorCode& status); > UDateTimePatternField getAppendFormatNumber(const char* field) const; > UDateTimePatternField getAppendNameNumber(const char* field) const; >+ UnicodeString& getMutableAppendItemName(UDateTimePatternField field); > void getAppendName(UDateTimePatternField field, UnicodeString& value); >+ UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status); > int32_t getCanonicalIndex(const UnicodeString& field); > const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0); > UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); >@@ -505,6 +556,12 @@ private: > UBool isAvailableFormatSet(const UnicodeString &key) const; > void copyHashtable(Hashtable *other, UErrorCode &status); > UBool isCanonicalItem(const UnicodeString& item) const; >+ static void U_CALLCONV loadAllowedHourFormatsData(UErrorCode &status); >+ void getAllowedHourFormats(const Locale &locale, UErrorCode &status); >+ >+ struct AppendItemFormatsSink; >+ struct AppendItemNamesSink; >+ struct AvailableFormatsSink; > } ;// end class DateTimePatternGenerator > > U_NAMESPACE_END >diff --git a/Source/WTF/icu/unicode/dtrule.h b/Source/WTF/icu/unicode/dtrule.h >index cb526a152ce30fcfb39cbb34f277aefa29e6230d..07672491a67342cb370eebd163d4f83747179382 100644 >--- a/Source/WTF/icu/unicode/dtrule.h >+++ b/Source/WTF/icu/unicode/dtrule.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2008, International Business Machines Corporation and * >diff --git a/Source/WTF/icu/unicode/enumset.h b/Source/WTF/icu/unicode/enumset.h >index 5106c37177111943b927c37948bdfce52c76c209..f63dd1622e20c4a5778080c51be9bca533e05f5e 100644 >--- a/Source/WTF/icu/unicode/enumset.h >+++ b/Source/WTF/icu/unicode/enumset.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >diff --git a/Source/WTF/icu/unicode/errorcode.h b/Source/WTF/icu/unicode/errorcode.h >index 3b601810d7b12fc5895ebf7689232985236b6d92..81cad2074523c21bdbc18e72d5e7d549a3bf9aa7 100644 >--- a/Source/WTF/icu/unicode/errorcode.h >+++ b/Source/WTF/icu/unicode/errorcode.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: errorcode.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/fieldpos.h b/Source/WTF/icu/unicode/fieldpos.h >index 38a9576e782a93ec642333bfbb9870da7794db91..0bcc8daa0f73e117347ce4db8615abec3a8f8bd6 100644 >--- a/Source/WTF/icu/unicode/fieldpos.h >+++ b/Source/WTF/icu/unicode/fieldpos.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2006, International Business Machines >@@ -56,7 +58,7 @@ U_NAMESPACE_BEGIN > * to perform partial formatting or to get information about the > * formatted output (such as the position of a field). > * >- * The FieldPosition class is not suitable for subclassing. >+ * The FieldPosition class is not intended for public subclassing. > * > * <p> > * Below is an example of using <code>FieldPosition</code> to aid >@@ -107,7 +109,8 @@ class U_I18N_API FieldPosition : public UObject { > public: > /** > * DONT_CARE may be specified as the field to indicate that the >- * caller doesn't need to specify a field. Do not subclass. >+ * caller doesn't need to specify a field. >+ * @stable ICU 2.0 > */ > enum { DONT_CARE = -1 }; > >diff --git a/Source/WTF/icu/unicode/filteredbrk.h b/Source/WTF/icu/unicode/filteredbrk.h >index 1412418be50bbaa4c5a642f78f5fd07b1b4d6dfe..a0319bf0a76af523ff4ec556d855ff706369f2a2 100644 >--- a/Source/WTF/icu/unicode/filteredbrk.h >+++ b/Source/WTF/icu/unicode/filteredbrk.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 1997-2014, International Business Machines >+* Copyright (C) 1997-2015, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************** > */ >@@ -12,7 +14,6 @@ > #include "unicode/brkiter.h" > > #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION >-#ifndef U_HIDE_INTERNAL_API > > U_NAMESPACE_BEGIN > >@@ -30,25 +31,13 @@ U_NAMESPACE_BEGIN > * but with "Mr." as an exception, a filtered break iterator > * would consider the string "Mr. Smith" to be a single segment. > * >- * <p><b>Note:</b> An instance of {@link BreakIterator} returned by this builder >- * class currently does not support following operations in this technology preview >- * version: >- * <ul> >- * <li>{@link BreakIterator#next(int32_t) next(int32_t n)}</li> >- * <li>{@link BreakIterator#previous(void) previous(void)}</li> >- * <li>{@link BreakIterator#following(int32_t) following(int32_t offset)}</li> >- * <li>{@link BreakIterator#preceding(int32_t) preceding(int32_t offset)}</li> >- * </ul> >- * When one of above methods is called, BreakIterator.DONE will be returned immediately >- * without updating the internal state. >- * >- * @internal technology preview >+ * @stable ICU 56 > */ >-class U_I18N_API FilteredBreakIteratorBuilder : public UObject { >+class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { > public: > /** > * destructor. >- * @internal technology preview >+ * @stable ICU 56 > */ > virtual ~FilteredBreakIteratorBuilder(); > >@@ -62,18 +51,34 @@ class U_I18N_API FilteredBreakIteratorBuilder : public UObject { > * @param where the locale. > * @param status The error code. > * @return the new builder >- * @internal technology preview >+ * @stable ICU 56 > */ > static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); > >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * This function has been deprecated in favor of createEmptyInstance, which has >+ * identical behavior. >+ * @param status The error code. >+ * @return the new builder >+ * @deprecated ICU 60 use createEmptyInstance instead >+ * @see createEmptyInstance() >+ */ >+ static inline FilteredBreakIteratorBuilder *createInstance(UErrorCode &status) { >+ return createEmptyInstance(status); >+ } >+#endif /* U_HIDE_DEPRECATED_API */ >+ >+#ifndef U_HIDE_DRAFT_API > /** > * Construct an empty FilteredBreakIteratorBuilder. > * In this state, it will not suppress any segment boundaries. > * @param status The error code. > * @return the new builder >- * @internal technology preview >+ * @draft ICU 60 > */ >- static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); >+ static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); >+#endif /* U_HIDE_DRAFT_API */ > > /** > * Suppress a certain string from being the end of a segment. >@@ -83,7 +88,7 @@ class U_I18N_API FilteredBreakIteratorBuilder : public UObject { > * @param status error code > * @return returns TRUE if the string was not present and now added, > * FALSE if the call was a no-op because the string was already being suppressed. >- * @internal technology preview >+ * @stable ICU 56 > */ > virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; > >@@ -96,10 +101,24 @@ class U_I18N_API FilteredBreakIteratorBuilder : public UObject { > * @param status error code > * @return returns TRUE if the string was present and now removed, > * FALSE if the call was a no-op because the string was not being suppressed. >- * @internal technology preview >+ * @stable ICU 56 > */ > virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; > >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * This function has been deprecated in favor of wrapIteratorWithFilter() >+ * The behavior is identical. >+ * @param adoptBreakIterator the break iterator to adopt >+ * @param status error code >+ * @return the new BreakIterator, owned by the caller. >+ * @deprecated ICU 60 use wrapIteratorWithFilter() instead >+ * @see wrapBreakIteratorWithFilter() >+ */ >+ virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; >+#endif /* U_HIDE_DEPRECATED_API */ >+ >+#ifndef U_HIDE_DRAFT_API > /** > * Wrap (adopt) an existing break iterator in a new filtered instance. > * The resulting BreakIterator is owned by the caller. >@@ -107,17 +126,21 @@ class U_I18N_API FilteredBreakIteratorBuilder : public UObject { > * Note that the adoptBreakIterator is adopted by the new BreakIterator > * and should no longer be used by the caller. > * The FilteredBreakIteratorBuilder may be reused. >+ * This function is an alias for build() > * @param adoptBreakIterator the break iterator to adopt > * @param status error code > * @return the new BreakIterator, owned by the caller. >- * @internal technology preview >+ * @draft ICU 60 > */ >- virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; >+ inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { >+ return build(adoptBreakIterator, status); >+ } >+#endif /* U_HIDE_DRAFT_API */ > > protected: > /** > * For subclass use >- * @internal technology preview >+ * @stable ICU 56 > */ > FilteredBreakIteratorBuilder(); > }; >@@ -125,7 +148,6 @@ class U_I18N_API FilteredBreakIteratorBuilder : public UObject { > > U_NAMESPACE_END > >-#endif /* U_HIDE_INTERNAL_API */ > #endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION > > #endif // #ifndef FILTEREDBRK_H >diff --git a/Source/WTF/icu/unicode/fmtable.h b/Source/WTF/icu/unicode/fmtable.h >index 6cad276f42366cdab25960b8f074a034d7f4d1bb..766a71969deadc8146431a4e904c7059ead2fcfb 100644 >--- a/Source/WTF/icu/unicode/fmtable.h >+++ b/Source/WTF/icu/unicode/fmtable.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2014, International Business Machines >@@ -134,7 +136,7 @@ public: > * decimal number. > * @stable ICU 4.4 > */ >- Formattable(const StringPiece &number, UErrorCode &status); >+ Formattable(StringPiece number, UErrorCode &status); > > /** > * Creates a Formattable object with a UnicodeString object to copy from. >@@ -581,7 +583,7 @@ public: > * incoming string is not a valid decimal number. > * @stable ICU 4.4 > */ >- void setDecimalNumber(const StringPiece &numberString, >+ void setDecimalNumber(StringPiece numberString, > UErrorCode &status); > > /** >diff --git a/Source/WTF/icu/unicode/format.h b/Source/WTF/icu/unicode/format.h >index cb8ea61f76e6c236ba5c4a103423d5125fa4a798..b05318dae7ba7fae70aeaa6acac262ecdc1d3224 100644 >--- a/Source/WTF/icu/unicode/format.h >+++ b/Source/WTF/icu/unicode/format.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2011, International Business Machines Corporation and others. >diff --git a/Source/WTF/icu/unicode/fpositer.h b/Source/WTF/icu/unicode/fpositer.h >index b842161a69b794ccc6bf97898a384c3ee825decb..38ccd8feb30676bd596436e04a81d4d8288c46e3 100644 >--- a/Source/WTF/icu/unicode/fpositer.h >+++ b/Source/WTF/icu/unicode/fpositer.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 2010-2012, International Business Machines >@@ -45,6 +47,13 @@ U_NAMESPACE_BEGIN > > class UVector32; > >+// Forward declaration for number formatting: >+namespace number { >+namespace impl { >+class NumberStringBuilder; >+} >+} >+ > /** > * FieldPositionIterator returns the field ids and their start/limit positions generated > * by a call to Format::format. See Format, NumberFormat, DecimalFormat. >@@ -97,8 +106,6 @@ public: > UBool next(FieldPosition& fp); > > private: >- friend class FieldPositionIteratorHandler; >- > /** > * Sets the data used by the iterator, and resets the position. > * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid >@@ -106,6 +113,9 @@ private: > */ > void setData(UVector32 *adopt, UErrorCode& status); > >+ friend class FieldPositionIteratorHandler; >+ friend class number::impl::NumberStringBuilder; >+ > UVector32 *data; > int32_t pos; > }; >diff --git a/Source/WTF/icu/unicode/gender.h b/Source/WTF/icu/unicode/gender.h >index 1a6ae8fe6c8d4854f28d9e0a0289d75e1ab3c57a..e3c27d024e09431321e426ee257afa81883ea2e8 100644 >--- a/Source/WTF/icu/unicode/gender.h >+++ b/Source/WTF/icu/unicode/gender.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2008-2013, International Business Machines Corporation and >diff --git a/Source/WTF/icu/unicode/gregocal.h b/Source/WTF/icu/unicode/gregocal.h >index e6ae4d6a1df70b0ceffe596d45fb52d1583dea14..2b4fe1d879cadf36d8a150d0136690558da3cba5 100644 >--- a/Source/WTF/icu/unicode/gregocal.h >+++ b/Source/WTF/icu/unicode/gregocal.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > * Copyright (C) 1997-2013, International Business Machines Corporation and others. > * All Rights Reserved. >diff --git a/Source/WTF/icu/unicode/icudataver.h b/Source/WTF/icu/unicode/icudataver.h >index 609f580f06a35ffe7d6796294cd18312e846ac02..1cb202e3d45c62af59717dc052fa3a88192c4681 100644 >--- a/Source/WTF/icu/unicode/icudataver.h >+++ b/Source/WTF/icu/unicode/icudataver.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >diff --git a/Source/WTF/icu/unicode/icuplug.h b/Source/WTF/icu/unicode/icuplug.h >index 61dc2a3eb0afa1d16b59fc13ddc0a1dcd053a691..1a894a71c4ae8899cc5f75e39c5112af96f3fd52 100644 >--- a/Source/WTF/icu/unicode/icuplug.h >+++ b/Source/WTF/icu/unicode/icuplug.h >@@ -1,7 +1,9 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >-* Copyright (C) 2009-2012, International Business Machines >+* Copyright (C) 2009-2015, International Business Machines > * Corporation and others. All Rights Reserved. > * > ****************************************************************************** >@@ -108,6 +110,10 @@ > #include "unicode/utypes.h" > > >+#if UCONFIG_ENABLE_PLUGINS >+ >+ >+ > /* === Basic types === */ > > #ifndef U_HIDE_INTERNAL_API >@@ -153,7 +159,11 @@ typedef enum { > UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/ > UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/ > UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/ >- UPLUG_REASON_COUNT /**< count of known reasons **/ >+ /** >+ * Number of known reasons. >+ * @internal The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UPLUG_REASON_COUNT > } UPlugReason; > > >@@ -169,7 +179,11 @@ typedef enum { > UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/ > UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/ > UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/ >- UPLUG_LEVEL_COUNT /**< count of known reasons **/ >+ /** >+ * Number of known levels. >+ * @internal The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UPLUG_LEVEL_COUNT > } UPlugLevel; > > /** >@@ -368,4 +382,7 @@ U_INTERNAL void U_EXPORT2 > uplug_removePlug(UPlugData *plug, UErrorCode *status); > #endif /* U_HIDE_INTERNAL_API */ > >-#endif >+#endif /* UCONFIG_ENABLE_PLUGINS */ >+ >+#endif /* _ICUPLUG */ >+ >diff --git a/Source/WTF/icu/unicode/idna.h b/Source/WTF/icu/unicode/idna.h >index 90194a378f38255b81980838b8fc384220b583b6..f08658e502e200838dcae236a330bc5b092ff7c4 100644 >--- a/Source/WTF/icu/unicode/idna.h >+++ b/Source/WTF/icu/unicode/idna.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2012, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: idna.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -198,7 +200,7 @@ public: > * @stable ICU 4.6 > */ > virtual void >- labelToASCII_UTF8(const StringPiece &label, ByteSink &dest, >+ labelToASCII_UTF8(StringPiece label, ByteSink &dest, > IDNAInfo &info, UErrorCode &errorCode) const; > > /** >@@ -216,7 +218,7 @@ public: > * @stable ICU 4.6 > */ > virtual void >- labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest, >+ labelToUnicodeUTF8(StringPiece label, ByteSink &dest, > IDNAInfo &info, UErrorCode &errorCode) const; > > /** >@@ -234,7 +236,7 @@ public: > * @stable ICU 4.6 > */ > virtual void >- nameToASCII_UTF8(const StringPiece &name, ByteSink &dest, >+ nameToASCII_UTF8(StringPiece name, ByteSink &dest, > IDNAInfo &info, UErrorCode &errorCode) const; > > /** >@@ -252,7 +254,7 @@ public: > * @stable ICU 4.6 > */ > virtual void >- nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest, >+ nameToUnicodeUTF8(StringPiece name, ByteSink &dest, > IDNAInfo &info, UErrorCode &errorCode) const; > }; > >diff --git a/Source/WTF/icu/unicode/listformatter.h b/Source/WTF/icu/unicode/listformatter.h >index e48faaa1276c70b8bc38a7fe6cda237a6f5f24af..180fbcb5cde5b743a9faf8c84dcdfd8ca20747d4 100644 >--- a/Source/WTF/icu/unicode/listformatter.h >+++ b/Source/WTF/icu/unicode/listformatter.h >@@ -1,12 +1,14 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >-* Copyright (C) 2012-2014, International Business Machines >+* Copyright (C) 2012-2016, International Business Machines > * Corporation and others. All Rights Reserved. > * > ******************************************************************************* > * file name: listformatter.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -145,7 +147,7 @@ class U_COMMON_API ListFormatter : public UObject{ > /** > * @internal constructor made public for testing. > */ >- ListFormatter(const ListFormatData &data); >+ ListFormatter(const ListFormatData &data, UErrorCode &errorCode); > /** > * @internal constructor made public for testing. > */ >@@ -155,6 +157,8 @@ class U_COMMON_API ListFormatter : public UObject{ > private: > static void initializeHash(UErrorCode& errorCode); > static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); >+ struct ListPatternsSink; >+ static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode); > > ListFormatter(); > >diff --git a/Source/WTF/icu/unicode/localpointer.h b/Source/WTF/icu/unicode/localpointer.h >index e3aabf65c380706fa08853697487c727ab9abaec..e17ee3d886ef34df04f891ceb8e0b7cfb88c05a9 100644 >--- a/Source/WTF/icu/unicode/localpointer.h >+++ b/Source/WTF/icu/unicode/localpointer.h >@@ -1,12 +1,14 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >-* Copyright (C) 2009-2014, International Business Machines >+* Copyright (C) 2009-2016, International Business Machines > * Corporation and others. All Rights Reserved. > * > ******************************************************************************* > * file name: localpointer.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -18,7 +20,7 @@ > #define __LOCALPOINTER_H__ > > /** >- * \file >+ * \file > * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code. > * > * These classes are inspired by >@@ -52,7 +54,7 @@ U_NAMESPACE_BEGIN > * Destructor and adoptInstead(). > * > * There is no operator T *() provided because the programmer must decide >- * whether to use getAlias() (without transfer of ownership) or orpan() >+ * whether to use getAlias() (without transfer of ownership) or orphan() > * (with transfer of ownership and NULLing of the pointer). > * > * @see LocalPointer >@@ -151,11 +153,11 @@ protected: > T *ptr; > private: > // No comparison operators with other LocalPointerBases. >- bool operator==(const LocalPointerBase &other); >- bool operator!=(const LocalPointerBase &other); >- // No ownership transfer: No copy constructor, no assignment operator. >- LocalPointerBase(const LocalPointerBase &other); >- void operator=(const LocalPointerBase &other); >+ bool operator==(const LocalPointerBase<T> &other); >+ bool operator!=(const LocalPointerBase<T> &other); >+ // No ownership sharing: No copy constructor, no assignment operator. >+ LocalPointerBase(const LocalPointerBase<T> &other); >+ void operator=(const LocalPointerBase<T> &other); > // No heap allocation. Use only on the stack. > static void * U_EXPORT2 operator new(size_t size); > static void * U_EXPORT2 operator new[](size_t size); >@@ -172,9 +174,9 @@ private: > * \code > * LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005)); > * int32_t length=s->length(); // 2 >- * UChar lead=s->charAt(0); // 0xd900 >+ * char16_t lead=s->charAt(0); // 0xd900 > * if(some condition) { return; } // no need to explicitly delete the pointer >- * s.adoptInstead(new UnicodeString((UChar)0xfffc)); >+ * s.adoptInstead(new UnicodeString((char16_t)0xfffc)); > * length=s->length(); // 1 > * // no need to explicitly delete the pointer > * \endcode >@@ -185,13 +187,14 @@ private: > template<typename T> > class LocalPointer : public LocalPointerBase<T> { > public: >+ using LocalPointerBase<T>::operator*; >+ using LocalPointerBase<T>::operator->; > /** > * Constructor takes ownership. > * @param p simple pointer to an object that is adopted > * @stable ICU 4.4 > */ > explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {} >-#ifndef U_HIDE_DRAFT_API > /** > * Constructor takes ownership and reports an error if NULL. > * >@@ -203,14 +206,21 @@ public: > * @param p simple pointer to an object that is adopted > * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR > * if p==NULL and no other failure code had been set >- * @draft ICU 55 >+ * @stable ICU 55 > */ > LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) { > if(p==NULL && U_SUCCESS(errorCode)) { > errorCode=U_MEMORY_ALLOCATION_ERROR; > } > } >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * Move constructor, leaves src with isNull(). >+ * @param src source smart pointer >+ * @stable ICU 56 >+ */ >+ LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) { >+ src.ptr=NULL; >+ } > /** > * Destructor deletes the object it owns. > * @stable ICU 4.4 >@@ -218,6 +228,51 @@ public: > ~LocalPointer() { > delete LocalPointerBase<T>::ptr; > } >+ /** >+ * Move assignment operator, leaves src with isNull(). >+ * The behavior is undefined if *this and src are the same object. >+ * @param src source smart pointer >+ * @return *this >+ * @stable ICU 56 >+ */ >+ LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT { >+ return moveFrom(src); >+ } >+ // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API >+ /** >+ * Move assignment, leaves src with isNull(). >+ * The behavior is undefined if *this and src are the same object. >+ * >+ * Can be called explicitly, does not need C++11 support. >+ * @param src source smart pointer >+ * @return *this >+ * @draft ICU 56 >+ */ >+ LocalPointer<T> &moveFrom(LocalPointer<T> &src) U_NOEXCEPT { >+ delete LocalPointerBase<T>::ptr; >+ LocalPointerBase<T>::ptr=src.ptr; >+ src.ptr=NULL; >+ return *this; >+ } >+ /** >+ * Swap pointers. >+ * @param other other smart pointer >+ * @stable ICU 56 >+ */ >+ void swap(LocalPointer<T> &other) U_NOEXCEPT { >+ T *temp=LocalPointerBase<T>::ptr; >+ LocalPointerBase<T>::ptr=other.ptr; >+ other.ptr=temp; >+ } >+ /** >+ * Non-member LocalPointer swap function. >+ * @param p1 will get p2's pointer >+ * @param p2 will get p1's pointer >+ * @stable ICU 56 >+ */ >+ friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) U_NOEXCEPT { >+ p1.swap(p2); >+ } > /** > * Deletes the object it owns, > * and adopts (takes ownership of) the one passed in. >@@ -228,7 +283,6 @@ public: > delete LocalPointerBase<T>::ptr; > LocalPointerBase<T>::ptr=p; > } >-#ifndef U_HIDE_DRAFT_API > /** > * Deletes the object it owns, > * and adopts (takes ownership of) the one passed in. >@@ -242,7 +296,7 @@ public: > * @param p simple pointer to an object that is adopted > * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR > * if p==NULL and no other failure code had been set >- * @draft ICU 55 >+ * @stable ICU 55 > */ > void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { > if(U_SUCCESS(errorCode)) { >@@ -255,7 +309,6 @@ public: > delete p; > } > } >-#endif /* U_HIDE_DRAFT_API */ > }; > > /** >@@ -266,10 +319,10 @@ public: > * Usage example: > * \code > * LocalArray<UnicodeString> a(new UnicodeString[2]); >- * a[0].append((UChar)0x61); >+ * a[0].append((char16_t)0x61); > * if(some condition) { return; } // no need to explicitly delete the array > * a.adoptInstead(new UnicodeString[4]); >- * a[3].append((UChar)0x62).append((UChar)0x63).reverse(); >+ * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse(); > * // no need to explicitly delete the array > * \endcode > * >@@ -279,12 +332,40 @@ public: > template<typename T> > class LocalArray : public LocalPointerBase<T> { > public: >+ using LocalPointerBase<T>::operator*; >+ using LocalPointerBase<T>::operator->; > /** > * Constructor takes ownership. > * @param p simple pointer to an array of T objects that is adopted > * @stable ICU 4.4 > */ > explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {} >+ /** >+ * Constructor takes ownership and reports an error if NULL. >+ * >+ * This constructor is intended to be used with other-class constructors >+ * that may report a failure UErrorCode, >+ * so that callers need to check only for U_FAILURE(errorCode) >+ * and not also separately for isNull(). >+ * >+ * @param p simple pointer to an array of T objects that is adopted >+ * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR >+ * if p==NULL and no other failure code had been set >+ * @stable ICU 56 >+ */ >+ LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) { >+ if(p==NULL && U_SUCCESS(errorCode)) { >+ errorCode=U_MEMORY_ALLOCATION_ERROR; >+ } >+ } >+ /** >+ * Move constructor, leaves src with isNull(). >+ * @param src source smart pointer >+ * @stable ICU 56 >+ */ >+ LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) { >+ src.ptr=NULL; >+ } > /** > * Destructor deletes the array it owns. > * @stable ICU 4.4 >@@ -292,6 +373,51 @@ public: > ~LocalArray() { > delete[] LocalPointerBase<T>::ptr; > } >+ /** >+ * Move assignment operator, leaves src with isNull(). >+ * The behavior is undefined if *this and src are the same object. >+ * @param src source smart pointer >+ * @return *this >+ * @stable ICU 56 >+ */ >+ LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT { >+ return moveFrom(src); >+ } >+ // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API >+ /** >+ * Move assignment, leaves src with isNull(). >+ * The behavior is undefined if *this and src are the same object. >+ * >+ * Can be called explicitly, does not need C++11 support. >+ * @param src source smart pointer >+ * @return *this >+ * @draft ICU 56 >+ */ >+ LocalArray<T> &moveFrom(LocalArray<T> &src) U_NOEXCEPT { >+ delete[] LocalPointerBase<T>::ptr; >+ LocalPointerBase<T>::ptr=src.ptr; >+ src.ptr=NULL; >+ return *this; >+ } >+ /** >+ * Swap pointers. >+ * @param other other smart pointer >+ * @stable ICU 56 >+ */ >+ void swap(LocalArray<T> &other) U_NOEXCEPT { >+ T *temp=LocalPointerBase<T>::ptr; >+ LocalPointerBase<T>::ptr=other.ptr; >+ other.ptr=temp; >+ } >+ /** >+ * Non-member LocalArray swap function. >+ * @param p1 will get p2's pointer >+ * @param p2 will get p1's pointer >+ * @stable ICU 56 >+ */ >+ friend inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT { >+ p1.swap(p2); >+ } > /** > * Deletes the array it owns, > * and adopts (takes ownership of) the one passed in. >@@ -302,6 +428,32 @@ public: > delete[] LocalPointerBase<T>::ptr; > LocalPointerBase<T>::ptr=p; > } >+ /** >+ * Deletes the array it owns, >+ * and adopts (takes ownership of) the one passed in. >+ * >+ * If U_FAILURE(errorCode), then the current array is retained and the new one deleted. >+ * >+ * If U_SUCCESS(errorCode) but the input pointer is NULL, >+ * then U_MEMORY_ALLOCATION_ERROR is set, >+ * the current array is deleted, and NULL is set. >+ * >+ * @param p simple pointer to an array of T objects that is adopted >+ * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR >+ * if p==NULL and no other failure code had been set >+ * @stable ICU 56 >+ */ >+ void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { >+ if(U_SUCCESS(errorCode)) { >+ delete[] LocalPointerBase<T>::ptr; >+ LocalPointerBase<T>::ptr=p; >+ if(p==NULL) { >+ errorCode=U_MEMORY_ALLOCATION_ERROR; >+ } >+ } else { >+ delete[] p; >+ } >+ } > /** > * Array item access (writable). > * No index bounds check. >@@ -319,9 +471,6 @@ public: > * like LocalPointer<Type> except that this subclass will use the closeFunction > * rather than the C++ delete operator. > * >- * Requirement: The closeFunction must tolerate a NULL pointer. >- * (We could add a NULL check here but it is normally redundant.) >- * > * Usage example: > * \code > * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode)); >@@ -338,10 +487,33 @@ public: > #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \ > class LocalPointerClassName : public LocalPointerBase<Type> { \ > public: \ >+ using LocalPointerBase<Type>::operator*; \ >+ using LocalPointerBase<Type>::operator->; \ > explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \ >- ~LocalPointerClassName() { closeFunction(ptr); } \ >+ LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \ >+ : LocalPointerBase<Type>(src.ptr) { \ >+ src.ptr=NULL; \ >+ } \ >+ ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \ >+ LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \ >+ return moveFrom(src); \ >+ } \ >+ LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \ >+ if (ptr != NULL) { closeFunction(ptr); } \ >+ LocalPointerBase<Type>::ptr=src.ptr; \ >+ src.ptr=NULL; \ >+ return *this; \ >+ } \ >+ void swap(LocalPointerClassName &other) U_NOEXCEPT { \ >+ Type *temp=LocalPointerBase<Type>::ptr; \ >+ LocalPointerBase<Type>::ptr=other.ptr; \ >+ other.ptr=temp; \ >+ } \ >+ friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \ >+ p1.swap(p2); \ >+ } \ > void adoptInstead(Type *p) { \ >- closeFunction(ptr); \ >+ if (ptr != NULL) { closeFunction(ptr); } \ > ptr=p; \ > } \ > } >diff --git a/Source/WTF/icu/unicode/locdspnm.h b/Source/WTF/icu/unicode/locdspnm.h >index 74862b6d8a5b203a483f72b9c2fa3f3bbaaa855b..7f227829b4cc00d4e7c5563cd91c85357344e36c 100644 >--- a/Source/WTF/icu/unicode/locdspnm.h >+++ b/Source/WTF/icu/unicode/locdspnm.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** >-* Copyright (C) 2010-2014, International Business Machines Corporation and >+* Copyright (C) 2010-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ****************************************************************************** > */ >@@ -18,6 +20,7 @@ > #if !UCONFIG_NO_FORMATTING > > #include "unicode/locid.h" >+#include "unicode/strenum.h" > #include "unicode/uscript.h" > #include "unicode/uldnames.h" > #include "unicode/udisplaycontext.h" >@@ -30,7 +33,7 @@ U_NAMESPACE_BEGIN > * values, see Locale. > * @stable ICU 4.4 > */ >-class U_I18N_API LocaleDisplayNames : public UObject { >+class U_COMMON_API LocaleDisplayNames : public UObject { > public: > /** > * Destructor. >diff --git a/Source/WTF/icu/unicode/locid.h b/Source/WTF/icu/unicode/locid.h >index 1ad5cb546ebe397ef436df36503eb4371c386696..dd7d068a4e5400423de6b3cab60c36276ef1ffa6 100644 >--- a/Source/WTF/icu/unicode/locid.h >+++ b/Source/WTF/icu/unicode/locid.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -31,10 +33,8 @@ > > #include "unicode/utypes.h" > #include "unicode/uobject.h" >-#include "unicode/unistr.h" > #include "unicode/putil.h" > #include "unicode/uloc.h" >-#include "unicode/strenum.h" > > /** > * \file >@@ -46,6 +46,9 @@ U_NAMESPACE_BEGIN > // Forward Declarations > void U_CALLCONV locale_available_init(); /**< @internal */ > >+class StringEnumeration; >+class UnicodeString; >+ > /** > * A <code>Locale</code> object represents a specific geographical, political, > * or cultural region. An operation that requires a <code>Locale</code> to perform >@@ -85,7 +88,7 @@ void U_CALLCONV locale_available_init(); /**< @internal */ > * <P> > * The third constructor requires a third argument--the <STRONG>Variant.</STRONG> > * The Variant codes are vendor and browser-specific. >- * For example, use REVISED for a langauge's revised script orthography, and POSIX for POSIX. >+ * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX. > * Where there are two variants, separate them with an underscore, and > * put the most important one first. For > * example, a Traditional Spanish collation might be referenced, with >@@ -493,7 +496,6 @@ public: > */ > uint32_t getLCID(void) const; > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns whether this locale's script is written right-to-left. > * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). >@@ -505,10 +507,9 @@ public: > * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". > * > * @return TRUE if the locale's script is written right-to-left >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UBool isRightToLeft() const; >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Fills in "dispLang" with the name of this locale's language in a format suitable for >diff --git a/Source/WTF/icu/unicode/measfmt.h b/Source/WTF/icu/unicode/measfmt.h >index 61a1e86d9c431e7c18a48ccb976e37c16ed82c1b..156bb81b544deeeed9c59c0c2d8cdaf96a2e285d 100644 >--- a/Source/WTF/icu/unicode/measfmt.h >+++ b/Source/WTF/icu/unicode/measfmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (c) 2004-2015, International Business Machines >+* Copyright (c) 2004-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * Author: Alan Liu >@@ -59,11 +61,13 @@ enum UMeasureFormatWidth { > */ > UMEASFMT_WIDTH_NUMERIC, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of values in this enum. >- * @stable ICU 53 >+ * One more than the highest normal UMeasureFormatWidth value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UMEASFMT_WIDTH_COUNT = 4 >+#endif // U_HIDE_DEPRECATED_API > }; > /** @stable ICU 53 */ > typedef enum UMeasureFormatWidth UMeasureFormatWidth; >@@ -78,7 +82,7 @@ class MeasureFormatCacheData; > class SharedNumberFormat; > class SharedPluralRules; > class QuantityFormatter; >-class SimplePatternFormatter; >+class SimpleFormatter; > class ListFormatter; > class DateFormat; > >@@ -186,7 +190,6 @@ class U_I18N_API MeasureFormat : public Format { > FieldPosition &pos, > UErrorCode &status) const; > >-#ifndef U_HIDE_DRAFT_API > /** > * Formats a single measure per unit. An example of such a > * formatted string is 3.5 meters per second. >@@ -198,7 +201,7 @@ class U_I18N_API MeasureFormat : public Format { > * @param status the error. > * @return appendTo reference > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > UnicodeString &formatMeasurePerUnit( > const Measure &measure, >@@ -207,7 +210,19 @@ class U_I18N_API MeasureFormat : public Format { > FieldPosition &pos, > UErrorCode &status) const; > >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * Gets the display name of the specified {@link MeasureUnit} corresponding to the current >+ * locale and format width. >+ * @param unit The unit for which to get a display name. >+ * @param status the error. >+ * @return The display name in the locale and width specified in >+ * {@link MeasureFormat#getInstance}, or null if there is no display name available >+ * for the specified unit. >+ * >+ * @stable ICU 58 >+ */ >+ UnicodeString getUnitDisplayName(const MeasureUnit& unit, UErrorCode &status) const; >+ > > /** > * Return a formatter for CurrencyAmount objects in the given >@@ -327,17 +342,19 @@ class U_I18N_API MeasureFormat : public Format { > // shared across instances. > ListFormatter *listFormatter; > >- const QuantityFormatter *getQuantityFormatter( >- int32_t index, >- int32_t widthIndex, >- UErrorCode &status) const; >+ const SimpleFormatter *getFormatterOrNull( >+ const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index) const; > >- const SimplePatternFormatter *getPerUnitFormatter( >- int32_t index, >- int32_t widthIndex) const; >+ const SimpleFormatter *getFormatter( >+ const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index, >+ UErrorCode &errorCode) const; > >- const SimplePatternFormatter *getPerFormatter( >- int32_t widthIndex, >+ const SimpleFormatter *getPluralFormatter( >+ const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index, >+ UErrorCode &errorCode) const; >+ >+ const SimpleFormatter *getPerFormatter( >+ UMeasureFormatWidth width, > UErrorCode &status) const; > > int32_t withPerUnitAndAppend( >diff --git a/Source/WTF/icu/unicode/measunit.h b/Source/WTF/icu/unicode/measunit.h >index c7370667d315ce20ee10ed270188c78a8539af6b..4140ae3679f94e9ff7a29eed41d259e046847f2f 100644 >--- a/Source/WTF/icu/unicode/measunit.h >+++ b/Source/WTF/icu/unicode/measunit.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (c) 2004-2015, International Business Machines >+* Copyright (c) 2004-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * Author: Alan Liu >@@ -38,11 +40,10 @@ class U_I18N_API MeasureUnit: public UObject { > > /** > * Default constructor. >+ * Populates the instance with the base dimensionless unit. > * @stable ICU 3.0 > */ >- MeasureUnit() : fTypeId(0), fSubTypeId(0) { >- fCurrency[0] = 0; >- } >+ MeasureUnit(); > > /** > * Copy constructor. >@@ -147,7 +148,7 @@ class U_I18N_API MeasureUnit: public UObject { > * <pre> > * . Base* polymorphic_pointer = createPolymorphicObject(); > * . if (polymorphic_pointer->getDynamicClassID() == >- * . erived::getStaticClassID()) ... >+ * . Derived::getStaticClassID()) ... > * </pre> > * @return The class ID for all objects of this class. > * @stable ICU 53 >@@ -183,6 +184,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static int32_t getIndexCount(); > >+ /** >+ * ICU use only. >+ * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(), >+ * or a negative value if there is no such unit >+ * @internal >+ */ >+ static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype); >+ > /** > * ICU use only. > * @internal >@@ -207,16 +216,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createGForce(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of acceleration: meter-per-second-squared. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of angle: arc-minute. > * Caller owns returned value and must free it. >@@ -241,16 +248,22 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createDegree(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of angle: radian. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createRadian(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * Returns unit of angle: revolution. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createRevolutionAngle(UErrorCode &status); >+ > /** > * Returns unit of area: acre. > * Caller owns returned value and must free it. >@@ -267,16 +280,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createHectare(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of area: square-centimeter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createSquareCentimeter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of area: square-foot. > * Caller owns returned value and must free it. >@@ -285,16 +296,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createSquareFoot(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of area: square-inch. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createSquareInch(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of area: square-kilometer. > * Caller owns returned value and must free it. >@@ -319,136 +328,174 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createSquareMile(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of area: square-yard. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createSquareYard(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of concentr: karat. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 54 >+ */ >+ static MeasureUnit *createKarat(UErrorCode &status); >+ >+ /** >+ * Returns unit of concentr: milligram-per-deciliter. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 57 >+ */ >+ static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status); >+ >+ /** >+ * Returns unit of concentr: millimole-per-liter. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 57 >+ */ >+ static MeasureUnit *createMillimolePerLiter(UErrorCode &status); >+ >+ /** >+ * Returns unit of concentr: part-per-million. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 57 >+ */ >+ static MeasureUnit *createPartPerMillion(UErrorCode &status); >+ >+ /** >+ * Returns unit of consumption: liter-per-100kilometers. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); >+ > /** > * Returns unit of consumption: liter-per-kilometer. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createLiterPerKilometer(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of consumption: mile-per-gallon. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMilePerGallon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of consumption: mile-per-gallon-imperial. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 57 >+ */ >+ static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); >+ >+ /* >+ * The following were draft ICU 58, but have been withdrawn: >+ * static MeasureUnit *createEast(UErrorCode &status); >+ * static MeasureUnit *createNorth(UErrorCode &status); >+ * static MeasureUnit *createSouth(UErrorCode &status); >+ * static MeasureUnit *createWest(UErrorCode &status); >+ */ >+ > /** > * Returns unit of digital: bit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createBit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: byte. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createByte(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: gigabit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createGigabit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: gigabyte. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createGigabyte(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: kilobit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilobit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: kilobyte. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilobyte(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: megabit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMegabit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: megabyte. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMegabyte(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: terabit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createTerabit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of digital: terabyte. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createTerabyte(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * Returns unit of duration: century. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createCentury(UErrorCode &status); >+ > /** > * Returns unit of duration: day. > * Caller owns returned value and must free it. >@@ -465,16 +512,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createHour(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of duration: microsecond. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMicrosecond(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of duration: millisecond. > * Caller owns returned value and must free it. >@@ -499,16 +544,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createMonth(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of duration: nanosecond. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createNanosecond(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of duration: second. > * Caller owns returned value and must free it. >@@ -533,156 +576,126 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createYear(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of electric: ampere. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createAmpere(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of electric: milliampere. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMilliampere(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of electric: ohm. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createOhm(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of electric: volt. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createVolt(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: calorie. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCalorie(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: foodcalorie. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createFoodcalorie(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: joule. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createJoule(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: kilocalorie. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilocalorie(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: kilojoule. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilojoule(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of energy: kilowatt-hour. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilowattHour(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of frequency: gigahertz. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createGigahertz(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of frequency: hertz. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createHertz(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of frequency: kilohertz. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKilohertz(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of frequency: megahertz. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMegahertz(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: astronomical-unit. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createAstronomicalUnit(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of length: centimeter. > * Caller owns returned value and must free it. >@@ -691,26 +704,22 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createCentimeter(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: decimeter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createDecimeter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: fathom. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createFathom(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of length: foot. > * Caller owns returned value and must free it. >@@ -719,16 +728,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createFoot(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: furlong. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createFurlong(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of length: inch. > * Caller owns returned value and must free it. >@@ -761,16 +768,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createMeter(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: micrometer. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMicrometer(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of length: mile. > * Caller owns returned value and must free it. >@@ -779,6 +784,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createMile(UErrorCode &status); > >+ /** >+ * Returns unit of length: mile-scandinavian. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createMileScandinavian(UErrorCode &status); >+ > /** > * Returns unit of length: millimeter. > * Caller owns returned value and must free it. >@@ -787,36 +800,30 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createMillimeter(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: nanometer. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createNanometer(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: nautical-mile. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createNauticalMile(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of length: parsec. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createParsec(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of length: picometer. > * Caller owns returned value and must free it. >@@ -825,6 +832,16 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createPicometer(UErrorCode &status); > >+#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of length: point. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @draft ICU 59 >+ */ >+ static MeasureUnit *createPoint(UErrorCode &status); >+#endif /* U_HIDE_DRAFT_API */ >+ > /** > * Returns unit of length: yard. > * Caller owns returned value and must free it. >@@ -833,26 +850,22 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createYard(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of light: lux. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createLux(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: carat. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCarat(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of mass: gram. > * Caller owns returned value and must free it. >@@ -869,36 +882,30 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createKilogram(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: metric-ton. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMetricTon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: microgram. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMicrogram(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: milligram. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMilligram(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of mass: ounce. > * Caller owns returned value and must free it. >@@ -907,16 +914,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createOunce(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: ounce-troy. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createOunceTroy(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of mass: pound. > * Caller owns returned value and must free it. >@@ -925,36 +930,30 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createPound(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: stone. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createStone(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of mass: ton. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createTon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of power: gigawatt. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createGigawatt(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of power: horsepower. > * Caller owns returned value and must free it. >@@ -971,26 +970,22 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createKilowatt(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of power: megawatt. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMegawatt(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of power: milliwatt. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMilliwatt(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of power: watt. > * Caller owns returned value and must free it. >@@ -1023,43 +1018,37 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createMillibar(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of pressure: millimeter-of-mercury. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMillimeterOfMercury(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of pressure: pound-per-square-inch. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createPoundPerSquareInch(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** >- * Returns unit of proportion: karat. >+ * Returns unit of speed: kilometer-per-hour. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 53 > */ >- static MeasureUnit *createKarat(UErrorCode &status); >+ static MeasureUnit *createKilometerPerHour(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** >- * Returns unit of speed: kilometer-per-hour. >+ * Returns unit of speed: knot. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @stable ICU 53 >+ * @stable ICU 56 > */ >- static MeasureUnit *createKilometerPerHour(UErrorCode &status); >+ static MeasureUnit *createKnot(UErrorCode &status); > > /** > * Returns unit of speed: meter-per-second. >@@ -1093,76 +1082,70 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createFahrenheit(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of temperature: generic. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createGenericTemperature(UErrorCode &status); >+ > /** > * Returns unit of temperature: kelvin. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createKelvin(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: acre-foot. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createAcreFoot(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: bushel. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createBushel(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: centiliter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCentiliter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cubic-centimeter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCubicCentimeter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cubic-foot. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCubicFoot(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cubic-inch. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCubicInch(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of volume: cubic-kilometer. > * Caller owns returned value and must free it. >@@ -1171,16 +1154,14 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createCubicKilometer(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cubic-meter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCubicMeter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of volume: cubic-mile. > * Caller owns returned value and must free it. >@@ -1189,66 +1170,70 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createCubicMile(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cubic-yard. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCubicYard(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: cup. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createCup(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of volume: cup-metric. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createCupMetric(UErrorCode &status); >+ > /** > * Returns unit of volume: deciliter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createDeciliter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: fluid-ounce. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createFluidOunce(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: gallon. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createGallon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of volume: gallon-imperial. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 57 >+ */ >+ static MeasureUnit *createGallonImperial(UErrorCode &status); >+ > /** > * Returns unit of volume: hectoliter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createHectoliter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > /** > * Returns unit of volume: liter. > * Caller owns returned value and must free it. >@@ -1257,66 +1242,62 @@ class U_I18N_API MeasureUnit: public UObject { > */ > static MeasureUnit *createLiter(UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: megaliter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMegaliter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: milliliter. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createMilliliter(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: pint. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createPint(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API >+ /** >+ * Returns unit of volume: pint-metric. >+ * Caller owns returned value and must free it. >+ * @param status ICU error code. >+ * @stable ICU 56 >+ */ >+ static MeasureUnit *createPintMetric(UErrorCode &status); >+ > /** > * Returns unit of volume: quart. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createQuart(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: tablespoon. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createTablespoon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ >-#ifndef U_HIDE_DRAFT_API > /** > * Returns unit of volume: teaspoon. > * Caller owns returned value and must free it. > * @param status ICU error code. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static MeasureUnit *createTeaspoon(UErrorCode &status); > >-#endif /* U_HIDE_DRAFT_API */ > > // End generated createXXX methods > >@@ -1335,6 +1316,12 @@ class U_I18N_API MeasureUnit: public UObject { > */ > void initCurrency(const char *isoCurrency); > >+ /** >+ * For ICU use only. >+ * @internal >+ */ >+ void initNoUnit(const char *subtype); >+ > #endif /* U_HIDE_INTERNAL_API */ > > private: >diff --git a/Source/WTF/icu/unicode/measure.h b/Source/WTF/icu/unicode/measure.h >index c0f88bbdaa134d8c3b9c7c6adff328331d518e70..99b7d7a1439941af50281d9eaf2e9e9cd9018972 100644 >--- a/Source/WTF/icu/unicode/measure.h >+++ b/Source/WTF/icu/unicode/measure.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2004-2015, International Business Machines >diff --git a/Source/WTF/icu/unicode/messagepattern.h b/Source/WTF/icu/unicode/messagepattern.h >index f8b8dfb43f3149296ce1c806511af8087ae2291e..f28adafee0d2acd481ff40bb684855b68f7b2c3d 100644 >--- a/Source/WTF/icu/unicode/messagepattern.h >+++ b/Source/WTF/icu/unicode/messagepattern.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2011-2013, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: messagepattern.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/msgfmt.h b/Source/WTF/icu/unicode/msgfmt.h >index 5de91e41ff70c31e5b1fef33c4ba221eba2f6b42..fef80107747bf8473f3dbccac331b21cff298ddc 100644 >--- a/Source/WTF/icu/unicode/msgfmt.h >+++ b/Source/WTF/icu/unicode/msgfmt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > * Copyright (C) 2007-2013, International Business Machines Corporation and > * others. All Rights Reserved. >@@ -937,7 +939,7 @@ private: > * @return the index of the list which matches the keyword s. > */ > static int32_t findKeyword( const UnicodeString& s, >- const UChar * const *list); >+ const char16_t * const *list); > > /** > * Thin wrapper around the format(... AppendableWrapper ...) variant. >diff --git a/Source/WTF/icu/unicode/normalizer2.h b/Source/WTF/icu/unicode/normalizer2.h >index c03cba39e987a6669299b5b256730e7fea4c2e7a..8a6d7138021b566c8a93d827a93988bd25dc8495 100644 >--- a/Source/WTF/icu/unicode/normalizer2.h >+++ b/Source/WTF/icu/unicode/normalizer2.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: normalizer2.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -26,12 +28,15 @@ > > #if !UCONFIG_NO_NORMALIZATION > >+#include "unicode/stringpiece.h" > #include "unicode/uniset.h" > #include "unicode/unistr.h" > #include "unicode/unorm2.h" > > U_NAMESPACE_BEGIN > >+class ByteSink; >+ > /** > * Unicode normalization functionality for standard Unicode normalization or > * for using custom mapping tables. >@@ -213,6 +218,35 @@ public: > normalize(const UnicodeString &src, > UnicodeString &dest, > UErrorCode &errorCode) const = 0; >+ >+ /** >+ * Normalizes a UTF-8 string and optionally records how source substrings >+ * relate to changed and unchanged result substrings. >+ * >+ * Currently implemented completely only for "compose" modes, >+ * such as for NFC, NFKC, and NFKC_Casefold >+ * (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 U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. >+ * @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. >+ * @param edits Records edits for index mapping, working with styled text, >+ * and getting only changes (if any). >+ * The Edits contents is undefined if any error occurs. >+ * This function calls edits->reset() first unless >+ * options includes U_EDITS_NO_RESET. edits can be nullptr. >+ * @param errorCode Standard ICU error code. Its input value must >+ * pass the U_SUCCESS() test, or else the function returns >+ * immediately. Check for U_FAILURE() on output or use with >+ * function chaining. (See User Guide for details.) >+ * @draft ICU 60 >+ */ >+ virtual void >+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, >+ Edits *edits, UErrorCode &errorCode) const; >+ > /** > * Appends the normalized form of the second string to the first string > * (merging them at the boundary) and returns the first string. >@@ -280,7 +314,7 @@ public: > * > * When used on a standard NFC Normalizer2 instance, > * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); >- * in this case, the result contains either one or two code points (=1..4 UChars). >+ * in this case, the result contains either one or two code points (=1..4 char16_ts). > * > * This function is independent of the mode of the Normalizer2. > * The default implementation returns FALSE. >@@ -338,6 +372,30 @@ public: > */ > virtual UBool > isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0; >+ /** >+ * Tests if the UTF-8 string is normalized. >+ * Internally, in cases where the quickCheck() method would return "maybe" >+ * (which is only possible for the two COMPOSE modes) this method >+ * resolves to "yes" or "no" to provide a definitive result, >+ * at the cost of doing more work in those cases. >+ * >+ * This works for all normalization modes, >+ * but it is currently optimized for UTF-8 only for "compose" modes, >+ * such as for NFC, NFKC, and NFKC_Casefold >+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). >+ * For other modes it currently converts to UTF-16 and calls isNormalized(). >+ * >+ * @param s UTF-8 input string >+ * @param errorCode Standard ICU error code. Its input value must >+ * pass the U_SUCCESS() test, or else the function returns >+ * immediately. Check for U_FAILURE() on output or use with >+ * function chaining. (See User Guide for details.) >+ * @return TRUE if s is normalized >+ * @draft ICU 60 >+ */ >+ virtual UBool >+ isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const; >+ > > /** > * Tests if the string is normalized. >@@ -477,7 +535,36 @@ public: > virtual UnicodeString & > normalize(const UnicodeString &src, > UnicodeString &dest, >- UErrorCode &errorCode) const; >+ UErrorCode &errorCode) const U_OVERRIDE; >+ >+ /** >+ * Normalizes a UTF-8 string and optionally records how source substrings >+ * relate to changed and unchanged result substrings. >+ * >+ * Currently implemented completely only for "compose" modes, >+ * such as for NFC, NFKC, and NFKC_Casefold >+ * (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 U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. >+ * @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. >+ * @param edits Records edits for index mapping, working with styled text, >+ * and getting only changes (if any). >+ * The Edits contents is undefined if any error occurs. >+ * This function calls edits->reset() first unless >+ * options includes U_EDITS_NO_RESET. edits can be nullptr. >+ * @param errorCode Standard ICU error code. Its input value must >+ * pass the U_SUCCESS() test, or else the function returns >+ * immediately. Check for U_FAILURE() on output or use with >+ * function chaining. (See User Guide for details.) >+ * @draft ICU 60 >+ */ >+ virtual void >+ normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, >+ Edits *edits, UErrorCode &errorCode) const U_OVERRIDE; >+ > /** > * Appends the normalized form of the second string to the first string > * (merging them at the boundary) and returns the first string. >@@ -495,7 +582,7 @@ public: > virtual UnicodeString & > normalizeSecondAndAppend(UnicodeString &first, > const UnicodeString &second, >- UErrorCode &errorCode) const; >+ UErrorCode &errorCode) const U_OVERRIDE; > /** > * Appends the second string to the first string > * (merging them at the boundary) and returns the first string. >@@ -513,7 +600,7 @@ public: > virtual UnicodeString & > append(UnicodeString &first, > const UnicodeString &second, >- UErrorCode &errorCode) const; >+ UErrorCode &errorCode) const U_OVERRIDE; > > /** > * Gets the decomposition mapping of c. >@@ -527,7 +614,7 @@ public: > * @stable ICU 4.6 > */ > virtual UBool >- getDecomposition(UChar32 c, UnicodeString &decomposition) const; >+ getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; > > /** > * Gets the raw decomposition mapping of c. >@@ -541,7 +628,7 @@ public: > * @stable ICU 49 > */ > virtual UBool >- getRawDecomposition(UChar32 c, UnicodeString &decomposition) const; >+ getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; > > /** > * Performs pairwise composition of a & b and returns the composite if there is one. >@@ -554,7 +641,7 @@ public: > * @stable ICU 49 > */ > virtual UChar32 >- composePair(UChar32 a, UChar32 b) const; >+ composePair(UChar32 a, UChar32 b) const U_OVERRIDE; > > /** > * Gets the combining class of c. >@@ -565,7 +652,7 @@ public: > * @stable ICU 49 > */ > virtual uint8_t >- getCombiningClass(UChar32 c) const; >+ getCombiningClass(UChar32 c) const U_OVERRIDE; > > /** > * Tests if the string is normalized. >@@ -579,7 +666,30 @@ public: > * @stable ICU 4.4 > */ > virtual UBool >- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const; >+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; >+ /** >+ * Tests if the UTF-8 string is normalized. >+ * Internally, in cases where the quickCheck() method would return "maybe" >+ * (which is only possible for the two COMPOSE modes) this method >+ * resolves to "yes" or "no" to provide a definitive result, >+ * at the cost of doing more work in those cases. >+ * >+ * This works for all normalization modes, >+ * but it is currently optimized for UTF-8 only for "compose" modes, >+ * such as for NFC, NFKC, and NFKC_Casefold >+ * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). >+ * For other modes it currently converts to UTF-16 and calls isNormalized(). >+ * >+ * @param s UTF-8 input string >+ * @param errorCode Standard ICU error code. Its input value must >+ * pass the U_SUCCESS() test, or else the function returns >+ * immediately. Check for U_FAILURE() on output or use with >+ * function chaining. (See User Guide for details.) >+ * @return TRUE if s is normalized >+ * @draft ICU 60 >+ */ >+ virtual UBool >+ isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE; > /** > * Tests if the string is normalized. > * For details see the Normalizer2 base class documentation. >@@ -592,7 +702,7 @@ public: > * @stable ICU 4.4 > */ > virtual UNormalizationCheckResult >- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const; >+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; > /** > * Returns the end of the normalized substring of the input string. > * For details see the Normalizer2 base class documentation. >@@ -605,7 +715,7 @@ public: > * @stable ICU 4.4 > */ > virtual int32_t >- spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const; >+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; > > /** > * Tests if the character always has a normalization boundary before it, >@@ -615,7 +725,7 @@ public: > * @return TRUE if c has a normalization boundary before it > * @stable ICU 4.4 > */ >- virtual UBool hasBoundaryBefore(UChar32 c) const; >+ virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE; > > /** > * Tests if the character always has a normalization boundary after it, >@@ -625,7 +735,7 @@ public: > * @return TRUE if c has a normalization boundary after it > * @stable ICU 4.4 > */ >- virtual UBool hasBoundaryAfter(UChar32 c) const; >+ virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE; > > /** > * Tests if the character is normalization-inert. >@@ -634,7 +744,7 @@ public: > * @return TRUE if c is normalization-inert > * @stable ICU 4.4 > */ >- virtual UBool isInert(UChar32 c) const; >+ virtual UBool isInert(UChar32 c) const U_OVERRIDE; > private: > UnicodeString & > normalize(const UnicodeString &src, >@@ -642,6 +752,12 @@ private: > USetSpanCondition spanCondition, > UErrorCode &errorCode) const; > >+ void >+ normalizeUTF8(uint32_t options, const char *src, int32_t length, >+ ByteSink &sink, Edits *edits, >+ USetSpanCondition spanCondition, >+ UErrorCode &errorCode) const; >+ > UnicodeString & > normalizeSecondAndAppend(UnicodeString &first, > const UnicodeString &second, >diff --git a/Source/WTF/icu/unicode/normlzr.h b/Source/WTF/icu/unicode/normlzr.h >index 06cbfd477e6735148db1e618b0a2e0455c1d6d23..0141058fb0014a1928ac2b094548e9c456f1eb62 100644 >--- a/Source/WTF/icu/unicode/normlzr.h >+++ b/Source/WTF/icu/unicode/normlzr.h >@@ -1,7 +1,9 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************** > * COPYRIGHT: >- * Copyright (c) 1996-2011, International Business Machines Corporation and >+ * Copyright (c) 1996-2015, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************** > */ >@@ -26,14 +28,16 @@ > > U_NAMESPACE_BEGIN > /** >- * The Normalizer class supports the standard normalization forms described in >- * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> >- * Unicode Standard Annex #15: Unicode Normalization Forms</a>. >+ * Old Unicode normalization API. > * >- * Note: This API has been replaced by the Normalizer2 class and is only available >+ * This API has been replaced by the Normalizer2 class and is only available > * for backward compatibility. This class simply delegates to the Normalizer2 class. > * There is one exception: The new API does not provide a replacement for Normalizer::compare(). > * >+ * The Normalizer class supports the standard normalization forms described in >+ * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> >+ * Unicode Standard Annex #15: Unicode Normalization Forms</a>. >+ * > * The Normalizer class consists of two parts: > * - static functions that normalize strings or test if strings are normalized > * - a Normalizer object is an iterator that takes any kind of text and >@@ -129,10 +133,11 @@ U_NAMESPACE_BEGIN > */ > class U_COMMON_API Normalizer : public UObject { > public: >+#ifndef U_HIDE_DEPRECATED_API > /** > * If DONE is returned from an iteration function that returns a code point, > * then there are no more normalization results available. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > enum { > DONE=0xffff >@@ -148,7 +153,7 @@ public: > * will start at the beginning of the string. > * > * @param mode The normalization mode. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > Normalizer(const UnicodeString& str, UNormalizationMode mode); > >@@ -161,9 +166,9 @@ public: > * > * @param length Length of the string, or -1 if NUL-terminated. > * @param mode The normalization mode. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ >- Normalizer(const UChar* str, int32_t length, UNormalizationMode mode); >+ Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode); > > /** > * Creates a new <code>Normalizer</code> object for iterating over the >@@ -173,20 +178,21 @@ public: > * will start at the beginning of the string. > * > * @param mode The normalization mode. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > Normalizer(const CharacterIterator& iter, UNormalizationMode mode); >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * Copy constructor. > * @param copy The object to be copied. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > Normalizer(const Normalizer& copy); > > /** > * Destructor >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > virtual ~Normalizer(); > >@@ -195,6 +201,7 @@ public: > // Static utility methods > //------------------------------------------------------------------------- > >+#ifndef U_HIDE_DEPRECATED_API > /** > * Normalizes a <code>UnicodeString</code> according to the specified normalization mode. > * This is a wrapper for unorm_normalize(), using UnicodeString's. >@@ -207,7 +214,7 @@ public: > * @param options the optional features to be enabled (0 for no options) > * @param result The normalized string (on output). > * @param status The error code. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static void U_EXPORT2 normalize(const UnicodeString& source, > UNormalizationMode mode, int32_t options, >@@ -229,7 +236,7 @@ public: > * @param options the optional features to be enabled (0 for no options) > * @param result The composed string (on output). > * @param status The error code. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static void U_EXPORT2 compose(const UnicodeString& source, > UBool compat, int32_t options, >@@ -251,7 +258,7 @@ public: > * @param options the optional features to be enabled (0 for no options) > * @param result The decomposed string (on output). > * @param status The error code. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static void U_EXPORT2 decompose(const UnicodeString& source, > UBool compat, int32_t options, >@@ -276,7 +283,7 @@ public: > * @return UNORM_YES, UNORM_NO or UNORM_MAYBE > * > * @see isNormalized >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static inline UNormalizationCheckResult > quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status); >@@ -292,7 +299,7 @@ public: > * @return UNORM_YES, UNORM_NO or UNORM_MAYBE > * > * @see isNormalized >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static UNormalizationCheckResult > quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status); >@@ -315,7 +322,7 @@ public: > * "mode" normalization form. > * > * @see quickCheck >- * @stable ICU 2.2 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static inline UBool > isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode); >@@ -333,7 +340,7 @@ public: > * "mode" normalization form. > * > * @see quickCheck >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static UBool > isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); >@@ -365,13 +372,14 @@ public: > * @see unorm_next > * @see unorm_previous > * >- * @stable ICU 2.1 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static UnicodeString & > U_EXPORT2 concatenate(const UnicodeString &left, const UnicodeString &right, > UnicodeString &result, > UNormalizationMode mode, int32_t options, > UErrorCode &errorCode); >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * Compare two strings for canonical equivalence. >@@ -442,6 +450,7 @@ public: > uint32_t options, > UErrorCode &errorCode); > >+#ifndef U_HIDE_DEPRECATED_API > //------------------------------------------------------------------------- > // Iteration API > //------------------------------------------------------------------------- >@@ -452,7 +461,7 @@ public: > * The getIndex() is not changed. > * > * @return the current normalized code point >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UChar32 current(void); > >@@ -462,7 +471,7 @@ public: > * (Post-increment semantics.) > * > * @return the first normalized code point >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UChar32 first(void); > >@@ -472,7 +481,7 @@ public: > * (Pre-decrement semantics.) > * > * @return the last normalized code point >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UChar32 last(void); > >@@ -488,7 +497,7 @@ public: > * The C API unorm_next() is more efficient and does not have this ambiguity. > * > * @return the next normalized code point >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UChar32 next(void); > >@@ -504,7 +513,7 @@ public: > * The C API unorm_previous() is more efficient and does not have this ambiguity. > * > * @return the previous normalized code point >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UChar32 previous(void); > >@@ -515,14 +524,14 @@ public: > * specified here. > * > * @param index the desired index in the input text. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void setIndexOnly(int32_t index); > > /** > * Reset the index to the beginning of the text. > * This is equivalent to setIndexOnly(startIndex)). >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void reset(void); > >@@ -538,7 +547,7 @@ public: > * was returned from with previous(). > * > * @return the current index in the input text >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > int32_t getIndex(void) const; > >@@ -548,7 +557,7 @@ public: > * over which this <code>Normalizer</code> is iterating. > * > * @return the smallest index in the input text where the Normalizer operates >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > int32_t startIndex(void) const; > >@@ -560,7 +569,7 @@ public: > * before this index. > * > * @return the first index in the input text where the Normalizer does not operate >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > int32_t endIndex(void) const; > >@@ -570,7 +579,7 @@ public: > * > * @param that a Normalizer object to compare this one to > * @return comparison result >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UBool operator==(const Normalizer& that) const; > >@@ -580,7 +589,7 @@ public: > * > * @param that a Normalizer object to compare this one to > * @return comparison result >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > inline UBool operator!=(const Normalizer& that) const; > >@@ -588,7 +597,7 @@ public: > * Returns a pointer to a new Normalizer that is a clone of this one. > * The caller is responsible for deleting the new clone. > * @return a pointer to a new Normalizer >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > Normalizer* clone(void) const; > >@@ -596,7 +605,7 @@ public: > * Generates a hash code for this iterator. > * > * @return the hash code >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > int32_t hashCode(void) const; > >@@ -617,7 +626,7 @@ public: > * <p> > * @param newMode the new mode for this <code>Normalizer</code>. > * @see #getUMode >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void setMode(UNormalizationMode newMode); > >@@ -629,7 +638,7 @@ public: > * > * @return the mode for this <code>Normalizer</code> > * @see #setMode >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UNormalizationMode getUMode(void) const; > >@@ -647,7 +656,7 @@ public: > * turn the option(s) on and <code>FALSE</code> to turn it/them off. > * > * @see #getOption >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void setOption(int32_t option, > UBool value); >@@ -660,7 +669,7 @@ public: > * @param option the option(s) that are to be checked > * @return TRUE if any of the option(s) are set > * @see #setOption >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > UBool getOption(int32_t option) const; > >@@ -670,7 +679,7 @@ public: > * > * @param newText a string that replaces the current input text > * @param status a UErrorCode >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void setText(const UnicodeString& newText, > UErrorCode &status); >@@ -681,7 +690,7 @@ public: > * > * @param newText a CharacterIterator object that replaces the current input text > * @param status a UErrorCode >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void setText(const CharacterIterator& newText, > UErrorCode &status); >@@ -693,30 +702,31 @@ public: > * @param newText a string that replaces the current input text > * @param length the length of the string, or -1 if NUL-terminated > * @param status a UErrorCode >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ >- void setText(const UChar* newText, >+ void setText(ConstChar16Ptr newText, > int32_t length, > UErrorCode &status); > /** > * Copies the input text into the UnicodeString argument. > * > * @param result Receives a copy of the text under iteration. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > void getText(UnicodeString& result); > > /** > * ICU "poor man's RTTI", returns a UClassID for this class. > * @returns a UClassID for this class. >- * @stable ICU 2.2 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > static UClassID U_EXPORT2 getStaticClassID(); >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * ICU "poor man's RTTI", returns a UClassID for the actual class. > * @return a UClassID for the actual class. >- * @stable ICU 2.2 >+ * @deprecated ICU 56 Use Normalizer2 instead. > */ > virtual UClassID getDynamicClassID() const; > >@@ -742,7 +752,7 @@ private: > > FilteredNormalizer2*fFilteredNorm2; // owned if not NULL > const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 >- UNormalizationMode fUMode; >+ UNormalizationMode fUMode; // deprecated > int32_t fOptions; > > // The input text and our position in it >@@ -761,6 +771,7 @@ private: > // Inline implementations > //------------------------------------------------------------------------- > >+#ifndef U_HIDE_DEPRECATED_API > inline UBool > Normalizer::operator!= (const Normalizer& other) const > { return ! operator==(other); } >@@ -778,14 +789,15 @@ Normalizer::isNormalized(const UnicodeString& source, > UErrorCode &status) { > return isNormalized(source, mode, 0, status); > } >+#endif /* U_HIDE_DEPRECATED_API */ > > inline int32_t > Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, > uint32_t options, > UErrorCode &errorCode) { > // all argument checking is done in unorm_compare >- return unorm_compare(s1.getBuffer(), s1.length(), >- s2.getBuffer(), s2.length(), >+ return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(), >+ toUCharPtr(s2.getBuffer()), s2.length(), > options, > &errorCode); > } >diff --git a/Source/WTF/icu/unicode/numfmt.h b/Source/WTF/icu/unicode/numfmt.h >index 164c65769fe8a3f0a7a380d322f1ba23e5a0e84c..68be021055bafb780df50ae650c92cfab8915a1f 100644 >--- a/Source/WTF/icu/unicode/numfmt.h >+++ b/Source/WTF/icu/unicode/numfmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** >-* Copyright (C) 1997-2015, International Business Machines Corporation and others. >+* Copyright (C) 1997-2016, International Business Machines Corporation and others. > * All Rights Reserved. > ******************************************************************************** > * >@@ -56,6 +58,12 @@ class StringEnumeration; > * formatting and parsing a number. Also provides methods for > * determining which locales have number formats, and what their names > * are. >+ * >+ * <p><strong>NOTE:</strong> Starting in ICU 60, there is a new set of APIs for localized number >+ * formatting that are designed to be an improvement over DecimalFormat. New users are discouraged >+ * from using DecimalFormat. For more information, see numberformatter.h. >+ * >+ * \headerfile unicode/numfmt.h "unicode/numfmt.h" > * <P> > * NumberFormat helps you to format and parse numbers for any locale. > * Your code can be completely independent of the locale conventions >@@ -64,16 +72,22 @@ class StringEnumeration; > * <P> > * To format a number for the current Locale, use one of the static > * factory methods: >- * <pre> > * \code >- * double myNumber = 7.0; >- * UnicodeString myString; >- * UErrorCode success = U_ZERO_ERROR; >- * NumberFormat* nf = NumberFormat::createInstance(success) >- * nf->format(myNumber, myString); >- * cout << " Example 1: " << myString << endl; >+ * #include <iostream> >+ * #include "unicode/numfmt.h" >+ * #include "unicode/unistr.h" >+ * #include "unicode/ustream.h" >+ * using namespace std; >+ * >+ * int main() { >+ * double myNumber = 7.0; >+ * UnicodeString myString; >+ * UErrorCode success = U_ZERO_ERROR; >+ * NumberFormat* nf = NumberFormat::createInstance(success); >+ * nf->format(myNumber, myString); >+ * cout << " Example 1: " << myString << endl; >+ * } > * \endcode >- * </pre> > * Note that there are additional factory methods within subclasses of > * NumberFormat. > * <P> >@@ -81,68 +95,56 @@ class StringEnumeration; > * the format and use it multiple times so that the system doesn't > * have to fetch the information about the local language and country > * conventions multiple times. >- * <pre> > * \code > * UnicodeString myString; > * UErrorCode success = U_ZERO_ERROR; >- * nf = NumberFormat::createInstance( success ); >- * int32_t a[] = { 123, 3333, -1234567 }; >- * const int32_t a_len = sizeof(a) / sizeof(a[0]); >- * myString.remove(); >- * for (int32_t i = 0; i < a_len; i++) { >- * nf->format(a[i], myString); >- * myString += " ; "; >+ * NumberFormat *nf = NumberFormat::createInstance( success ); >+ * for (int32_t number: {123, 3333, -1234567}) { >+ * nf->format(number, myString); >+ * myString += "; "; > * } > * cout << " Example 2: " << myString << endl; > * \endcode >- * </pre> > * To format a number for a different Locale, specify it in the >- * call to createInstance(). >- * <pre> >+ * call to \c createInstance(). > * \code >- * nf = NumberFormat::createInstance( Locale::FRENCH, success ); >+ * nf = NumberFormat::createInstance(Locale::getFrench(), success); > * \endcode >- * </pre> >- * You can use a NumberFormat to parse also. >- * <pre> >+ * You can use a \c NumberFormat to parse also. > * \code > * UErrorCode success; > * Formattable result(-999); // initialized with error code > * nf->parse(myString, result, success); > * \endcode >- * </pre> >- * Use createInstance to get the normal number format for that country. >- * There are other static factory methods available. Use getCurrency >- * to get the currency number format for that country. Use getPercent >+ * Use \c createInstance() to get the normal number format for a \c Locale. >+ * There are other static factory methods available. Use \c createCurrencyInstance() >+ * to get the currency number format for that country. Use \c createPercentInstance() > * to get a format for displaying percentages. With this format, a > * fraction from 0.53 is displayed as 53%. > * <P> >- * Starting from ICU 4.2, you can use createInstance() by passing in a 'style' >- * as parameter to get the correct instance. >- * For example, >- * use createInstance(...kNumberStyle...) to get the normal number format, >- * createInstance(...kPercentStyle...) to get a format for displaying >- * percentage, >- * createInstance(...kScientificStyle...) to get a format for displaying >- * scientific number, >- * createInstance(...kCurrencyStyle...) to get the currency number format, >- * in which the currency is represented by its symbol, for example, "$3.00". >- * createInstance(...kIsoCurrencyStyle...) to get the currency number format, >- * in which the currency is represented by its ISO code, for example "USD3.00". >- * createInstance(...kPluralCurrencyStyle...) to get the currency number format, >+ * The type of number formatting can be specified by passing a 'style' parameter to \c createInstance(). >+ * For example, use\n >+ * \c createInstance(locale, UNUM_DECIMAL, errorCode) to get the normal number format,\n >+ * \c createInstance(locale, UNUM_PERCENT, errorCode) to get a format for displaying percentage,\n >+ * \c createInstance(locale, UNUM_SCIENTIFIC, errorCode) to get a format for displaying scientific number,\n >+ * \c createInstance(locale, UNUM_CURRENCY, errorCode) to get the currency number format, >+ * in which the currency is represented by its symbol, for example, "$3.00".\n >+ * \c createInstance(locale, UNUM_CURRENCY_ISO, errorCode) to get the currency number format, >+ * in which the currency is represented by its ISO code, for example "USD3.00".\n >+ * \c createInstance(locale, UNUM_CURRENCY_PLURAL, errorCode) to get the currency number format, > * in which the currency is represented by its full name in plural format, > * for example, "3.00 US dollars" or "1.00 US dollar". > * <P> > * You can also control the display of numbers with such methods as >- * getMinimumFractionDigits. If you want even more control over the >+ * \c getMinimumFractionDigits(). If you want even more control over the > * format or parsing, or want to give your users more control, you can >- * try casting the NumberFormat you get from the factory methods to a >- * DecimalNumberFormat. This will work for the vast majority of >- * countries; just remember to put it in a try block in case you >+ * try dynamic_casting the \c NumberFormat you get from the factory methods to a >+ * \c DecimalFormat. This will work for the vast majority of >+ * countries; just remember to test for NULL in case you > * encounter an unusual one. > * <P> > * You can also use forms of the parse and format methods with >- * ParsePosition and FieldPosition to allow you to: >+ * \c ParsePosition and \c FieldPosition to allow you to: > * <ul type=round> > * <li>(a) progressively parse through pieces of a string. > * <li>(b) align the decimal point and other areas. >@@ -150,8 +152,8 @@ class StringEnumeration; > * For example, you can align numbers in two ways. > * <P> > * If you are using a monospaced font with spacing for alignment, you >- * can pass the FieldPosition in your format call, with field = >- * INTEGER_FIELD. On output, getEndIndex will be set to the offset >+ * can pass the \c FieldPosition in your format call, with field = >+ * \c UNUM_INTEGER_FIELD. On output, \c getEndIndex will be set to the offset > * between the last character of the integer and the decimal. Add > * (desiredSpaceCount - getEndIndex) spaces at the front of the > * string. >@@ -171,6 +173,33 @@ class StringEnumeration; > */ > class U_I18N_API NumberFormat : public Format { > public: >+ /** >+ * Rounding mode. >+ * >+ * <p> >+ * For more detail on rounding modes, see: >+ * http://userguide.icu-project.org/formatparse/numbers/rounding-modes >+ * >+ * @stable ICU 2.4 >+ */ >+ enum ERoundingMode { >+ kRoundCeiling, /**< Round towards positive infinity */ >+ kRoundFloor, /**< Round towards negative infinity */ >+ kRoundDown, /**< Round towards zero */ >+ kRoundUp, /**< Round away from zero */ >+ kRoundHalfEven, /**< Round towards the nearest integer, or >+ towards the nearest even integer if equidistant */ >+ kRoundHalfDown, /**< Round towards the nearest integer, or >+ towards zero if equidistant */ >+ kRoundHalfUp, /**< Round towards the nearest integer, or >+ away from zero if equidistant */ >+ /** >+ * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. >+ * @stable ICU 4.8 >+ */ >+ kRoundUnnecessary >+ }; >+ > /** > * Alignment Field constants used to construct a FieldPosition object. > * Signifies that the position of the integer part or fraction part of >@@ -271,7 +300,7 @@ public: > * NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(const Formattable& obj, > UnicodeString& appendTo, >@@ -394,7 +423,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(double number, > UnicodeString& appendTo, >@@ -446,7 +475,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(int32_t number, > UnicodeString& appendTo, >@@ -479,6 +508,7 @@ public: > * Result is appended to existing contents. > * @param pos On input: an alignment field, if desired. > * On output: the offsets of the alignment field. >+ * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. > * @internal > */ >@@ -498,7 +528,7 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ > virtual UnicodeString& format(int64_t number, > UnicodeString& appendTo, >@@ -519,15 +549,15 @@ public: > * Can be NULL. > * @param status Output param filled with success/failure status. > * @return Reference to 'appendTo' parameter. >- * @stable 4.4 >+ * @stable ICU 4.4 > */ >- virtual UnicodeString& format(const StringPiece &number, >+ virtual UnicodeString& format(StringPiece number, > UnicodeString& appendTo, > FieldPositionIterator* posIter, > UErrorCode& status) const; > public: > /** >- * Format a decimal number. >+ * Format a decimal number. > * The number is a DigitList wrapper onto a floating point decimal number. > * The default implementation in NumberFormat converts the decimal number > * to a double and formats that. Subclasses of NumberFormat that want >@@ -549,7 +579,7 @@ public: > UErrorCode& status) const; > > /** >- * Format a decimal number. >+ * Format a decimal number. > * The number is a DigitList wrapper onto a floating point decimal number. > * The default implementation in NumberFormat converts the decimal number > * to a double and formats that. Subclasses of NumberFormat that want >@@ -659,8 +689,8 @@ public: > /** > * Sets whether lenient parsing should be enabled (it is off by default). > * >- * @param enable <code>TRUE</code> if lenient parsing should be used, >- * <code>FALSE</code> otherwise. >+ * @param enable \c TRUE if lenient parsing should be used, >+ * \c FALSE otherwise. > * @stable ICU 4.8 > */ > virtual void setLenient(UBool enable); >@@ -668,28 +698,23 @@ public: > /** > * Returns whether lenient parsing is enabled (it is off by default). > * >- * @return <code>TRUE</code> if lenient parsing is enabled, >- * <code>FALSE</code> otherwise. >+ * @return \c TRUE if lenient parsing is enabled, >+ * \c FALSE otherwise. > * @see #setLenient > * @stable ICU 4.8 > */ > virtual UBool isLenient(void) const; > > /** >- * Returns the default number format for the current default >- * locale. The default format is one of the styles provided by >- * the other factory methods: getNumberInstance, >- * getCurrencyInstance or getPercentInstance. Exactly which one >- * is locale dependant. >+ * Create a default style NumberFormat for the current default locale. >+ * The default formatting style is locale dependent. > * @stable ICU 2.0 > */ > static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); > > /** >- * Returns the default number format for the specified locale. >- * The default format is one of the styles provided by the other >- * factory methods: getNumberInstance, getCurrencyInstance or >- * getPercentInstance. Exactly which one is locale dependant. >+ * Create a default style NumberFormat for the specified locale. >+ * The default formatting style is locale dependent. > * @param inLocale the given locale. > * @stable ICU 2.0 > */ >@@ -697,7 +722,7 @@ public: > UErrorCode&); > > /** >- * Creates the specified decimal format style of the desired locale. >+ * Create a specific style NumberFormat for the specified locale. > * @param desiredLocale the given locale. > * @param style the given style. > * @param errorCode Output param filled with success/failure status. >@@ -821,7 +846,7 @@ public: > * Returns true if grouping is used in this format. For example, > * in the English locale, with grouping on, the number 1234567 > * might be formatted as "1,234,567". The grouping separator as >- * well as the size of each group is locale dependant and is >+ * well as the size of each group is locale dependent and is > * determined by sub-classes of NumberFormat. > * @see setGroupingUsed > * @stable ICU 2.0 >@@ -938,7 +963,7 @@ public: > * @param ec input-output error code > * @stable ICU 3.0 > */ >- virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); >+ virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); > > /** > * Gets the currency used to display currency >@@ -947,7 +972,7 @@ public: > * the currency in use, or a pointer to the empty string. > * @stable ICU 2.6 > */ >- const UChar* getCurrency() const; >+ const char16_t* getCurrency() const; > > /** > * Set a particular UDisplayContext value in the formatter, such as >@@ -955,7 +980,7 @@ public: > * @param value The UDisplayContext value to set. > * @param status Input/output status. If at entry this indicates a failure > * status, the function will do nothing; otherwise this will be >- * updated with any new status from the function. >+ * updated with any new status from the function. > * @stable ICU 53 > */ > virtual void setContext(UDisplayContext value, UErrorCode& status); >@@ -966,12 +991,27 @@ public: > * @param type The UDisplayContextType whose value to return > * @param status Input/output status. If at entry this indicates a failure > * status, the function will do nothing; otherwise this will be >- * updated with any new status from the function. >+ * updated with any new status from the function. > * @return The UDisplayContextValue for the specified type. > * @stable ICU 53 > */ > virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; > >+ /** >+ * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary >+ * if the subclass does not support rounding. >+ * @return A rounding mode >+ * @draft ICU 60 >+ */ >+ virtual ERoundingMode getRoundingMode(void) const; >+ >+ /** >+ * Set the rounding mode. If a subclass does not support rounding, this will do nothing. >+ * @param roundingMode A rounding mode >+ * @draft ICU 60 >+ */ >+ virtual void setRoundingMode(ERoundingMode roundingMode); >+ > public: > > /** >@@ -1025,7 +1065,7 @@ protected: > * have a capacity of at least 4 > * @internal > */ >- virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; >+ virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; > > #ifndef U_HIDE_INTERNAL_API > /** >@@ -1062,15 +1102,17 @@ private: > int32_t fMinFractionDigits; > > protected: >+ /** \internal */ > static const int32_t gDefaultMaxIntegerDigits; >+ /** \internal */ > static const int32_t gDefaultMinIntegerDigits; >- >+ > private: > UBool fParseIntegerOnly; > UBool fLenient; // TRUE => lenient parse is enabled > > // ISO currency code >- UChar fCurrency[4]; >+ char16_t fCurrency[4]; > > UDisplayContext fCapitalizationContext; > >diff --git a/Source/WTF/icu/unicode/numsys.h b/Source/WTF/icu/unicode/numsys.h >index deeda2cabcde34dd33042ad71bd8d788ce82e069..9ec3f13fd10b3e15dba82b6eee39ac34c03426e1 100644 >--- a/Source/WTF/icu/unicode/numsys.h >+++ b/Source/WTF/icu/unicode/numsys.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2014, International Business Machines Corporation and >@@ -191,7 +193,7 @@ private: > > void setAlgorithmic(UBool algorithmic); > >- void setDesc(UnicodeString desc); >+ void setDesc(const UnicodeString &desc); > > void setName(const char* name); > >diff --git a/Source/WTF/icu/unicode/parseerr.h b/Source/WTF/icu/unicode/parseerr.h >index 44ff00811de7bc59b32ed4677050fb7e1b4f113b..fc1e3f4c8e60a1feba12a4b72194b1df7570ad43 100644 >--- a/Source/WTF/icu/unicode/parseerr.h >+++ b/Source/WTF/icu/unicode/parseerr.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2005, International Business Machines >diff --git a/Source/WTF/icu/unicode/parsepos.h b/Source/WTF/icu/unicode/parsepos.h >index cdf49e04ec27c2666e7d413d0adebee4d53dc7cd..bbebca7b5713a2aa12d2fa1fd4331c1e321a449d 100644 >--- a/Source/WTF/icu/unicode/parsepos.h >+++ b/Source/WTF/icu/unicode/parsepos.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. > ******************************************************************************* >diff --git a/Source/WTF/icu/unicode/platform.h b/Source/WTF/icu/unicode/platform.h >index 482900069d10ca872693ea819c5e434ef4ceed2c..f220b1fc34d8e2a90771b49aeee4b2290bf8bfca 100644 >--- a/Source/WTF/icu/unicode/platform.h >+++ b/Source/WTF/icu/unicode/platform.h >@@ -1,7 +1,9 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >-* Copyright (C) 1997-2015, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > * > ****************************************************************************** >@@ -130,6 +132,8 @@ > #define U_PF_BROWSER_NATIVE_CLIENT 4020 > /** Android is based on Linux. @internal */ > #define U_PF_ANDROID 4050 >+/** Fuchsia is a POSIX-ish platform. @internal */ >+#define U_PF_FUCHSIA 4100 > /* Maximum value for Linux-based platform is 4499 */ > /** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ > #define U_PF_OS390 9000 >@@ -148,8 +152,10 @@ > # define U_PLATFORM U_PF_ANDROID > /* Android wchar_t support depends on the API level. */ > # include <android/api-level.h> >-#elif defined(__native_client__) >+#elif defined(__pnacl__) || defined(__native_client__) > # define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT >+#elif defined(__Fuchsia__) >+# define U_PLATFORM U_PF_FUCHSIA > #elif defined(linux) || defined(__linux__) || defined(__linux) > # define U_PLATFORM U_PF_LINUX > #elif defined(__APPLE__) && defined(__MACH__) >@@ -160,6 +166,9 @@ > # define U_PLATFORM U_PF_DARWIN > # endif > #elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__) >+# if defined(__FreeBSD__) >+# include <sys/endian.h> >+# endif > # define U_PLATFORM U_PF_BSD > #elif defined(sun) || defined(__sun) > /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */ >@@ -187,6 +196,20 @@ > # define U_PLATFORM U_PF_UNKNOWN > #endif > >+/** >+ * \def UPRV_INCOMPLETE_CPP11_SUPPORT >+ * This switch turns off ICU 60 NumberFormatter code. >+ * By default, this switch is enabled on AIX and z/OS, >+ * which have poor C++11 support. >+ * >+ * NOTE: This switch is intended to be temporary; see #13393. >+ * >+ * @internal >+ */ >+#ifndef UPRV_INCOMPLETE_CPP11_SUPPORT >+# define UPRV_INCOMPLETE_CPP11_SUPPORT (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_SOLARIS ) >+#endif >+ > /** > * \def CYGWINMSVC > * Defined if this is Windows with Cygwin, but using MSVC rather than gcc. >@@ -228,6 +251,18 @@ > # define U_PLATFORM_HAS_WIN32_API 0 > #endif > >+/** >+ * \def U_PLATFORM_HAS_WINUWP_API >+ * Defines whether target is intended for Universal Windows Platform API >+ * Set to 1 for Windows10 Release Solution Configuration >+ * @internal >+ */ >+#ifdef U_PLATFORM_HAS_WINUWP_API >+ /* Use the predefined value. */ >+#else >+# define U_PLATFORM_HAS_WINUWP_API 0 >+#endif >+ > /** > * \def U_PLATFORM_IMPLEMENTS_POSIX > * Defines whether the platform implements (most of) the POSIX API. >@@ -313,42 +348,6 @@ > # define U_HAVE_INTTYPES_H U_HAVE_STDINT_H > #endif > >-/** >- * \def U_IOSTREAM_SOURCE >- * Defines what support for C++ streams is available. >- * >- * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available >- * (the ISO/IEC C++ FDIS was published in November 1997), and then >- * one should qualify streams using the std namespace in ICU header >- * files. >- * Starting with ICU 49, this is the only supported version. >- * >- * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is >- * available instead (in June 1985 Stroustrup published >- * "An Extensible I/O Facility for C++" at the summer USENIX conference). >- * Starting with ICU 49, this version is not supported any more. >- * >- * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711), >- * then C++ streams are not available and >- * support for them will be silently suppressed in ICU. >- * >- * @internal >- */ >-#ifndef U_IOSTREAM_SOURCE >-#define U_IOSTREAM_SOURCE 199711 >-#endif >- >-/** >- * \def U_HAVE_STD_STRING >- * Defines whether the standard C++ (STL) <string> header is available. >- * @internal >- */ >-#ifdef U_HAVE_STD_STRING >- /* Use the predefined value. */ >-#else >-# define U_HAVE_STD_STRING 1 >-#endif >- > /*===========================================================================*/ > /** @{ Compiler and environment features */ > /*===========================================================================*/ >@@ -425,10 +424,25 @@ > # define U_HAVE_DEBUG_LOCATION_NEW 0 > #endif > >-/* Compatibility with non clang compilers */ >+/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */ > #ifndef __has_attribute > # define __has_attribute(x) 0 > #endif >+#ifndef __has_cpp_attribute >+# define __has_cpp_attribute(x) 0 >+#endif >+#ifndef __has_builtin >+# define __has_builtin(x) 0 >+#endif >+#ifndef __has_feature >+# define __has_feature(x) 0 >+#endif >+#ifndef __has_extension >+# define __has_extension(x) 0 >+#endif >+#ifndef __has_warning >+# define __has_warning(x) 0 >+#endif > > /** > * \def U_MALLOC_ATTR >@@ -454,6 +468,77 @@ > # define U_ALLOC_SIZE_ATTR2(X,Y) > #endif > >+/** >+ * \def U_CPLUSPLUS_VERSION >+ * 0 if no C++; 1, 11, 14, ... if C++. >+ * Support for specific features cannot always be determined by the C++ version alone. >+ * @internal >+ */ >+#ifdef U_CPLUSPLUS_VERSION >+# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus) >+# undef U_CPLUSPLUS_VERSION >+# define U_CPLUSPLUS_VERSION 0 >+# endif >+ /* Otherwise use the predefined value. */ >+#elif !defined(__cplusplus) >+# define U_CPLUSPLUS_VERSION 0 >+#elif __cplusplus >= 201402L >+# define U_CPLUSPLUS_VERSION 14 >+#elif __cplusplus >= 201103L >+# define U_CPLUSPLUS_VERSION 11 >+#else >+ // C++98 or C++03 >+# define U_CPLUSPLUS_VERSION 1 >+#endif >+ >+#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) >+// add in std::nullptr_t >+namespace std { >+ typedef decltype(nullptr) nullptr_t; >+}; >+#endif >+ >+/** >+ * \def U_NOEXCEPT >+ * "noexcept" if supported, otherwise empty. >+ * Some code, especially STL containers, uses move semantics of objects only >+ * if the move constructor and the move operator are declared as not throwing exceptions. >+ * @internal >+ */ >+#ifdef U_NOEXCEPT >+ /* Use the predefined value. */ >+#elif defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS /* Visual Studio */ >+# define U_NOEXCEPT >+#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_noexcept) || __has_extension(cxx_noexcept) \ >+ || (defined(_MSC_VER) && _MSC_VER >= 1900) /* Visual Studio 2015 */ >+# define U_NOEXCEPT noexcept >+#else >+# define U_NOEXCEPT >+#endif >+ >+/** >+ * \def U_FALLTHROUGH >+ * Annotate intentional fall-through between switch labels. >+ * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough >+ * @internal >+ */ >+#ifndef __cplusplus >+ // Not for C. >+#elif defined(U_FALLTHROUGH) >+ // Use the predefined value. >+#elif defined(__clang__) >+ // Test for compiler vs. feature separately. >+ // Other compilers might choke on the feature test. >+# if __has_cpp_attribute(clang::fallthrough) || \ >+ (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")) >+# define U_FALLTHROUGH [[clang::fallthrough]] >+# endif >+#endif >+ >+#ifndef U_FALLTHROUGH >+# define U_FALLTHROUGH >+#endif >+ > /** @} */ > > /*===========================================================================*/ >@@ -669,8 +754,9 @@ > * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but > * does not support u"abc" string literals. > * C++11 and C11 require support for UTF-16 literals >+ * TODO: Fix for plain C. Doesn't work on Mac. > */ >-# if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) >+# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) > # define U_HAVE_CHAR16_T 1 > # else > # define U_HAVE_CHAR16_T 0 >@@ -748,6 +834,12 @@ > * This is only used for non-ICU-API functions. > * When a function is a public ICU API, > * you must use the U_CAPI and U_EXPORT2 qualifiers. >+ * >+ * Please note, you need to use U_CALLCONV after the *. >+ * >+ * NO : "static const char U_CALLCONV *func( . . . )" >+ * YES: "static const char* U_CALLCONV func( . . . )" >+ * > * @stable ICU 2.0 > */ > #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) >@@ -756,6 +848,16 @@ > # define U_CALLCONV U_EXPORT2 > #endif > >+/** >+ * \def U_CALLCONV_FPTR >+ * Similar to U_CALLCONV, but only used on function pointers. >+ * @internal >+ */ >+#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) >+# define U_CALLCONV_FPTR U_CALLCONV >+#else >+# define U_CALLCONV_FPTR >+#endif > /* @} */ > > #endif >diff --git a/Source/WTF/icu/unicode/plurfmt.h b/Source/WTF/icu/unicode/plurfmt.h >index f7099d81e2314f22038f1d1927771c497cdcbf47..fd537c24c21b5da5c1aca1263101f3291d832b01 100644 >--- a/Source/WTF/icu/unicode/plurfmt.h >+++ b/Source/WTF/icu/unicode/plurfmt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2014, International Business Machines Corporation and >diff --git a/Source/WTF/icu/unicode/plurrule.h b/Source/WTF/icu/unicode/plurrule.h >index 6d219fb2f735a598a10269b53451afdb52400745..d372d79c8451791f7ea3a120083a0ea4f5383d51 100644 >--- a/Source/WTF/icu/unicode/plurrule.h >+++ b/Source/WTF/icu/unicode/plurrule.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2008-2015, International Business Machines Corporation and >@@ -27,6 +29,9 @@ > > #include "unicode/format.h" > #include "unicode/upluralrules.h" >+#ifndef U_HIDE_INTERNAL_API >+#include "unicode/numfmt.h" >+#endif /* U_HIDE_INTERNAL_API */ > > /** > * Value returned by PluralRules::getUniqueKeywordValue() when there is no >@@ -38,7 +43,8 @@ > U_NAMESPACE_BEGIN > > class Hashtable; >-class FixedDecimal; >+class IFixedDecimal; >+class VisibleDigitsWithExponent; > class RuleChain; > class PluralRuleParser; > class PluralKeywordEnumeration; >@@ -342,10 +348,30 @@ public: > UnicodeString select(double number) const; > > #ifndef U_HIDE_INTERNAL_API >+ /** >+ * Given a number and a format, returns the keyword of the first applicable >+ * rule for this PluralRules object. >+ * Note: This internal preview interface may be removed in the future if >+ * an architecturally cleaner solution reaches stable status. >+ * @param obj The numeric object for which the rule should be determined. >+ * @param fmt The NumberFormat specifying how the number will be formatted >+ * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). >+ * @param status Input/output parameter. If at entry this indicates a >+ * failure status, the method returns immediately; otherwise >+ * this is set to indicate the outcome of the call. >+ * @return The keyword of the selected rule. Undefined in the case of an error. >+ * @internal ICU 59 technology preview, may be removed in the future >+ */ >+ UnicodeString select(const Formattable& obj, const NumberFormat& fmt, UErrorCode& status) const; >+ >+ /** >+ * @internal >+ */ >+ UnicodeString select(const IFixedDecimal &number) const; > /** > * @internal > */ >- UnicodeString select(const FixedDecimal &number) const; >+ UnicodeString select(const VisibleDigitsWithExponent &number) const; > #endif /* U_HIDE_INTERNAL_API */ > > /** >@@ -376,7 +402,7 @@ public: > /** > * Deprecated Function, does not produce useful results. > * >- * Orginally intended to return all the values for which select() would return the keyword. >+ * Originally intended to return all the values for which select() would return the keyword. > * If the keyword is unknown, returns no values, but this is not an error. If > * the number of values is unlimited, returns no values and -1 as the > * count. >diff --git a/Source/WTF/icu/unicode/ptypes.h b/Source/WTF/icu/unicode/ptypes.h >index b7f711603282c36c732220e7a96c9133dd0250fe..6eaf2dbf03572568102283c57957de8bf95a6f9f 100644 >--- a/Source/WTF/icu/unicode/ptypes.h >+++ b/Source/WTF/icu/unicode/ptypes.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >diff --git a/Source/WTF/icu/unicode/putil.h b/Source/WTF/icu/unicode/putil.h >index df1b17bad0f653510fdf18dd4c78ead94a8a2283..406551a8d86bd0ff63449b8f140909d4dfb2087d 100644 >--- a/Source/WTF/icu/unicode/putil.h >+++ b/Source/WTF/icu/unicode/putil.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >diff --git a/Source/WTF/icu/unicode/rbbi.h b/Source/WTF/icu/unicode/rbbi.h >index d47598a50e6fa3bab2ad49e022aaf396cac329e5..521e502f1190cc8aea31fbf11134aefd83d4c5d5 100644 >--- a/Source/WTF/icu/unicode/rbbi.h >+++ b/Source/WTF/icu/unicode/rbbi.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > *************************************************************************** >-* Copyright (C) 1999-2014 International Business Machines Corporation * >+* Copyright (C) 1999-2016 International Business Machines Corporation * > * and others. All rights reserved. * > *************************************************************************** > >@@ -29,23 +31,14 @@ > #include "unicode/schriter.h" > #include "unicode/uchriter.h" > >- >-struct UTrie; >- > U_NAMESPACE_BEGIN > > /** @internal */ >+class LanguageBreakEngine; > struct RBBIDataHeader; >-class RuleBasedBreakIteratorTables; >-class BreakIterator; > class RBBIDataWrapper; >-class UStack; >-class LanguageBreakEngine; > class UnhandledEngine; >-struct RBBIStateTable; >- >- >- >+class UStack; > > /** > * >@@ -56,15 +49,11 @@ struct RBBIStateTable; > * > * <p>See the ICU User Guide for information on Break Iterator Rules.</p> > * >- * <p>This class is not intended to be subclassed. (Class DictionaryBasedBreakIterator >- * is a subclass, but that relationship is effectively internal to the ICU >- * implementation. The subclassing interface to RulesBasedBreakIterator is >- * not part of the ICU API, and may not remain stable.</p> >- * >+ * <p>This class is not intended to be subclassed.</p> > */ > class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { > >-protected: >+private: > /** > * The UText through which this BreakIterator accesses the text > * @internal >@@ -98,48 +87,50 @@ protected: > */ > RBBIDataWrapper *fData; > >- /** Index of the Rule {tag} values for the most recent match. >+ /** >+ * The iteration state - current position, rule status for the current position, >+ * and whether the iterator ran off the end, yielding UBRK_DONE. >+ * Current position is pinned to be 0 < position <= text.length. >+ * Current position is always set to a boundary. > * @internal > */ >- int32_t fLastRuleStatusIndex; >+ /** >+ * The current position of the iterator. Pinned, 0 < fPosition <= text.length. >+ * Never has the value UBRK_DONE (-1). >+ */ >+ int32_t fPosition; > > /** >- * Rule tag value valid flag. >- * Some iterator operations don't intrinsically set the correct tag value. >- * This flag lets us lazily compute the value if we are ever asked for it. >- * @internal >- */ >- UBool fLastStatusIndexValid; >+ * TODO: >+ */ >+ int32_t fRuleStatusIndex; > > /** >- * Counter for the number of characters encountered with the "dictionary" >- * flag set. >- * @internal >- */ >- uint32_t fDictionaryCharCount; >+ * True when iteration has run off the end, and iterator functions should return UBRK_DONE. >+ */ >+ UBool fDone; > > /** >- * When a range of characters is divided up using the dictionary, the break >- * positions that are discovered are stored here, preventing us from having >- * to use either the dictionary or the state table again until the iterator >- * leaves this range of text. Has the most impact for line breaking. >- * @internal >+ * Cache of previously determined boundary positions. > */ >- int32_t* fCachedBreakPositions; >- >+ public: // TODO: debug, return to private. >+ class BreakCache; >+ BreakCache *fBreakCache; >+ private: > /** >- * The number of elements in fCachedBreakPositions >+ * Counter for the number of characters encountered with the "dictionary" >+ * flag set. > * @internal > */ >- int32_t fNumCachedBreakPositions; >+ uint32_t fDictionaryCharCount; > > /** >- * if fCachedBreakPositions is not null, this indicates which item in the >- * cache the current iteration position refers to >- * @internal >+ * Cache of boundary positions within a region of text that has been >+ * sub-divided by dictionary based breaking. > */ >- int32_t fPositionInCache; >- >+ class DictionaryCache; >+ DictionaryCache *fDictionaryCache; >+ > /** > * > * If present, UStack of LanguageBreakEngine objects that might handle >@@ -148,7 +139,7 @@ protected: > * @internal > */ > UStack *fLanguageBreakEngines; >- >+ > /** > * > * If present, the special LanguageBreakEngine used for handling >@@ -157,32 +148,18 @@ protected: > * @internal > */ > UnhandledEngine *fUnhandledBreakEngine; >- >+ > /** > * > * The type of the break iterator, or -1 if it has not been set. > * @internal > */ > int32_t fBreakType; >- >-protected: >+ > //======================================================================= > // constructors > //======================================================================= > >-#ifndef U_HIDE_INTERNAL_API >- /** >- * Constant to be used in the constructor >- * RuleBasedBreakIterator(RBBIDataHeader*, EDontAdopt, UErrorCode &); >- * which does not adopt the memory indicated by the RBBIDataHeader* >- * parameter. >- * >- * @internal >- */ >- enum EDontAdopt { >- kDontAdopt >- }; >- > /** > * Constructor from a flattened set of RBBI data in malloced memory. > * RulesBasedBreakIterators built from a custom set of rules >@@ -195,24 +172,11 @@ protected: > */ > RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); > >- /** >- * Constructor from a flattened set of RBBI data in memory which need not >- * be malloced (e.g. it may be a memory-mapped file, etc.). >- * >- * This version does not adopt the memory, and does not >- * free it when done. >- * @internal >- */ >- RuleBasedBreakIterator(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status); >-#endif /* U_HIDE_INTERNAL_API */ >- >- >+ /** @internal */ > friend class RBBIRuleBuilder; > /** @internal */ > friend class BreakIterator; > >- >- > public: > > /** Default constructor. Creates an empty shell of an iterator, with no >@@ -248,7 +212,7 @@ public: > * constuction from source rules. > * > * Ownership of the storage containing the compiled rules remains with the >- * caller of this function. The compiled rules must not be modified or >+ * caller of this function. The compiled rules must not be modified or > * deleted during the life of the break iterator. > * > * The compiled rules are not compatible across different major versions of ICU. >@@ -402,6 +366,11 @@ public: > /** > * Set the iterator to analyze a new piece of text. This function resets > * the current iteration position to the beginning of the text. >+ * >+ * The BreakIterator will retain a reference to the supplied string. >+ * The caller must not modify or delete the text while the BreakIterator >+ * retains the reference. >+ * > * @param newText The text to analyze. > * @stable ICU 2.0 > */ >@@ -491,7 +460,10 @@ public: > virtual UBool isBoundary(int32_t offset); > > /** >- * Returns the current iteration position. >+ * Returns the current iteration position. Note that UBRK_DONE is never >+ * returned from this function; if iteration has run to the end of a >+ * string, current() will return the length of the string while >+ * next() will return UBRK_DONE). > * @return The current iteration position. > * @stable ICU 2.0 > */ >@@ -523,6 +495,7 @@ public: > * Note: this function is not thread safe. It should not have been > * declared const, and the const remains only for compatibility > * reasons. (The function is logically const, but not bit-wise const). >+ * TODO: check this. Probably thread safe now. > * <p> > * @return the status from the break rule that determined the most recently > * returned break position. >@@ -661,7 +634,7 @@ public: > virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status); > > >-protected: >+private: > //======================================================================= > // implementation > //======================================================================= >@@ -670,85 +643,44 @@ protected: > * in text or iteration position. > * @internal > */ >- virtual void reset(void); >- >-#if 0 >- /** >- * Return true if the category lookup for this char >- * indicates that it is in the set of dictionary lookup chars. >- * This function is intended for use by dictionary based break iterators. >- * @return true if the category lookup for this char >- * indicates that it is in the set of dictionary lookup chars. >- * @internal >- */ >- virtual UBool isDictionaryChar(UChar32); >- >- /** >- * Get the type of the break iterator. >- * @internal >- */ >- virtual int32_t getBreakType() const; >-#endif >+ void reset(void); > > /** > * Set the type of the break iterator. > * @internal > */ >- virtual void setBreakType(int32_t type); >+ void setBreakType(int32_t type); > >-#ifndef U_HIDE_INTERNAL_API > /** > * Common initialization function, used by constructors and bufferClone. > * @internal > */ >- void init(); >-#endif /* U_HIDE_INTERNAL_API */ >- >-private: >+ void init(UErrorCode &status); > > /** >- * This method backs the iterator back up to a "safe position" in the text. >- * This is a position that we know, without any context, must be a break position. >- * The various calling methods then iterate forward from this safe position to >- * the appropriate position to return. (For more information, see the description >- * of buildBackwardsStateTable() in RuleBasedBreakIterator.Builder.) >- * @param statetable state table used of moving backwards >+ * Iterate backwards from an arbitrary position in the input text using the Safe Reverse rules. >+ * This locates a "Safe Position" from which the forward break rules >+ * will operate correctly. A Safe Position is not necessarily a boundary itself. >+ * >+ * @param fromPosition the position in the input text to begin the iteration. > * @internal > */ >- int32_t handlePrevious(const RBBIStateTable *statetable); >+ int32_t handlePrevious(int32_t fromPosition); > > /** >- * This method is the actual implementation of the next() method. All iteration >- * vectors through here. This method initializes the state machine to state 1 >- * and advances through the text character by character until we reach the end >- * of the text or the state machine transitions to state 0. We update our return >- * value every time the state machine passes through a possible end state. >- * @param statetable state table used of moving forwards >- * @internal >- */ >- int32_t handleNext(const RBBIStateTable *statetable); >- >-protected: >- >-#ifndef U_HIDE_INTERNAL_API >- /** >- * This is the function that actually implements dictionary-based >- * breaking. Covering at least the range from startPos to endPos, >- * it checks for dictionary characters, and if it finds them determines >- * the appropriate object to deal with them. It may cache found breaks in >- * fCachedBreakPositions as it goes. It may well also look at text outside >- * the range startPos to endPos. >- * If going forward, endPos is the normal Unicode break result, and >- * if goind in reverse, startPos is the normal Unicode break result >- * @param startPos The start position of a range of text >- * @param endPos The end position of a range of text >- * @param reverse The call is for the reverse direction >+ * Find a rule-based boundary by running the state machine. >+ * Input >+ * fPosition, the position in the text to begin from. >+ * Output >+ * fPosition: the boundary following the starting position. >+ * fDictionaryCharCount the number of dictionary characters encountered. >+ * If > 0, the segment will be further subdivided >+ * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. >+ * > * @internal > */ >- int32_t checkDictionary(int32_t startPos, int32_t endPos, UBool reverse); >-#endif /* U_HIDE_INTERNAL_API */ >+ int32_t handleNext(); > >-private: > > /** > * This function returns the appropriate LanguageBreakEngine for a >@@ -758,11 +690,14 @@ private: > */ > const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); > >+ public: >+#ifndef U_HIDE_INTERNAL_API > /** >- * @internal >+ * Debugging function only. >+ * @internal > */ >- void makeRuleStatusValid(); >- >+ void dumpCache(); >+#endif /* U_HIDE_INTERNAL_API */ > }; > > //------------------------------------------------------------------------------ >diff --git a/Source/WTF/icu/unicode/rbnf.h b/Source/WTF/icu/unicode/rbnf.h >index 7058c9671cb117c4e30e9dc6ea5900c59813adc1..12925443b2d8fa6372e6e6efc610d6d35b020c3a 100644 >--- a/Source/WTF/icu/unicode/rbnf.h >+++ b/Source/WTF/icu/unicode/rbnf.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 1997-2015, International Business Machines Corporation and others. >@@ -38,6 +40,7 @@ > > U_NAMESPACE_BEGIN > >+class NFRule; > class NFRuleSet; > class LocalizationInfo; > class PluralFormat; >@@ -53,7 +56,13 @@ enum URBNFRuleSetTag { > URBNF_ORDINAL, > URBNF_DURATION, > URBNF_NUMBERING_SYSTEM, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal URBNFRuleSetTag value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > URBNF_COUNT >+#endif // U_HIDE_DEPRECATED_API > }; > > /** >@@ -264,17 +273,47 @@ enum URBNFRuleSetTag { > * </tr> > * <tr> > * <td>x.x:</td> >- * <td>The rule is an <em>improper fraction rule.</em></td> >+ * <td>The rule is an <em>improper fraction rule</em>. If the full stop in >+ * the middle of the rule name is replaced with the decimal point >+ * that is used in the language or DecimalFormatSymbols, then that rule will >+ * have precedence when formatting and parsing this rule. For example, some >+ * languages use the comma, and can thus be written as x,x instead. For example, >+ * you can use "x.x: << point >>;x,x: << comma >>;" to >+ * handle the decimal point that matches the language's natural spelling of >+ * the punctuation of either the full stop or comma.</td> > * </tr> > * <tr> > * <td>0.x:</td> >- * <td>The rule is a <em>proper fraction rule.</em></td> >+ * <td>The rule is a <em>proper fraction rule</em>. If the full stop in >+ * the middle of the rule name is replaced with the decimal point >+ * that is used in the language or DecimalFormatSymbols, then that rule will >+ * have precedence when formatting and parsing this rule. For example, some >+ * languages use the comma, and can thus be written as 0,x instead. For example, >+ * you can use "0.x: point >>;0,x: comma >>;" to >+ * handle the decimal point that matches the language's natural spelling of >+ * the punctuation of either the full stop or comma.</td> > * </tr> > * <tr> > * <td>x.0:</td> >- * <td>The rule is a <em>master rule.</em></td> >+ * <td>The rule is a <em>master rule</em>. If the full stop in >+ * the middle of the rule name is replaced with the decimal point >+ * that is used in the language or DecimalFormatSymbols, then that rule will >+ * have precedence when formatting and parsing this rule. For example, some >+ * languages use the comma, and can thus be written as x,0 instead. For example, >+ * you can use "x.0: << point;x,0: << comma;" to >+ * handle the decimal point that matches the language's natural spelling of >+ * the punctuation of either the full stop or comma.</td> >+ * </tr> >+ * <tr> >+ * <td>Inf:</td> >+ * <td>The rule for infinity.</td> >+ * </tr> >+ * <tr> >+ * <td>NaN:</td> >+ * <td>The rule for an IEEE 754 NaN (not a number).</td> > * </tr> > * <tr> >+ * <tr> > * <td><em>nothing</em></td> > * <td>If the rule's rule descriptor is left out, the base value is one plus the > * preceding rule's base value (or zero if this is the first rule in the list) in a normal >@@ -827,6 +866,52 @@ public: > FieldPosition& pos, > UErrorCode& status) const; > >+protected: >+ /** >+ * Format a decimal number. >+ * The number is a DigitList wrapper onto a floating point decimal number. >+ * The default implementation in NumberFormat converts the decimal number >+ * to a double and formats that. Subclasses of NumberFormat that want >+ * to specifically handle big decimal numbers must override this method. >+ * class DecimalFormat does so. >+ * >+ * @param number The number, a DigitList format Decimal Floating Point. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param posIter On return, can be used to iterate over positions >+ * of fields generated by this format call. >+ * @param status Output param filled with success/failure status. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(const DigitList &number, >+ UnicodeString& appendTo, >+ FieldPositionIterator* posIter, >+ UErrorCode& status) const; >+ >+ /** >+ * Format a decimal number. >+ * The number is a DigitList wrapper onto a floating point decimal number. >+ * The default implementation in NumberFormat converts the decimal number >+ * to a double and formats that. Subclasses of NumberFormat that want >+ * to specifically handle big decimal numbers must override this method. >+ * class DecimalFormat does so. >+ * >+ * @param number The number, a DigitList format Decimal Floating Point. >+ * @param appendTo Output parameter to receive result. >+ * Result is appended to existing contents. >+ * @param pos On input: an alignment field, if desired. >+ * On output: the offsets of the alignment field. >+ * @param status Output param filled with success/failure status. >+ * @return Reference to 'appendTo' parameter. >+ * @internal >+ */ >+ virtual UnicodeString& format(const DigitList &number, >+ UnicodeString& appendTo, >+ FieldPosition& pos, >+ UErrorCode& status) const; >+public: >+ > using NumberFormat::parse; > > /** >@@ -925,6 +1010,20 @@ public: > */ > virtual void setContext(UDisplayContext value, UErrorCode& status); > >+ /** >+ * Get the rounding mode. >+ * @return A rounding mode >+ * @draft ICU 60 >+ */ >+ virtual ERoundingMode getRoundingMode(void) const; >+ >+ /** >+ * Set the rounding mode. >+ * @param roundingMode A rounding mode >+ * @draft ICU 60 >+ */ >+ virtual void setRoundingMode(ERoundingMode roundingMode); >+ > public: > /** > * ICU "poor man's RTTI", returns a UClassID for this class. >@@ -974,19 +1073,26 @@ private: > void dispose(); > void stripWhitespace(UnicodeString& src); > void initDefaultRuleSet(); >- void format(double number, NFRuleSet& ruleSet); > NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const; > > /* friend access */ > friend class NFSubstitution; > friend class NFRule; >+ friend class NFRuleSet; > friend class FractionalPartSubstitution; > > inline NFRuleSet * getDefaultRuleSet() const; > const RuleBasedCollator * getCollator() const; >- DecimalFormatSymbols * getDecimalFormatSymbols() const; >+ DecimalFormatSymbols * initializeDecimalFormatSymbols(UErrorCode &status); >+ const DecimalFormatSymbols * getDecimalFormatSymbols() const; >+ NFRule * initializeDefaultInfinityRule(UErrorCode &status); >+ const NFRule * getDefaultInfinityRule() const; >+ NFRule * initializeDefaultNaNRule(UErrorCode &status); >+ const NFRule * getDefaultNaNRule() const; > PluralFormat *createPluralFormat(UPluralType pluralType, const UnicodeString &pattern, UErrorCode& status) const; >- UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult) const; >+ UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const; >+ UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const; >+ void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const; > > private: > NFRuleSet **ruleSets; >@@ -996,6 +1102,9 @@ private: > Locale locale; > RuleBasedCollator* collator; > DecimalFormatSymbols* decimalFormatSymbols; >+ NFRule *defaultInfinityRule; >+ NFRule *defaultNaNRule; >+ ERoundingMode roundingMode; > UBool lenient; > UnicodeString* lenientParseRules; > LocalizationInfo* localizations; >diff --git a/Source/WTF/icu/unicode/rbtz.h b/Source/WTF/icu/unicode/rbtz.h >index f20fc81a4e5c2c8f72356cc5980be849691d45dd..6d652f692b221eaf6102161c6c8fd2034f08376d 100644 >--- a/Source/WTF/icu/unicode/rbtz.h >+++ b/Source/WTF/icu/unicode/rbtz.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2013, International Business Machines Corporation and * >diff --git a/Source/WTF/icu/unicode/regex.h b/Source/WTF/icu/unicode/regex.h >index c3c6441b6f8cb4ff632a878a73088d48a43fe574..6829f7ba47255ff65dede862867176d25d41dad2 100644 >--- a/Source/WTF/icu/unicode/regex.h >+++ b/Source/WTF/icu/unicode/regex.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 2002-2015, International Business Machines >+* Copyright (C) 2002-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * file name: regex.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * indentation:4 > * > * created on: 2002oct22 >@@ -348,17 +350,17 @@ public: > private: > /** > * Cause a compilation error if an application accidentally attempts to >- * create a matcher with a (UChar *) string as input rather than >+ * create a matcher with a (char16_t *) string as input rather than > * a UnicodeString. Avoids a dangling reference to a temporary string. > * <p> >- * To efficiently work with UChar *strings, wrap the data in a UnicodeString >+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString > * using one of the aliasing constructors, such as >- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code> >+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code> > * or in a UText, using >- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code> >+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code> > * > */ >- RegexMatcher *matcher(const UChar *input, >+ RegexMatcher *matcher(const char16_t *input, > UErrorCode &status) const; > public: > >@@ -450,7 +452,7 @@ public: > * @param groupName The capture group name. > * @param status A UErrorCode to receive any errors. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > virtual int32_t groupNumberFromName(const UnicodeString &groupName, UErrorCode &status) const; > >@@ -469,7 +471,7 @@ public: > * nul-terminated. > * @param status A UErrorCode to receive any errors. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > virtual int32_t groupNumberFromName(const char *groupName, int32_t nameLength, UErrorCode &status) const; > >@@ -746,17 +748,17 @@ public: > private: > /** > * Cause a compilation error if an application accidentally attempts to >- * create a matcher with a (UChar *) string as input rather than >+ * create a matcher with a (char16_t *) string as input rather than > * a UnicodeString. Avoids a dangling reference to a temporary string. > * <p> >- * To efficiently work with UChar *strings, wrap the data in a UnicodeString >+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString > * using one of the aliasing constructors, such as >- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code> >+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code> > * or in a UText, using >- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code> >+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code> > * > */ >- RegexMatcher(const UnicodeString ®exp, const UChar *input, >+ RegexMatcher(const UnicodeString ®exp, const char16_t *input, > uint32_t flags, UErrorCode &status); > public: > >@@ -849,7 +851,7 @@ public: > * position may not be valid with the altered input string.</p> > * @param status A reference to a UErrorCode to receive any errors. > * @return TRUE if a match is found. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > virtual UBool find(UErrorCode &status); > >@@ -881,6 +883,11 @@ public: > * Returns a string containing the text captured by the given group > * during the previous match operation. Group(0) is the entire match. > * >+ * A zero length string is returned both for capture groups that did not >+ * participate in the match and for actual zero length matches. >+ * To distinguish between these two cases use the function start(), >+ * which returns -1 for non-participating groups. >+ * > * @param groupNum the capture group number > * @param status A reference to a UErrorCode to receive any errors. > * Possible errors are U_REGEX_INVALID_STATE if no match >@@ -919,6 +926,11 @@ public: > * Returns a shallow clone of the entire live input string with the UText current native index > * set to the beginning of the requested group. > * >+ * A group length of zero is returned both for capture groups that did not >+ * participate in the match and for actual zero length matches. >+ * To distinguish between these two cases use the function start(), >+ * which returns -1 for non-participating groups. >+ * > * @param groupNum The capture group number. > * @param dest The UText into which the input should be cloned, or NULL to create a new UText. > * @param group_len A reference to receive the length of the desired capture group >@@ -1144,17 +1156,17 @@ public: > private: > /** > * Cause a compilation error if an application accidentally attempts to >- * reset a matcher with a (UChar *) string as input rather than >+ * reset a matcher with a (char16_t *) string as input rather than > * a UnicodeString. Avoids a dangling reference to a temporary string. > * <p> >- * To efficiently work with UChar *strings, wrap the data in a UnicodeString >+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString > * using one of the aliasing constructors, such as >- * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code> >+ * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code> > * or in a UText, using >- * <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code> >+ * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code> > * > */ >- RegexMatcher &reset(const UChar *input); >+ RegexMatcher &reset(const char16_t *input); > public: > > /** >diff --git a/Source/WTF/icu/unicode/region.h b/Source/WTF/icu/unicode/region.h >index cb75234bf9b6196aa091508042703588e376a4e8..80b2929e9f00c3c63b1de632358a1e104d41904d 100644 >--- a/Source/WTF/icu/unicode/region.h >+++ b/Source/WTF/icu/unicode/region.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >- * Copyright (C) 2014-2015, International Business Machines Corporation and others. >+ * Copyright (C) 2014-2016, International Business Machines Corporation and others. > * All Rights Reserved. > ******************************************************************************* > */ >@@ -101,13 +103,11 @@ public: > */ > static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns an enumeration over the IDs of all known regions that match the given type. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Returns a pointer to the region that contains this region. Returns NULL if this region is code "001" (World) >@@ -127,7 +127,6 @@ public: > */ > const Region* getContainingRegion(URegionType type) const; > >-#ifndef U_HIDE_DRAFT_API > /** > * Return an enumeration over the IDs of all the regions that are immediate children of this region in the > * region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two, >@@ -135,7 +134,7 @@ public: > * any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing > * the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe) > * and "155" (Western Europe). >- * @draft ICU 55 >+ * @stable ICU 55 > */ > StringEnumeration* getContainedRegions(UErrorCode &status) const; > >@@ -144,10 +143,9 @@ public: > * hierarchy and match the given type. This API may return an empty enumeration if this region doesn't have any > * sub-regions that match the given type. For example, calling this method with region "150" (Europe) and type > * "URGN_TERRITORY" returns a set containing all the territories in Europe ( "FR" (France) - "IT" (Italy) - "DE" (Germany) etc. ) >- * @draft ICU 55 >+ * @stable ICU 55 > */ > StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const; >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Returns true if this region contains the supplied other region anywhere in the region hierarchy. >@@ -155,15 +153,13 @@ public: > */ > UBool contains(const Region &other) const; > >-#ifndef U_HIDE_DRAFT_API > /** > * For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement > * regions for this region. Returns null for a non-deprecated region. For example, calling this method with region > * "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc... >- * @draft ICU 55 >+ * @stable ICU 55 > */ > StringEnumeration* getPreferredValues(UErrorCode &status) const; >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Return this region's canonical region code. >@@ -216,7 +212,7 @@ private: > * anything meaningful. > */ > >- static void loadRegionData(UErrorCode &status); >+ static void U_CALLCONV loadRegionData(UErrorCode &status); > > }; > >diff --git a/Source/WTF/icu/unicode/reldatefmt.h b/Source/WTF/icu/unicode/reldatefmt.h >index 7b416cfcf6f715e97cd59b343b6bd4c72315b08c..09d9620be5b0631df87b0e44ca3d1d3337d1203d 100644 >--- a/Source/WTF/icu/unicode/reldatefmt.h >+++ b/Source/WTF/icu/unicode/reldatefmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************** >-* Copyright (C) 2014-2015, International Business Machines Corporation and >+* Copyright (C) 2014-2016, International Business Machines Corporation and > * others. > * All Rights Reserved. > ***************************************************************************** >@@ -15,6 +17,7 @@ > #include "unicode/utypes.h" > #include "unicode/uobject.h" > #include "unicode/udisplaycontext.h" >+#include "unicode/ureldatefmt.h" > #include "unicode/locid.h" > > /** >@@ -22,42 +25,7 @@ > * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" > */ > >-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION >- >-#ifndef U_HIDE_DRAFT_API >- >-/** >- * The formatting style >- * @draft ICU 54 >- */ >-typedef enum UDateRelativeDateTimeFormatterStyle { >- >- /** >- * Everything spelled out. >- * @draft ICU 54 >- */ >- UDAT_STYLE_LONG, >- >- /** >- * Abbreviations used when possible. >- * @draft ICU 54 >- */ >- UDAT_STYLE_SHORT, >- >- /** >- * Use the shortest possible form. >- * @draft ICU 54 >- */ >- UDAT_STYLE_NARROW, >- >- /** >- * The number of styles. >- * @draft ICU 54 >- */ >- UDAT_STYLE_COUNT >-} UDateRelativeDateTimeFormatterStyle; >- >-#endif /* U_HIDE_DRAFT_API */ >+#if !UCONFIG_NO_FORMATTING > > /** > * Represents the unit for formatting a relative date. e.g "in 5 days" >@@ -108,11 +76,13 @@ typedef enum UDateRelativeUnit { > */ > UDAT_RELATIVE_YEARS, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of items in this enum. >- * @stable ICU 53 >+ * One more than the highest normal UDateRelativeUnit value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UDAT_RELATIVE_UNIT_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UDateRelativeUnit; > > /** >@@ -195,11 +165,13 @@ typedef enum UDateAbsoluteUnit { > */ > UDAT_ABSOLUTE_NOW, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of items in this enum. >- * @stable ICU 53 >+ * One more than the highest normal UDateAbsoluteUnit value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UDAT_ABSOLUTE_UNIT_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UDateAbsoluteUnit; > > /** >@@ -245,16 +217,20 @@ typedef enum UDateDirection { > */ > UDAT_DIRECTION_PLAIN, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of items in this enum. >- * @stable ICU 53 >+ * One more than the highest normal UDateDirection value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UDAT_DIRECTION_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UDateDirection; > >+#if !UCONFIG_NO_BREAK_ITERATION > > U_NAMESPACE_BEGIN > >+class BreakIterator; > class RelativeDateTimeCacheData; > class SharedNumberFormat; > class SharedPluralRules; >@@ -358,7 +334,6 @@ public: > RelativeDateTimeFormatter( > const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Create RelativeDateTimeFormatter with given locale, NumberFormat, > * and capitalization context. >@@ -372,7 +347,7 @@ public: > * @param capitalizationContext A value from UDisplayContext that pertains to > * capitalization. > * @status Any error is returned here. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > RelativeDateTimeFormatter( > const Locale& locale, >@@ -380,7 +355,6 @@ public: > UDateRelativeDateTimeFormatterStyle style, > UDisplayContext capitalizationContext, > UErrorCode& status); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Copy constructor. >@@ -441,6 +415,52 @@ public: > UnicodeString& appendTo, > UErrorCode& status) const; > >+ /** >+ * Format a combination of URelativeDateTimeUnit and numeric offset >+ * using a numeric style, e.g. "1 week ago", "in 1 week", >+ * "5 weeks ago", "in 5 weeks". >+ * >+ * @param offset The signed offset for the specified unit. This >+ * will be formatted according to this object's >+ * NumberFormat object. >+ * @param unit The unit to use when formatting the relative >+ * date, e.g. UDAT_REL_UNIT_WEEK, >+ * UDAT_REL_UNIT_FRIDAY. >+ * @param appendTo The string to which the formatted result will be >+ * appended. >+ * @param status ICU error code returned here. >+ * @return appendTo >+ * @stable ICU 57 >+ */ >+ UnicodeString& formatNumeric( >+ double offset, >+ URelativeDateTimeUnit unit, >+ UnicodeString& appendTo, >+ UErrorCode& status) const; >+ >+ /** >+ * Format a combination of URelativeDateTimeUnit and numeric offset >+ * using a text style if possible, e.g. "last week", "this week", >+ * "next week", "yesterday", "tomorrow". Falls back to numeric >+ * style if no appropriate text term is available for the specified >+ * offset in the object's locale. >+ * >+ * @param offset The signed offset for the specified unit. >+ * @param unit The unit to use when formatting the relative >+ * date, e.g. UDAT_REL_UNIT_WEEK, >+ * UDAT_REL_UNIT_FRIDAY. >+ * @param appendTo The string to which the formatted result will be >+ * appended. >+ * @param status ICU error code returned here. >+ * @return appendTo >+ * @stable ICU 57 >+ */ >+ UnicodeString& format( >+ double offset, >+ URelativeDateTimeUnit unit, >+ UnicodeString& appendTo, >+ UErrorCode& status) const; >+ > /** > * Combines a relative date string and a time string in this object's > * locale. This is done with the same date-time separator used for the >@@ -466,21 +486,19 @@ public: > */ > const NumberFormat& getNumberFormat() const; > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns the capitalization context. > * >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDisplayContext getCapitalizationContext() const; > > /** > * Returns the format style. > * >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDateRelativeDateTimeFormatterStyle getFormatStyle() const; >-#endif /* U_HIDE_DRAFT_API */ > > private: > const RelativeDateTimeCacheData* fCache; >@@ -499,5 +517,6 @@ private: > > U_NAMESPACE_END > >-#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION*/ >-#endif >+#endif /* !UCONFIG_NO_BREAK_ITERATION */ >+#endif /* !UCONFIG_NO_FORMATTING */ >+#endif /* __RELDATEFMT_H */ >diff --git a/Source/WTF/icu/unicode/rep.h b/Source/WTF/icu/unicode/rep.h >index 4c7eae1401dcd6c9542157dbfa0f2fe3ea8dc4ed..41fdc040497bf2cdd40c003e91076f59645073a0 100644 >--- a/Source/WTF/icu/unicode/rep.h >+++ b/Source/WTF/icu/unicode/rep.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ************************************************************************** > * Copyright (C) 1999-2012, International Business Machines Corporation and >@@ -91,7 +93,7 @@ public: > * @return 16-bit code unit of text at given offset > * @stable ICU 1.8 > */ >- inline UChar charAt(int32_t offset) const; >+ inline char16_t charAt(int32_t offset) const; > > /** > * Returns the 32-bit code point at the given 16-bit offset into >@@ -228,7 +230,7 @@ protected: > * Virtual version of charAt(). > * @stable ICU 2.4 > */ >- virtual UChar getCharAt(int32_t offset) const = 0; >+ virtual char16_t getCharAt(int32_t offset) const = 0; > > /** > * Virtual version of char32At(). >@@ -244,7 +246,7 @@ Replaceable::length() const { > return getLength(); > } > >-inline UChar >+inline char16_t > Replaceable::charAt(int32_t offset) const { > return getCharAt(offset); > } >diff --git a/Source/WTF/icu/unicode/resbund.h b/Source/WTF/icu/unicode/resbund.h >index 6e3c1b2afc017ed210efb0024d9460bb96ab51bb..b522a7a615422cdc788708bcfffd5495f734503c 100644 >--- a/Source/WTF/icu/unicode/resbund.h >+++ b/Source/WTF/icu/unicode/resbund.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -214,7 +216,7 @@ public: > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found > * could be a warning > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> >- * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. >+ * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file. > * @stable ICU 2.0 > */ > UnicodeString >diff --git a/Source/WTF/icu/unicode/schriter.h b/Source/WTF/icu/unicode/schriter.h >index d0b5e22503cff261d2cd240ff12007f937f783b2..b1dc939bd66f85544f4fde2bcb49665272726b86 100644 >--- a/Source/WTF/icu/unicode/schriter.h >+++ b/Source/WTF/icu/unicode/schriter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -173,7 +175,7 @@ protected: > * @param newTextLength The length of the String > * @stable ICU 2.0 > */ >- void setText(const UChar* newText, int32_t newTextLength); >+ void setText(const char16_t* newText, int32_t newTextLength); > > /** > * Copy of the iterated string object. >diff --git a/Source/WTF/icu/unicode/scientificnumberformatter.h b/Source/WTF/icu/unicode/scientificnumberformatter.h >index 700694cd24bb0fc1cce17d7e899cd5c0b3485fd6..15023d5141a470a652221532024816a357275bd9 100644 >--- a/Source/WTF/icu/unicode/scientificnumberformatter.h >+++ b/Source/WTF/icu/unicode/scientificnumberformatter.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (c) 2014, International Business Machines >+* Copyright (c) 2014-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > */ >@@ -11,7 +13,6 @@ > > #if !UCONFIG_NO_FORMATTING > >-#ifndef U_HIDE_DRAFT_API > > #include "unicode/unistr.h" > >@@ -45,7 +46,7 @@ class Formattable; > * fmt->format(1.23456e-78, appendTo, status); > * </pre> > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > class U_I18N_API ScientificNumberFormatter : public UObject { > public: >@@ -58,7 +59,7 @@ public: > * @param status error returned here. > * @return The new ScientificNumberFormatter instance. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static ScientificNumberFormatter *createSuperscriptInstance( > DecimalFormat *fmtToAdopt, UErrorCode &status); >@@ -70,7 +71,7 @@ public: > * @param status error returned here. > * @return The ScientificNumberFormatter instance. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static ScientificNumberFormatter *createSuperscriptInstance( > const Locale &locale, UErrorCode &status); >@@ -86,7 +87,7 @@ public: > * @param status error returned here. > * @return The new ScientificNumberFormatter instance. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static ScientificNumberFormatter *createMarkupInstance( > DecimalFormat *fmtToAdopt, >@@ -103,7 +104,7 @@ public: > * @param status error returned here. > * @return The ScientificNumberFormatter instance. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static ScientificNumberFormatter *createMarkupInstance( > const Locale &locale, >@@ -114,7 +115,7 @@ public: > > /** > * Returns a copy of this object. Caller must free returned copy. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > ScientificNumberFormatter *clone() const { > return new ScientificNumberFormatter(*this); >@@ -122,7 +123,7 @@ public: > > /** > * Destructor. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > virtual ~ScientificNumberFormatter(); > >@@ -134,7 +135,7 @@ public: > * @param status any error returned here. > * @return appendTo > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > UnicodeString &format( > const Formattable &number, >@@ -216,7 +217,6 @@ public: > > U_NAMESPACE_END > >-#endif /* U_HIDE_DRAFT_API */ > > #endif /* !UCONFIG_NO_FORMATTING */ > #endif >diff --git a/Source/WTF/icu/unicode/search.h b/Source/WTF/icu/unicode/search.h >index 71bbf2dd529db60015b5c0abe7a5b1d01aa7228b..65f7f10bcc1c5c6065be7a8e9a6e95b1b128d793 100644 >--- a/Source/WTF/icu/unicode/search.h >+++ b/Source/WTF/icu/unicode/search.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 2001-2011 IBM and others. All rights reserved. >diff --git a/Source/WTF/icu/unicode/selfmt.h b/Source/WTF/icu/unicode/selfmt.h >old mode 100644 >new mode 100755 >index 635144bb9b35d6bad3a397cd353c8ff0fe826ff4..08e9d444ee9715a2a4b52c16a3795276894acb59 >--- a/Source/WTF/icu/unicode/selfmt.h >+++ b/Source/WTF/icu/unicode/selfmt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /******************************************************************** > * COPYRIGHT: > * Copyright (c) 1997-2011, International Business Machines Corporation and >diff --git a/Source/WTF/icu/unicode/simpletz.h b/Source/WTF/icu/unicode/simpletz.h >index 4762f639956171d436b8ae3bff882331ff659540..5b802632b0de78504cafc14ec81c876222b482e3 100644 >--- a/Source/WTF/icu/unicode/simpletz.h >+++ b/Source/WTF/icu/unicode/simpletz.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 1997-2013, International Business Machines * >diff --git a/Source/WTF/icu/unicode/smpdtfmt.h b/Source/WTF/icu/unicode/smpdtfmt.h >index ccdaff42abb8911ea3ebc65390b199b51ae423a0..9801b29bdb749bde8bf6f0fda9f02fdeb44f09f5 100644 >--- a/Source/WTF/icu/unicode/smpdtfmt.h >+++ b/Source/WTF/icu/unicode/smpdtfmt.h >@@ -1,5 +1,7 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* >-* Copyright (C) 1997-2015, International Business Machines Corporation and >+* Copyright (C) 1997-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > * >@@ -89,7 +91,7 @@ class SimpleDateFormatMutableNFs; > * <td style="text-align: center" rowspan="3">G</td> > * <td style="text-align: center">1..3</td> > * <td>AD</td> >- * <td rowspan="3">Era - Replaced with the Era string for the current date. One to three letters for the >+ * <td rowspan="3">Era - Replaced with the Era string for the current date. One to three letters for the > * abbreviated form, four letters for the long (wide) form, five for the narrow form.</td> > * </tr> > * <tr> >@@ -218,7 +220,7 @@ class SimpleDateFormatMutableNFs; > * <td rowspan="3" style="text-align: center">q</td> > * <td style="text-align: center">1..2</td> > * <td>02</td> >- * <td rowspan="3"><b>Stand-Alone</b> Quarter - Use one or two for the numerical quarter, three for the abbreviation, >+ * <td rowspan="3"><b>Stand-Alone</b> Quarter - Use one or two for the numerical quarter, three for the abbreviation, > * or four for the full name (five for the narrow name is not yet supported).</td> > * </tr> > * <tr> >@@ -254,7 +256,7 @@ class SimpleDateFormatMutableNFs; > * <td rowspan="4" style="text-align: center">L</td> > * <td style="text-align: center">1..2</td> > * <td>09</td> >- * <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation, >+ * <td rowspan="4"><b>Stand-Alone</b> Month - Use one or two for the numerical month, three for the abbreviation, > * four for the full (wide) name, or 5 for the narrow name. With two ("LL"), the month number is zero-padded if > * necessary (e.g. "08")</td> > * </tr> >@@ -310,7 +312,7 @@ class SimpleDateFormatMutableNFs; > * <td>2451334</td> > * <td>Modified Julian day. This is different from the conventional Julian day number in two regards. > * First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; >- * that is, it depends on the local time zone. It can be thought of as a single number that encompasses >+ * that is, it depends on the local time zone. It can be thought of as a single number that encompasses > * all the date-related fields.</td> > * </tr> > * <tr> >@@ -319,7 +321,7 @@ class SimpleDateFormatMutableNFs; > * <td rowspan="4" style="text-align: center">E</td> > * <td style="text-align: center">1..3</td> > * <td>Tue</td> >- * <td rowspan="4">Day of week - Use one through three letters for the short day, four for the full (wide) name, >+ * <td rowspan="4">Day of week - Use one through three letters for the short day, four for the full (wide) name, > * five for the narrow name, or six for the short name.</td> > * </tr> > * <tr> >@@ -539,7 +541,7 @@ class SimpleDateFormatMutableNFs; > * <td>The <i>generic location format</i>. > * Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO"; > * Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)<br> >- * This is especially useful when presenting possible timezone choices for user selection, >+ * This is especially useful when presenting possible timezone choices for user selection, > * since the naming is more uniform than the "v" format.</td> > * </tr> > * <tr> >@@ -651,7 +653,7 @@ class SimpleDateFormatMutableNFs; > * = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success ); > * GregorianCalendar cal(success); > * UDate currentTime_1 = cal.getTime(success); >- * FieldPosition fp(0); >+ * FieldPosition fp(FieldPosition::DONT_CARE); > * UnicodeString dateString; > * formatter->format( currentTime_1, dateString, fp ); > * cout << "result: " << dateString << endl; >@@ -999,6 +1001,12 @@ public: > * (Presumably, letters that would be more mnemonic in that locale's > * language.) This function would produce a pattern using those > * letters. >+ * <p> >+ * <b>Note:</b> This implementation depends on DateFormatSymbols::getLocalPatternChars() >+ * to get localized format pattern characters. ICU does not include >+ * localized pattern character data, therefore, unless user sets localized >+ * pattern characters manually, this method returns the same result as >+ * toPattern(). > * > * @param result Receives the localized pattern. > * @param status Output param set to success/failure code on >@@ -1126,18 +1134,17 @@ public: > * @param value The UDisplayContext value to set. > * @param status Input/output status. If at entry this indicates a failure > * status, the function will do nothing; otherwise this will be >- * updated with any new status from the function. >+ * updated with any new status from the function. > * @stable ICU 53 > */ > virtual void setContext(UDisplayContext value, UErrorCode& status); >- >-#ifndef U_HIDE_DRAFT_API >+ > /** > * Overrides base class method and >- * This method clears per field NumberFormat instances >- * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)} >+ * This method clears per field NumberFormat instances >+ * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)} > * @param adoptNF the NumbeferFormat used >- * @draft ICU 54 >+ * @stable ICU 54 > */ > void adoptNumberFormat(NumberFormat *formatToAdopt); > >@@ -1145,7 +1152,7 @@ public: > * Allow the user to set the NumberFormat for several fields > * It can be a single field like: "y"(year) or "M"(month) > * It can be several field combined together: "yM"(year and month) >- * Note: >+ * Note: > * 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") > * If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) > * Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)} >@@ -1154,17 +1161,16 @@ public: > * @param adoptNF the NumbeferFormat used > * @param status Receives a status code, which will be U_ZERO_ERROR > * if the operation succeeds. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > void adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status); > > /** > * Get the numbering system to be used for a particular field. > * @param field The UDateFormatField to get >- * @draft ICU 54 >+ * @stable ICU 54 > */ >- const NumberFormat * getNumberFormatForField(UChar field) const; >-#endif /* U_HIDE_DRAFT_API */ >+ const NumberFormat * getNumberFormatForField(char16_t field) const; > > #ifndef U_HIDE_INTERNAL_API > /** >@@ -1256,7 +1262,7 @@ private: > * succeeds. > */ > void subFormat(UnicodeString &appendTo, >- UChar ch, >+ char16_t ch, > int32_t count, > UDisplayContext capitalizationContext, > int32_t fieldNum, >@@ -1271,7 +1277,7 @@ private: > * having a number of digits between "minDigits" and > * "maxDigits". Uses the DateFormat's NumberFormat. > * >- * @param currentNumberFormat >+ * @param currentNumberFormat > * @param appendTo Output parameter to receive result. > * Formatted number is appended to existing contents. > * @param value Value to format. >@@ -1288,7 +1294,7 @@ private: > * Return true if the given format character, occuring count > * times, represents a numeric field. > */ >- static UBool isNumeric(UChar formatChar, int32_t count); >+ static UBool isNumeric(char16_t formatChar, int32_t count); > > /** > * Returns TRUE if the patternOffset is at the start of a numeric field. >@@ -1359,7 +1365,14 @@ private: > */ > int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field, > const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const; >- >+ >+ /** >+ * Used by subParse() to match localized day period strings. >+ */ >+ int32_t matchDayPeriodStrings(const UnicodeString& text, int32_t start, >+ const UnicodeString* stringArray, int32_t stringArrayCount, >+ int32_t &dayPeriod) const; >+ > /** > * Private function used by subParse to match literal pattern text. > * >@@ -1376,9 +1389,9 @@ private: > * @return <code>TRUE</code> if the literal text could be matched, <code>FALSE</code> otherwise. > */ > static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset, >- const UnicodeString &text, int32_t &textOffset, >+ const UnicodeString &text, int32_t &textOffset, > UBool whitespaceLenient, UBool partialMatchLenient, UBool oldLeniency); >- >+ > /** > * Private member function that converts the parsed date strings into > * timeFields. Returns -start (for ParsePosition) if failed. >@@ -1399,9 +1412,10 @@ private: > * @return the new start position if matching succeeded; a negative number > * indicating matching failure, otherwise. > */ >- int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count, >+ int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count, > UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal, >- int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs) const; >+ int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs, >+ int32_t *dayPeriod=NULL) const; > > void parseInt(const UnicodeString& text, > Formattable& number, >@@ -1419,6 +1433,16 @@ private: > int32_t checkIntSuffix(const UnicodeString& text, int32_t start, > int32_t patLoc, UBool isNegative) const; > >+ /** >+ * Counts number of digit code points in the specified text. >+ * >+ * @param text input text >+ * @param start start index, inclusive >+ * @param end end index, exclusive >+ * @return number of digits found in the text in the specified range. >+ */ >+ int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const; >+ > /** > * Translate a pattern, mapping each character in the from string to the > * corresponding character in the to string. Return an error if the original >@@ -1509,12 +1533,12 @@ private: > /** > * Map calendar field letter into calendar field level. > */ >- static int32_t getLevelFromChar(UChar ch); >+ static int32_t getLevelFromChar(char16_t ch); > > /** > * Tell if a character can be used to define a field in a format string. > */ >- static UBool isSyntaxChar(UChar ch); >+ static UBool isSyntaxChar(char16_t ch); > > /** > * The formatting pattern for this formatter. >@@ -1558,6 +1582,14 @@ private: > */ > UDate fDefaultCenturyStart; > >+ UBool fHasMinute; >+ UBool fHasSecond; >+ >+ /** >+ * Sets fHasMinutes and fHasSeconds. >+ */ >+ void parsePattern(); >+ > /** > * See documentation for defaultCenturyStart. > */ >diff --git a/Source/WTF/icu/unicode/sortkey.h b/Source/WTF/icu/unicode/sortkey.h >index c125eeecf00980cf452148874bd3d77521e0d76f..1f4246018f00f21441b9018556f4105dbb6494d7 100644 >--- a/Source/WTF/icu/unicode/sortkey.h >+++ b/Source/WTF/icu/unicode/sortkey.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************** > * Copyright (C) 1996-2014, International Business Machines Corporation and others. >diff --git a/Source/WTF/icu/unicode/std_string.h b/Source/WTF/icu/unicode/std_string.h >index 05955c5d1e727f8e35bcaeb7d95f85a70d630ca1..729c56399506eb38b2c9edc1c6420e5abbe5d897 100644 >--- a/Source/WTF/icu/unicode/std_string.h >+++ b/Source/WTF/icu/unicode/std_string.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: std_string.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -25,13 +27,11 @@ > > #include "unicode/utypes.h" > >-#if U_HAVE_STD_STRING >- >-#if !defined(_MSC_VER) >-namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 >+// Workaround for a libstdc++ bug before libstdc++4.6 (2011). >+// https://bugs.llvm.org/show_bug.cgi?id=13364 >+#if defined(__GLIBCXX__) >+namespace std { class type_info; } > #endif > #include <string> > >-#endif // U_HAVE_STD_STRING >- > #endif // __STD_STRING_H__ >diff --git a/Source/WTF/icu/unicode/strenum.h b/Source/WTF/icu/unicode/strenum.h >index 3dbe21c6b2dddfb869387d48efd6243db3915b39..61d514813b92c14679a99ce4f7c2c9f89b6f15f7 100644 >--- a/Source/WTF/icu/unicode/strenum.h >+++ b/Source/WTF/icu/unicode/strenum.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -33,7 +35,7 @@ U_NAMESPACE_BEGIN > * call, so the returned string still might not be 'valid' on > * subsequent use.</p> > * >- * <p>Strings may take the form of const char*, const UChar*, or const >+ * <p>Strings may take the form of const char*, const char16_t*, or const > * UnicodeString*. The type you get is determine by the variant of > * 'next' that you call. In general the StringEnumeration is > * optimized for one of these types, but all StringEnumerations can >@@ -110,7 +112,7 @@ public: > * <p>If the iterator is out of sync with its service, status is set > * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p> > * >- * <p>If the native service string is a UChar* string, it is >+ * <p>If the native service string is a char16_t* string, it is > * converted to char* with the invariant converter. If the > * conversion fails (because a character cannot be converted) then > * status is set to U_INVARIANT_CONVERSION_ERROR and the return >@@ -129,7 +131,7 @@ public: > virtual const char* next(int32_t *resultLength, UErrorCode& status); > > /** >- * <p>Returns the next element as a NUL-terminated UChar*. If there >+ * <p>Returns the next element as a NUL-terminated char16_t*. If there > * are no more elements, returns NULL. If the resultLength pointer > * is not NULL, the length of the string (not counting the > * terminating NUL) is returned at that address. If an error >@@ -151,7 +153,7 @@ public: > * > * @stable ICU 2.4 > */ >- virtual const UChar* unext(int32_t *resultLength, UErrorCode& status); >+ virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status); > > /** > * <p>Returns the next element a UnicodeString*. If there are no >diff --git a/Source/WTF/icu/unicode/stringoptions.h b/Source/WTF/icu/unicode/stringoptions.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f2de96e9634a02e355eb13ea79f08d758a2e3bdd >--- /dev/null >+++ b/Source/WTF/icu/unicode/stringoptions.h >@@ -0,0 +1,198 @@ >+// © 2017 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html >+ >+// stringoptions.h >+// created: 2017jun08 Markus W. Scherer >+ >+#ifndef __STRINGOPTIONS_H__ >+#define __STRINGOPTIONS_H__ >+ >+#include "unicode/utypes.h" >+ >+/** >+ * \file >+ * \brief C API: Bit set option bit constants for various string and character processing functions. >+ */ >+ >+/** >+ * Option value for case folding: Use default mappings defined in CaseFolding.txt. >+ * >+ * @stable ICU 2.0 >+ */ >+#define U_FOLD_CASE_DEFAULT 0 >+ >+/** >+ * Option value for case folding: >+ * >+ * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I >+ * and dotless i appropriately for Turkic languages (tr, az). >+ * >+ * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that >+ * are to be included for default mappings and >+ * excluded for the Turkic-specific mappings. >+ * >+ * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that >+ * are to be excluded for default mappings and >+ * included for the Turkic-specific mappings. >+ * >+ * @stable ICU 2.0 >+ */ >+#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 >+ >+#ifndef U_HIDE_DRAFT_API >+ >+/** >+ * Titlecase the string as a whole rather than each word. >+ * (Titlecase only the character at index 0, possibly adjusted.) >+ * Option bits value for titlecasing APIs that take an options bit set. >+ * >+ * It is an error to specify multiple titlecasing iterator options together, >+ * including both an options bit and an explicit BreakIterator. >+ * >+ * @see U_TITLECASE_ADJUST_TO_CASED >+ * @draft ICU 60 >+ */ >+#define U_TITLECASE_WHOLE_STRING 0x20 >+ >+/** >+ * Titlecase sentences rather than words. >+ * (Titlecase only the first character of each sentence, possibly adjusted.) >+ * Option bits value for titlecasing APIs that take an options bit set. >+ * >+ * It is an error to specify multiple titlecasing iterator options together, >+ * including both an options bit and an explicit BreakIterator. >+ * >+ * @see U_TITLECASE_ADJUST_TO_CASED >+ * @draft ICU 60 >+ */ >+#define U_TITLECASE_SENTENCES 0x40 >+ >+#endif // U_HIDE_DRAFT_API >+ >+/** >+ * Do not lowercase non-initial parts of words when titlecasing. >+ * Option bit for titlecasing APIs that take an options bit set. >+ * >+ * By default, titlecasing will titlecase the character at each >+ * (possibly adjusted) BreakIterator index and >+ * lowercase all other characters up to the next iterator index. >+ * With this option, the other characters will not be modified. >+ * >+ * @see U_TITLECASE_ADJUST_TO_CASED >+ * @see UnicodeString::toTitle >+ * @see CaseMap::toTitle >+ * @see ucasemap_setOptions >+ * @see ucasemap_toTitle >+ * @see ucasemap_utf8ToTitle >+ * @stable ICU 3.8 >+ */ >+#define U_TITLECASE_NO_LOWERCASE 0x100 >+ >+/** >+ * Do not adjust the titlecasing BreakIterator indexes; >+ * titlecase exactly the characters at breaks from the iterator. >+ * Option bit for titlecasing APIs that take an options bit set. >+ * >+ * By default, titlecasing will take each break iterator index, >+ * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED), >+ * and titlecase that one. >+ * >+ * Other characters are lowercased. >+ * >+ * It is an error to specify multiple titlecasing adjustment options together. >+ * >+ * @see U_TITLECASE_ADJUST_TO_CASED >+ * @see U_TITLECASE_NO_LOWERCASE >+ * @see UnicodeString::toTitle >+ * @see CaseMap::toTitle >+ * @see ucasemap_setOptions >+ * @see ucasemap_toTitle >+ * @see ucasemap_utf8ToTitle >+ * @stable ICU 3.8 >+ */ >+#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 >+ >+#ifndef U_HIDE_DRAFT_API >+ >+/** >+ * Adjust each titlecasing BreakIterator index to the next cased character. >+ * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).) >+ * Option bit for titlecasing APIs that take an options bit set. >+ * >+ * This used to be the default index adjustment in ICU. >+ * Since ICU 60, the default index adjustment is to the next character that is >+ * a letter, number, symbol, or private use code point. >+ * (Uncased modifier letters are skipped.) >+ * The difference in behavior is small for word titlecasing, >+ * but the new adjustment is much better for whole-string and sentence titlecasing: >+ * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»". >+ * >+ * It is an error to specify multiple titlecasing adjustment options together. >+ * >+ * @see U_TITLECASE_NO_BREAK_ADJUSTMENT >+ * @draft ICU 60 >+ */ >+#define U_TITLECASE_ADJUST_TO_CASED 0x400 >+ >+/** >+ * Option for string transformation functions to not first reset the Edits object. >+ * Used for example in some case-mapping and normalization functions. >+ * >+ * @see CaseMap >+ * @see Edits >+ * @see Normalizer2 >+ * @draft ICU 60 >+ */ >+#define U_EDITS_NO_RESET 0x2000 >+ >+/** >+ * Omit unchanged text when recording how source substrings >+ * relate to changed and unchanged result substrings. >+ * Used for example in some case-mapping and normalization functions. >+ * >+ * @see CaseMap >+ * @see Edits >+ * @see Normalizer2 >+ * @draft ICU 60 >+ */ >+#define U_OMIT_UNCHANGED_TEXT 0x4000 >+ >+#endif // U_HIDE_DRAFT_API >+ >+/** >+ * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: >+ * Compare strings in code point order instead of code unit order. >+ * @stable ICU 2.2 >+ */ >+#define U_COMPARE_CODE_POINT_ORDER 0x8000 >+ >+/** >+ * Option bit for unorm_compare: >+ * Perform case-insensitive comparison. >+ * @stable ICU 2.2 >+ */ >+#define U_COMPARE_IGNORE_CASE 0x10000 >+ >+/** >+ * Option bit for unorm_compare: >+ * Both input strings are assumed to fulfill FCD conditions. >+ * @stable ICU 2.2 >+ */ >+#define UNORM_INPUT_IS_FCD 0x20000 >+ >+// Related definitions elsewhere. >+// Options that are not meaningful in the same functions >+// can share the same bits. >+// >+// Public: >+// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 >+// >+// Internal: (may change or be removed) >+// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff >+// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7 >+// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0 >+// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600 >+// ustr_imp.h #define _STRNCMP_STYLE 0x1000 >+// unormcmp.cpp #define _COMPARE_EQUIV 0x80000 >+ >+#endif // __STRINGOPTIONS_H__ >diff --git a/Source/WTF/icu/unicode/stringpiece.h b/Source/WTF/icu/unicode/stringpiece.h >index b29571d4adbbdd9d6d832aaeb0f9768b24161a56..b0887effa52585601897b2a8420177ad58843e9e 100644 >--- a/Source/WTF/icu/unicode/stringpiece.h >+++ b/Source/WTF/icu/unicode/stringpiece.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > // Copyright (C) 2009-2013, International Business Machines > // Corporation and others. All Rights Reserved. > // >@@ -40,9 +42,9 @@ U_NAMESPACE_BEGIN > * in a "const char*" or a "string" wherever a "StringPiece" is > * expected. > * >- * Functions or methods may use const StringPiece& parameters to accept either >- * a "const char*" or a "string" value that will be implicitly converted to >- * a StringPiece. >+ * Functions or methods may use StringPiece parameters to accept either a >+ * "const char*" or a "string" value that will be implicitly converted to a >+ * StringPiece. > * > * Systematic usage of StringPiece is encouraged as it will reduce unnecessary > * conversions from "const char*" to "string" and back again. >@@ -66,14 +68,12 @@ class U_COMMON_API StringPiece : public UMemory { > * @stable ICU 4.2 > */ > StringPiece(const char* str); >-#if U_HAVE_STD_STRING > /** > * Constructs from a std::string. > * @stable ICU 4.2 > */ > StringPiece(const std::string& str) > : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { } >-#endif > /** > * Constructs from a const char * pointer and a specified length. > * @param offset a const char * pointer (need not be terminated) >diff --git a/Source/WTF/icu/unicode/stringtriebuilder.h b/Source/WTF/icu/unicode/stringtriebuilder.h >index 04447e543713d1ac9b5c93657fa15073ca436ca2..caeae51a47222087033931a19a2245604a5b9394 100644 >--- a/Source/WTF/icu/unicode/stringtriebuilder.h >+++ b/Source/WTF/icu/unicode/stringtriebuilder.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2012,2014, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: stringtriebuilder.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -103,7 +105,7 @@ protected: > /** @internal */ > virtual int32_t getElementStringLength(int32_t i) const = 0; > /** @internal */ >- virtual UChar getElementUnit(int32_t i, int32_t unitIndex) const = 0; >+ virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0; > /** @internal */ > virtual int32_t getElementValue(int32_t i) const = 0; > >@@ -118,7 +120,7 @@ protected: > /** @internal */ > virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0; > /** @internal */ >- virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, UChar unit) const = 0; >+ virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0; > > /** @internal */ > virtual UBool matchNodesCanHaveValues() const = 0; >@@ -135,7 +137,7 @@ protected: > /** @internal */ > static const int32_t kMaxBranchLinearSubNodeLength=5; > >- // Maximum number of nested split-branch levels for a branch on all 2^16 possible UChar units. >+ // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units. > // log2(2^16/kMaxBranchLinearSubNodeLength) rounded up. > /** @internal */ > static const int32_t kMaxSplitBranchLevels=14; >@@ -184,7 +186,8 @@ protected: > /** @internal */ > UHashtable *nodes; > >-#ifndef U_HIDE_INTERNAL_API >+ // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, >+ // it is needed for layout of other objects. > /** @internal */ > class Node : public UObject { > public: >@@ -243,6 +246,7 @@ protected: > int32_t offset; > }; > >+#ifndef U_HIDE_INTERNAL_API > // This class should not be overridden because > // registerFinalValue() compares a stack-allocated FinalValueNode > // (stack-allocated so that we don't unnecessarily create lots of duplicate nodes) >@@ -252,13 +256,16 @@ protected: > /** @internal */ > class FinalValueNode : public Node { > public: >- FinalValueNode(int32_t v) : Node(0x111111*37+v), value(v) {} >+ FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {} > virtual UBool operator==(const Node &other) const; > virtual void write(StringTrieBuilder &builder); > protected: > int32_t value; > }; >+#endif /* U_HIDE_INTERNAL_API */ > >+ // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, >+ // it is needed for layout of other objects. > /** > * @internal > */ >@@ -269,34 +276,38 @@ protected: > void setValue(int32_t v) { > hasValue=TRUE; > value=v; >- hash=hash*37+v; >+ hash=hash*37u+v; > } > protected: > UBool hasValue; > int32_t value; > }; > >+#ifndef U_HIDE_INTERNAL_API > /** > * @internal > */ > class IntermediateValueNode : public ValueNode { > public: > IntermediateValueNode(int32_t v, Node *nextNode) >- : ValueNode(0x222222*37+hashCode(nextNode)), next(nextNode) { setValue(v); } >+ : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); } > virtual UBool operator==(const Node &other) const; > virtual int32_t markRightEdgesFirst(int32_t edgeNumber); > virtual void write(StringTrieBuilder &builder); > protected: > Node *next; > }; >+#endif /* U_HIDE_INTERNAL_API */ > >+ // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, >+ // it is needed for layout of other objects. > /** > * @internal > */ > class LinearMatchNode : public ValueNode { > public: > LinearMatchNode(int32_t len, Node *nextNode) >- : ValueNode((0x333333*37+len)*37+hashCode(nextNode)), >+ : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)), > length(len), next(nextNode) {} > virtual UBool operator==(const Node &other) const; > virtual int32_t markRightEdgesFirst(int32_t edgeNumber); >@@ -305,6 +316,7 @@ protected: > Node *next; > }; > >+#ifndef U_HIDE_INTERNAL_API > /** > * @internal > */ >@@ -326,25 +338,25 @@ protected: > virtual void write(StringTrieBuilder &builder); > // Adds a unit with a final value. > void add(int32_t c, int32_t value) { >- units[length]=(UChar)c; >+ units[length]=(char16_t)c; > equal[length]=NULL; > values[length]=value; > ++length; >- hash=(hash*37+c)*37+value; >+ hash=(hash*37u+c)*37u+value; > } > // Adds a unit which leads to another match node. > void add(int32_t c, Node *node) { >- units[length]=(UChar)c; >+ units[length]=(char16_t)c; > equal[length]=node; > values[length]=0; > ++length; >- hash=(hash*37+c)*37+hashCode(node); >+ hash=(hash*37u+c)*37u+hashCode(node); > } > protected: > Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value". > int32_t length; > int32_t values[kMaxBranchLinearSubNodeLength]; >- UChar units[kMaxBranchLinearSubNodeLength]; >+ char16_t units[kMaxBranchLinearSubNodeLength]; > }; > > /** >@@ -352,15 +364,15 @@ protected: > */ > class SplitBranchNode : public BranchNode { > public: >- SplitBranchNode(UChar middleUnit, Node *lessThanNode, Node *greaterOrEqualNode) >- : BranchNode(((0x555555*37+middleUnit)*37+ >- hashCode(lessThanNode))*37+hashCode(greaterOrEqualNode)), >+ SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode) >+ : BranchNode(((0x555555u*37u+middleUnit)*37u+ >+ hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)), > unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {} > virtual UBool operator==(const Node &other) const; > virtual int32_t markRightEdgesFirst(int32_t edgeNumber); > virtual void write(StringTrieBuilder &builder); > protected: >- UChar unit; >+ char16_t unit; > Node *lessThan; > Node *greaterOrEqual; > }; >@@ -370,7 +382,7 @@ protected: > class BranchHeadNode : public ValueNode { > public: > BranchHeadNode(int32_t len, Node *subNode) >- : ValueNode((0x666666*37+len)*37+hashCode(subNode)), >+ : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)), > length(len), next(subNode) {} > virtual UBool operator==(const Node &other) const; > virtual int32_t markRightEdgesFirst(int32_t edgeNumber); >diff --git a/Source/WTF/icu/unicode/stsearch.h b/Source/WTF/icu/unicode/stsearch.h >index d38cb23f2157e6945e66b10f2b844200e3e16c13..57b5b321e90d91db35f38985ff535cc4dcb3b68b 100644 >--- a/Source/WTF/icu/unicode/stsearch.h >+++ b/Source/WTF/icu/unicode/stsearch.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 2001-2014 IBM and others. All rights reserved. >diff --git a/Source/WTF/icu/unicode/symtable.h b/Source/WTF/icu/unicode/symtable.h >index 428f8bff23e12f17444bdb34f04c15cb7d3a5869..35e5f238a709545beacb8c65fd13bafed0a4fb4f 100644 >--- a/Source/WTF/icu/unicode/symtable.h >+++ b/Source/WTF/icu/unicode/symtable.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2000-2005, International Business Machines >diff --git a/Source/WTF/icu/unicode/tblcoll.h b/Source/WTF/icu/unicode/tblcoll.h >index e56f189ad2d1f82efe79c8737c08de88a19066af..24ba213b41eacc1181f1926f4d11da467a77f24d 100644 >--- a/Source/WTF/icu/unicode/tblcoll.h >+++ b/Source/WTF/icu/unicode/tblcoll.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** >-* Copyright (C) 1996-2015, International Business Machines Corporation and >+* Copyright (C) 1996-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ****************************************************************************** > */ >@@ -94,12 +96,12 @@ class UVector64; > * Collator, using data-driven tables. The user can create a customized > * table-based collation. > * <p> >- * For more information about the collation service see >+ * For more information about the collation service see > * <a href="http://userguide.icu-project.org/collation">the User Guide</a>. > * <p> >- * Collation service provides correct sorting orders for most locales supported in ICU. >+ * Collation service provides correct sorting orders for most locales supported in ICU. > * If specific data for a locale is not available, the orders eventually falls back >- * to the <a href="http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Collation">CLDR root sort order</a>. >+ * to the <a href="http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Collation">CLDR root sort order</a>. > * <p> > * Sort ordering may be customized by providing your own set of rules. For more on > * this subject see the <a href="http://userguide.icu-project.org/collation/customization"> >@@ -161,7 +163,7 @@ public: > UColAttributeValue decompositionMode, > UErrorCode& status); > >-#ifndef U_HIDE_INTERNAL_API >+#ifndef U_HIDE_INTERNAL_API > /** > * TODO: document & propose as public API > * @internal >@@ -180,8 +182,8 @@ public: > > > /** Opens a collator from a collator binary image created using >- * cloneBinary. Binary image used in instantiation of the >- * collator remains owned by the user and should stay around for >+ * cloneBinary. Binary image used in instantiation of the >+ * collator remains owned by the user and should stay around for > * the lifetime of the collator. The API also takes a base collator > * which must be the root collator. > * @param bin binary image owned by the user and required through the >@@ -196,8 +198,8 @@ public: > * @see cloneBinary > * @stable ICU 3.4 > */ >- RuleBasedCollator(const uint8_t *bin, int32_t length, >- const RuleBasedCollator *base, >+ RuleBasedCollator(const uint8_t *bin, int32_t length, >+ const RuleBasedCollator *base, > UErrorCode &status); > > /** >@@ -258,7 +260,7 @@ public: > > /** > * The comparison function compares the character data stored in two >- * different strings. Returns information about whether a string is less >+ * different strings. Returns information about whether a string is less > * than, greater than or equal to another string. > * @param source the source string to be compared with. > * @param target the string that is to be compared with the source string. >@@ -273,15 +275,15 @@ public: > UErrorCode &status) const; > > /** >- * Does the same thing as compare but limits the comparison to a specified >+ * Does the same thing as compare but limits the comparison to a specified > * length > * @param source the source string to be compared with. > * @param target the string that is to be compared with the source string. > * @param length the length the comparison is limited to > * @param status possible error code >- * @return Returns an enum value. UCOL_GREATER if source (up to the specified >- * length) is greater than target; UCOL_EQUAL if source (up to specified >- * length) is equal to target; UCOL_LESS if source (up to the specified >+ * @return Returns an enum value. UCOL_GREATER if source (up to the specified >+ * length) is greater than target; UCOL_EQUAL if source (up to specified >+ * length) is equal to target; UCOL_LESS if source (up to the specified > * length) is less than target. > * @stable ICU 2.6 > */ >@@ -292,7 +294,7 @@ public: > > /** > * The comparison function compares the character data stored in two >- * different string arrays. Returns information about whether a string array >+ * different string arrays. Returns information about whether a string array > * is less than, greater than or equal to another string array. > * @param source the source string array to be compared with. > * @param sourceLength the length of the source string array. If this value >@@ -306,8 +308,8 @@ public: > * than target > * @stable ICU 2.6 > */ >- virtual UCollationResult compare(const UChar* source, int32_t sourceLength, >- const UChar* target, int32_t targetLength, >+ virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, >+ const char16_t* target, int32_t targetLength, > UErrorCode &status) const; > > /** >@@ -346,7 +348,7 @@ public: > * Transforms the string into a series of characters > * that can be compared with CollationKey.compare(). > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source the source string. >@@ -364,7 +366,7 @@ public: > * Transforms a specified region of the string into a series of characters > * that can be compared with CollationKey.compare. > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source the source string. >@@ -375,7 +377,7 @@ public: > * @see CollationKey > * @stable ICU 2.0 > */ >- virtual CollationKey& getCollationKey(const UChar *source, >+ virtual CollationKey& getCollationKey(const char16_t *source, > int32_t sourceLength, > CollationKey& key, > UErrorCode& status) const; >@@ -413,7 +415,7 @@ public: > */ > virtual void getVersion(UVersionInfo info) const; > >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** > * Returns the maximum length of any expansion sequences that end with the > * specified comparison order. >@@ -458,7 +460,7 @@ public: > */ > static UClassID U_EXPORT2 getStaticClassID(void); > >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** > * Do not use this method: The caller and the ICU library might use different heaps. > * Use cloneBinary() instead which writes to caller-provided memory. >@@ -472,7 +474,7 @@ public: > uint8_t *cloneRuleData(int32_t &length, UErrorCode &status) const; > #endif /* U_HIDE_DEPRECATED_API */ > >- /** Creates a binary image of a collator. This binary image can be stored and >+ /** Creates a binary image of a collator. This binary image can be stored and > * later used to instantiate a collator using ucol_openBinary. > * This API supports preflighting. > * @param buffer a fill-in buffer to receive the binary image >@@ -550,7 +552,7 @@ public: > * the top of one of the supported reordering groups, > * and it must not be beyond the last of those groups. > * See setMaxVariable(). >- * @param varTop one or more (if contraction) UChars to which the variable top should be set >+ * @param varTop one or more (if contraction) char16_ts to which the variable top should be set > * @param len length of variable top string. If -1 it is considered to be zero terminated. > * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> > * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> >@@ -559,7 +561,7 @@ public: > * @return variable top primary weight > * @deprecated ICU 53 Call setMaxVariable() instead. > */ >- virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status); >+ virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status); > > /** > * Sets the variable top to the primary weight of the specified string. >@@ -568,7 +570,7 @@ public: > * the top of one of the supported reordering groups, > * and it must not be beyond the last of those groups. > * See setMaxVariable(). >- * @param varTop a UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set >+ * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set > * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> > * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> > * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond >@@ -601,10 +603,10 @@ public: > virtual uint32_t getVariableTop(UErrorCode &status) const; > > /** >- * Get a UnicodeSet that contains all the characters and sequences tailored in >+ * Get a UnicodeSet that contains all the characters and sequences tailored in > * this collator. > * @param status error code of the operation >- * @return a pointer to a UnicodeSet object containing all the >+ * @return a pointer to a UnicodeSet object containing all the > * code points and sequences that may sort differently than > * in the root collator. The object must be disposed of by using delete > * @stable ICU 2.4 >@@ -614,7 +616,7 @@ public: > /** > * Get the sort key as an array of bytes from a UnicodeString. > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source string to be processed. >@@ -629,9 +631,9 @@ public: > int32_t resultLength) const; > > /** >- * Get the sort key as an array of bytes from a UChar buffer. >+ * Get the sort key as an array of bytes from a char16_t buffer. > * >- * Note that sort keys are often less efficient than simply doing comparison. >+ * Note that sort keys are often less efficient than simply doing comparison. > * For more details, see the ICU User Guide. > * > * @param source string to be processed. >@@ -644,7 +646,7 @@ public: > * @return Number of bytes needed for storing the sort key > * @stable ICU 2.2 > */ >- virtual int32_t getSortKey(const UChar *source, int32_t sourceLength, >+ virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength, > uint8_t *result, int32_t resultLength) const; > > /** >@@ -658,7 +660,7 @@ public: > * @see ucol_setReorderCodes > * @see Collator#getEquivalentReorderCodes > * @see Collator#setReorderCodes >- * @stable ICU 4.8 >+ * @stable ICU 4.8 > */ > virtual int32_t getReorderCodes(int32_t *dest, > int32_t destCapacity, >@@ -666,14 +668,14 @@ public: > > /** > * Sets the ordering of scripts for this collator. >- * @param reorderCodes An array of script codes in the new order. This can be NULL if the >+ * @param reorderCodes An array of script codes in the new order. This can be NULL if the > * length is also set to 0. An empty array will clear any reordering codes on the collator. > * @param reorderCodesLength The length of reorderCodes. > * @param status error code > * @see ucol_setReorderCodes > * @see Collator#getReorderCodes > * @see Collator#getEquivalentReorderCodes >- * @stable ICU 4.8 >+ * @stable ICU 4.8 > */ > virtual void setReorderCodes(const int32_t* reorderCodes, > int32_t reorderCodesLength, >@@ -689,18 +691,18 @@ public: > UErrorCode &errorCode) const; > > /** Get the short definition string for a collator. This internal API harvests the collator's >- * locale and the attribute set and produces a string that can be used for opening >+ * locale and the attribute set and produces a string that can be used for opening > * a collator with the same attributes using the ucol_openFromShortString API. > * This string will be normalized. > * The structure and the syntax of the string is defined in the "Naming collators" >- * section of the users guide: >+ * section of the users guide: > * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme > * This function supports preflighting. >- * >+ * > * This is internal, and intended to be used with delegate converters. > * > * @param locale a locale that will appear as a collators locale in the resulting >- * short string definition. If NULL, the locale will be harvested >+ * short string definition. If NULL, the locale will be harvested > * from the collator. > * @param buffer space to hold the resulting string > * @param capacity capacity of the buffer >@@ -724,6 +726,7 @@ public: > UCharIterator *iter, uint32_t state[2], > uint8_t *dest, int32_t count, UErrorCode &errorCode) const; > >+ // Do not enclose the default constructor with #ifndef U_HIDE_INTERNAL_API > /** > * Only for use in ucol_openRules(). > * @internal >@@ -818,17 +821,17 @@ private: > void adoptTailoring(CollationTailoring *t, UErrorCode &errorCode); > > // Both lengths must be <0 or else both must be >=0. >- UCollationResult doCompare(const UChar *left, int32_t leftLength, >- const UChar *right, int32_t rightLength, >+ UCollationResult doCompare(const char16_t *left, int32_t leftLength, >+ const char16_t *right, int32_t rightLength, > UErrorCode &errorCode) const; > UCollationResult doCompare(const uint8_t *left, int32_t leftLength, > const uint8_t *right, int32_t rightLength, > UErrorCode &errorCode) const; > >- void writeSortKey(const UChar *s, int32_t length, >+ void writeSortKey(const char16_t *s, int32_t length, > SortKeyByteSink &sink, UErrorCode &errorCode) const; > >- void writeIdenticalLevel(const UChar *s, const UChar *limit, >+ void writeIdenticalLevel(const char16_t *s, const char16_t *limit, > SortKeyByteSink &sink, UErrorCode &errorCode) const; > > const CollationSettings &getDefaultSettings() const; >@@ -853,7 +856,7 @@ private: > */ > UBool isUnsafe(UChar32 c) const; > >- static void computeMaxExpansions(const CollationTailoring *t, UErrorCode &errorCode); >+ static void U_CALLCONV computeMaxExpansions(const CollationTailoring *t, UErrorCode &errorCode); > UBool initMaxExpansions(UErrorCode &errorCode) const; > > void setFastLatinOptions(CollationSettings &ownedSettings) const; >diff --git a/Source/WTF/icu/unicode/timezone.h b/Source/WTF/icu/unicode/timezone.h >index c3356c9738a26303525eb4b4b45c76f927415266..83dee317784a819962d4118f6bf39fafdee28082 100644 >--- a/Source/WTF/icu/unicode/timezone.h >+++ b/Source/WTF/icu/unicode/timezone.h >@@ -1,5 +1,7 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /************************************************************************* >-* Copyright (c) 1997-2015, International Business Machines Corporation >+* Copyright (c) 1997-2016, International Business Machines Corporation > * and others. All Rights Reserved. > ************************************************************************** > * >@@ -66,8 +68,8 @@ class StringEnumeration; > * TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles"); > * </pre> > * \htmlonly</blockquote>\endhtmlonly >- * You can use <code>getAvailableIDs</code> method to iterate through >- * all the supported time zone IDs, or getCanonicalID method to check >+ * You can use the <code>createEnumeration</code> method to iterate through >+ * all the supported time zone IDs, or the <code>getCanonicalID</code> method to check > * if a time zone ID is supported or not. You can then choose a > * supported ID to get a <code>TimeZone</code>. > * If the time zone you want is not represented by one of the >@@ -273,7 +275,6 @@ public: > static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id, > int32_t index); > >-#ifndef U_HIDE_DRAFT_API > /** > * Creates an instance of TimeZone detected from the current host > * system configuration. Note that ICU4C does not change the default >@@ -285,10 +286,9 @@ public: > * > * @return A new instance of TimeZone detected from the current host system > * configuration. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > static TimeZone* U_EXPORT2 detectHostTimeZone(); >-#endif > > /** > * Creates a new copy of the default TimeZone for this host. Unless the default time >@@ -863,7 +863,7 @@ private: > * @param id zone id string > * @return the pointer of the ID resource, or NULL. > */ >- static const UChar* findID(const UnicodeString& id); >+ static const char16_t* findID(const UnicodeString& id); > > /** > * Resolve a link in Olson tzdata. When the given id is known and it's not a link, >@@ -873,7 +873,7 @@ private: > * @param id zone id string > * @return the dereferenced zone or NULL > */ >- static const UChar* dereferOlsonLink(const UnicodeString& id); >+ static const char16_t* dereferOlsonLink(const UnicodeString& id); > > /** > * Returns the region code associated with the given zone, >@@ -881,7 +881,7 @@ private: > * @param id zone id string > * @return the region associated with the given zone > */ >- static const UChar* getRegion(const UnicodeString& id); >+ static const char16_t* getRegion(const UnicodeString& id); > > public: > #ifndef U_HIDE_INTERNAL_API >@@ -893,7 +893,7 @@ private: > * @return the region associated with the given zone > * @internal > */ >- static const UChar* getRegion(const UnicodeString& id, UErrorCode& status); >+ static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status); > #endif /* U_HIDE_INTERNAL_API */ > > private: >diff --git a/Source/WTF/icu/unicode/tmunit.h b/Source/WTF/icu/unicode/tmunit.h >index e417f3522bceb3c5cee6ac3a41c24fe6b6aabc07..fa59f104734baa33f6299aa7f762d3f990326b34 100644 >--- a/Source/WTF/icu/unicode/tmunit.h >+++ b/Source/WTF/icu/unicode/tmunit.h >@@ -1,7 +1,9 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >- * Copyright (C) 2009-2014, Google, International Business Machines Corporation and * >- * others. All Rights Reserved. * >+ * Copyright (C) 2009-2016, International Business Machines Corporation, * >+ * Google, and others. All Rights Reserved. * > ******************************************************************************* > */ > >@@ -41,18 +43,24 @@ public: > UTIMEUNIT_HOUR, > UTIMEUNIT_MINUTE, > UTIMEUNIT_SECOND, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UTimeUnitFields value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UTIMEUNIT_FIELD_COUNT >+#endif // U_HIDE_DEPRECATED_API > }; > > /** > * Create Instance. >- * @param timeUnitField time unit field based on which the instance >+ * @param timeUnitField time unit field based on which the instance > * is created. >- * @param status input-output error code. >+ * @param status input-output error code. > * If the timeUnitField is invalid, > * then this will be set to U_ILLEGAL_ARGUMENT_ERROR. > * @return a TimeUnit instance >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField, > UErrorCode& status); >@@ -60,19 +68,19 @@ public: > > /** > * Override clone. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > virtual UObject* clone() const; > > /** > * Copy operator. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > TimeUnit(const TimeUnit& other); > > /** > * Assignment operator. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > TimeUnit& operator=(const TimeUnit& other); > >@@ -82,7 +90,7 @@ public: > * @return The class ID for this object. All objects of a given > * class have the same class ID. Objects of other classes have > * different class IDs. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > virtual UClassID getDynamicClassID() const; > >@@ -90,7 +98,7 @@ public: > * Returns the class ID for this class. This is used to compare to > * the return value of getDynamicClassID(). > * @return The class ID for all objects of this class. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > static UClassID U_EXPORT2 getStaticClassID(); > >@@ -98,13 +106,13 @@ public: > /** > * Get time unit field. > * @return time unit field. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > UTimeUnitFields getTimeUnitField() const; > > /** > * Destructor. >- * @stable ICU 4.2 >+ * @stable ICU 4.2 > */ > virtual ~TimeUnit(); > >@@ -113,7 +121,7 @@ private: > > /** > * Constructor >- * @internal ICU 4.2 >+ * @internal (private) > */ > TimeUnit(UTimeUnitFields timeUnitField); > >diff --git a/Source/WTF/icu/unicode/tmutamt.h b/Source/WTF/icu/unicode/tmutamt.h >index bd2b8a4a9e21285c17bb8ecbb9628065871e6fee..274bfa6f23fb0d99cc2194381df0a3fd6f7f533b 100644 >--- a/Source/WTF/icu/unicode/tmutamt.h >+++ b/Source/WTF/icu/unicode/tmutamt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2009-2010, Google, International Business Machines Corporation and * >diff --git a/Source/WTF/icu/unicode/tmutfmt.h b/Source/WTF/icu/unicode/tmutfmt.h >index 728ff13219a012d1c886ee98bb8d8ea183cbd18b..8f245859a622bafbfc345b5c6b9ceecae70f81fe 100644 >--- a/Source/WTF/icu/unicode/tmutfmt.h >+++ b/Source/WTF/icu/unicode/tmutfmt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2008-2014, Google, International Business Machines Corporation >@@ -50,6 +52,8 @@ U_NAMESPACE_BEGIN > class Hashtable; > class UVector; > >+struct TimeUnitFormatReadSink; >+ > /** > * Format or parse a TimeUnitAmount, using plural rules for the units where available. > * >@@ -227,6 +231,7 @@ private: > // UTIMEUNIT_YEAR. > static const char* getTimeUnitName(TimeUnit::UTimeUnitFields field, UErrorCode& status); > >+ friend struct TimeUnitFormatReadSink; > }; > > inline UBool >diff --git a/Source/WTF/icu/unicode/translit.h b/Source/WTF/icu/unicode/translit.h >index 22e1e24e500d9f209cbc58acca9534330b60fd41..bccba5480242467e63a82dc704d1bc9247f07566 100644 >--- a/Source/WTF/icu/unicode/translit.h >+++ b/Source/WTF/icu/unicode/translit.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2014, International Business Machines >@@ -1317,7 +1319,7 @@ inline int32_t Transliterator::getMaximumContextLength(void) const { > inline void Transliterator::setID(const UnicodeString& id) { > ID = id; > // NUL-terminate the ID string, which is a non-aliased copy. >- ID.append((UChar)0); >+ ID.append((char16_t)0); > ID.truncate(ID.length()-1); > } > >diff --git a/Source/WTF/icu/unicode/tzfmt.h b/Source/WTF/icu/unicode/tzfmt.h >index 24f0e49eb79251e4daa34cc2e4a3a72b34d04f1c..724ff4d85bb265796611eeda4d2ca68558f2d698 100644 >--- a/Source/WTF/icu/unicode/tzfmt.h >+++ b/Source/WTF/icu/unicode/tzfmt.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2011-2014, International Business Machines Corporation and >+* Copyright (C) 2011-2015, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > */ >@@ -233,18 +235,15 @@ typedef enum UTimeZoneFormatParseOption { > * by other styles. > * @stable ICU 50 > */ >- UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01 >-#ifndef U_HIDE_DRAFT_API >- , >+ UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01, > /** > * When parsing a time zone display name in UTZFMT_STYLE_SPECIFIC_SHORT, > * look for the IANA tz database compatible zone abbreviations in addition > * to the localized names coming from the {@link TimeZoneNames} currently > * used by the {@link TimeZoneFormat}. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02 >-#endif /* U_HIDE_DRAFT_API */ > } UTimeZoneFormatParseOption; > > U_CDECL_END >@@ -943,7 +942,7 @@ private: > * @param parsedLen the parsed length, or 0 on failure. > * @return the parsed offset in milliseconds. > */ >- int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, UChar separator, >+ int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator, > int32_t& parsedLen) const; > > /** >@@ -983,7 +982,7 @@ private: > * @param maxFields The maximum fields > * @return The offset string > */ >- static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, UChar sep, >+ static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep, > OffsetFields minFields, OffsetFields maxFields, UnicodeString& result); > > /** >@@ -1013,7 +1012,7 @@ private: > * @param maxFields The maximum Fields to be parsed > * @return Parsed offset, 0 or positive number. > */ >- static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, UChar sep, >+ static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep, > OffsetFields minFields, OffsetFields maxFields); > > /** >diff --git a/Source/WTF/icu/unicode/tznames.h b/Source/WTF/icu/unicode/tznames.h >index 9583ded022f2eb2b8104b1255a02d1657e7e7812..399265d85ae66cb8b8489b58c5a355e03f4466c1 100644 >--- a/Source/WTF/icu/unicode/tznames.h >+++ b/Source/WTF/icu/unicode/tznames.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2011-2014, International Business Machines Corporation and >+* Copyright (C) 2011-2016, International Business Machines Corporation and > * others. All Rights Reserved. > ******************************************************************************* > */ >@@ -133,7 +135,7 @@ public: > virtual ~TimeZoneNames(); > > /** >- * Return true if the given TimeZoneNames objects are emantically equal. >+ * Return true if the given TimeZoneNames objects are semantically equal. > * @param other the object to be compared with. > * @return Return TRUE if the given Format objects are semantically equal. > * @stable ICU 50 >@@ -167,7 +169,6 @@ public: > */ > static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns an instance of <code>TimeZoneNames</code> containing only short specific > * zone names (SHORT_STANDARD and SHORT_DAYLIGHT), >@@ -176,10 +177,9 @@ public: > * Note: The input locale is used for resolving ambiguous names (e.g. "IST" is parsed > * as Israel Standard Time for Israel, while it is parsed as India Standard Time for > * all other regions). The zone names returned by this instance are not localized. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Returns an enumeration of all available meta zone IDs. >@@ -290,6 +290,16 @@ public: > */ > virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const; > >+ /** >+ * @internal ICU internal only, for specific users only until proposed publicly. >+ */ >+ virtual void loadAllDisplayNames(UErrorCode& status); >+ >+ /** >+ * @internal ICU internal only, for specific users only until proposed publicly. >+ */ >+ virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const; >+ > /** > * <code>MatchInfoCollection</code> represents a collection of time zone name matches used by > * {@link TimeZoneNames#find}. >diff --git a/Source/WTF/icu/unicode/tzrule.h b/Source/WTF/icu/unicode/tzrule.h >index afa40148d42d82ea484159716ec0b4943ee57f71..1647fda703ee687e433e0773e68f047f54ce2306 100644 >--- a/Source/WTF/icu/unicode/tzrule.h >+++ b/Source/WTF/icu/unicode/tzrule.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2008, International Business Machines Corporation and * >diff --git a/Source/WTF/icu/unicode/tztrans.h b/Source/WTF/icu/unicode/tztrans.h >index 94b8e91267a5c6a9e91fedf99b17c72a855cd3fb..a476c68c8f751fc74b7403cf046c6d2de99b5bf2 100644 >--- a/Source/WTF/icu/unicode/tztrans.h >+++ b/Source/WTF/icu/unicode/tztrans.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2008, International Business Machines Corporation and * >diff --git a/Source/WTF/icu/unicode/ubidi.h b/Source/WTF/icu/unicode/ubidi.h >index 27042ed7f4b94e2078d175474b3be2a9daf3f911..ef21f2420666cd4db47cd1ebc5162df6eba11d16 100644 >--- a/Source/WTF/icu/unicode/ubidi.h >+++ b/Source/WTF/icu/unicode/ubidi.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -6,7 +8,7 @@ > * > ****************************************************************************** > * file name: ubidi.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -718,9 +720,13 @@ typedef enum UBiDiReorderingMode { > * <code>UBIDI_REORDER_NUMBERS_SPECIAL</code> Bidi algorithm. > * @stable ICU 3.6 */ > UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, >- /** Number of values for reordering mode. >- * @stable ICU 3.6 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * Number of values for reordering mode. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UBIDI_REORDER_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UBiDiReorderingMode; > > /** >@@ -1190,11 +1196,14 @@ ubidi_setContext(UBiDi *pBiDi, > * A level overrides the directional property of its corresponding > * (same index) character if the level has the > * <code>#UBIDI_LEVEL_OVERRIDE</code> bit set.<br><br> >- * Except for that bit, it must be >+ * Aside from that bit, it must be > * <code>paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL</code>, >- * with one exception: a level of zero may be specified for a paragraph >- * separator even if <code>paraLevel>0</code> when multiple paragraphs >- * are submitted in the same call to <code>ubidi_setPara()</code>.<br><br> >+ * except that level 0 is always allowed. >+ * Level 0 for a paragraph separator prevents reordering of paragraphs; >+ * this only works reliably if <code>#UBIDI_LEVEL_OVERRIDE</code> >+ * is also set for paragraph separators. >+ * Level 0 for other characters is treated as a wildcard >+ * and is lifted up to the resolved level of the surrounding paragraph.<br><br> > * <strong>Caution: </strong>A copy of this pointer, not of the levels, > * will be stored in the <code>UBiDi</code> object; > * the <code>embeddingLevels</code> array must not be >@@ -1959,13 +1968,19 @@ U_STABLE int32_t U_EXPORT2 > ubidi_getResultLength(const UBiDi *pBiDi); > > U_CDECL_BEGIN >+ >+#ifndef U_HIDE_DEPRECATED_API > /** >- * value returned by <code>UBiDiClassCallback</code> callbacks when >+ * Value returned by <code>UBiDiClassCallback</code> callbacks when > * there is no need to override the standard Bidi class for a given code point. >+ * >+ * This constant is deprecated; use u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1 instead. >+ * > * @see UBiDiClassCallback >- * @stable ICU 3.6 >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT >+#endif // U_HIDE_DEPRECATED_API > > /** > * Callback type declaration for overriding default Bidi class values with >@@ -1981,8 +1996,8 @@ U_CDECL_BEGIN > * > * @return The directional property / Bidi class for the given code point > * <code>c</code> if the default class has been overridden, or >- * <code>#U_BIDI_CLASS_DEFAULT</code> if the standard Bidi class value >- * for <code>c</code> is to be used. >+ * <code>#U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code> >+ * if the standard Bidi class value for <code>c</code> is to be used. > * @see ubidi_setClassCallback > * @see ubidi_getClassCallback > * @stable ICU 3.6 >@@ -1995,8 +2010,8 @@ U_CDECL_END > /** > * Retrieve the Bidi class for a given code point. > * <p>If a <code>#UBiDiClassCallback</code> callback is defined and returns a >- * value other than <code>#U_BIDI_CLASS_DEFAULT</code>, that value is used; >- * otherwise the default class determination mechanism is invoked.</p> >+ * value other than <code>#U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>, >+ * that value is used; otherwise the default class determination mechanism is invoked.</p> > * > * @param pBiDi is the paragraph <code>UBiDi</code> object. > * >diff --git a/Source/WTF/icu/unicode/ubiditransform.h b/Source/WTF/icu/unicode/ubiditransform.h >new file mode 100644 >index 0000000000000000000000000000000000000000..627b005ed45f8d1397e0d2585dc2e00be7964a69 >--- /dev/null >+++ b/Source/WTF/icu/unicode/ubiditransform.h >@@ -0,0 +1,318 @@ >+/* >+****************************************************************************** >+* >+* © 2016 and later: Unicode, Inc. and others. >+* License & terms of use: http://www.unicode.org/copyright.html >+* >+****************************************************************************** >+* file name: ubiditransform.h >+* encoding: UTF-8 >+* tab size: 8 (not used) >+* indentation:4 >+* >+* created on: 2016jul24 >+* created by: Lina Kemmel >+* >+*/ >+ >+#ifndef UBIDITRANSFORM_H >+#define UBIDITRANSFORM_H >+ >+#include "unicode/utypes.h" >+#include "unicode/ubidi.h" >+#include "unicode/uchar.h" >+#include "unicode/localpointer.h" >+ >+/** >+ * \file >+ * \brief Bidi Transformations >+ * >+ * <code>UBiDiOrder</code> indicates the order of text.<p> >+ * This bidi transformation engine supports all possible combinations (4 in >+ * total) of input and output text order: >+ * <ul> >+ * <li><logical input, visual output>: unless the output direction is RTL, this >+ * corresponds to a normal operation of the Bidi algorithm as described in the >+ * Unicode Technical Report and implemented by <code>UBiDi</code> when the >+ * reordering mode is set to <code>UBIDI_REORDER_DEFAULT</code>. Visual RTL >+ * mode is not supported by <code>UBiDi</code> and is accomplished through >+ * reversing a visual LTR string,</li> >+ * <li><visual input, logical output>: unless the input direction is RTL, this >+ * corresponds to an "inverse bidi algorithm" in <code>UBiDi</code> with the >+ * reordering mode set to <code>UBIDI_REORDER_INVERSE_LIKE_DIRECT</code>. >+ * Visual RTL mode is not not supported by <code>UBiDi</code> and is >+ * accomplished through reversing a visual LTR string,</li> >+ * <li><logical input, logical output>: if the input and output base directions >+ * mismatch, this corresponds to the <code>UBiDi</code> implementation with the >+ * reordering mode set to <code>UBIDI_REORDER_RUNS_ONLY</code>; and if the >+ * input and output base directions are identical, the transformation engine >+ * will only handle character mirroring and Arabic shaping operations without >+ * reordering,</li> >+ * <li><visual input, visual output>: this reordering mode is not supported by >+ * the <code>UBiDi</code> engine; it implies character mirroring, Arabic >+ * shaping, and - if the input/output base directions mismatch - string >+ * reverse operations.</li> >+ * </ul> >+ * @see ubidi_setInverse >+ * @see ubidi_setReorderingMode >+ * @see UBIDI_REORDER_DEFAULT >+ * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT >+ * @see UBIDI_REORDER_RUNS_ONLY >+ * @stable ICU 58 >+ */ >+typedef enum { >+ /** 0: Constant indicating a logical order. >+ * This is the default for input text. >+ * @stable ICU 58 >+ */ >+ UBIDI_LOGICAL = 0, >+ /** 1: Constant indicating a visual order. >+ * This is a default for output text. >+ * @stable ICU 58 >+ */ >+ UBIDI_VISUAL >+} UBiDiOrder; >+ >+/** >+ * <code>UBiDiMirroring</code> indicates whether or not characters with the >+ * "mirrored" property in RTL runs should be replaced with their mirror-image >+ * counterparts. >+ * @see UBIDI_DO_MIRRORING >+ * @see ubidi_setReorderingOptions >+ * @see ubidi_writeReordered >+ * @see ubidi_writeReverse >+ * @stable ICU 58 >+ */ >+typedef enum { >+ /** 0: Constant indicating that character mirroring should not be >+ * performed. >+ * This is the default. >+ * @stable ICU 58 >+ */ >+ UBIDI_MIRRORING_OFF = 0, >+ /** 1: Constant indicating that character mirroring should be performed. >+ * This corresponds to calling <code>ubidi_writeReordered</code> or >+ * <code>ubidi_writeReverse</code> with the >+ * <code>UBIDI_DO_MIRRORING</code> option bit set. >+ * @stable ICU 58 >+ */ >+ UBIDI_MIRRORING_ON >+} UBiDiMirroring; >+ >+/** >+ * Forward declaration of the <code>UBiDiTransform</code> structure that stores >+ * information used by the layout transformation engine. >+ * @stable ICU 58 >+ */ >+typedef struct UBiDiTransform UBiDiTransform; >+ >+/** >+ * Performs transformation of text from the bidi layout defined by the input >+ * ordering scheme to the bidi layout defined by the output ordering scheme, >+ * and applies character mirroring and Arabic shaping operations.<p> >+ * In terms of <code>UBiDi</code>, such a transformation implies: >+ * <ul> >+ * <li>calling <code>ubidi_setReorderingMode</code> as needed (when the >+ * reordering mode is other than normal),</li> >+ * <li>calling <code>ubidi_setInverse</code> as needed (when text should be >+ * transformed from a visual to a logical form),</li> >+ * <li>resolving embedding levels of each character in the input text by >+ * calling <code>ubidi_setPara</code>,</li> >+ * <li>reordering the characters based on the computed embedding levels, also >+ * performing character mirroring as needed, and streaming the result to the >+ * output, by calling <code>ubidi_writeReordered</code>,</li> >+ * <li>performing Arabic digit and letter shaping on the output text by calling >+ * <code>u_shapeArabic</code>.</li> >+ * </ul> >+ * An "ordering scheme" encompasses the base direction and the order of text, >+ * and these characteristics must be defined by the caller for both input and >+ * output explicitly .<p> >+ * There are 36 possible combinations of <input, output> ordering schemes, >+ * which are partially supported by <code>UBiDi</code> already. Examples of the >+ * currently supported combinations: >+ * <ul> >+ * <li><Logical LTR, Visual LTR>: this is equivalent to calling >+ * <code>ubidi_setPara</code> with <code>paraLevel == UBIDI_LTR</code>,</li> >+ * <li><Logical RTL, Visual LTR>: this is equivalent to calling >+ * <code>ubidi_setPara</code> with <code>paraLevel == UBIDI_RTL</code>,</li> >+ * <li><Logical Default ("Auto") LTR, Visual LTR>: this is equivalent to >+ * calling <code>ubidi_setPara</code> with >+ * <code>paraLevel == UBIDI_DEFAULT_LTR</code>,</li> >+ * <li><Logical Default ("Auto") RTL, Visual LTR>: this is equivalent to >+ * calling <code>ubidi_setPara</code> with >+ * <code>paraLevel == UBIDI_DEFAULT_RTL</code>,</li> >+ * <li><Visual LTR, Logical LTR>: this is equivalent to >+ * calling <code>ubidi_setInverse(UBiDi*, TRUE)</code> and then >+ * <code>ubidi_setPara</code> with <code>paraLevel == UBIDI_LTR</code>,</li> >+ * <li><Visual LTR, Logical RTL>: this is equivalent to >+ * calling <code>ubidi_setInverse(UBiDi*, TRUE)</code> and then >+ * <code>ubidi_setPara</code> with <code>paraLevel == UBIDI_RTL</code>.</li> >+ * </ul> >+ * All combinations that involve the Visual RTL scheme are unsupported by >+ * <code>UBiDi</code>, for instance: >+ * <ul> >+ * <li><Logical LTR, Visual RTL>,</li> >+ * <li><Visual RTL, Logical RTL>.</li> >+ * </ul> >+ * <p>Example of usage of the transformation engine:<br> >+ * <pre> >+ * \code >+ * UChar text1[] = {'a', 'b', 'c', 0x0625, '1', 0}; >+ * UChar text2[] = {'a', 'b', 'c', 0x0625, '1', 0}; >+ * UErrorCode errorCode = U_ZERO_ERROR; >+ * // Run a transformation. >+ * ubiditransform_transform(pBidiTransform, >+ * text1, -1, text2, -1, >+ * UBIDI_LTR, UBIDI_VISUAL, >+ * UBIDI_RTL, UBIDI_LOGICAL, >+ * UBIDI_MIRRORING_OFF, >+ * U_SHAPE_DIGITS_AN2EN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED, >+ * &errorCode); >+ * // Do something with text2. >+ * text2[4] = '2'; >+ * // Run a reverse transformation. >+ * ubiditransform_transform(pBidiTransform, >+ * text2, -1, text1, -1, >+ * UBIDI_RTL, UBIDI_LOGICAL, >+ * UBIDI_LTR, UBIDI_VISUAL, >+ * UBIDI_MIRRORING_OFF, >+ * U_SHAPE_DIGITS_EN2AN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED, >+ * &errorCode); >+ *\endcode >+ * </pre> >+ * </p> >+ * >+ * @param pBiDiTransform A pointer to a <code>UBiDiTransform</code> object >+ * allocated with <code>ubiditransform_open()</code> or >+ * <code>NULL</code>.<p> >+ * This object serves for one-time setup to amortize initialization >+ * overheads. Use of this object is not thread-safe. All other threads >+ * should allocate a new <code>UBiDiTransform</code> object by calling >+ * <code>ubiditransform_open()</code> before using it. Alternatively, >+ * a caller can set this parameter to <code>NULL</code>, in which case >+ * the object will be allocated by the engine on the fly.</p> >+ * @param src A pointer to the text that the Bidi layout transformations will >+ * be performed on. >+ * <p><strong>Note:</strong> the text must be (at least) >+ * <code>srcLength</code> long.</p> >+ * @param srcLength The length of the text, in number of UChars. If >+ * <code>length == -1</code> then the text must be zero-terminated. >+ * @param dest A pointer to where the processed text is to be copied. >+ * @param destSize The size of the <code>dest</code> buffer, in number of >+ * UChars. If the <code>U_SHAPE_LETTERS_UNSHAPE</code> option is set, >+ * then the destination length could be as large as >+ * <code>srcLength * 2</code>. Otherwise, the destination length will >+ * not exceed <code>srcLength</code>. If the caller reserves the last >+ * position for zero-termination, it should be excluded from >+ * <code>destSize</code>. >+ * <p><code>destSize == -1</code> is allowed and makes sense when >+ * <code>dest</code> was holds some meaningful value, e.g. that of >+ * <code>src</code>. In this case <code>dest</code> must be >+ * zero-terminated.</p> >+ * @param inParaLevel A base embedding level of the input as defined in >+ * <code>ubidi_setPara</code> documentation for the >+ * <code>paraLevel</code> parameter. >+ * @param inOrder An order of the input, which can be one of the >+ * <code>UBiDiOrder</code> values. >+ * @param outParaLevel A base embedding level of the output as defined in >+ * <code>ubidi_setPara</code> documentation for the >+ * <code>paraLevel</code> parameter. >+ * @param outOrder An order of the output, which can be one of the >+ * <code>UBiDiOrder</code> values. >+ * @param doMirroring Indicates whether or not to perform character mirroring, >+ * and can accept one of the <code>UBiDiMirroring</code> values. >+ * @param shapingOptions Arabic digit and letter shaping options defined in the >+ * ushape.h documentation. >+ * <p><strong>Note:</strong> Direction indicator options are computed by >+ * the transformation engine based on the effective ordering schemes, so >+ * user-defined direction indicators will be ignored.</p> >+ * @param pErrorCode A pointer to an error code value. >+ * >+ * @return The destination length, i.e. the number of UChars written to >+ * <code>dest</code>. If the transformation fails, the return value >+ * will be 0 (and the error code will be written to >+ * <code>pErrorCode</code>). >+ * >+ * @see UBiDiLevel >+ * @see UBiDiOrder >+ * @see UBiDiMirroring >+ * @see ubidi_setPara >+ * @see u_shapeArabic >+ * @stable ICU 58 >+ */ >+U_STABLE uint32_t U_EXPORT2 >+ubiditransform_transform(UBiDiTransform *pBiDiTransform, >+ const UChar *src, int32_t srcLength, >+ UChar *dest, int32_t destSize, >+ UBiDiLevel inParaLevel, UBiDiOrder inOrder, >+ UBiDiLevel outParaLevel, UBiDiOrder outOrder, >+ UBiDiMirroring doMirroring, uint32_t shapingOptions, >+ UErrorCode *pErrorCode); >+ >+/** >+ * Allocates a <code>UBiDiTransform</code> object. This object can be reused, >+ * e.g. with different ordering schemes, mirroring or shaping options.<p> >+ * <strong>Note:</strong>The object can only be reused in the same thread. >+ * All other threads should allocate a new <code>UBiDiTransform</code> object >+ * before using it.<p> >+ * Example of usage:<p> >+ * <pre> >+ * \code >+ * UErrorCode errorCode = U_ZERO_ERROR; >+ * // Open a new UBiDiTransform. >+ * UBiDiTransform* transform = ubiditransform_open(&errorCode); >+ * // Run a transformation. >+ * ubiditransform_transform(transform, >+ * text1, -1, text2, -1, >+ * UBIDI_RTL, UBIDI_LOGICAL, >+ * UBIDI_LTR, UBIDI_VISUAL, >+ * UBIDI_MIRRORING_ON, >+ * U_SHAPE_DIGITS_EN2AN, >+ * &errorCode); >+ * // Do something with the output text and invoke another transformation using >+ * // that text as input. >+ * ubiditransform_transform(transform, >+ * text2, -1, text3, -1, >+ * UBIDI_LTR, UBIDI_VISUAL, >+ * UBIDI_RTL, UBIDI_VISUAL, >+ * UBIDI_MIRRORING_ON, >+ * 0, &errorCode); >+ *\endcode >+ * </pre> >+ * <p> >+ * The <code>UBiDiTransform</code> object must be deallocated by calling >+ * <code>ubiditransform_close()</code>. >+ * >+ * @return An empty <code>UBiDiTransform</code> object. >+ * @stable ICU 58 >+ */ >+U_STABLE UBiDiTransform* U_EXPORT2 >+ubiditransform_open(UErrorCode *pErrorCode); >+ >+/** >+ * Deallocates the given <code>UBiDiTransform</code> object. >+ * @stable ICU 58 >+ */ >+U_STABLE void U_EXPORT2 >+ubiditransform_close(UBiDiTransform *pBidiTransform); >+ >+#if U_SHOW_CPLUSPLUS_API >+ >+U_NAMESPACE_BEGIN >+ >+/** >+ * \class LocalUBiDiTransformPointer >+ * "Smart pointer" class, closes a UBiDiTransform via ubiditransform_close(). >+ * For most methods see the LocalPointerBase base class. >+ * >+ * @see LocalPointerBase >+ * @see LocalPointer >+ * @stable ICU 58 >+ */ >+U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close); >+ >+U_NAMESPACE_END >+ >+#endif >+ >+#endif >diff --git a/Source/WTF/icu/unicode/ubrk.h b/Source/WTF/icu/unicode/ubrk.h >index 9bdb4d5d9de3188e3fed72e39efeb752b5da5b04..600328c49c66bc1934b0f1e41b4f826fea2f5a83 100644 >--- a/Source/WTF/icu/unicode/ubrk.h >+++ b/Source/WTF/icu/unicode/ubrk.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** >-* Copyright (C) 1996-2014, International Business Machines Corporation and others. >+* Copyright (C) 1996-2015, International Business Machines Corporation and others. > * All Rights Reserved. > ****************************************************************************** > */ >@@ -45,10 +47,20 @@ > * when line-wrapping. The mechanism correctly handles punctuation and > * hyphenated words. > * <p> >+ * Note: The locale keyword "lb" can be used to modify line break >+ * behavior according to the CSS level 3 line-break options, see >+ * <http://dev.w3.org/csswg/css-text/#line-breaking>. For example: >+ * "ja@lb=strict", "zh@lb=loose". >+ * <p> > * Sentence boundary analysis allows selection with correct > * interpretation of periods within numbers and abbreviations, and > * trailing punctuation marks such as quotation marks and parentheses. > * <p> >+ * Note: The locale keyword "ss" can be used to enable use of >+ * segmentation suppression data (preventing breaks in English after >+ * abbreviations such as "Mr." or "Est.", for example), as follows: >+ * "en@ss=standard". >+ * <p> > * Word boundary analysis is used by search and replace functions, as > * well as within text editing applications that allow the user to > * select words with a double click. Word selection provides correct >@@ -60,7 +72,7 @@ > * "Extended Grapheme Clusters", which are groupings of codepoints > * that should be treated as character-like units for many text operations. > * Please see Unicode Standard Annex #29, Unicode Text Segmentation, >- * http://www.unicode.org/reports/tr29/ for additional information >+ * http://www.unicode.org/reports/tr29/ for additional information > * on grapheme clusters and guidelines on their use. > * <p> > * Title boundary analysis locates all positions, >@@ -104,8 +116,12 @@ typedef enum UBreakIteratorType { > * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. > */ > UBRK_TITLE = 4, >-#endif /* U_HIDE_DEPRECATED_API */ >- UBRK_COUNT = 5 >+ /** >+ * One more than the highest normal UBreakIteratorType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UBRK_COUNT = 5 >+#endif // U_HIDE_DEPRECATED_API > } UBreakIteratorType; > > /** Value indicating all text boundaries have been returned. >@@ -120,7 +136,10 @@ typedef enum UBreakIteratorType { > * word, to allow for further subdivisions of a category in future releases. > * Applications should check for tag values falling within the range, rather > * than for single individual values. >- * @stable ICU 2.2 >+ * >+ * The numeric values of all of these constants are stable (will not change). >+ * >+ * @stable ICU 2.2 > */ > typedef enum UWordBreak { > /** Tag value for "words" that do not fit into any of other categories. >@@ -153,7 +172,10 @@ typedef enum UWordBreak { > * word, to allow for further subdivisions of a category in future releases. > * Applications should check for tag values falling within the range, rather > * than for single individual values. >- * @stable ICU 2.8 >+ * >+ * The numeric values of all of these constants are stable (will not change). >+ * >+ * @stable ICU 2.8 > */ > typedef enum ULineBreakTag { > /** Tag value for soft line breaks, positions at which a line break >@@ -175,7 +197,10 @@ typedef enum ULineBreakTag { > * sentence, to allow for further subdivisions of a category in future releases. > * Applications should check for tag values falling within the range, rather > * than for single individual values. >- * @stable ICU 2.8 >+ * >+ * The numeric values of all of these constants are stable (will not change). >+ * >+ * @stable ICU 2.8 > */ > typedef enum USentenceBreakTag { > /** Tag value for for sentences ending with a sentence terminator >@@ -202,8 +227,11 @@ typedef enum USentenceBreakTag { > * and sentence breaks in text. > * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, > * UBRK_LINE, UBRK_SENTENCE >- * @param locale The locale specifying the text-breaking conventions. >- * @param text The text to be iterated over. >+ * @param locale The locale specifying the text-breaking conventions. Note that >+ * locale keys such as "lb" and "ss" may be used to modify text break behavior, >+ * see general discussion of BreakIterator C API. >+ * @param text The text to be iterated over. May be null, in which case ubrk_setText() is >+ * used to specify the text to be iterated. > * @param textLength The number of characters in text, or -1 if null-terminated. > * @param status A UErrorCode to receive any errors. > * @return A UBreakIterator for the specified locale. >@@ -240,6 +268,34 @@ ubrk_openRules(const UChar *rules, > UParseError *parseErr, > UErrorCode *status); > >+#ifndef U_HIDE_DRAFT_API >+/** >+ * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. >+ * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. >+ * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not >+ * compatible across different major versions of ICU, nor across platforms of different >+ * endianness or different base character set family (ASCII vs EBCDIC). >+ * @param binaryRules A set of compiled binary rules specifying the text breaking >+ * conventions. Ownership of the storage containing the compiled >+ * rules remains with the caller of this function. The compiled >+ * rules must not be modified or deleted during the life of the >+ * break iterator. >+ * @param rulesLength The length of binaryRules in bytes; must be >= 0. >+ * @param text The text to be iterated over. May be null, in which case >+ * ubrk_setText() is used to specify the text to be iterated. >+ * @param textLength The number of characters in text, or -1 if null-terminated. >+ * @param status Pointer to UErrorCode to receive any errors. >+ * @return UBreakIterator for the specified rules. >+ * @see ubrk_getBinaryRules >+ * @draft ICU 59 >+ */ >+U_DRAFT UBreakIterator* U_EXPORT2 >+ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, >+ const UChar * text, int32_t textLength, >+ UErrorCode * status); >+ >+#endif /* U_HIDE_DRAFT_API */ >+ > /** > * Thread safe cloning operation > * @param bi iterator to be cloned >@@ -304,7 +360,11 @@ U_NAMESPACE_END > #endif > > /** >- * Sets an existing iterator to point to a new piece of text >+ * Sets an existing iterator to point to a new piece of text. >+ * The break iterator retains a pointer to the supplied text. >+ * The caller must not modify or delete the text while the BreakIterator >+ * retains the reference. >+ * > * @param bi The iterator to use > * @param text The text to be set > * @param textLength The length of the text >@@ -535,6 +595,40 @@ ubrk_refreshUText(UBreakIterator *bi, > UText *text, > UErrorCode *status); > >+ >+#ifndef U_HIDE_DRAFT_API >+/** >+ * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. >+ * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator >+ * more quickly than using ubrk_openRules. The compiled rules are not compatible across >+ * different major versions of ICU, nor across platforms of different endianness or >+ * different base character set family (ASCII vs EBCDIC). Supports preflighting (with >+ * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to >+ * the binaryRules buffer. However, whether preflighting or not, if the actual length >+ * is greater than INT32_MAX, then the function returns 0 and sets *status to >+ * U_INDEX_OUTOFBOUNDS_ERROR. >+ >+ * @param bi The break iterator to use. >+ * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for >+ * preflighting. >+ * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for >+ * preflighting. Must be >= 0. >+ * @param status Pointer to UErrorCode to receive any errors, such as >+ * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or >+ * U_ILLEGAL_ARGUMENT_ERROR. >+ * @return The actual byte length of the binary rules, if <= INT32_MAX; >+ * otherwise 0. If not preflighting and this is larger than >+ * rulesCapacity, *status will be set to an error. >+ * @see ubrk_openBinaryRules >+ * @draft ICU 59 >+ */ >+U_DRAFT int32_t U_EXPORT2 >+ubrk_getBinaryRules(UBreakIterator *bi, >+ uint8_t * binaryRules, int32_t rulesCapacity, >+ UErrorCode * status); >+ >+#endif /* U_HIDE_DRAFT_API */ >+ > #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ > > #endif >diff --git a/Source/WTF/icu/unicode/ucal.h b/Source/WTF/icu/unicode/ucal.h >index 36828607099a76e16933992a794cce8a900bc6ee..c765e7859f59f489b7f6d4f1ba9d263d342ecbe7 100644 >--- a/Source/WTF/icu/unicode/ucal.h >+++ b/Source/WTF/icu/unicode/ucal.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 1996-2015, International Business Machines Corporation and >@@ -423,10 +425,12 @@ enum UCalendarDateFields { > */ > UCAL_IS_LEAP_MONTH, > >- /** >- * Field count >- * @stable ICU 2.6 >- */ >+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, >+ * it is needed for layout of Calendar, DateFormat, and other objects */ >+ /** >+ * One more than the highest normal UCalendarDateFields value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCAL_FIELD_COUNT, > > /** >diff --git a/Source/WTF/icu/unicode/ucasemap.h b/Source/WTF/icu/unicode/ucasemap.h >index b37e16588697f1a930191ee3df816c63b7bd38c1..6b253e3d638475e535179283467914f180a6a55d 100644 >--- a/Source/WTF/icu/unicode/ucasemap.h >+++ b/Source/WTF/icu/unicode/ucasemap.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: ucasemap.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -20,8 +22,9 @@ > #define __UCASEMAP_H__ > > #include "unicode/utypes.h" >-#include "unicode/ustring.h" > #include "unicode/localpointer.h" >+#include "unicode/stringoptions.h" >+#include "unicode/ustring.h" > > /** > * \file >@@ -142,47 +145,6 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); > U_STABLE void U_EXPORT2 > ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); > >-/** >- * Do not lowercase non-initial parts of words when titlecasing. >- * Option bit for titlecasing APIs that take an options bit set. >- * >- * By default, titlecasing will titlecase the first cased character >- * of a word and lowercase all other characters. >- * With this option, the other characters will not be modified. >- * >- * @see ucasemap_setOptions >- * @see ucasemap_toTitle >- * @see ucasemap_utf8ToTitle >- * @see UnicodeString::toTitle >- * @stable ICU 3.8 >- */ >-#define U_TITLECASE_NO_LOWERCASE 0x100 >- >-/** >- * Do not adjust the titlecasing indexes from BreakIterator::next() indexes; >- * titlecase exactly the characters at breaks from the iterator. >- * Option bit for titlecasing APIs that take an options bit set. >- * >- * By default, titlecasing will take each break iterator index, >- * adjust it by looking for the next cased character, and titlecase that one. >- * Other characters are lowercased. >- * >- * This follows Unicode 4 & 5 section 3.13 Default Case Operations: >- * >- * R3 toTitlecase(X): Find the word boundaries based on Unicode Standard Annex >- * #29, "Text Boundaries." Between each pair of word boundaries, find the first >- * cased character F. If F exists, map F to default_title(F); then map each >- * subsequent character C to default_lower(C). >- * >- * @see ucasemap_setOptions >- * @see ucasemap_toTitle >- * @see ucasemap_utf8ToTitle >- * @see UnicodeString::toTitle >- * @see U_TITLECASE_NO_LOWERCASE >- * @stable ICU 3.8 >- */ >-#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 >- > #if !UCONFIG_NO_BREAK_ITERATION > > /** >@@ -240,7 +202,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode > * The standard titlecase iterator for the root locale implements the > * algorithm of Unicode TR 21. > * >- * This function uses only the setUText(), first(), next() and close() methods of the >+ * This function uses only the setText(), first() and next() methods of the > * provided break iterator. > * > * The result may be longer or shorter than the original. >@@ -251,7 +213,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode > * @param dest A buffer for the result string. The result will be NUL-terminated if > * the buffer is large enough. > * The contents is undefined in case of failure. >- * @param destCapacity The size of the buffer (number of bytes). If it is 0, then >+ * @param destCapacity The size of the buffer (number of UChars). If it is 0, then > * dest may be NULL and the function will only return the length of the result > * without writing any of the result string. > * @param src The original string. >@@ -270,7 +232,7 @@ ucasemap_toTitle(UCaseMap *csm, > const UChar *src, int32_t srcLength, > UErrorCode *pErrorCode); > >-#endif >+#endif // UCONFIG_NO_BREAK_ITERATION > > /** > * Lowercase the characters in a UTF-8 string. >diff --git a/Source/WTF/icu/unicode/ucat.h b/Source/WTF/icu/unicode/ucat.h >index ad9f0373a30d77f85e99b4103d03f5767be38565..4d1ff3f6b28d1ef293078344c2225fbc69fb7c47 100644 >--- a/Source/WTF/icu/unicode/ucat.h >+++ b/Source/WTF/icu/unicode/ucat.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2003-2004, International Business Machines >diff --git a/Source/WTF/icu/unicode/uchar.h b/Source/WTF/icu/unicode/uchar.h >index 1d3ae0dd43f435fbf01ec2dee0e5163921d6e551..3613374d9a43a5df7e8f302db61f3fb281e94e6c 100644 >--- a/Source/WTF/icu/unicode/uchar.h >+++ b/Source/WTF/icu/unicode/uchar.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 1997-2014, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -24,6 +26,7 @@ > #define UCHAR_H > > #include "unicode/utypes.h" >+#include "unicode/stringoptions.h" > > U_CDECL_BEGIN > >@@ -39,7 +42,7 @@ U_CDECL_BEGIN > * @see u_getUnicodeVersion > * @stable ICU 2.0 > */ >-#define U_UNICODE_VERSION "7.0" >+#define U_UNICODE_VERSION "10.0" > > /** > * \file >@@ -146,8 +149,9 @@ U_CDECL_BEGIN > * > * The properties APIs are intended to reflect Unicode properties as defined > * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). >- * For details about the properties see http://www.unicode.org/ucd/ . >- * For names of Unicode properties see the UCD file PropertyAliases.txt. >+ * >+ * For details about the properties see >+ * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/). > * > * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2, > * then properties marked with "new in Unicode 3.2" are not or not fully available. >@@ -397,8 +401,58 @@ typedef enum UProperty { > UCHAR_CHANGES_WHEN_CASEMAPPED=55, > /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */ > UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56, >- /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */ >- UCHAR_BINARY_LIMIT=57, >+ /** >+ * Binary property Emoji. >+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties >+ * >+ * @stable ICU 57 >+ */ >+ UCHAR_EMOJI=57, >+ /** >+ * Binary property Emoji_Presentation. >+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties >+ * >+ * @stable ICU 57 >+ */ >+ UCHAR_EMOJI_PRESENTATION=58, >+ /** >+ * Binary property Emoji_Modifier. >+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties >+ * >+ * @stable ICU 57 >+ */ >+ UCHAR_EMOJI_MODIFIER=59, >+ /** >+ * Binary property Emoji_Modifier_Base. >+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties >+ * >+ * @stable ICU 57 >+ */ >+ UCHAR_EMOJI_MODIFIER_BASE=60, >+ /** >+ * Binary property Emoji_Component. >+ * See http://www.unicode.org/reports/tr51/#Emoji_Properties >+ * >+ * @stable ICU 60 >+ */ >+ UCHAR_EMOJI_COMPONENT=61, >+ /** >+ * Binary property Regional_Indicator. >+ * @stable ICU 60 >+ */ >+ UCHAR_REGIONAL_INDICATOR=62, >+ /** >+ * Binary property Prepended_Concatenation_Mark. >+ * @stable ICU 60 >+ */ >+ UCHAR_PREPENDED_CONCATENATION_MARK=63, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for binary Unicode properties. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UCHAR_BINARY_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > /** Enumerated property Bidi_Class. > Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */ >@@ -485,8 +539,13 @@ typedef enum UProperty { > (http://www.unicode.org/reports/tr9/) > Returns UBidiPairedBracketType values. @stable ICU 52 */ > UCHAR_BIDI_PAIRED_BRACKET_TYPE=0x1015, >- /** One more than the last constant for enumerated/integer Unicode properties. @stable ICU 2.2 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for enumerated/integer Unicode properties. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCHAR_INT_LIMIT=0x1016, >+#endif // U_HIDE_DEPRECATED_API > > /** Bitmask property General_Category_Mask. > This is the General_Category property returned as a bit mask. >@@ -499,16 +558,26 @@ typedef enum UProperty { > UCHAR_GENERAL_CATEGORY_MASK=0x2000, > /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */ > UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK, >- /** One more than the last constant for bit-mask Unicode properties. @stable ICU 2.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for bit-mask Unicode properties. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCHAR_MASK_LIMIT=0x2001, >+#endif // U_HIDE_DEPRECATED_API > > /** Double property Numeric_Value. > Corresponds to u_getNumericValue. @stable ICU 2.4 */ > UCHAR_NUMERIC_VALUE=0x3000, > /** First constant for double Unicode properties. @stable ICU 2.4 */ > UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE, >- /** One more than the last constant for double Unicode properties. @stable ICU 2.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for double Unicode properties. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCHAR_DOUBLE_LIMIT=0x3001, >+#endif // U_HIDE_DEPRECATED_API > > /** String property Age. > Corresponds to u_charAge. @stable ICU 2.4 */ >@@ -560,8 +629,13 @@ typedef enum UProperty { > /** String property Bidi_Paired_Bracket (new in Unicode 6.3). > Corresponds to u_getBidiPairedBracket. @stable ICU 52 */ > UCHAR_BIDI_PAIRED_BRACKET=0x400D, >- /** One more than the last constant for string Unicode properties. @stable ICU 2.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for string Unicode properties. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCHAR_STRING_LIMIT=0x400E, >+#endif // U_HIDE_DEPRECATED_API > > /** Miscellaneous property Script_Extensions (new in Unicode 6.0). > Some characters are commonly used in multiple scripts. >@@ -571,9 +645,14 @@ typedef enum UProperty { > UCHAR_SCRIPT_EXTENSIONS=0x7000, > /** First constant for Unicode properties with unusual value types. @stable ICU 4.6 */ > UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS, >- /** One more than the last constant for Unicode properties with unusual value types. >- * @stable ICU 4.6 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the last constant for Unicode properties with unusual value types. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCHAR_OTHER_PROPERTY_LIMIT=0x7001, >+#endif // U_HIDE_DEPRECATED_API >+ > /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */ > UCHAR_INVALID_CODE = -1 > } UProperty; >@@ -654,7 +733,13 @@ typedef enum UCharCategory > U_INITIAL_PUNCTUATION = 28, > /** Pf @stable ICU 2.0 */ > U_FINAL_PUNCTUATION = 29, >- /** One higher than the last enum UCharCategory constant. @stable ICU 2.0 */ >+ /** >+ * One higher than the last enum UCharCategory constant. >+ * This numeric value is stable (will not change), see >+ * http://www.unicode.org/policies/stability_policy.html#Property_Value >+ * >+ * @stable ICU 2.0 >+ */ > U_CHAR_CATEGORY_COUNT > } UCharCategory; > >@@ -828,8 +913,15 @@ typedef enum UCharDirection { > U_RIGHT_TO_LEFT_ISOLATE = 21, > /** PDI @stable ICU 52 */ > U_POP_DIRECTIONAL_ISOLATE = 22, >- /** @stable ICU 2.0 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest UCharDirection value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_CHAR_DIRECTION_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UCharDirection; > > /** >@@ -851,8 +943,15 @@ typedef enum UBidiPairedBracketType { > U_BPT_OPEN, > /** Close paired bracket. @stable ICU 52 */ > U_BPT_CLOSE, >- /** @stable ICU 52 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UBidiPairedBracketType value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_BPT_COUNT /* 3 */ >+#endif // U_HIDE_DEPRECATED_API > } UBidiPairedBracketType; > > /** >@@ -1183,7 +1282,7 @@ enum UBlockCode { > * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement". > * @stable ICU 2.2 > */ >- UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, >+ UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, > /** @stable ICU 2.2 */ > UBLOCK_TAGALOG = 98, /*[1700]*/ > /** @stable ICU 2.2 */ >@@ -1519,8 +1618,80 @@ enum UBlockCode { > /** @stable ICU 54 */ > UBLOCK_WARANG_CITI = 252, /*[118A0]*/ > >- /** @stable ICU 2.0 */ >- UBLOCK_COUNT = 253, >+ /* New blocks in Unicode 8.0 */ >+ >+ /** @stable ICU 56 */ >+ UBLOCK_AHOM = 253, /*[11700]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_ANATOLIAN_HIEROGLYPHS = 254, /*[14400]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_CHEROKEE_SUPPLEMENT = 255, /*[AB70]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E = 256, /*[2B820]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_EARLY_DYNASTIC_CUNEIFORM = 257, /*[12480]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_HATRAN = 258, /*[108E0]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_MULTANI = 259, /*[11280]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_OLD_HUNGARIAN = 260, /*[10C80]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS = 261, /*[1F900]*/ >+ /** @stable ICU 56 */ >+ UBLOCK_SUTTON_SIGNWRITING = 262, /*[1D800]*/ >+ >+ /* New blocks in Unicode 9.0 */ >+ >+ /** @stable ICU 58 */ >+ UBLOCK_ADLAM = 263, /*[1E900]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_BHAIKSUKI = 264, /*[11C00]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_CYRILLIC_EXTENDED_C = 265, /*[1C80]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_GLAGOLITIC_SUPPLEMENT = 266, /*[1E000]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = 267, /*[16FE0]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_MARCHEN = 268, /*[11C70]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_MONGOLIAN_SUPPLEMENT = 269, /*[11660]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_NEWA = 270, /*[11400]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_OSAGE = 271, /*[104B0]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_TANGUT = 272, /*[17000]*/ >+ /** @stable ICU 58 */ >+ UBLOCK_TANGUT_COMPONENTS = 273, /*[18800]*/ >+ >+ // New blocks in Unicode 10.0 >+ >+ /** @stable ICU 60 */ >+ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_NUSHU = 277, /*[1B170]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_SOYOMBO = 278, /*[11A50]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/ >+ /** @stable ICU 60 */ >+ UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/ >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UBlockCode value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BLOCK). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UBLOCK_COUNT = 281, >+#endif // U_HIDE_DEPRECATED_API > > /** @stable ICU 2.0 */ > UBLOCK_INVALID_CODE=-1 >@@ -1549,7 +1720,15 @@ typedef enum UEastAsianWidth { > U_EA_FULLWIDTH, /*[F]*/ > U_EA_NARROW, /*[Na]*/ > U_EA_WIDE, /*[W]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UEastAsianWidth value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_EA_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UEastAsianWidth; > > /** >@@ -1566,7 +1745,7 @@ typedef enum UEastAsianWidth { > typedef enum UCharNameChoice { > /** Unicode character name (Name property). @stable ICU 2.0 */ > U_UNICODE_CHAR_NAME, >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** > * The Unicode_1_Name property value which is of little practical value. > * Beginning with ICU 49, ICU APIs return an empty string for this name choice. >@@ -1578,8 +1757,13 @@ typedef enum UCharNameChoice { > U_EXTENDED_CHAR_NAME = U_UNICODE_CHAR_NAME+2, > /** Corrected name from NameAliases.txt. @stable ICU 4.4 */ > U_CHAR_NAME_ALIAS, >- /** @stable ICU 2.0 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UCharNameChoice value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_CHAR_NAME_CHOICE_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UCharNameChoice; > > /** >@@ -1598,7 +1782,13 @@ typedef enum UCharNameChoice { > typedef enum UPropertyNameChoice { > U_SHORT_PROPERTY_NAME, > U_LONG_PROPERTY_NAME, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UPropertyNameChoice value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_PROPERTY_NAME_CHOICE_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UPropertyNameChoice; > > /** >@@ -1632,7 +1822,15 @@ typedef enum UDecompositionType { > U_DT_SUPER, /*[sup]*/ > U_DT_VERTICAL, /*[vert]*/ > U_DT_WIDE, /*[wide]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UDecompositionType value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_DT_COUNT /* 18 */ >+#endif // U_HIDE_DEPRECATED_API > } UDecompositionType; > > /** >@@ -1654,7 +1852,15 @@ typedef enum UJoiningType { > U_JT_LEFT_JOINING, /*[L]*/ > U_JT_RIGHT_JOINING, /*[R]*/ > U_JT_TRANSPARENT, /*[T]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UJoiningType value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_JT_COUNT /* 6 */ >+#endif // U_HIDE_DEPRECATED_API > } UJoiningType; > > /** >@@ -1757,7 +1963,31 @@ typedef enum UJoiningGroup { > U_JG_MANICHAEAN_YODH, /**< @stable ICU 54 */ > U_JG_MANICHAEAN_ZAYIN, /**< @stable ICU 54 */ > U_JG_STRAIGHT_WAW, /**< @stable ICU 54 */ >+ U_JG_AFRICAN_FEH, /**< @stable ICU 58 */ >+ U_JG_AFRICAN_NOON, /**< @stable ICU 58 */ >+ U_JG_AFRICAN_QAF, /**< @stable ICU 58 */ >+ >+ U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_JA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_RA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */ >+ U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */ >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UJoiningGroup value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_JG_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UJoiningGroup; > > /** >@@ -1783,10 +2013,31 @@ typedef enum UGraphemeClusterBreak { > U_GCB_LVT = 7, /*[LVT]*/ > U_GCB_T = 8, /*[T]*/ > U_GCB_V = 9, /*[V]*/ >+ /** @stable ICU 4.0 */ > U_GCB_SPACING_MARK = 10, /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ >+ /** @stable ICU 4.0 */ > U_GCB_PREPEND = 11, /*[PP]*/ >+ /** @stable ICU 50 */ > U_GCB_REGIONAL_INDICATOR = 12, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ >- U_GCB_COUNT = 13 >+ /** @stable ICU 58 */ >+ U_GCB_E_BASE = 13, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ >+ /** @stable ICU 58 */ >+ U_GCB_E_BASE_GAZ = 14, /*[EBG]*/ >+ /** @stable ICU 58 */ >+ U_GCB_E_MODIFIER = 15, /*[EM]*/ >+ /** @stable ICU 58 */ >+ U_GCB_GLUE_AFTER_ZWJ = 16, /*[GAZ]*/ >+ /** @stable ICU 58 */ >+ U_GCB_ZWJ = 17, /*[ZWJ]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UGraphemeClusterBreak value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_GCB_COUNT = 18 >+#endif // U_HIDE_DEPRECATED_API > } UGraphemeClusterBreak; > > /** >@@ -1811,16 +2062,43 @@ typedef enum UWordBreakValues { > U_WB_MIDNUM = 5, /*[MN]*/ > U_WB_NUMERIC = 6, /*[NU]*/ > U_WB_EXTENDNUMLET = 7, /*[EX]*/ >+ /** @stable ICU 4.0 */ > U_WB_CR = 8, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ >+ /** @stable ICU 4.0 */ > U_WB_EXTEND = 9, /*[Extend]*/ >+ /** @stable ICU 4.0 */ > U_WB_LF = 10, /*[LF]*/ >+ /** @stable ICU 4.0 */ > U_WB_MIDNUMLET =11, /*[MB]*/ >+ /** @stable ICU 4.0 */ > U_WB_NEWLINE =12, /*[NL]*/ >+ /** @stable ICU 50 */ > U_WB_REGIONAL_INDICATOR = 13, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ >+ /** @stable ICU 52 */ > U_WB_HEBREW_LETTER = 14, /*[HL]*/ /* from here on: new in Unicode 6.3/ICU 52 */ >+ /** @stable ICU 52 */ > U_WB_SINGLE_QUOTE = 15, /*[SQ]*/ >+ /** @stable ICU 52 */ > U_WB_DOUBLE_QUOTE = 16, /*[DQ]*/ >- U_WB_COUNT = 17 >+ /** @stable ICU 58 */ >+ U_WB_E_BASE = 17, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ >+ /** @stable ICU 58 */ >+ U_WB_E_BASE_GAZ = 18, /*[EBG]*/ >+ /** @stable ICU 58 */ >+ U_WB_E_MODIFIER = 19, /*[EM]*/ >+ /** @stable ICU 58 */ >+ U_WB_GLUE_AFTER_ZWJ = 20, /*[GAZ]*/ >+ /** @stable ICU 58 */ >+ U_WB_ZWJ = 21, /*[ZWJ]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UWordBreakValues value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_WORD_BREAK). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_WB_COUNT = 22 >+#endif // U_HIDE_DEPRECATED_API > } UWordBreakValues; > > /** >@@ -1851,7 +2129,15 @@ typedef enum USentenceBreak { > U_SB_EXTEND = 12, /*[EX]*/ > U_SB_LF = 13, /*[LF]*/ > U_SB_SCONTINUE = 14, /*[SC]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal USentenceBreak value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_SB_COUNT = 15 >+#endif // U_HIDE_DEPRECATED_API > } USentenceBreak; > > /** >@@ -1898,18 +2184,43 @@ typedef enum ULineBreak { > U_LB_SPACE = 26, /*[SP]*/ > U_LB_BREAK_SYMBOLS = 27, /*[SY]*/ > U_LB_ZWSPACE = 28, /*[ZW]*/ >+ /** @stable ICU 2.6 */ > U_LB_NEXT_LINE = 29, /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */ >+ /** @stable ICU 2.6 */ > U_LB_WORD_JOINER = 30, /*[WJ]*/ >+ /** @stable ICU 3.4 */ > U_LB_H2 = 31, /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */ >+ /** @stable ICU 3.4 */ > U_LB_H3 = 32, /*[H3]*/ >+ /** @stable ICU 3.4 */ > U_LB_JL = 33, /*[JL]*/ >+ /** @stable ICU 3.4 */ > U_LB_JT = 34, /*[JT]*/ >+ /** @stable ICU 3.4 */ > U_LB_JV = 35, /*[JV]*/ >+ /** @stable ICU 4.4 */ > U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */ >+ /** @stable ICU 49 */ > U_LB_CONDITIONAL_JAPANESE_STARTER = 37,/*[CJ]*/ /* new in Unicode 6.1/ICU 49 */ >+ /** @stable ICU 49 */ > U_LB_HEBREW_LETTER = 38, /*[HL]*/ /* new in Unicode 6.1/ICU 49 */ >+ /** @stable ICU 50 */ > U_LB_REGIONAL_INDICATOR = 39,/*[RI]*/ /* new in Unicode 6.2/ICU 50 */ >- U_LB_COUNT = 40 >+ /** @stable ICU 58 */ >+ U_LB_E_BASE = 40, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ >+ /** @stable ICU 58 */ >+ U_LB_E_MODIFIER = 41, /*[EM]*/ >+ /** @stable ICU 58 */ >+ U_LB_ZWJ = 42, /*[ZWJ]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal ULineBreak value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_LINE_BREAK). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_LB_COUNT = 43 >+#endif // U_HIDE_DEPRECATED_API > } ULineBreak; > > /** >@@ -1929,7 +2240,15 @@ typedef enum UNumericType { > U_NT_DECIMAL, /*[de]*/ > U_NT_DIGIT, /*[di]*/ > U_NT_NUMERIC, /*[nu]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UNumericType value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_NT_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UNumericType; > > /** >@@ -1951,7 +2270,15 @@ typedef enum UHangulSyllableType { > U_HST_TRAILING_JAMO, /*[T]*/ > U_HST_LV_SYLLABLE, /*[LV]*/ > U_HST_LVT_SYLLABLE, /*[LVT]*/ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UHangulSyllableType value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_HST_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UHangulSyllableType; > > /** >@@ -2816,7 +3143,7 @@ u_charName(UChar32 code, UCharNameChoice nameChoice, > char *buffer, int32_t bufferLength, > UErrorCode *pErrorCode); > >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** > * Returns an empty string. > * Used to return the ISO 10646 comment for a character. >@@ -3243,27 +3570,6 @@ u_toupper(UChar32 c); > U_STABLE UChar32 U_EXPORT2 > u_totitle(UChar32 c); > >-/** Option value for case folding: use default mappings defined in CaseFolding.txt. @stable ICU 2.0 */ >-#define U_FOLD_CASE_DEFAULT 0 >- >-/** >- * Option value for case folding: >- * >- * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I >- * and dotless i appropriately for Turkic languages (tr, az). >- * >- * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that >- * are to be included for default mappings and >- * excluded for the Turkic-specific mappings. >- * >- * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that >- * are to be excluded for default mappings and >- * included for the Turkic-specific mappings. >- * >- * @stable ICU 2.0 >- */ >-#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 >- > /** > * The given character is mapped to its case folding equivalent according to > * UnicodeData.txt and CaseFolding.txt; >diff --git a/Source/WTF/icu/unicode/ucharstrie.h b/Source/WTF/icu/unicode/ucharstrie.h >index 0575a974d0c957acc7d37fcc00e36d038a7c1aba..dfc93f6d0bae8acf02463b99044e8dea72e939bb 100644 >--- a/Source/WTF/icu/unicode/ucharstrie.h >+++ b/Source/WTF/icu/unicode/ucharstrie.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2012, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: ucharstrie.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -34,7 +36,7 @@ class UVector32; > > /** > * Light-weight, non-const reader class for a UCharsTrie. >- * Traverses a UChar-serialized data structure with minimal state, >+ * Traverses a char16_t-serialized data structure with minimal state, > * for mapping strings (16-bit-unit sequences) to non-negative integer values. > * > * This class owns the serialized trie data only if it was constructed by >@@ -50,18 +52,18 @@ public: > /** > * Constructs a UCharsTrie reader instance. > * >- * The trieUChars must contain a copy of a UChar sequence from the UCharsTrieBuilder, >- * starting with the first UChar of that sequence. >- * The UCharsTrie object will not read more UChars than >+ * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder, >+ * starting with the first char16_t of that sequence. >+ * The UCharsTrie object will not read more char16_ts than > * the UCharsTrieBuilder generated in the corresponding build() call. > * > * The array is not copied/cloned and must not be modified while > * the UCharsTrie object is in use. > * >- * @param trieUChars The UChar array that contains the serialized trie. >+ * @param trieUChars The char16_t array that contains the serialized trie. > * @stable ICU 4.8 > */ >- UCharsTrie(const UChar *trieUChars) >+ UCharsTrie(ConstChar16Ptr trieUChars) > : ownedArray_(NULL), uchars_(trieUChars), > pos_(uchars_), remainingMatchLength_(-1) {} > >@@ -73,7 +75,7 @@ public: > > /** > * Copy constructor, copies the other trie reader object and its state, >- * but not the UChar array which will be shared. (Shallow copy.) >+ * but not the char16_t array which will be shared. (Shallow copy.) > * @param other Another UCharsTrie object. > * @stable ICU 4.8 > */ >@@ -107,8 +109,8 @@ public: > private: > friend class UCharsTrie; > >- const UChar *uchars; >- const UChar *pos; >+ const char16_t *uchars; >+ const char16_t *pos; > int32_t remainingMatchLength; > }; > >@@ -146,14 +148,14 @@ public: > > /** > * Determines whether the string so far matches, whether it has a value, >- * and whether another input UChar can continue a matching string. >+ * and whether another input char16_t can continue a matching string. > * @return The match/value Result. > * @stable ICU 4.8 > */ > UStringTrieResult current() const; > > /** >- * Traverses the trie from the initial state for this input UChar. >+ * Traverses the trie from the initial state for this input char16_t. > * Equivalent to reset().next(uchar). > * @param uchar Input char value. Values below 0 and above 0xffff will never match. > * @return The match/value Result. >@@ -175,7 +177,7 @@ public: > UStringTrieResult firstForCodePoint(UChar32 cp); > > /** >- * Traverses the trie from the current state for this input UChar. >+ * Traverses the trie from the current state for this input char16_t. > * @param uchar Input char value. Values below 0 and above 0xffff will never match. > * @return The match/value Result. > * @stable ICU 4.8 >@@ -206,7 +208,7 @@ public: > * @return The match/value Result. > * @stable ICU 4.8 > */ >- UStringTrieResult next(const UChar *s, int32_t length); >+ UStringTrieResult next(ConstChar16Ptr s, int32_t length); > > /** > * Returns a matching string's value if called immediately after >@@ -218,7 +220,7 @@ public: > * @stable ICU 4.8 > */ > inline int32_t getValue() const { >- const UChar *pos=pos_; >+ const char16_t *pos=pos_; > int32_t leadUnit=*pos++; > // U_ASSERT(leadUnit>=kMinValueLead); > return leadUnit&kValueIsFinal ? >@@ -235,16 +237,16 @@ public: > * @stable ICU 4.8 > */ > inline UBool hasUniqueValue(int32_t &uniqueValue) const { >- const UChar *pos=pos_; >+ const char16_t *pos=pos_; > // Skip the rest of a pending linear-match node. > return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); > } > > /** >- * Finds each UChar which continues the string from the current state. >- * That is, each UChar c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. >- * @param out Each next UChar is appended to this object. >- * @return the number of UChars which continue the string from here >+ * Finds each char16_t which continues the string from the current state. >+ * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. >+ * @param out Each next char16_t is appended to this object. >+ * @return the number of char16_ts which continue the string from here > * @stable ICU 4.8 > */ > int32_t getNextUChars(Appendable &out) const; >@@ -256,8 +258,8 @@ public: > class U_COMMON_API Iterator : public UMemory { > public: > /** >- * Iterates from the root of a UChar-serialized UCharsTrie. >- * @param trieUChars The trie UChars. >+ * Iterates from the root of a char16_t-serialized UCharsTrie. >+ * @param trieUChars The trie char16_ts. > * @param maxStringLength If 0, the iterator returns full strings. > * Otherwise, the iterator returns strings with this maximum length. > * @param errorCode Standard ICU error code. Its input value must >@@ -266,7 +268,7 @@ public: > * function chaining. (See User Guide for details.) > * @stable ICU 4.8 > */ >- Iterator(const UChar *trieUChars, int32_t maxStringLength, UErrorCode &errorCode); >+ Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode); > > /** > * Iterates from the current state of the specified UCharsTrie. >@@ -334,11 +336,11 @@ public: > return TRUE; > } > >- const UChar *branchNext(const UChar *pos, int32_t length, UErrorCode &errorCode); >+ const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); > >- const UChar *uchars_; >- const UChar *pos_; >- const UChar *initialPos_; >+ const char16_t *uchars_; >+ const char16_t *pos_; >+ const char16_t *initialPos_; > int32_t remainingMatchLength_; > int32_t initialRemainingMatchLength_; > UBool skipValue_; // Skip intermediate value which was already delivered. >@@ -366,7 +368,7 @@ private: > * this constructor adopts the builder's array. > * This constructor is only called by the builder. > */ >- UCharsTrie(UChar *adoptUChars, const UChar *trieUChars) >+ UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars) > : ownedArray_(adoptUChars), uchars_(trieUChars), > pos_(uchars_), remainingMatchLength_(-1) {} > >@@ -379,7 +381,7 @@ private: > > // Reads a compact 32-bit integer. > // pos is already after the leadUnit, and the lead unit has bit 15 reset. >- static inline int32_t readValue(const UChar *pos, int32_t leadUnit) { >+ static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) { > int32_t value; > if(leadUnit<kMinTwoUnitValueLead) { > value=leadUnit; >@@ -390,7 +392,7 @@ private: > } > return value; > } >- static inline const UChar *skipValue(const UChar *pos, int32_t leadUnit) { >+ static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) { > if(leadUnit>=kMinTwoUnitValueLead) { > if(leadUnit<kThreeUnitValueLead) { > ++pos; >@@ -400,12 +402,12 @@ private: > } > return pos; > } >- static inline const UChar *skipValue(const UChar *pos) { >+ static inline const char16_t *skipValue(const char16_t *pos) { > int32_t leadUnit=*pos++; > return skipValue(pos, leadUnit&0x7fff); > } > >- static inline int32_t readNodeValue(const UChar *pos, int32_t leadUnit) { >+ static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) { > // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal); > int32_t value; > if(leadUnit<kMinTwoUnitNodeValueLead) { >@@ -417,7 +419,7 @@ private: > } > return value; > } >- static inline const UChar *skipNodeValue(const UChar *pos, int32_t leadUnit) { >+ static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) { > // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal); > if(leadUnit>=kMinTwoUnitNodeValueLead) { > if(leadUnit<kThreeUnitNodeValueLead) { >@@ -429,7 +431,7 @@ private: > return pos; > } > >- static inline const UChar *jumpByDelta(const UChar *pos) { >+ static inline const char16_t *jumpByDelta(const char16_t *pos) { > int32_t delta=*pos++; > if(delta>=kMinTwoUnitDeltaLead) { > if(delta==kThreeUnitDeltaLead) { >@@ -442,7 +444,7 @@ private: > return pos+delta; > } > >- static const UChar *skipDelta(const UChar *pos) { >+ static const char16_t *skipDelta(const char16_t *pos) { > int32_t delta=*pos++; > if(delta>=kMinTwoUnitDeltaLead) { > if(delta==kThreeUnitDeltaLead) { >@@ -459,28 +461,28 @@ private: > } > > // Handles a branch node for both next(uchar) and next(string). >- UStringTrieResult branchNext(const UChar *pos, int32_t length, int32_t uchar); >+ UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar); > > // Requires remainingLength_<0. >- UStringTrieResult nextImpl(const UChar *pos, int32_t uchar); >+ UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar); > > // Helper functions for hasUniqueValue(). > // Recursively finds a unique value (or whether there is not a unique one) > // from a branch. >- static const UChar *findUniqueValueFromBranch(const UChar *pos, int32_t length, >+ static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length, > UBool haveUniqueValue, int32_t &uniqueValue); > // Recursively finds a unique value (or whether there is not a unique one) > // starting from a position on a node lead unit. >- static UBool findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &uniqueValue); >+ static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue); > > // Helper functions for getNextUChars(). > // getNextUChars() when pos is on a branch node. >- static void getNextBranchUChars(const UChar *pos, int32_t length, Appendable &out); >+ static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out); > > // UCharsTrie data structure > // >- // The trie consists of a series of UChar-serialized nodes for incremental >- // Unicode string/UChar sequence matching. (UChar=16-bit unsigned integer) >+ // The trie consists of a series of char16_t-serialized nodes for incremental >+ // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer) > // The root node is at the beginning of the trie data. > // > // Types of nodes are distinguished by their node lead unit ranges. >@@ -489,9 +491,9 @@ private: > // > // Node types: > // - Final-value node: Stores a 32-bit integer in a compact, variable-length format. >- // The value is for the string/UChar sequence so far. >+ // The value is for the string/char16_t sequence so far. > // - Match node, optionally with an intermediate value in a different compact format. >- // The value, if present, is for the string/UChar sequence so far. >+ // The value, if present, is for the string/char16_t sequence so far. > // > // Aside from the value, which uses the node lead unit's high bits: > // >@@ -558,15 +560,15 @@ private: > > static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff > >- UChar *ownedArray_; >+ char16_t *ownedArray_; > > // Fixed value referencing the UCharsTrie words. >- const UChar *uchars_; >+ const char16_t *uchars_; > > // Iterator variables. > > // Pointer to next trie unit to read. NULL if no more matches. >- const UChar *pos_; >+ const char16_t *pos_; > // Remaining length of a linear-match node, minus 1. Negative if not in such a node. > int32_t remainingMatchLength_; > }; >diff --git a/Source/WTF/icu/unicode/ucharstriebuilder.h b/Source/WTF/icu/unicode/ucharstriebuilder.h >index 35e353d41b515eea8ff6ad972031501e21644f39..2aa4757e52cb07c7e1c27902d883a357b66d3166 100644 >--- a/Source/WTF/icu/unicode/ucharstriebuilder.h >+++ b/Source/WTF/icu/unicode/ucharstriebuilder.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2010-2014, International Business Machines >+* Copyright (C) 2010-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: ucharstriebuilder.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -87,21 +89,21 @@ public: > UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); > > /** >- * Builds a UCharsTrie for the add()ed data and UChar-serializes it. >+ * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. > * Once built, no further data can be add()ed until clear() is called. > * > * A UCharsTrie cannot be empty. At least one (string, value) pair > * must have been add()ed. > * > * Multiple calls to buildUnicodeString() set the UnicodeStrings to the >- * builder's same UChar array, without rebuilding. >+ * builder's same char16_t array, without rebuilding. > * If buildUnicodeString() is called after build(), the trie will be > * re-serialized into a new array. > * If build() is called after buildUnicodeString(), the trie object will become > * the owner of the previously returned array. > * After clear() has been called, a new array will be used as well. > * @param buildOption Build option, see UStringTrieBuildOption. >- * @param result A UnicodeString which will be set to the UChar-serialized >+ * @param result A UnicodeString which will be set to the char16_t-serialized > * UCharsTrie for the add()ed data. > * @param errorCode Standard ICU error code. Its input value must > * pass the U_SUCCESS() test, or else the function returns >@@ -133,14 +135,14 @@ private: > void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode); > > virtual int32_t getElementStringLength(int32_t i) const; >- virtual UChar getElementUnit(int32_t i, int32_t unitIndex) const; >+ virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; > virtual int32_t getElementValue(int32_t i) const; > > virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const; > > virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const; > virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; >- virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, UChar unit) const; >+ virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; > > virtual UBool matchNodesCanHaveValues() const { return TRUE; } > >@@ -150,11 +152,11 @@ private: > > class UCTLinearMatchNode : public LinearMatchNode { > public: >- UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode); >+ UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); > virtual UBool operator==(const Node &other) const; > virtual void write(StringTrieBuilder &builder); > private: >- const UChar *s; >+ const char16_t *s; > }; > > virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, >@@ -162,7 +164,7 @@ private: > > UBool ensureCapacity(int32_t length); > virtual int32_t write(int32_t unit); >- int32_t write(const UChar *s, int32_t length); >+ int32_t write(const char16_t *s, int32_t length); > virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length); > virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); > virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); >@@ -173,9 +175,9 @@ private: > int32_t elementsCapacity; > int32_t elementsLength; > >- // UChar serialization of the trie. >+ // char16_t serialization of the trie. > // Grows from the back: ucharsLength measures from the end of the buffer! >- UChar *uchars; >+ char16_t *uchars; > int32_t ucharsCapacity; > int32_t ucharsLength; > }; >diff --git a/Source/WTF/icu/unicode/uchriter.h b/Source/WTF/icu/unicode/uchriter.h >index 6d5a990f7b7ed3d5bacf2da8471ef8ff9422f99c..efcd263f8bcc90ea6a78b9e6c1f7651be621a64b 100644 >--- a/Source/WTF/icu/unicode/uchriter.h >+++ b/Source/WTF/icu/unicode/uchriter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1998-2005, International Business Machines >@@ -13,18 +15,18 @@ > > /** > * \file >- * \brief C++ API: UChar Character Iterator >+ * \brief C++ API: char16_t Character Iterator > */ > > U_NAMESPACE_BEGIN > > /** > * A concrete subclass of CharacterIterator that iterates over the >- * characters (code units or code points) in a UChar array. >+ * characters (code units or code points) in a char16_t array. > * It's possible not only to create an >- * iterator that iterates over an entire UChar array, but also to >- * create one that iterates over only a subrange of a UChar array >- * (iterators over different subranges of the same UChar array don't >+ * iterator that iterates over an entire char16_t array, but also to >+ * create one that iterates over only a subrange of a char16_t array >+ * (iterators over different subranges of the same char16_t array don't > * compare equal). > * @see CharacterIterator > * @see ForwardCharacterIterator >@@ -33,34 +35,34 @@ U_NAMESPACE_BEGIN > class U_COMMON_API UCharCharacterIterator : public CharacterIterator { > public: > /** >- * Create an iterator over the UChar array referred to by "textPtr". >+ * Create an iterator over the char16_t array referred to by "textPtr". > * The iteration range is 0 to <code>length-1</code>. > * text is only aliased, not adopted (the > * destructor will not delete it). >- * @param textPtr The UChar array to be iterated over >- * @param length The length of the UChar array >+ * @param textPtr The char16_t array to be iterated over >+ * @param length The length of the char16_t array > * @stable ICU 2.0 > */ >- UCharCharacterIterator(const UChar* textPtr, int32_t length); >+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length); > > /** >- * Create an iterator over the UChar array referred to by "textPtr". >+ * Create an iterator over the char16_t array referred to by "textPtr". > * The iteration range is 0 to <code>length-1</code>. > * text is only aliased, not adopted (the > * destructor will not delete it). > * The starting > * position is specified by "position". If "position" is outside the valid > * iteration range, the behavior of this object is undefined. >- * @param textPtr The UChar array to be iteratd over >- * @param length The length of the UChar array >+ * @param textPtr The char16_t array to be iteratd over >+ * @param length The length of the char16_t array > * @param position The starting position of the iteration > * @stable ICU 2.0 > */ >- UCharCharacterIterator(const UChar* textPtr, int32_t length, >+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, > int32_t position); > > /** >- * Create an iterator over the UChar array referred to by "textPtr". >+ * Create an iterator over the char16_t array referred to by "textPtr". > * The iteration range is 0 to <code>end-1</code>. > * text is only aliased, not adopted (the > * destructor will not delete it). >@@ -68,14 +70,14 @@ public: > * position is specified by "position". If begin and end do not > * form a valid iteration range or "position" is outside the valid > * iteration range, the behavior of this object is undefined. >- * @param textPtr The UChar array to be iterated over >- * @param length The length of the UChar array >+ * @param textPtr The char16_t array to be iterated over >+ * @param length The length of the char16_t array > * @param textBegin The begin position of the iteration range > * @param textEnd The end position of the iteration range > * @param position The starting position of the iteration > * @stable ICU 2.0 > */ >- UCharCharacterIterator(const UChar* textPtr, int32_t length, >+ UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, > int32_t textBegin, > int32_t textEnd, > int32_t position); >@@ -139,7 +141,7 @@ public: > * @return the first code unit in its iteration range. > * @stable ICU 2.0 > */ >- virtual UChar first(void); >+ virtual char16_t first(void); > > /** > * Sets the iterator to refer to the first code unit in its >@@ -149,7 +151,7 @@ public: > * @return the first code unit in its iteration range > * @stable ICU 2.0 > */ >- virtual UChar firstPostInc(void); >+ virtual char16_t firstPostInc(void); > > /** > * Sets the iterator to refer to the first code point in its >@@ -179,7 +181,7 @@ public: > * @return the last code unit in its iteration range. > * @stable ICU 2.0 > */ >- virtual UChar last(void); >+ virtual char16_t last(void); > > /** > * Sets the iterator to refer to the last code point in its >@@ -198,7 +200,7 @@ public: > * @return the code unit > * @stable ICU 2.0 > */ >- virtual UChar setIndex(int32_t position); >+ virtual char16_t setIndex(int32_t position); > > /** > * Sets the iterator to refer to the beginning of the code point >@@ -218,7 +220,7 @@ public: > * @return the code unit the iterator currently refers to. > * @stable ICU 2.0 > */ >- virtual UChar current(void) const; >+ virtual char16_t current(void) const; > > /** > * Returns the code point the iterator currently refers to. >@@ -234,7 +236,7 @@ public: > * @return the next code unit in the iteration range. > * @stable ICU 2.0 > */ >- virtual UChar next(void); >+ virtual char16_t next(void); > > /** > * Gets the current code unit for returning and advances to the next code unit >@@ -244,7 +246,7 @@ public: > * @return the current code unit. > * @stable ICU 2.0 > */ >- virtual UChar nextPostInc(void); >+ virtual char16_t nextPostInc(void); > > /** > * Advances to the next code point in the iteration range (toward >@@ -286,7 +288,7 @@ public: > * @return the previous code unit in the iteration range. > * @stable ICU 2.0 > */ >- virtual UChar previous(void); >+ virtual char16_t previous(void); > > /** > * Advances to the previous code point in the iteration range (toward >@@ -332,16 +334,20 @@ public: > * @return the new position > * @stable ICU 2.0 > */ >+#ifdef move32 >+ // One of the system headers right now is sometimes defining a conflicting macro we don't use >+#undef move32 >+#endif > virtual int32_t move32(int32_t delta, EOrigin origin); > > /** > * Sets the iterator to iterate over a new range of text > * @stable ICU 2.0 > */ >- void setText(const UChar* newText, int32_t newTextLength); >+ void setText(ConstChar16Ptr newText, int32_t newTextLength); > > /** >- * Copies the UChar array under iteration into the UnicodeString >+ * Copies the char16_t array under iteration into the UnicodeString > * referred to by "result". Even if this iterator iterates across > * only a part of this string, the whole string is copied. > * @param result Receives a copy of the text under iteration. >@@ -373,7 +379,7 @@ protected: > * Protected member text > * @stable ICU 2.0 > */ >- const UChar* text; >+ const char16_t* text; > > }; > >diff --git a/Source/WTF/icu/unicode/uclean.h b/Source/WTF/icu/unicode/uclean.h >index d9a1e539058cde85efd2aa84cb707d37417425fe..5b0486d3950177b1c80d713f92fc62fde2cb0b5b 100644 >--- a/Source/WTF/icu/unicode/uclean.h >+++ b/Source/WTF/icu/unicode/uclean.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * Copyright (C) 2001-2014, International Business Machines > * Corporation and others. All Rights Reserved. > ****************************************************************************** > * file name: uclean.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -99,7 +101,7 @@ u_init(UErrorCode *status); > U_STABLE void U_EXPORT2 > u_cleanup(void); > >- >+U_CDECL_BEGIN > /** > * Pointer type for a user supplied memory allocation function. > * @param context user supplied value, obtained from from u_setMemoryFunctions(). >@@ -147,9 +149,10 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); > * @system > */ > U_STABLE void U_EXPORT2 >-u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, >+u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, > UErrorCode *status); > >+U_CDECL_END > > #ifndef U_HIDE_DEPRECATED_API > /********************************************************************************* >@@ -170,6 +173,7 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem > */ > typedef void *UMTX; > >+U_CDECL_BEGIN > /** > * Function Pointer type for a user supplied mutex initialization function. > * The user-supplied function will be called by ICU whenever ICU needs to create a >@@ -199,7 +203,7 @@ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCod > * @system > */ > typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); >- >+U_CDECL_END > > /** > * Set the functions that ICU will use for mutex operations >diff --git a/Source/WTF/icu/unicode/ucnv.h b/Source/WTF/icu/unicode/ucnv.h >index 564656c284f8e0270b2c956254322b4443b30351..05d0050f4a2fc9f973da08f3fcd265f2412880d7 100644 >--- a/Source/WTF/icu/unicode/ucnv.h >+++ b/Source/WTF/icu/unicode/ucnv.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2014, International Business Machines >@@ -27,7 +29,7 @@ > * converter, you can get its properties, set options, convert your data and > * close the converter.</p> > * >- * <p>Since many software programs recogize different converter names for >+ * <p>Since many software programs recognize different converter names for > * different types of converters, there are other functions in this API to > * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, > * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the >@@ -182,7 +184,7 @@ typedef enum { > > /** > * Function pointer for error callback in the codepage to unicode direction. >- * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason). >+ * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason). > * @param context Pointer to the callback's private data > * @param args Information about the conversion in progress > * @param codeUnits Points to 'length' bytes of the concerned codepage sequence >@@ -450,7 +452,7 @@ ucnv_openU(const UChar *name, > * @param platform the platform in which the codepage number exists > * @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT> > * @return the created Unicode converter object, or <TT>NULL</TT> if an error >- * occured. >+ * occurred. > * @see ucnv_open > * @see ucnv_openU > * @see ucnv_close >@@ -594,7 +596,7 @@ U_NAMESPACE_END > * stateful, then subChars will be an empty string. > * > * @param converter the Unicode converter >- * @param subChars the subsitution characters >+ * @param subChars the substitution characters > * @param len on input the capacity of subChars, on output the number > * of bytes copied to it > * @param err the outgoing error status code. >@@ -830,7 +832,7 @@ ucnv_getMinCharSize(const UConverter *converter); > * name will be filled in. > * > * @param converter the Unicode converter. >- * @param displayLocale is the specific Locale we want to localised for >+ * @param displayLocale is the specific Locale we want to localized for > * @param displayName user provided buffer to be filled in > * @param displayNameCapacity size of displayName Buffer > * @param err error status code >@@ -875,7 +877,7 @@ ucnv_getName(const UConverter *converter, UErrorCode *err); > * > * @param converter the Unicode converter > * @param err the error status code. >- * @return If any error occurrs, -1 will be returned otherwise, the codepage number >+ * @return If any error occurs, -1 will be returned otherwise, the codepage number > * will be returned > * @see ucnv_openCCSID > * @see ucnv_getPlatform >@@ -941,8 +943,13 @@ typedef enum UConverterUnicodeSet { > UCNV_ROUNDTRIP_SET, > /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */ > UCNV_ROUNDTRIP_AND_FALLBACK_SET, >- /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * Number of UConverterUnicodeSet selectors. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCNV_SET_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UConverterUnicodeSet; > > >diff --git a/Source/WTF/icu/unicode/ucnv_cb.h b/Source/WTF/icu/unicode/ucnv_cb.h >index f0e67ba11e0c4bb10877174980cbe48ec15bf798..14169ed61c14c9b9549a4f847f8dd3f18b10153d 100644 >--- a/Source/WTF/icu/unicode/ucnv_cb.h >+++ b/Source/WTF/icu/unicode/ucnv_cb.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 2000-2004, International Business Machines >diff --git a/Source/WTF/icu/unicode/ucnv_err.h b/Source/WTF/icu/unicode/ucnv_err.h >index e092e95f808bf70c063a64d1d7d4be333adacb45..2f74754ce4de1414a55220b51b9f67fd47998db1 100644 >--- a/Source/WTF/icu/unicode/ucnv_err.h >+++ b/Source/WTF/icu/unicode/ucnv_err.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2009, International Business Machines >diff --git a/Source/WTF/icu/unicode/ucnvsel.h b/Source/WTF/icu/unicode/ucnvsel.h >index eb9588eb2dbef011a77c76c565e8fa8013ed7cbd..d423845ceb62974b79f53fd8030f95ac641a08c1 100644 >--- a/Source/WTF/icu/unicode/ucnvsel.h >+++ b/Source/WTF/icu/unicode/ucnvsel.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >diff --git a/Source/WTF/icu/unicode/ucol.h b/Source/WTF/icu/unicode/ucol.h >index 510ddc8c6bddceaf495c3c7e1a71d558ec643092..ecabd9e09b9d7a9cdd365f694555214767366aef 100644 >--- a/Source/WTF/icu/unicode/ucol.h >+++ b/Source/WTF/icu/unicode/ucol.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (c) 1996-2015, International Business Machines Corporation and others. >@@ -123,8 +125,13 @@ typedef enum { > /** upper case sorts before lower case */ > UCOL_UPPER_FIRST = 25, > >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UColAttributeValue value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCOL_ATTRIBUTE_VALUE_COUNT >- >+#endif /* U_HIDE_DEPRECATED_API */ > } UColAttributeValue; > > /** >@@ -191,12 +198,13 @@ typedef enum { > * @stable ICU 4.8 > */ > UCOL_REORDER_CODE_DIGIT = 0x1004, >- /** >- * The limit of the reorder codes. This is intended for use in range checking >- * and enumeration of the reorder codes. >- * @stable ICU 4.8 >- */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UColReorderCode value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCOL_REORDER_CODE_LIMIT = 0x1005 >+#endif /* U_HIDE_DEPRECATED_API */ > } UColReorderCode; > > /** >@@ -333,10 +341,13 @@ typedef enum { > * @stable ICU 2.8 > */ > UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2, >- /** >- * The number of UColAttribute constants. >- * @stable ICU 2.0 >- */ >+ >+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, >+ * it is needed for layout of RuleBasedCollator object. */ >+ /** >+ * One more than the highest normal UColAttribute value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UCOL_ATTRIBUTE_COUNT > } UColAttribute; > >@@ -1050,7 +1061,13 @@ typedef enum { > UCOL_BOUND_UPPER = 1, > /** upper bound that will match all the strings that have the same initial substring as the given string */ > UCOL_BOUND_UPPER_LONG = 2, >- UCOL_BOUND_VALUE_COUNT >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UColBoundMode value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UCOL_BOUND_VALUE_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ > } UColBoundMode; > > /** >@@ -1269,6 +1286,7 @@ ucol_setVariableTop(UCollator *coll, > */ > U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status); > >+#ifndef U_HIDE_DEPRECATED_API > /** > * Sets the variable top to the specified primary weight. > * >@@ -1284,6 +1302,7 @@ U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCod > */ > U_DEPRECATED void U_EXPORT2 > ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status); >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * Thread safe cloning operation. The result is a clone of a given collator. >diff --git a/Source/WTF/icu/unicode/ucoleitr.h b/Source/WTF/icu/unicode/ucoleitr.h >index f987624056727c44f67ca10572f7a8dde96bab3f..85ec8383d7cb2eb58037ef8a6140b043d2262b8b 100644 >--- a/Source/WTF/icu/unicode/ucoleitr.h >+++ b/Source/WTF/icu/unicode/ucoleitr.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2001-2014, International Business Machines >@@ -150,7 +152,7 @@ ucol_reset(UCollationElements *elems); > * A single character may contain more than one collation element. > * @param elems The UCollationElements containing the text. > * @param status A pointer to a UErrorCode to receive any errors. >- * @return The next collation elements ordering, otherwise returns NULLORDER >+ * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER > * if an error has occured or if the end of string has been reached > * @stable ICU 2.0 > */ >@@ -166,7 +168,7 @@ ucol_next(UCollationElements *elems, UErrorCode *status); > * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack > * buffer has been exhausted. > * @return The previous collation elements ordering, otherwise returns >- * NULLORDER if an error has occured or if the start of string has >+ * UCOL_NULLORDER if an error has occured or if the start of string has > * been reached. > * @stable ICU 2.0 > */ >diff --git a/Source/WTF/icu/unicode/uconfig.h b/Source/WTF/icu/unicode/uconfig.h >index f6223bb8a87b5a4bdc9b583a84b87da683f46a07..8e67756ba98de20672d29a1d4094292a4ca36867 100644 >--- a/Source/WTF/icu/unicode/uconfig.h >+++ b/Source/WTF/icu/unicode/uconfig.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 2002-2015, International Business Machines >+* Copyright (C) 2002-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * file name: uconfig.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -74,7 +76,7 @@ > #endif > > /** >- * Determines wheter to enable auto cleanup of libraries. >+ * Determines whether to enable auto cleanup of libraries. > * @internal > */ > #ifndef UCLN_NO_AUTO_CLEANUP >@@ -87,7 +89,7 @@ > * @internal > */ > #ifndef U_DISABLE_RENAMING >-#define U_DISABLE_RENAMING 0 >+#define U_DISABLE_RENAMING 1 > #endif > > /** >@@ -134,6 +136,15 @@ > #define U_ENABLE_TRACING 0 > #endif > >+/** >+ * \def UCONFIG_ENABLE_PLUGINS >+ * Determines whether to enable ICU plugins. >+ * @internal >+ */ >+#ifndef UCONFIG_ENABLE_PLUGINS >+#define UCONFIG_ENABLE_PLUGINS 0 >+#endif >+ > /** > * \def U_ENABLE_DYLOAD > * Whether to enable Dynamic loading in ICU. >@@ -152,7 +163,6 @@ > #define U_CHECK_DYLOAD 1 > #endif > >- > /** > * \def U_DEFAULT_SHOW_DRAFT > * Do we allow ICU users to use the draft APIs by default? >@@ -252,7 +262,8 @@ > > /** > * \def UCONFIG_NO_CONVERSION >- * ICU will not completely build with this switch turned on. >+ * ICU will not completely build (compiling the tools fails) with this >+ * switch turned on. > * This switch turns off all converters. > * > * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1 >@@ -278,7 +289,7 @@ > * This is not possible on EBCDIC platforms > * because they need ibm-37 or ibm-1047 default converters. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ > #ifndef UCONFIG_ONLY_HTML_CONVERSION > # define UCONFIG_ONLY_HTML_CONVERSION 0 >@@ -310,7 +321,9 @@ > */ > #ifndef UCONFIG_NO_NORMALIZATION > # define UCONFIG_NO_NORMALIZATION 0 >-#elif UCONFIG_NO_NORMALIZATION >+#endif >+ >+#if UCONFIG_NO_NORMALIZATION > /* common library */ > /* ICU 50 CJK dictionary BreakIterator uses normalization */ > # define UCONFIG_NO_BREAK_ITERATION 1 >@@ -437,9 +450,6 @@ > */ > #ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION > # define UCONFIG_NO_FILTERED_BREAK_ITERATION 0 >- >- >- > #endif > > #endif >diff --git a/Source/WTF/icu/unicode/ucsdet.h b/Source/WTF/icu/unicode/ucsdet.h >index d3a297be1e1eda1392a777000a599c15dbc4d004..52ed5ad0ee2eb553ae4319380e97103b8e75fe59 100644 >--- a/Source/WTF/icu/unicode/ucsdet.h >+++ b/Source/WTF/icu/unicode/ucsdet.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 2005-2013, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * file name: ucsdet.h >- * encoding: US-ASCII >+ * encoding: UTF-8 > * indentation:4 > * > * created on: 2005Aug04 >@@ -43,6 +45,10 @@ > * in a single language, and a minimum of a few hundred bytes worth of plain text > * in the language are needed. The detection process will attempt to > * ignore html or xml style markup that could otherwise obscure the content. >+ * <p> >+ * An alternative to the ICU Charset Detector is the >+ * Compact Encoding Detector, https://github.com/google/compact_enc_det. >+ * It often gives more accurate results, especially with short input samples. > */ > > >@@ -393,7 +399,7 @@ ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); > /** > * Enable or disable individual charset encoding. > * A name of charset encoding must be included in the names returned by >- * {@link #getAllDetectableCharsets()}. >+ * {@link #ucsdet_getAllDetectableCharsets()}. > * > * @param ucsd a Charset detector. > * @param encoding encoding the name of charset encoding. >diff --git a/Source/WTF/icu/unicode/ucurr.h b/Source/WTF/icu/unicode/ucurr.h >index 5b196901693f40cc259f963efa99809348a63946..1abb3b22e97af41dcf4b422b67559437d34bed08 100644 >--- a/Source/WTF/icu/unicode/ucurr.h >+++ b/Source/WTF/icu/unicode/ucurr.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (c) 2002-2014, International Business Machines >+* Copyright (c) 2002-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > */ >@@ -13,55 +15,53 @@ > /** > * \file > * \brief C API: Encapsulates information about a currency. >+ * >+ * The ucurr API encapsulates information about a currency, as defined by >+ * ISO 4217. A currency is represented by a 3-character string >+ * containing its ISO 4217 code. This API can return various data >+ * necessary the proper display of a currency: >+ * >+ * <ul><li>A display symbol, for a specific locale >+ * <li>The number of fraction digits to display >+ * <li>A rounding increment >+ * </ul> >+ * >+ * The <tt>DecimalFormat</tt> class uses these data to display >+ * currencies. >+ * @author Alan Liu >+ * @since ICU 2.2 > */ > > #if !UCONFIG_NO_FORMATTING > > /** > * Currency Usage used for Decimal Format >- * @draft ICU 54 >+ * @stable ICU 54 > */ > enum UCurrencyUsage { >-#ifndef U_HIDE_DRAFT_API > /** > * a setting to specify currency usage which determines currency digit > * and rounding for standard usage, for example: "50.00 NT$" > * used as DEFAULT value >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UCURR_USAGE_STANDARD=0, > /** > * a setting to specify currency usage which determines currency digit > * and rounding for cash usage, for example: "50 NT$" >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UCURR_USAGE_CASH=1, >-#endif /* U_HIDE_DRAFT_API */ >+#ifndef U_HIDE_DEPRECATED_API > /** > * One higher than the last enum UCurrencyUsage constant. >- * @draft ICU 54 >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UCURR_USAGE_COUNT=2 >+#endif // U_HIDE_DEPRECATED_API > }; > typedef enum UCurrencyUsage UCurrencyUsage; > >-/** >- * The ucurr API encapsulates information about a currency, as defined by >- * ISO 4217. A currency is represented by a 3-character string >- * containing its ISO 4217 code. This API can return various data >- * necessary the proper display of a currency: >- * >- * <ul><li>A display symbol, for a specific locale >- * <li>The number of fraction digits to display >- * <li>A rounding increment >- * </ul> >- * >- * The <tt>DecimalFormat</tt> class uses these data to display >- * currencies. >- * @author Alan Liu >- * @since ICU 2.2 >- */ >- > /** > * Finds a currency code for the given locale. > * @param locale the locale for which to retrieve a currency code. >@@ -204,7 +204,6 @@ U_STABLE int32_t U_EXPORT2 > ucurr_getDefaultFractionDigits(const UChar* currency, > UErrorCode* ec); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns the number of the number of fraction digits that should > * be displayed for the given currency with usage. >@@ -213,13 +212,12 @@ ucurr_getDefaultFractionDigits(const UChar* currency, > * @param ec input-output error code > * @return a non-negative number of fraction digits to be > * displayed, or 0 if there is an error >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, > const UCurrencyUsage usage, > UErrorCode* ec); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Returns the rounding increment for the given currency, or 0.0 if no >@@ -235,7 +233,6 @@ U_STABLE double U_EXPORT2 > ucurr_getRoundingIncrement(const UChar* currency, > UErrorCode* ec); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns the rounding increment for the given currency, or 0.0 if no > * rounding is done by the currency given usage. >@@ -244,13 +241,12 @@ ucurr_getRoundingIncrement(const UChar* currency, > * @param ec input-output error code > * @return the non-negative rounding increment, or 0.0 if none, > * or 0.0 if there is an error >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT double U_EXPORT2 >+U_STABLE double U_EXPORT2 > ucurr_getRoundingIncrementForUsage(const UChar* currency, > const UCurrencyUsage usage, > UErrorCode* ec); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Selector constants for ucurr_openCurrencies(). >diff --git a/Source/WTF/icu/unicode/udat.h b/Source/WTF/icu/unicode/udat.h >index 532613a0637dbbe07968f2e110d1e608a369733d..90aff20df2a122b76428f903062d07767898d8d1 100644 >--- a/Source/WTF/icu/unicode/udat.h >+++ b/Source/WTF/icu/unicode/udat.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >- * Copyright (C) 1996-2015, International Business Machines >+ * Copyright (C) 1996-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > */ >@@ -150,7 +152,7 @@ > */ > typedef void* UDateFormat; > >-/** The possible date/time format styles >+/** The possible date/time format styles > * @stable ICU 2.6 > */ > typedef enum UDateFormatStyle { >@@ -167,16 +169,16 @@ typedef enum UDateFormatStyle { > > /** Bitfield for relative date */ > UDAT_RELATIVE = (1 << 7), >- >+ > UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE, >- >+ > UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE, >- >+ > UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE, >- >+ > UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE, >- >- >+ >+ > /** No style */ > UDAT_NONE = -1, > >@@ -294,7 +296,7 @@ typedef enum UDateFormatStyle { > * Used in combinations date + time, date + time + zone, or time + zone. > * @stable ICU 4.0 > */ >-#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd" >+#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd" > /** > * Constant for date skeleton with year, numeric month, weekday, and day. > * Used in combinations date + time, date + time + zone, or time + zone. >@@ -446,7 +448,7 @@ typedef enum UDateFormatStyle { > > /* deprecated skeleton constants */ > >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** > * Constant for date skeleton with standalone month. > * @deprecated ICU 50 Use UDAT_MONTH instead. >@@ -759,30 +761,54 @@ typedef enum UDateFormatField { > * @internal ICU 53 > */ > UDAT_RELATED_YEAR_FIELD = 34, >-#endif /* U_HIDE_INTERNAL_API */ >+#endif /* U_HIDE_INTERNAL_API */ > >-#ifndef U_HIDE_DRAFT_API > /** >- * FieldPosition and UFieldPosition selector for ':' time separator, >- * no corresponding UCAL_ field. >- * @draft ICU 55 >+ * FieldPosition selector for 'b' field alignment. >+ * Displays midnight and noon for 12am and 12pm, respectively, if available; >+ * otherwise fall back to AM / PM. >+ * @stable ICU 57 > */ >- UDAT_TIME_SEPARATOR_FIELD = 35, >-#endif /* U_HIDE_DRAFT_API */ >+ UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35, > >- /** >+ /* FieldPosition selector for 'B' field alignment. >+ * Displays flexible day periods, such as "in the morning", if available. >+ * @stable ICU 57 >+ */ >+ UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36, >+ >+#ifndef U_HIDE_INTERNAL_API >+ /** >+ * FieldPosition and UFieldPosition selector for time separator, >+ * no corresponding UCAL_ field. No pattern character is currently >+ * defined for this. >+ * @internal >+ */ >+ UDAT_TIME_SEPARATOR_FIELD = 37, >+#endif /* U_HIDE_INTERNAL_API */ >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** > * Number of FieldPosition and UFieldPosition selectors for > * DateFormat and UDateFormat. > * Valid selectors range from 0 to UDAT_FIELD_COUNT-1. >- * This value is subject to change if new fields are defined >- * in the future. >- * @stable ICU 3.0 >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ >- UDAT_FIELD_COUNT = 36 >- >+ UDAT_FIELD_COUNT = 38 >+#endif /* U_HIDE_DEPRECATED_API */ > } UDateFormatField; > > >+#ifndef U_HIDE_INTERNAL_API >+/** >+ * Is a pattern character defined for UDAT_TIME_SEPARATOR_FIELD? >+ * In ICU 55 it was COLON, but that was withdrawn in ICU 56. >+ * @internal ICU 56 >+ */ >+#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0 >+#endif /* U_HIDE_INTERNAL_API */ >+ >+ > /** > * Maps from a UDateFormatField to the corresponding UCalendarDateFields. > * Note: since the mapping is many-to-one, there is no inverse mapping. >@@ -791,7 +817,7 @@ typedef enum UDateFormatField { > * of error (e.g., the input field is UDAT_FIELD_COUNT). > * @stable ICU 4.4 > */ >-U_STABLE UCalendarDateFields U_EXPORT2 >+U_CAPI UCalendarDateFields U_EXPORT2 > udat_toCalendarDateField(UDateFormatField field); > > >@@ -823,7 +849,7 @@ udat_toCalendarDateField(UDateFormatField field); > * an error occurred. > * @stable ICU 2.0 > */ >-U_STABLE UDateFormat* U_EXPORT2 >+U_CAPI UDateFormat* U_EXPORT2 > udat_open(UDateFormatStyle timeStyle, > UDateFormatStyle dateStyle, > const char *locale, >@@ -840,13 +866,13 @@ udat_open(UDateFormatStyle timeStyle, > * @param format The formatter to close. > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_close(UDateFormat* format); > > > /** > * DateFormat boolean attributes >- * >+ * > * @stable ICU 53 > */ > typedef enum UDateFormatBooleanAttribute { >@@ -861,22 +887,24 @@ typedef enum UDateFormatBooleanAttribute { > * @stable ICU 53 > */ > UDAT_PARSE_ALLOW_NUMERIC = 1, >-#ifndef U_HIDE_DRAFT_API > /** > * indicates tolerance of a partial literal match >- * @draft ICU 53 >+ * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy" >+ * @stable ICU 56 >+ */ >+ UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2, >+ /** >+ * indicates tolerance of pattern mismatch between input data and specified format pattern. >+ * e.g. accepting "September" for a month pattern of MMM ("Sep") >+ * @stable ICU 56 > */ >- UDAT_PARSE_PARTIAL_MATCH = 2, >- /** >- * indicates tolerance of pattern mismatch between input data and specified format pattern. >- * e.g. accepting "September" for a month pattern of MMM ("Sep") >- * @draft ICU 53 >- */ > UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, >-#endif /* U_HIDE_DRAFT_API */ >+ >+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, >+ * it is needed for layout of DateFormat object. */ > /** >- * count boolean date format constants >- * @stable ICU 53 >+ * One more than the highest normal UDateFormatBooleanAttribute value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4 > } UDateFormatBooleanAttribute; >@@ -891,7 +919,7 @@ typedef enum UDateFormatBooleanAttribute { > * @return The value of attr. > * @stable ICU 53 > */ >-U_STABLE UBool U_EXPORT2 >+U_CAPI UBool U_EXPORT2 > udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status); > > /** >@@ -904,7 +932,7 @@ udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att > * @param status A pointer to an UErrorCode to receive any errors > * @stable ICU 53 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status); > > >@@ -936,7 +964,7 @@ U_NAMESPACE_END > * @return A pointer to a UDateFormat identical to fmt. > * @stable ICU 2.0 > */ >-U_STABLE UDateFormat* U_EXPORT2 >+U_CAPI UDateFormat* U_EXPORT2 > udat_clone(const UDateFormat *fmt, > UErrorCode *status); > >@@ -958,7 +986,7 @@ udat_clone(const UDateFormat *fmt, > * @see UFieldPosition > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_format( const UDateFormat* format, > UDate dateToFormat, > UChar* result, >@@ -966,7 +994,6 @@ udat_format( const UDateFormat* format, > UFieldPosition* position, > UErrorCode* status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Format a date using an UDateFormat. > * The date will be formatted using the conventions specified in {@link #udat_open } >@@ -987,9 +1014,9 @@ udat_format( const UDateFormat* format, > * @see udat_format > * @see udat_parseCalendar > * @see UFieldPosition >-* @draft ICU 55 >+* @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_formatCalendar( const UDateFormat* format, > UCalendar* calendar, > UChar* result, >@@ -1022,9 +1049,9 @@ udat_formatCalendar( const UDateFormat* format, > * The total buffer size needed; if greater than resultLength, the output was truncated. > * @see udat_parse > * @see UFieldPositionIterator >-* @draft ICU 55 >+* @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_formatForFields( const UDateFormat* format, > UDate dateToFormat, > UChar* result, >@@ -1060,9 +1087,9 @@ udat_formatForFields( const UDateFormat* format, > * @see udat_format > * @see udat_parseCalendar > * @see UFieldPositionIterator >-* @draft ICU 55 >+* @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_formatCalendarForFields( const UDateFormat* format, > UCalendar* calendar, > UChar* result, >@@ -1070,7 +1097,6 @@ udat_formatCalendarForFields( const UDateFormat* format, > UFieldPositionIterator* fpositer, > UErrorCode* status); > >-#endif /* U_HIDE_DRAFT_API */ > > /** > * Parse a string into an date/time using a UDateFormat. >@@ -1097,7 +1123,7 @@ udat_formatCalendarForFields( const UDateFormat* format, > * @see udat_format > * @stable ICU 2.0 > */ >-U_STABLE UDate U_EXPORT2 >+U_CAPI UDate U_EXPORT2 > udat_parse(const UDateFormat* format, > const UChar* text, > int32_t textLength, >@@ -1125,7 +1151,7 @@ udat_parse(const UDateFormat* format, > * @see udat_format > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_parseCalendar(const UDateFormat* format, > UCalendar* calendar, > const UChar* text, >@@ -1142,7 +1168,7 @@ udat_parseCalendar(const UDateFormat* format, > * @see udat_setLenient > * @stable ICU 2.0 > */ >-U_STABLE UBool U_EXPORT2 >+U_CAPI UBool U_EXPORT2 > udat_isLenient(const UDateFormat* fmt); > > /** >@@ -1154,7 +1180,7 @@ udat_isLenient(const UDateFormat* fmt); > * @see dat_isLenient > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setLenient( UDateFormat* fmt, > UBool isLenient); > >@@ -1167,7 +1193,7 @@ udat_setLenient( UDateFormat* fmt, > * @see udat_setCalendar > * @stable ICU 2.0 > */ >-U_STABLE const UCalendar* U_EXPORT2 >+U_CAPI const UCalendar* U_EXPORT2 > udat_getCalendar(const UDateFormat* fmt); > > /** >@@ -1179,7 +1205,7 @@ udat_getCalendar(const UDateFormat* fmt); > * @see udat_setCalendar > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setCalendar( UDateFormat* fmt, > const UCalendar* calendarToSet); > >@@ -1192,10 +1218,9 @@ udat_setCalendar( UDateFormat* fmt, > * @see udat_setNumberFormat > * @stable ICU 2.0 > */ >-U_STABLE const UNumberFormat* U_EXPORT2 >+U_CAPI const UNumberFormat* U_EXPORT2 > udat_getNumberFormat(const UDateFormat* fmt); > >-#ifndef U_HIDE_DRAFT_API > /** > * Get the UNumberFormat for specific field associated with an UDateFormat. > * For example: 'y' for year and 'M' for month >@@ -1203,16 +1228,16 @@ udat_getNumberFormat(const UDateFormat* fmt); > * @param field the field to query > * @return A pointer to the UNumberFormat used by fmt to format field numbers. > * @see udat_setNumberFormatForField >-* @draft ICU 54 >+* @stable ICU 54 > */ >-U_DRAFT const UNumberFormat* U_EXPORT2 >+U_CAPI const UNumberFormat* U_EXPORT2 > udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); > > /** > * Set the UNumberFormat for specific field associated with an UDateFormat. > * It can be a single field like: "y"(year) or "M"(month) > * It can be several field combined together: "yM"(year and month) >-* Note: >+* Note: > * 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") > * If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) > * >@@ -1221,32 +1246,28 @@ udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); > * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. > * @param status error code passed around (memory allocation or invalid fields) > * @see udat_getNumberFormatForField >-* @draft ICU 54 >+* @stable ICU 54 > */ >-U_DRAFT void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_adoptNumberFormatForFields( UDateFormat* fmt, > const UChar* fields, > UNumberFormat* numberFormatToSet, > UErrorCode* status); >-#endif /* U_HIDE_DRAFT_API */ >- > /** > * Set the UNumberFormat associated with an UDateFormat. > * A UDateFormat uses a UNumberFormat to format numbers within a date, > * for example the day number. >-* This method also clears per field NumberFormat instances previously >-* set by {@see udat_setNumberFormatForField} >+* This method also clears per field NumberFormat instances previously >+* set by {@see udat_setNumberFormatForField} > * @param fmt The formatter to set. > * @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. > * @see udat_getNumberFormat > * @see udat_setNumberFormatForField > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setNumberFormat( UDateFormat* fmt, > const UNumberFormat* numberFormatToSet); >- >-#ifndef U_HIDE_DRAFT_API > /** > * Adopt the UNumberFormat associated with an UDateFormat. > * A UDateFormat uses a UNumberFormat to format numbers within a date, >@@ -1254,13 +1275,11 @@ udat_setNumberFormat( UDateFormat* fmt, > * @param fmt The formatter to set. > * @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers. > * @see udat_getNumberFormat >-* @draft ICU 54 >+* @stable ICU 54 > */ >-U_DRAFT void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_adoptNumberFormat( UDateFormat* fmt, > UNumberFormat* numberFormatToAdopt); >-#endif /* U_HIDE_DRAFT_API */ >- > /** > * Get a locale for which date/time formatting patterns are available. > * A UDateFormat in a locale returned by this function will perform the correct >@@ -1270,7 +1289,7 @@ udat_adoptNumberFormat( UDateFormat* fmt, > * @see udat_countAvailable > * @stable ICU 2.0 > */ >-U_STABLE const char* U_EXPORT2 >+U_CAPI const char* U_EXPORT2 > udat_getAvailable(int32_t localeIndex); > > /** >@@ -1281,7 +1300,7 @@ udat_getAvailable(int32_t localeIndex); > * @see udat_getAvailable > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_countAvailable(void); > > /** >@@ -1294,7 +1313,7 @@ udat_countAvailable(void); > * @see udat_Set2DigitYearStart > * @stable ICU 2.0 > */ >-U_STABLE UDate U_EXPORT2 >+U_CAPI UDate U_EXPORT2 > udat_get2DigitYearStart( const UDateFormat *fmt, > UErrorCode *status); > >@@ -1308,7 +1327,7 @@ udat_get2DigitYearStart( const UDateFormat *fmt, > * @see udat_Set2DigitYearStart > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_set2DigitYearStart( UDateFormat *fmt, > UDate d, > UErrorCode *status); >@@ -1325,7 +1344,7 @@ udat_set2DigitYearStart( UDateFormat *fmt, > * @see udat_applyPattern > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_toPattern( const UDateFormat *fmt, > UBool localized, > UChar *result, >@@ -1342,14 +1361,14 @@ udat_toPattern( const UDateFormat *fmt, > * @see udat_toPattern > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_applyPattern( UDateFormat *format, > UBool localized, > const UChar *pattern, > int32_t patternLength); > >-/** >- * The possible types of date format symbols >+/** >+ * The possible types of date format symbols > * @stable ICU 2.6 > */ > typedef enum UDateFormatSymbolType { >@@ -1408,44 +1427,41 @@ typedef enum UDateFormatSymbolType { > * Standalone version of UDAT_SHORTER_WEEKDAYS. > * @stable ICU 51 > */ >- UDAT_STANDALONE_SHORTER_WEEKDAYS >-#ifndef U_HIDE_DRAFT_API >- , >+ UDAT_STANDALONE_SHORTER_WEEKDAYS, > /** > * Cyclic year names (only supported for some calendars, and only for FORMAT usage; > * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_CYCLIC_YEARS_WIDE, > /** > * Cyclic year names (only supported for some calendars, and only for FORMAT usage) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_CYCLIC_YEARS_ABBREVIATED, > /** > * Cyclic year names (only supported for some calendars, and only for FORMAT usage; > * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_CYCLIC_YEARS_NARROW, > /** > * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; > * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_ZODIAC_NAMES_WIDE, > /** > * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_ZODIAC_NAMES_ABBREVIATED, > /** > * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; > * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW) >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDAT_ZODIAC_NAMES_NARROW >-#endif /* U_HIDE_DRAFT_API */ > } UDateFormatSymbolType; > > struct UDateFormatSymbols; >@@ -1471,7 +1487,7 @@ typedef struct UDateFormatSymbols UDateFormatSymbols; > * @see udat_setSymbols > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_getSymbols(const UDateFormat *fmt, > UDateFormatSymbolType type, > int32_t symbolIndex, >@@ -1491,7 +1507,7 @@ udat_getSymbols(const UDateFormat *fmt, > * @see udat_setSymbols > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > udat_countSymbols( const UDateFormat *fmt, > UDateFormatSymbolType type); > >@@ -1510,7 +1526,7 @@ udat_countSymbols( const UDateFormat *fmt, > * @see udat_countSymbols > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setSymbols( UDateFormat *format, > UDateFormatSymbolType type, > int32_t symbolIndex, >@@ -1522,15 +1538,15 @@ udat_setSymbols( UDateFormat *format, > * Get the locale for this date format object. > * You can choose between valid and actual locale. > * @param fmt The formatter to get the locale from >- * @param type type of the locale we're looking for (valid or actual) >+ * @param type type of the locale we're looking for (valid or actual) > * @param status error code for the operation > * @return the locale name > * @stable ICU 2.8 > */ >-U_STABLE const char* U_EXPORT2 >+U_CAPI const char* U_EXPORT2 > udat_getLocaleByType(const UDateFormat *fmt, > ULocDataLocaleType type, >- UErrorCode* status); >+ UErrorCode* status); > > /** > * Set a particular UDisplayContext value in the formatter, such as >@@ -1540,7 +1556,7 @@ udat_getLocaleByType(const UDateFormat *fmt, > * @param status A pointer to an UErrorCode to receive any errors > * @stable ICU 51 > */ >-U_DRAFT void U_EXPORT2 >+U_CAPI void U_EXPORT2 > udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); > > /** >@@ -1552,7 +1568,7 @@ udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); > * @return The UDisplayContextValue for the specified type. > * @stable ICU 53 > */ >-U_STABLE UDisplayContext U_EXPORT2 >+U_CAPI UDisplayContext U_EXPORT2 > udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); > > #ifndef U_HIDE_INTERNAL_API >@@ -1567,7 +1583,7 @@ udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* st > * @see udat_applyPatternRelative > * @internal ICU 4.2 technology preview > */ >-U_INTERNAL int32_t U_EXPORT2 >+U_INTERNAL int32_t U_EXPORT2 > udat_toPatternRelativeDate(const UDateFormat *fmt, > UChar *result, > int32_t resultLength, >@@ -1584,7 +1600,7 @@ udat_toPatternRelativeDate(const UDateFormat *fmt, > * @see udat_applyPatternRelative > * @internal ICU 4.2 technology preview > */ >-U_INTERNAL int32_t U_EXPORT2 >+U_INTERNAL int32_t U_EXPORT2 > udat_toPatternRelativeTime(const UDateFormat *fmt, > UChar *result, > int32_t resultLength, >@@ -1602,7 +1618,7 @@ udat_toPatternRelativeTime(const UDateFormat *fmt, > * @see udat_toPatternRelativeDate, udat_toPatternRelativeTime > * @internal ICU 4.2 technology preview > */ >-U_INTERNAL void U_EXPORT2 >+U_INTERNAL void U_EXPORT2 > udat_applyPatternRelative(UDateFormat *format, > const UChar *datePattern, > int32_t datePatternLength, >diff --git a/Source/WTF/icu/unicode/udata.h b/Source/WTF/icu/unicode/udata.h >index 29e46630d5398d82738d1d61ffc4d2c914e8c68b..a0286e1e42036782986d523abf370e7c3a25aa38 100644 >--- a/Source/WTF/icu/unicode/udata.h >+++ b/Source/WTF/icu/unicode/udata.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -6,7 +8,7 @@ > * > ****************************************************************************** > * file name: udata.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -408,8 +410,13 @@ typedef enum UDataFileAccess { > UDATA_PACKAGES_FIRST, > /** ICU does not access the file system for data loading. @stable ICU 3.4 */ > UDATA_NO_FILES, >- /** Number of real UDataFileAccess values. @stable ICU 3.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * Number of real UDataFileAccess values. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UDATA_FILE_ACCESS_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UDataFileAccess; > > /** >diff --git a/Source/WTF/icu/unicode/udateintervalformat.h b/Source/WTF/icu/unicode/udateintervalformat.h >index 5ee92e629af54913a384ae7564c397a914bed283..9300ddcf82b9656cce0630dd7d781ea31492b37b 100644 >--- a/Source/WTF/icu/unicode/udateintervalformat.h >+++ b/Source/WTF/icu/unicode/udateintervalformat.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** >-* Copyright (C) 2010-2012, International Business Machines >+* Copyright (C) 2010-2012,2015 International Business Machines > * Corporation and others. All Rights Reserved. > ***************************************************************************************** > */ >@@ -160,6 +162,9 @@ U_NAMESPACE_END > * the beginning and ending indices of field number position->field, > * if such a field exists. This parameter may be NULL, in which case > * no field position data is returned. >+ * There may be multiple instances of a given field type in an >+ * interval format; in this case the position indices refer to the >+ * first instance. > * @param status > * A pointer to a UErrorCode to receive any errors. > * @return >diff --git a/Source/WTF/icu/unicode/udatpg.h b/Source/WTF/icu/unicode/udatpg.h >index 6b95252895e025344bc339fa594cbf3ae3a193de..76baa3da58940fe22c2c3d78ed50279399c552da 100644 >--- a/Source/WTF/icu/unicode/udatpg.h >+++ b/Source/WTF/icu/unicode/udatpg.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: udatpg.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -83,7 +85,13 @@ typedef enum UDateTimePatternField { > UDATPG_FRACTIONAL_SECOND_FIELD, > /** @stable ICU 3.8 */ > UDATPG_ZONE_FIELD, >- /** @stable ICU 3.8 */ >+ >+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, >+ * it is needed for layout of DateTimePatternGenerator object. */ >+ /** >+ * One more than the highest normal UDateTimePatternField value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UDATPG_FIELD_COUNT > } UDateTimePatternField; > >@@ -120,8 +128,13 @@ typedef enum UDateTimePatternConflict { > UDATPG_BASE_CONFLICT, > /** @stable ICU 3.8 */ > UDATPG_CONFLICT, >- /** @stable ICU 3.8 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UDateTimePatternConflict value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UDATPG_CONFLICT_COUNT >+#endif // U_HIDE_DEPRECATED_API > } UDateTimePatternConflict; > > /** >@@ -259,7 +272,8 @@ udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, > * Consecutive calls to this function do not affect each other, > * but this function cannot be used concurrently on a single generator object. > * >- * @param dtpg a pointer to UDateTimePatternGenerator. >+ * @param unusedDtpg a pointer to UDateTimePatternGenerator. >+ * This parameter is no longer used. Callers may pass NULL. > * @param pattern input pattern, such as "dd/MMM". > * @param length the length of pattern. > * @param skeleton such as "MMMdd" >@@ -270,7 +284,7 @@ udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, > * @stable ICU 3.8 > */ > U_STABLE int32_t U_EXPORT2 >-udatpg_getSkeleton(UDateTimePatternGenerator *dtpg, >+udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg, > const UChar *pattern, int32_t length, > UChar *skeleton, int32_t capacity, > UErrorCode *pErrorCode); >@@ -288,7 +302,8 @@ udatpg_getSkeleton(UDateTimePatternGenerator *dtpg, > * Consecutive calls to this function do not affect each other, > * but this function cannot be used concurrently on a single generator object. > * >- * @param dtpg a pointer to UDateTimePatternGenerator. >+ * @param unusedDtpg a pointer to UDateTimePatternGenerator. >+ * This parameter is no longer used. Callers may pass NULL. > * @param pattern input pattern, such as "dd/MMM". > * @param length the length of pattern. > * @param baseSkeleton such as "Md" >@@ -299,7 +314,7 @@ udatpg_getSkeleton(UDateTimePatternGenerator *dtpg, > * @stable ICU 3.8 > */ > U_STABLE int32_t U_EXPORT2 >-udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg, >+udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg, > const UChar *pattern, int32_t length, > UChar *baseSkeleton, int32_t capacity, > UErrorCode *pErrorCode); >diff --git a/Source/WTF/icu/unicode/udisplaycontext.h b/Source/WTF/icu/unicode/udisplaycontext.h >index 92b2f94a491dcceecd33be715195a43474952fed..398481c681224785618f5ad12e11b91b093b1074 100644 >--- a/Source/WTF/icu/unicode/udisplaycontext.h >+++ b/Source/WTF/icu/unicode/udisplaycontext.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** >-* Copyright (C) 2014, International Business Machines >+* Copyright (C) 2014-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ***************************************************************************************** > */ >@@ -35,16 +37,19 @@ enum UDisplayContextType { > * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc. > * @stable ICU 51 > */ >- UDISPCTX_TYPE_CAPITALIZATION = 1 >-#ifndef U_HIDE_DRAFT_API >- , >+ UDISPCTX_TYPE_CAPITALIZATION = 1, > /** > * Type to retrieve the display length setting, e.g. > * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT. >- * @draft ICU 54 >+ * @stable ICU 54 > */ >- UDISPCTX_TYPE_DISPLAY_LENGTH = 2 >-#endif /* U_HIDE_DRAFT_API */ >+ UDISPCTX_TYPE_DISPLAY_LENGTH = 2, >+ /** >+ * Type to retrieve the substitute handling setting, e.g. >+ * UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE. >+ * @stable ICU 58 >+ */ >+ UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3 > }; > /** > * @stable ICU 51 >@@ -115,9 +120,7 @@ enum UDisplayContext { > * isolated name on a calendar page. > * @stable ICU 51 > */ >- UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4 >-#ifndef U_HIDE_DRAFT_API >- , >+ UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4, > /** > * ================================ > * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or >@@ -128,17 +131,36 @@ enum UDisplayContext { > * A possible setting for DISPLAY_LENGTH: > * use full names when generating a locale name, > * e.g. "United States" for US. >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0, > /** > * A possible setting for DISPLAY_LENGTH: > * use short names when generating a locale name, > * e.g. "U.S." for US. >- * @draft ICU 54 >+ * @stable ICU 54 >+ */ >+ UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1, >+ /** >+ * ================================ >+ * SUBSTITUTE_HANDLING can be set to one of UDISPCTX_SUBSTITUTE or >+ * UDISPCTX_NO_SUBSTITUTE. Use UDisplayContextType UDISPCTX_TYPE_SUBSTITUTE_HANDLING >+ * to get the value. > */ >- UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1 >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * A possible setting for SUBSTITUTE_HANDLING: >+ * Returns a fallback value (e.g., the input code) when no data is available. >+ * This is the default value. >+ * @stable ICU 58 >+ */ >+ UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, >+ /** >+ * A possible setting for SUBSTITUTE_HANDLING: >+ * Returns a null value when no data is available. >+ * @stable ICU 58 >+ */ >+ UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 >+ > }; > /** > * @stable ICU 51 >diff --git a/Source/WTF/icu/unicode/uenum.h b/Source/WTF/icu/unicode/uenum.h >index 5408ec5a6605b7540858b4ef67e999fe22c512aa..fc6efa2450db17d7e69caa6452c956257a970bb8 100644 >--- a/Source/WTF/icu/unicode/uenum.h >+++ b/Source/WTF/icu/unicode/uenum.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: uenum.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:2 > * >@@ -21,7 +23,9 @@ > #include "unicode/localpointer.h" > > #if U_SHOW_CPLUSPLUS_API >-#include "unicode/strenum.h" >+U_NAMESPACE_BEGIN >+class StringEnumeration; >+U_NAMESPACE_END > #endif > > /** >diff --git a/Source/WTF/icu/unicode/ufieldpositer.h b/Source/WTF/icu/unicode/ufieldpositer.h >index 6cc9ffada496c3018ced77e9f01b36b6211ac607..3ae73b6d843974999a4b391cde84447d970d1a4d 100644 >--- a/Source/WTF/icu/unicode/ufieldpositer.h >+++ b/Source/WTF/icu/unicode/ufieldpositer.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** >-* Copyright (C) 2015, International Business Machines >+* Copyright (C) 2015-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ***************************************************************************************** > */ >@@ -11,7 +13,6 @@ > #include "unicode/utypes.h" > > #if !UCONFIG_NO_FORMATTING >-#ifndef U_HIDE_DRAFT_API > > #include "unicode/localpointer.h" > >@@ -37,10 +38,10 @@ > > /** > * Opaque UFieldPositionIterator object for use in C. >- * @draft ICU 55 >+ * @stable ICU 55 > */ > struct UFieldPositionIterator; >-typedef struct UFieldPositionIterator UFieldPositionIterator; /**< C typedef for struct UFieldPositionIterator. @draft ICU 55 */ >+typedef struct UFieldPositionIterator UFieldPositionIterator; /**< C typedef for struct UFieldPositionIterator. @stable ICU 55 */ > > /** > * Open a new, unset UFieldPositionIterator object. >@@ -49,18 +50,18 @@ typedef struct UFieldPositionIterator UFieldPositionIterator; /**< C typedef fo > * @return > * A pointer to an empty (unset) UFieldPositionIterator object, > * or NULL if an error occurred. >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT UFieldPositionIterator* U_EXPORT2 >+U_STABLE UFieldPositionIterator* U_EXPORT2 > ufieldpositer_open(UErrorCode* status); > > /** > * Close a UFieldPositionIterator object. Once closed it may no longer be used. > * @param fpositer > * A pointer to the UFieldPositionIterator object to close. >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT void U_EXPORT2 >+U_STABLE void U_EXPORT2 > ufieldpositer_close(UFieldPositionIterator *fpositer); > > >@@ -75,7 +76,7 @@ U_NAMESPACE_BEGIN > * > * @see LocalPointerBase > * @see LocalPointer >- * @draft ICU 55 >+ * @stable ICU 55 > */ > U_DEFINE_LOCAL_OPEN_POINTER(LocalUFieldPositionIteratorPointer, UFieldPositionIterator, ufieldpositer_close); > >@@ -85,8 +86,8 @@ U_NAMESPACE_END > > /** > * Get information for the next field in the formatted string to which this >- * UFieldPositionIterator currently applies, or return FALSE if there are >- * no more fields. >+ * UFieldPositionIterator currently applies, or return a negative value if there >+ * are no more fields. > * @param fpositer > * A pointer to the UFieldPositionIterator object containing iteration > * state for the format fields. >@@ -109,13 +110,12 @@ U_NAMESPACE_END > * descriptions of format functions that take a UFieldPositionIterator* > * parameter, such as {@link #udat_formatForFields}. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > ufieldpositer_next(UFieldPositionIterator *fpositer, > int32_t *beginIndex, int32_t *endIndex); > >-#endif /* U_HIDE_DRAFT_API */ > #endif /* #if !UCONFIG_NO_FORMATTING */ > > #endif >diff --git a/Source/WTF/icu/unicode/uformattable.h b/Source/WTF/icu/unicode/uformattable.h >index a64ae14653a19d56a86e6a1a4967d3518b213a99..9ba2a36901aa8356c5d4d744ec038e2bf10cba84 100644 >--- a/Source/WTF/icu/unicode/uformattable.h >+++ b/Source/WTF/icu/unicode/uformattable.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************** > * Copyright (C) 2013-2014, International Business Machines Corporation and others. >@@ -49,7 +51,13 @@ typedef enum UFormattableType { > UFMT_ARRAY, /**< ufmt_countArray() and ufmt_getArray() will return the value. @see ufmt_getArrayItemByIndex */ > UFMT_INT64, /**< ufmt_getInt64() will return without conversion. @see ufmt_getInt64 */ > UFMT_OBJECT, /**< ufmt_getObject() will return without conversion. @see ufmt_getObject*/ >- UFMT_COUNT /**< Count of defined UFormattableType values */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UFormattableType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UFMT_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ > } UFormattableType; > > >diff --git a/Source/WTF/icu/unicode/ugender.h b/Source/WTF/icu/unicode/ugender.h >index 86e229df61b298f96a0a1e2c126ff4373ff0d968..d015a2300cf6d6af1295e93b8720cf862089879b 100644 >--- a/Source/WTF/icu/unicode/ugender.h >+++ b/Source/WTF/icu/unicode/ugender.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** > * Copyright (C) 2010-2013, International Business Machines >diff --git a/Source/WTF/icu/unicode/uidna.h b/Source/WTF/icu/unicode/uidna.h >index decece1fb0e30f933a15cb2dc43f751ba1b0937b..0dafb7620174412ebf778393d3f0797187f57745 100644 >--- a/Source/WTF/icu/unicode/uidna.h >+++ b/Source/WTF/icu/unicode/uidna.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: uidna.h >- * encoding: US-ASCII >+ * encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/uiter.h b/Source/WTF/icu/unicode/uiter.h >index 0cdb8ffbe5c8154ac9d908f605b0eb16ea5bb199..11ad75acd515c6e106b34d7c8003fe747cfc2b0e 100644 >--- a/Source/WTF/icu/unicode/uiter.h >+++ b/Source/WTF/icu/unicode/uiter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: uiter.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/uldnames.h b/Source/WTF/icu/unicode/uldnames.h >index b0a2bb0fc89ffb6c9e54c333cec2a2c29f5e882c..3ebffa23db5f121e9bd7b183625b142b0e287e7a 100644 >--- a/Source/WTF/icu/unicode/uldnames.h >+++ b/Source/WTF/icu/unicode/uldnames.h >@@ -1,7 +1,9 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2010-2014, International Business Machines Corporation and * >-* others. All Rights Reserved. * >+* Copyright (C) 2010-2016, International Business Machines Corporation and >+* others. All Rights Reserved. > ******************************************************************************* > */ > >diff --git a/Source/WTF/icu/unicode/ulistformatter.h b/Source/WTF/icu/unicode/ulistformatter.h >index 1c6cb2d7b12395402cb21d6269bf44449f5bdeb9..9fe24f7c7b5efcbda812d629532c86eddab53524 100644 >--- a/Source/WTF/icu/unicode/ulistformatter.h >+++ b/Source/WTF/icu/unicode/ulistformatter.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** >-* Copyright (C) 2015, International Business Machines >+* Copyright (C) 2015-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ***************************************************************************************** > */ >@@ -11,7 +13,6 @@ > #include "unicode/utypes.h" > > #if !UCONFIG_NO_FORMATTING >-#ifndef U_HIDE_DRAFT_API > > #include "unicode/localpointer.h" > >@@ -27,10 +28,10 @@ > > /** > * Opaque UListFormatter object for use in C >- * @draft ICU 55 >+ * @stable ICU 55 > */ > struct UListFormatter; >-typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @draft ICU 55 */ >+typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */ > > /** > * Open a new UListFormatter object using the rules for a given locale. >@@ -46,9 +47,9 @@ typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFo > * @return > * A pointer to a UListFormatter object for the specified locale, > * or NULL if an error occurred. >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT UListFormatter* U_EXPORT2 >+U_CAPI UListFormatter* U_EXPORT2 > ulistfmt_open(const char* locale, > UErrorCode* status); > >@@ -56,9 +57,9 @@ ulistfmt_open(const char* locale, > * Close a UListFormatter object. Once closed it may no longer be used. > * @param listfmt > * The UListFormatter object to close. >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT void U_EXPORT2 >+U_CAPI void U_EXPORT2 > ulistfmt_close(UListFormatter *listfmt); > > >@@ -73,7 +74,7 @@ U_NAMESPACE_BEGIN > * > * @see LocalPointerBase > * @see LocalPointer >- * @draft ICU 55 >+ * @stable ICU 55 > */ > U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close); > >@@ -113,9 +114,9 @@ U_NAMESPACE_END > * The total buffer size needed; if greater than resultLength, the > * output was truncated. May be <=0 if unable to determine the > * total buffer size needed (e.g. for illegal arguments). >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > ulistfmt_format(const UListFormatter* listfmt, > const UChar* const strings[], > const int32_t * stringLengths, >@@ -124,7 +125,6 @@ ulistfmt_format(const UListFormatter* listfmt, > int32_t resultCapacity, > UErrorCode* status); > >-#endif /* U_HIDE_DRAFT_API */ > #endif /* #if !UCONFIG_NO_FORMATTING */ > > #endif >diff --git a/Source/WTF/icu/unicode/uloc.h b/Source/WTF/icu/unicode/uloc.h >index c305c8b78c8a853b938d65d16a1e1296db7737bb..23a54a9981ca9619fa0560245008ab0aa15722dd 100644 >--- a/Source/WTF/icu/unicode/uloc.h >+++ b/Source/WTF/icu/unicode/uloc.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 1997-2014, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -59,7 +61,7 @@ > * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a> > * > * <P> >- * The second option includes an additonal <STRONG>ISO Country >+ * The second option includes an additional <STRONG>ISO Country > * Code.</STRONG> These codes are the upper-case two-letter codes > * as defined by ISO-3166. > * You can find a full list of these codes at a number of sites, such as: >@@ -67,7 +69,7 @@ > * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a> > * > * <P> >- * The third option requires another additonal information--the >+ * The third option requires another additional information--the > * <STRONG>Variant.</STRONG> > * The Variant codes are vendor and browser-specific. > * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. >@@ -155,7 +157,7 @@ > * <STRONG>just</STRONG> a mechanism for identifying these services. > * > * <P> >- * Each international serivce that performs locale-sensitive operations >+ * Each international service that performs locale-sensitive operations > * allows you > * to get all the available objects of that type. You can sift > * through these objects by language, country, or variant, >@@ -348,10 +350,14 @@ typedef enum { > * @deprecated ICU 2.8 > */ > ULOC_REQUESTED_LOCALE = 2, >-#endif /* U_HIDE_DEPRECATED_API */ > >- ULOC_DATA_LOCALE_TYPE_LIMIT = 3 >-} ULocDataLocaleType ; >+ /** >+ * One more than the highest normal ULocDataLocaleType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ ULOC_DATA_LOCALE_TYPE_LIMIT = 3 >+#endif // U_HIDE_DEPRECATED_API >+} ULocDataLocaleType; > > #ifndef U_HIDE_SYSTEM_API > /** >@@ -533,6 +539,9 @@ uloc_getISO3Country(const char* localeID); > * Gets the Win32 LCID value for the specified locale. > * If the ICU locale is not recognized by Windows, 0 will be returned. > * >+ * LCIDs were deprecated with Windows Vista and Microsoft recommends >+ * that developers use BCP47 style tags instead (uloc_toLanguageTag). >+ * > * @param localeID the locale to get the Win32 LCID value with > * @return country the Win32 LCID for localeID > * @stable ICU 2.0 >@@ -571,7 +580,7 @@ uloc_getDisplayLanguage(const char* locale, > * if the locale's language code is "en", passing Locale::getFrench() for > * inLocale would result in "", while passing Locale::getGerman() > * for inLocale would result in "". NULL may be used to specify the default. >- * @param script the displayable country code for localeID >+ * @param script the displayable script for the localeID > * @param scriptCapacity the size of the script buffer to store the > * displayable script code with > * @param status error information if retrieving the displayable script code failed >@@ -588,6 +597,8 @@ uloc_getDisplayScript(const char* locale, > > /** > * Gets the country name suitable for display for the specified locale. >+ * Warning: this is for the region part of a valid locale ID; it cannot just be the region code (like "FR"). >+ * To get the display name for a region alone, or for other options, use ULocaleDisplayNames instead. > * > * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. > * @param displayLocale Specifies the locale to be used to display the name. In other words, >@@ -844,10 +855,12 @@ uloc_openKeywords(const char* localeID, > * Get the value for a keyword. Locale name does not need to be normalized. > * > * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") >- * @param keywordName name of the keyword for which we want the value. Case insensitive. >+ * @param keywordName name of the keyword for which we want the value; must not be >+ * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. > * @param buffer receiving buffer > * @param bufferCapacity capacity of receiving buffer >- * @param status containing error code - buffer not big enough. >+ * @param status containing error code: e.g. buffer not big enough or ill-formed localeID >+ * or keywordName parameters. > * @return the length of keyword value > * @stable ICU 2.8 > */ >@@ -864,18 +877,26 @@ uloc_getKeywordValue(const char* localeID, > * For removing all keywords, use uloc_getBaseName(). > * > * NOTE: Unlike almost every other ICU function which takes a >- * buffer, this function will NOT truncate the output text. If a >- * BUFFER_OVERFLOW_ERROR is received, it means that the original >- * buffer is untouched. This is done to prevent incorrect or possibly >- * even malformed locales from being generated and used. >+ * buffer, this function will NOT truncate the output text, and will >+ * not update the buffer with unterminated text setting a status of >+ * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received, >+ * it means a terminated version of the updated locale ID would not fit >+ * in the buffer, and the original buffer is untouched. This is done to >+ * prevent incorrect or possibly even malformed locales from being generated >+ * and used. > * >- * @param keywordName name of the keyword to be set. Case insensitive. >+ * @param keywordName name of the keyword to be set; must not be >+ * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. > * @param keywordValue value of the keyword to be set. If 0-length or >- * NULL, will result in the keyword being removed. No error is given if >- * that keyword does not exist. >- * @param buffer input buffer containing locale to be modified. >+ * NULL, will result in the keyword being removed; no error is given if >+ * that keyword does not exist. Otherwise, must consist only of >+ * [A-Za-z0-9] and [/_+-]. >+ * @param buffer input buffer containing well-formed locale ID to be >+ * modified. > * @param bufferCapacity capacity of receiving buffer >- * @param status containing error code - buffer not big enough. >+ * @param status containing error code: e.g. buffer not big enough >+ * or ill-formed keywordName or keywordValue parameters, or ill-formed >+ * locale ID in buffer on input. > * @return the length needed for the buffer > * @see uloc_getKeywordValue > * @stable ICU 3.2 >@@ -886,7 +907,6 @@ uloc_setKeywordValue(const char* keywordName, > char* buffer, int32_t bufferCapacity, > UErrorCode* status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Returns whether the locale's script is written right-to-left. > * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). >@@ -899,11 +919,10 @@ uloc_setKeywordValue(const char* keywordName, > * > * @param locale input locale ID > * @return TRUE if the locale's script is written right-to-left >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT UBool U_EXPORT2 >+U_STABLE UBool U_EXPORT2 > uloc_isRightToLeft(const char *locale); >-#endif /* U_HIDE_DRAFT_API */ > > /** > * enums for the return value for the character and line orientation >@@ -1151,7 +1170,6 @@ uloc_toLanguageTag(const char* localeID, > UBool strict, > UErrorCode* err); > >-#ifndef U_HIDE_DRAFT_API > /** > * Converts the specified keyword (legacy key, or BCP 47 Unicode locale > * extension key) to the equivalent BCP 47 Unicode locale extension key. >@@ -1171,9 +1189,9 @@ uloc_toLanguageTag(const char* localeID, > * mapped to a well-formed BCP 47 Unicode locale extension > * key. > * @see uloc_toLegacyKey >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uloc_toUnicodeLocaleKey(const char* keyword); > > /** >@@ -1202,9 +1220,9 @@ uloc_toUnicodeLocaleKey(const char* keyword); > * or NULL if the locale keyword value cannot be mapped to > * a well-formed BCP 47 Unicode locale extension type. > * @see uloc_toLegacyType >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uloc_toUnicodeLocaleType(const char* keyword, const char* value); > > /** >@@ -1217,9 +1235,9 @@ uloc_toUnicodeLocaleType(const char* keyword, const char* value); > * @return the well-formed legacy key, or NULL if the specified > * keyword cannot be mapped to a well-formed legacy key. > * @see toUnicodeLocaleKey >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uloc_toLegacyKey(const char* keyword); > > /** >@@ -1246,11 +1264,9 @@ uloc_toLegacyKey(const char* keyword); > * keyword value cannot be mapped to a well-formed legacy > * type. > * @see toUnicodeLocaleType >- * @draft ICU 54 >+ * @stable ICU 54 > */ >-U_DRAFT const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uloc_toLegacyType(const char* keyword, const char* value); > >-#endif /* U_HIDE_DRAFT_API */ >- > #endif /*_ULOC*/ >diff --git a/Source/WTF/icu/unicode/ulocdata.h b/Source/WTF/icu/unicode/ulocdata.h >index 63495f681cee4a1fdf7d31fe4bbbd3273e262d2d..de8d8539c6749accd50537bf69f1ed3fb12685d4 100644 >--- a/Source/WTF/icu/unicode/ulocdata.h >+++ b/Source/WTF/icu/unicode/ulocdata.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * * >@@ -6,7 +8,7 @@ > * * > ****************************************************************************** > * file name: ulocdata.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -47,8 +49,13 @@ typedef enum ULocaleDataExemplarSetType { > ULOCDATA_ES_INDEX=2, > /** Punctuation set @stable ICU 51 */ > ULOCDATA_ES_PUNCTUATION=3, >- /** One higher than the last valid type @stable ICU 3.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal ULocaleDataExemplarSetType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > ULOCDATA_ES_COUNT=4 >+#endif /* U_HIDE_DEPRECATED_API */ > } ULocaleDataExemplarSetType; > > /** The possible types of delimiters. >@@ -63,8 +70,13 @@ typedef enum ULocaleDataDelimiterType { > ULOCDATA_ALT_QUOTATION_START = 2, > /** Alternate quotation end @stable ICU 3.4 */ > ULOCDATA_ALT_QUOTATION_END = 3, >- /** One higher than the last valid type @stable ICU 3.4 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal ULocaleDataDelimiterType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > ULOCDATA_DELIMITER_COUNT = 4 >+#endif /* U_HIDE_DEPRECATED_API */ > } ULocaleDataDelimiterType; > > /** >@@ -189,7 +201,13 @@ typedef enum UMeasurementSystem { > UMS_SI, /**< Measurement system specified by SI otherwise known as Metric system. @stable ICU 2.8 */ > UMS_US, /**< Measurement system followed in the United States of America. @stable ICU 2.8 */ > UMS_UK, /**< Mix of metric and imperial units used in Great Britain. @stable ICU 55 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UMeasurementSystem value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UMS_LIMIT >+#endif /* U_HIDE_DEPRECATED_API */ > } UMeasurementSystem; > > /** >diff --git a/Source/WTF/icu/unicode/umachine.h b/Source/WTF/icu/unicode/umachine.h >index 532159216a5e3d13027a7ffef6fc328c7b6f64b9..91b872149382bec4c2e1994d3de1134d83ab1e8c 100644 >--- a/Source/WTF/icu/unicode/umachine.h >+++ b/Source/WTF/icu/unicode/umachine.h >@@ -1,12 +1,14 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >-* Copyright (C) 1999-2014, International Business Machines >+* Copyright (C) 1999-2015, International Business Machines > * Corporation and others. All Rights Reserved. > * > ****************************************************************************** > * file name: umachine.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -132,7 +134,7 @@ > * @internal > */ > >-#if defined(__cplusplus) && __cplusplus>=201103L >+#if U_CPLUSPLUS_VERSION >= 11 > /* C++11 */ > #ifndef U_OVERRIDE > #define U_OVERRIDE override >@@ -288,30 +290,92 @@ typedef int8_t UBool; > /** Number of bytes in a UChar. @stable ICU 2.0 */ > #define U_SIZEOF_UCHAR 2 > >+/** >+ * \def U_CHAR16_IS_TYPEDEF >+ * If 1, then char16_t is a typedef and not a real type (yet) >+ * @internal >+ */ >+#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) >+// for AIX, uchar.h needs to be included >+# include <uchar.h> >+# define U_CHAR16_IS_TYPEDEF 1 >+#else >+# define U_CHAR16_IS_TYPEDEF 0 >+#endif >+ >+ > /** > * \var UChar >- * Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), >- * or wchar_t if that is 16 bits wide; always assumed to be unsigned. >- * If neither is available, then define UChar to be uint16_t. > * >- * This makes the definition of UChar platform-dependent >- * but allows direct string type compatibility with platforms with >- * 16-bit wchar_t types. >+ * The base type for UTF-16 code units and pointers. >+ * Unsigned 16-bit integer. >+ * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar. >+ * >+ * UChar is configurable by defining the macro UCHAR_TYPE >+ * on the preprocessor or compiler command line: >+ * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. >+ * (The UCHAR_TYPE can also be #defined earlier in this file, for outside the ICU library code.) >+ * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16. >+ * >+ * The default is UChar=char16_t. >+ * >+ * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type. >+ * >+ * In C, char16_t is a simple typedef of uint_least16_t. >+ * ICU requires uint_least16_t=uint16_t for data memory mapping. >+ * On macOS, char16_t is not available because the uchar.h standard header is missing. > * > * @stable ICU 4.4 > */ >-#if defined(UCHAR_TYPE) >+ >+#if 1 >+ // #if 1 is normal. UChar defaults to char16_t in C++. >+ // For configuration testing of UChar=uint16_t temporarily change this to #if 0. >+ // The intltest Makefile #defines UCHAR_TYPE=char16_t, >+ // so we only #define it to uint16_t if it is undefined so far. >+#elif !defined(UCHAR_TYPE) >+# define UCHAR_TYPE uint16_t >+#endif >+ >+#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ >+ defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) >+ // Inside the ICU library code, never configurable. >+ typedef char16_t UChar; >+#elif defined(UCHAR_TYPE) > typedef UCHAR_TYPE UChar; >-/* Not #elif U_HAVE_CHAR16_T -- because that is type-incompatible with pre-C++11 callers >- typedef char16_t UChar; */ >-#elif U_SIZEOF_WCHAR_T==2 >- typedef wchar_t UChar; >-#elif defined(__CHAR16_TYPE__) >- typedef __CHAR16_TYPE__ UChar; >+#elif 0 >+ typedef char16_t UChar; > #else > typedef uint16_t UChar; > #endif > >+/** >+ * \var OldUChar >+ * Default ICU 58 definition of UChar. >+ * A base type for UTF-16 code units and pointers. >+ * Unsigned 16-bit integer. >+ * >+ * Define OldUChar to be wchar_t if that is 16 bits wide. >+ * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. >+ * >+ * This makes the definition of OldUChar platform-dependent >+ * but allows direct string type compatibility with platforms with >+ * 16-bit wchar_t types. >+ * >+ * This is how UChar was defined in ICU 58, for transition convenience. >+ * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. >+ * The current UChar responds to UCHAR_TYPE but OldUChar does not. >+ * >+ * @draft ICU 59 >+ */ >+#if U_SIZEOF_WCHAR_T==2 >+ typedef wchar_t OldUChar; >+#elif defined(__CHAR16_TYPE__) >+ typedef __CHAR16_TYPE__ OldUChar; >+#else >+ typedef uint16_t OldUChar; >+#endif >+ > /** > * Define UChar32 as a type for single Unicode code points. > * UChar32 is a signed 32-bit integer (same as int32_t). >diff --git a/Source/WTF/icu/unicode/umisc.h b/Source/WTF/icu/unicode/umisc.h >index d85451fc767c05835f6c15f566f3562e2d4af834..213290b9afa33cfdbdb0605c79e550df333f5ccc 100644 >--- a/Source/WTF/icu/unicode/umisc.h >+++ b/Source/WTF/icu/unicode/umisc.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2006, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * file name: umisc.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/umsg.h b/Source/WTF/icu/unicode/umsg.h >index 52fe90e2d6ad82612626ac22da3f252b91146101..5d235e42e80ba7d9058067029c0a97d083626578 100644 >--- a/Source/WTF/icu/unicode/umsg.h >+++ b/Source/WTF/icu/unicode/umsg.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /******************************************************************** > * COPYRIGHT: > * Copyright (c) 1997-2011, International Business Machines Corporation and >@@ -6,7 +8,7 @@ > ******************************************************************** > * > * file name: umsg.h >- * encoding: US-ASCII >+ * encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/unifilt.h b/Source/WTF/icu/unicode/unifilt.h >index ce952afaefbe73b4a4d31891cebb06174e0ed7b9..e10527154b6de13e65de39f4195547a219fc93a7 100644 >--- a/Source/WTF/icu/unicode/unifilt.h >+++ b/Source/WTF/icu/unicode/unifilt.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1999-2010, International Business Machines Corporation and others. >@@ -28,7 +30,7 @@ U_NAMESPACE_BEGIN > * defined range. > * @stable ICU 3.0 > */ >-#define U_ETHER ((UChar)0xFFFF) >+#define U_ETHER ((char16_t)0xFFFF) > > /** > * >diff --git a/Source/WTF/icu/unicode/unifunct.h b/Source/WTF/icu/unicode/unifunct.h >index 3aa7b0358c0390556a57d1328a5392d31b767c64..1c50759686148e98c660fabf56ac353b675b87cc 100644 >--- a/Source/WTF/icu/unicode/unifunct.h >+++ b/Source/WTF/icu/unicode/unifunct.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2002-2005, International Business Machines Corporation >diff --git a/Source/WTF/icu/unicode/unimatch.h b/Source/WTF/icu/unicode/unimatch.h >index 0dbb14efc2041f78c4973ad6d51f7f5a51ba1ba9..ee4326f93c1eb88bd7ce9112306d559c1365528e 100644 >--- a/Source/WTF/icu/unicode/unimatch.h >+++ b/Source/WTF/icu/unicode/unimatch.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > * Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. > ********************************************************************** >diff --git a/Source/WTF/icu/unicode/unirepl.h b/Source/WTF/icu/unicode/unirepl.h >index 6b7746b2213fcfcf8f88017e9408392bff627e12..ddcb0ad0e8ed0ca1f848aa309be4366d468a2603 100644 >--- a/Source/WTF/icu/unicode/unirepl.h >+++ b/Source/WTF/icu/unicode/unirepl.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2002-2005, International Business Machines Corporation >diff --git a/Source/WTF/icu/unicode/uniset.h b/Source/WTF/icu/unicode/uniset.h >index 237ebf766c365cdb9f0ec052aebb43fbd462d436..4a4ce193b6471982f37df2fb5c4f72d335086faa 100644 >--- a/Source/WTF/icu/unicode/uniset.h >+++ b/Source/WTF/icu/unicode/uniset.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > *************************************************************************** >-* Copyright (C) 1999-2014, International Business Machines Corporation >+* Copyright (C) 1999-2016, International Business Machines Corporation > * and others. All Rights Reserved. > *************************************************************************** > * Date Name Description >@@ -292,7 +294,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { > * indicating that toPattern() must generate a pattern > * representation from the inversion list. > */ >- UChar *pat; >+ char16_t *pat; > UVector* strings; // maintained in sorted order > UnicodeSetStringSpan *stringSpan; > >@@ -307,12 +309,12 @@ public: > * A bogus set has no value. It is different from an empty set. > * It can be used to indicate that no set value is available. > * >- * @return TRUE if the set is valid, FALSE otherwise >+ * @return TRUE if the set is bogus/invalid, FALSE otherwise > * @see setToBogus() > * @stable ICU 4.0 > */ > inline UBool isBogus(void) const; >- >+ > /** > * Make this UnicodeSet object invalid. > * The string will test TRUE with isBogus(). >@@ -360,7 +362,7 @@ public: > UnicodeSet(); > > /** >- * Constructs a set containing the given range. If <code>end > >+ * Constructs a set containing the given range. If <code>end < > * start</code> then an empty set is created. > * > * @param start first character, inclusive, of range >@@ -369,6 +371,28 @@ public: > */ > UnicodeSet(UChar32 start, UChar32 end); > >+#ifndef U_HIDE_INTERNAL_API >+ /** >+ * @internal >+ */ >+ enum ESerialization { >+ kSerialized /* result of serialize() */ >+ }; >+ >+ /** >+ * Constructs a set from the output of serialize(). >+ * >+ * @param buffer the 16 bit array >+ * @param bufferLen the original length returned from serialize() >+ * @param serialization the value 'kSerialized' >+ * @param status error code >+ * >+ * @internal >+ */ >+ UnicodeSet(const uint16_t buffer[], int32_t bufferLen, >+ ESerialization serialization, UErrorCode &status); >+#endif /* U_HIDE_INTERNAL_API */ >+ > /** > * Constructs a set from the given pattern. See the class > * description for the syntax of the pattern language. >@@ -867,7 +891,7 @@ public: > * @stable ICU 3.8 > * @see USetSpanCondition > */ >- int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; >+ int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; > > /** > * Returns the end of the substring of the input string according to the USetSpanCondition. >@@ -900,7 +924,7 @@ public: > * @stable ICU 3.8 > * @see USetSpanCondition > */ >- int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; >+ int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; > > /** > * Returns the start of the substring of the input string according to the USetSpanCondition. >diff --git a/Source/WTF/icu/unicode/unistr.h b/Source/WTF/icu/unicode/unistr.h >index 48fe2b3b1d6c8a35c77faa1220e4ffd779600310..b99a686126c4e14faa489f844de2f783bb69c1f1 100644 >--- a/Source/WTF/icu/unicode/unistr.h >+++ b/Source/WTF/icu/unicode/unistr.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 1998-2014, International Business Machines >+* Copyright (C) 1998-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -22,29 +24,19 @@ > #define UNISTR_H > > /** >- * \file >- * \brief C++ API: Unicode String >+ * \file >+ * \brief C++ API: Unicode String > */ > >+#include <cstddef> > #include "unicode/utypes.h" >+#include "unicode/char16ptr.h" > #include "unicode/rep.h" > #include "unicode/std_string.h" > #include "unicode/stringpiece.h" > #include "unicode/bytestream.h" >-#include "unicode/ucasemap.h" > > struct UConverter; // unicode/ucnv.h >-class StringThreadTest; >- >-#ifndef U_COMPARE_CODE_POINT_ORDER >-/* see also ustring.h and unorm.h */ >-/** >- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: >- * Compare strings in code point order instead of code unit order. >- * @stable ICU 2.2 >- */ >-#define U_COMPARE_CODE_POINT_ORDER 0x8000 >-#endif > > #ifndef USTRING_H > /** >@@ -54,28 +46,34 @@ U_STABLE int32_t U_EXPORT2 > u_strlen(const UChar *s); > #endif > >-/** >- * \def U_STRING_CASE_MAPPER_DEFINED >- * @internal >- */ >-#ifndef U_STRING_CASE_MAPPER_DEFINED >-#define U_STRING_CASE_MAPPER_DEFINED >+U_NAMESPACE_BEGIN > >+#if !UCONFIG_NO_BREAK_ITERATION >+class BreakIterator; // unicode/brkiter.h >+#endif >+class Edits; >+ >+U_NAMESPACE_END >+ >+// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper. > /** > * Internal string case mapping function type. >+ * All error checking must be done. >+ * src and dest must not overlap. > * @internal > */ > typedef int32_t U_CALLCONV >-UStringCaseMapper(const UCaseMap *csm, >- UChar *dest, int32_t destCapacity, >- const UChar *src, int32_t srcLength, >- UErrorCode *pErrorCode); >- >+UStringCaseMapper(int32_t caseLocale, uint32_t options, >+#if !UCONFIG_NO_BREAK_ITERATION >+ icu::BreakIterator *iter, > #endif >+ char16_t *dest, int32_t destCapacity, >+ const char16_t *src, int32_t srcLength, >+ icu::Edits *edits, >+ UErrorCode &errorCode); > > U_NAMESPACE_BEGIN > >-class BreakIterator; // unicode/brkiter.h > class Locale; // unicode/locid.h > class StringCharacterIterator; > class UnicodeStringAppendable; // unicode/appendable.h >@@ -96,10 +94,12 @@ class UnicodeStringAppendable; // unicode/appendable.h > > /** > * Unicode String literals in C++. >- * Dependent on the platform properties, different UnicodeString >- * constructors should be used to create a UnicodeString object from >- * a string literal. >- * The macros are defined for maximum performance. >+ * >+ * Note: these macros are not recommended for new code. >+ * Prior to the availability of C++11 and u"unicode string literals", >+ * these macros were provided for portability and efficiency when >+ * initializing UnicodeStrings from literals. >+ * > * They work only for strings that contain "invariant characters", i.e., > * only latin letters, digits, and some punctuation. > * See utypes.h for details. >@@ -107,18 +107,12 @@ class UnicodeStringAppendable; // unicode/appendable.h > * The string parameter must be a C string literal. > * The length of the string, not including the terminating > * <code>NUL</code>, must be specified as a constant. >- * The U_STRING_DECL macro should be invoked exactly once for one >- * such string variable before it is used. > * @stable ICU 2.0 > */ >-#if defined(U_DECLARE_UTF16) >-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length) >-#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) >-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)L ## cs, _length) >-#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY >-# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)cs, _length) >+#if !U_CHAR16_IS_TYPEDEF >+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) > #else >-# define UNICODE_STRING(cs, _length) icu::UnicodeString(cs, _length, US_INV) >+# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) > #endif > > /** >@@ -139,7 +133,7 @@ class UnicodeStringAppendable; // unicode/appendable.h > /** > * \def UNISTR_FROM_CHAR_EXPLICIT > * This can be defined to be empty or "explicit". >- * If explicit, then the UnicodeString(UChar) and UnicodeString(UChar32) >+ * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32) > * constructors are marked as explicit, preventing their inadvertent use. > * @stable ICU 49 > */ >@@ -156,7 +150,7 @@ class UnicodeStringAppendable; // unicode/appendable.h > /** > * \def UNISTR_FROM_STRING_EXPLICIT > * This can be defined to be empty or "explicit". >- * If explicit, then the UnicodeString(const char *) and UnicodeString(const UChar *) >+ * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *) > * constructors are marked as explicit, preventing their inadvertent use. > * > * In particular, this helps prevent accidentally depending on ICU conversion code >@@ -173,20 +167,67 @@ class UnicodeStringAppendable; // unicode/appendable.h > # endif > #endif > >+/** >+ * \def UNISTR_OBJECT_SIZE >+ * Desired sizeof(UnicodeString) in bytes. >+ * It should be a multiple of sizeof(pointer) to avoid unusable space for padding. >+ * The object size may want to be a multiple of 16 bytes, >+ * which is a common granularity for heap allocation. >+ * >+ * Any space inside the object beyond sizeof(vtable pointer) + 2 >+ * is available for storing short strings inside the object. >+ * The bigger the object, the longer a string that can be stored inside the object, >+ * without additional heap allocation. >+ * >+ * Depending on a platform's pointer size, pointer alignment requirements, >+ * and struct padding, the compiler will usually round up sizeof(UnicodeString) >+ * to 4 * sizeof(pointer) (or 3 * sizeof(pointer) for P128 data models), >+ * to hold the fields for heap-allocated strings. >+ * Such a minimum size also ensures that the object is easily large enough >+ * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH). >+ * >+ * sizeof(UnicodeString) >= 48 should work for all known platforms. >+ * >+ * For example, on a 64-bit machine where sizeof(vtable pointer) is 8, >+ * sizeof(UnicodeString) = 64 would leave space for >+ * (64 - sizeof(vtable pointer) - 2) / U_SIZEOF_UCHAR = (64 - 8 - 2) / 2 = 27 >+ * char16_ts stored inside the object. >+ * >+ * The minimum object size on a 64-bit machine would be >+ * 4 * sizeof(pointer) = 4 * 8 = 32 bytes, >+ * and the internal buffer would hold up to 11 char16_ts in that case. >+ * >+ * @see U16_MAX_LENGTH >+ * @stable ICU 56 >+ */ >+#ifndef UNISTR_OBJECT_SIZE >+# define UNISTR_OBJECT_SIZE 64 >+#endif >+ > /** > * UnicodeString is a string class that stores Unicode characters directly and provides >- * similar functionality as the Java String and StringBuffer classes. >+ * similar functionality as the Java String and StringBuffer/StringBuilder classes. > * It is a concrete implementation of the abstract class Replaceable (for transliteration). > * >+ * A UnicodeString may also "alias" an external array of characters >+ * (that is, point to it, rather than own the array) >+ * whose lifetime must then at least match the lifetime of the aliasing object. >+ * This aliasing may be preserved when returning a UnicodeString by value, >+ * depending on the compiler and the function implementation, >+ * via Return Value Optimization (RVO) or the move assignment operator. >+ * (However, the copy assignment operator does not preserve aliasing.) >+ * For details see the description of storage models at the end of the class API docs >+ * and in the User Guide chapter linked from there. >+ * > * The UnicodeString class is not suitable for subclassing. > * > * <p>For an overview of Unicode strings in C and C++ see the >- * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p> >+ * <a href="http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-">User Guide Strings chapter</a>.</p> > * > * <p>In ICU, a Unicode string consists of 16-bit Unicode <em>code units</em>. > * A Unicode character may be stored with either one code unit > * (the most common case) or with a matched pair of special code units >- * ("surrogates"). The data type for code units is UChar. >+ * ("surrogates"). The data type for code units is char16_t. > * For single-character handling, a Unicode character code <em>point</em> is a value > * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.</p> > * >@@ -202,7 +243,7 @@ class UnicodeStringAppendable; // unicode/appendable.h > * than other ICU APIs. In particular: > * - If indexes are out of bounds for a UnicodeString object > * (<0 or >length()) then they are "pinned" to the nearest boundary. >- * - If primitive string pointer values (e.g., const UChar * or char *) >+ * - If primitive string pointer values (e.g., const char16_t * or char *) > * for input strings are NULL, then those input string parameters are treated > * as if they pointed to an empty string. > * However, this is <em>not</em> the case for char * parameters for charset names >@@ -236,7 +277,7 @@ class UnicodeStringAppendable; // unicode/appendable.h > * significant performance improvements. > * Also, the internal buffer is accessible via special functions. > * For details see the >- * <a href="http://icu-project.org/userguide/strings.html">User Guide Strings chapter</a>.</p> >+ * <a href="http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model">User Guide Strings chapter</a>.</p> > * > * @see utf.h > * @see CharacterIterator >@@ -389,7 +430,7 @@ public: > * in <code>srcChars</code>. > * @stable ICU 2.0 > */ >- inline int8_t compare(const UChar *srcChars, >+ inline int8_t compare(ConstChar16Ptr srcChars, > int32_t srcLength) const; > > /** >@@ -408,7 +449,7 @@ public: > */ > inline int8_t compare(int32_t start, > int32_t length, >- const UChar *srcChars) const; >+ const char16_t *srcChars) const; > > /** > * Compare the characters bitwise in the range >@@ -429,7 +470,7 @@ public: > */ > inline int8_t compare(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -543,7 +584,7 @@ public: > * in code point order > * @stable ICU 2.0 > */ >- inline int8_t compareCodePointOrder(const UChar *srcChars, >+ inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars, > int32_t srcLength) const; > > /** >@@ -567,7 +608,7 @@ public: > */ > inline int8_t compareCodePointOrder(int32_t start, > int32_t length, >- const UChar *srcChars) const; >+ const char16_t *srcChars) const; > > /** > * Compare two Unicode strings in code point order. >@@ -592,7 +633,7 @@ public: > */ > inline int8_t compareCodePointOrder(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -716,7 +757,7 @@ public: > * @return A negative, zero, or positive integer indicating the comparison result. > * @stable ICU 2.0 > */ >- inline int8_t caseCompare(const UChar *srcChars, >+ inline int8_t caseCompare(ConstChar16Ptr srcChars, > int32_t srcLength, > uint32_t options) const; > >@@ -742,7 +783,7 @@ public: > */ > inline int8_t caseCompare(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > uint32_t options) const; > > /** >@@ -769,7 +810,7 @@ public: > */ > inline int8_t caseCompare(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength, > uint32_t options) const; >@@ -834,7 +875,7 @@ public: > * FALSE otherwise > * @stable ICU 2.0 > */ >- inline UBool startsWith(const UChar *srcChars, >+ inline UBool startsWith(ConstChar16Ptr srcChars, > int32_t srcLength) const; > > /** >@@ -846,7 +887,7 @@ public: > * @return TRUE if this ends with the characters in <TT>srcChars</TT>, FALSE otherwise > * @stable ICU 2.0 > */ >- inline UBool startsWith(const UChar *srcChars, >+ inline UBool startsWith(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -881,7 +922,7 @@ public: > * FALSE otherwise > * @stable ICU 2.0 > */ >- inline UBool endsWith(const UChar *srcChars, >+ inline UBool endsWith(ConstChar16Ptr srcChars, > int32_t srcLength) const; > > /** >@@ -894,7 +935,7 @@ public: > * FALSE otherwise > * @stable ICU 2.0 > */ >- inline UBool endsWith(const UChar *srcChars, >+ inline UBool endsWith(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -971,7 +1012,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t indexOf(const UChar *srcChars, >+ inline int32_t indexOf(const char16_t *srcChars, > int32_t srcLength, > int32_t start) const; > >@@ -987,7 +1028,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t indexOf(const UChar *srcChars, >+ inline int32_t indexOf(ConstChar16Ptr srcChars, > int32_t srcLength, > int32_t start, > int32_t length) const; >@@ -1008,7 +1049,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- int32_t indexOf(const UChar *srcChars, >+ int32_t indexOf(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength, > int32_t start, >@@ -1021,7 +1062,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t indexOf(UChar c) const; >+ inline int32_t indexOf(char16_t c) const; > > /** > * Locate in this the first occurrence of the code point <TT>c</TT>, >@@ -1041,7 +1082,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t indexOf(UChar c, >+ inline int32_t indexOf(char16_t c, > int32_t start) const; > > /** >@@ -1066,7 +1107,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t indexOf(UChar c, >+ inline int32_t indexOf(char16_t c, > int32_t start, > int32_t length) const; > >@@ -1154,7 +1195,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t lastIndexOf(const UChar *srcChars, >+ inline int32_t lastIndexOf(const char16_t *srcChars, > int32_t srcLength, > int32_t start) const; > >@@ -1170,7 +1211,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t lastIndexOf(const UChar *srcChars, >+ inline int32_t lastIndexOf(ConstChar16Ptr srcChars, > int32_t srcLength, > int32_t start, > int32_t length) const; >@@ -1191,7 +1232,7 @@ public: > * or -1 if not found. > * @stable ICU 2.0 > */ >- int32_t lastIndexOf(const UChar *srcChars, >+ int32_t lastIndexOf(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength, > int32_t start, >@@ -1204,7 +1245,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t lastIndexOf(UChar c) const; >+ inline int32_t lastIndexOf(char16_t c) const; > > /** > * Locate in this the last occurrence of the code point <TT>c</TT>, >@@ -1224,7 +1265,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t lastIndexOf(UChar c, >+ inline int32_t lastIndexOf(char16_t c, > int32_t start) const; > > /** >@@ -1249,7 +1290,7 @@ public: > * @return The offset into this of <TT>c</TT>, or -1 if not found. > * @stable ICU 2.0 > */ >- inline int32_t lastIndexOf(UChar c, >+ inline int32_t lastIndexOf(char16_t c, > int32_t start, > int32_t length) const; > >@@ -1279,7 +1320,7 @@ public: > * or 0xffff if the offset is not valid for this string > * @stable ICU 2.0 > */ >- inline UChar charAt(int32_t offset) const; >+ inline char16_t charAt(int32_t offset) const; > > /** > * Return the code unit at offset <tt>offset</tt>. >@@ -1288,7 +1329,7 @@ public: > * @return the code unit at offset <tt>offset</tt> > * @stable ICU 2.0 > */ >- inline UChar operator[] (int32_t offset) const; >+ inline char16_t operator[] (int32_t offset) const; > > /** > * Return the code point that contains the code unit >@@ -1409,7 +1450,7 @@ public: > */ > inline void extract(int32_t start, > int32_t length, >- UChar *dst, >+ Char16Ptr dst, > int32_t dstStart = 0) const; > > /** >@@ -1428,13 +1469,13 @@ public: > * then extract() will not copy the contents. > * > * @param dest Destination string buffer. >- * @param destCapacity Number of UChars available at dest. >+ * @param destCapacity Number of char16_ts available at dest. > * @param errorCode ICU error code. > * @return length() > * @stable ICU 2.0 > */ > int32_t >- extract(UChar *dest, int32_t destCapacity, >+ extract(Char16Ptr dest, int32_t destCapacity, > UErrorCode &errorCode) const; > > /** >@@ -1464,7 +1505,7 @@ public: > */ > inline void extractBetween(int32_t start, > int32_t limit, >- UChar *dst, >+ char16_t *dst, > int32_t dstStart = 0) const; > > /** >@@ -1481,12 +1522,12 @@ public: > UnicodeString& target) const; > > /** >- * Copy the characters in the range >- * [<tt>start</TT>, <tt>start + length</TT>) into an array of characters. >+ * Copy the characters in the range >+ * [<tt>start</TT>, <tt>start + startLength</TT>) into an array of characters. > * All characters must be invariant (see utypes.h). > * Use US_INV as the last, signature-distinguishing parameter. > * >- * This function does not write any more than <code>targetLength</code> >+ * This function does not write any more than <code>targetCapacity</code> > * characters but returns the length of the entire output string > * so that one can allocate a larger buffer and call the function again > * if necessary. >@@ -1665,8 +1706,6 @@ public: > */ > void toUTF8(ByteSink &sink) const; > >-#if U_HAVE_STD_STRING >- > /** > * Convert the UnicodeString to UTF-8 and append the result > * to a standard string. >@@ -1681,13 +1720,11 @@ public: > */ > template<typename StringClass> > StringClass &toUTF8String(StringClass &result) const { >- StringByteSink<StringClass> sbs(&result); >+ StringByteSink<StringClass> sbs(&result, length()); > toUTF8(sbs); > return result; > } > >-#endif >- > /** > * Convert the UnicodeString to UTF-32. > * Unpaired surrogates are replaced with U+FFFD. >@@ -1709,7 +1746,7 @@ public: > > /** > * Return the length of the UnicodeString object. >- * The length is the number of UChar code units are in the UnicodeString. >+ * The length is the number of char16_t code units are in the UnicodeString. > * If you want the number of code points, please use countChar32(). > * @return the length of the UnicodeString object > * @see countChar32 >@@ -1718,14 +1755,14 @@ public: > inline int32_t length(void) const; > > /** >- * Count Unicode code points in the length UChar code units of the string. >- * A code point may occupy either one or two UChar code units. >+ * Count Unicode code points in the length char16_t code units of the string. >+ * A code point may occupy either one or two char16_t code units. > * Counting code points involves reading all code units. > * > * This functions is basically the inverse of moveIndex32(). > * > * @param start the index of the first code unit to check >- * @param length the number of UChar code units to check >+ * @param length the number of char16_t code units to check > * @return the number of code points in the specified code units > * @see length > * @stable ICU 2.0 >@@ -1734,7 +1771,7 @@ public: > countChar32(int32_t start=0, int32_t length=INT32_MAX) const; > > /** >- * Check if the length UChar code units of the string >+ * Check if the length char16_t code units of the string > * contain more Unicode code points than a certain number. > * This is more efficient than counting all code points in this part of the string > * and comparing that number with a threshold. >@@ -1742,10 +1779,10 @@ public: > * falls within a certain range, and > * never needs to count more than 'number+1' code points. > * Logically equivalent to (countChar32(start, length)>number). >- * A Unicode code point may occupy either one or two UChar code units. >+ * A Unicode code point may occupy either one or two char16_t code units. > * > * @param start the index of the first code unit to check (0 for the entire string) >- * @param length the number of UChar code units to check >+ * @param length the number of char16_t code units to check > * (use INT32_MAX for the entire string; remember that start/length > * values are pinned) > * @param number The number of code points in the (sub)string is compared against >@@ -1771,7 +1808,7 @@ public: > * This is useful together with the getBuffer functions. > * See there for details. > * >- * @return the number of UChars available in the internal buffer >+ * @return the number of char16_ts available in the internal buffer > * @see getBuffer > * @stable ICU 2.0 > */ >@@ -1810,9 +1847,20 @@ public: > /** > * Assignment operator. Replace the characters in this UnicodeString > * with the characters from <TT>srcText</TT>. >+ * >+ * Starting with ICU 2.4, the assignment operator and the copy constructor >+ * allocate a new buffer and copy the buffer contents even for readonly aliases. >+ * By contrast, the fastCopyFrom() function implements the old, >+ * more efficient but less safe behavior >+ * of making this string also a readonly alias to the same buffer. >+ * >+ * If the source object has an "open" buffer from getBuffer(minCapacity), >+ * then the copy is an empty string. >+ * > * @param srcText The text containing the characters to replace > * @return a reference to this > * @stable ICU 2.0 >+ * @see fastCopyFrom > */ > UnicodeString &operator=(const UnicodeString &srcText); > >@@ -1834,12 +1882,58 @@ public: > * including its contents, for example for strings from resource bundles > * or aliases to string constants. > * >+ * If the source object has an "open" buffer from getBuffer(minCapacity), >+ * then the copy is an empty string. >+ * > * @param src The text containing the characters to replace. > * @return a reference to this > * @stable ICU 2.4 > */ > UnicodeString &fastCopyFrom(const UnicodeString &src); > >+ /** >+ * Move assignment operator, might leave src in bogus state. >+ * This string will have the same contents and state that the source string had. >+ * The behavior is undefined if *this and src are the same object. >+ * @param src source string >+ * @return *this >+ * @stable ICU 56 >+ */ >+ UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT { >+ return moveFrom(src); >+ } >+ >+ // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API >+ /** >+ * Move assignment, might leave src in bogus state. >+ * This string will have the same contents and state that the source string had. >+ * The behavior is undefined if *this and src are the same object. >+ * >+ * Can be called explicitly, does not need C++11 support. >+ * @param src source string >+ * @return *this >+ * @draft ICU 56 >+ */ >+ UnicodeString &moveFrom(UnicodeString &src) U_NOEXCEPT; >+ >+ /** >+ * Swap strings. >+ * @param other other string >+ * @stable ICU 56 >+ */ >+ void swap(UnicodeString &other) U_NOEXCEPT; >+ >+ /** >+ * Non-member UnicodeString swap function. >+ * @param s1 will get s2's contents and state >+ * @param s2 will get s1's contents and state >+ * @stable ICU 56 >+ */ >+ friend U_COMMON_API inline void U_EXPORT2 >+ swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { >+ s1.swap(s2); >+ } >+ > /** > * Assignment operator. Replace the characters in this UnicodeString > * with the code unit <TT>ch</TT>. >@@ -1847,7 +1941,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& operator= (UChar ch); >+ inline UnicodeString& operator= (char16_t ch); > > /** > * Assignment operator. Replace the characters in this UnicodeString >@@ -1907,7 +2001,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& setTo(const UChar *srcChars, >+ inline UnicodeString& setTo(const char16_t *srcChars, > int32_t srcLength); > > /** >@@ -1918,7 +2012,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- UnicodeString& setTo(UChar srcChar); >+ UnicodeString& setTo(char16_t srcChar); > > /** > * Set the characters in the UnicodeString object to the code point >@@ -1931,7 +2025,7 @@ public: > UnicodeString& setTo(UChar32 srcChar); > > /** >- * Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor. >+ * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor. > * The text will be used for the UnicodeString object, but > * it will not be released when the UnicodeString is destroyed. > * This has copy-on-write semantics: >@@ -1954,11 +2048,11 @@ public: > * @stable ICU 2.0 > */ > UnicodeString &setTo(UBool isTerminated, >- const UChar *text, >+ ConstChar16Ptr text, > int32_t textLength); > > /** >- * Aliasing setTo() function, analogous to the writable-aliasing UChar* constructor. >+ * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor. > * The text will be used for the UnicodeString object, but > * it will not be released when the UnicodeString is destroyed. > * This has write-through semantics: >@@ -1967,16 +2061,16 @@ public: > * a new buffer will be allocated and the contents copied as with regularly > * constructed strings. > * In an assignment to another UnicodeString, the buffer will be copied. >- * The extract(UChar *dst) function detects whether the dst pointer is the same >+ * The extract(Char16Ptr dst) function detects whether the dst pointer is the same > * as the string buffer itself and will in this case not copy the contents. > * > * @param buffer The characters to alias for the UnicodeString. > * @param buffLength The number of Unicode characters in <code>buffer</code> to alias. >- * @param buffCapacity The size of <code>buffer</code> in UChars. >+ * @param buffCapacity The size of <code>buffer</code> in char16_ts. > * @return a reference to this > * @stable ICU 2.0 > */ >- UnicodeString &setTo(UChar *buffer, >+ UnicodeString &setTo(char16_t *buffer, > int32_t buffLength, > int32_t buffCapacity); > >@@ -2012,7 +2106,7 @@ public: > * s.truncate(0); // set to an empty string (complete truncation), or > * s=UnicodeString(); // assign an empty string, or > * s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or >- * static const UChar nul=0; >+ * static const char16_t nul=0; > * s.setTo(&nul, 0); // set to an empty C Unicode string > * } > * \endcode >@@ -2030,7 +2124,7 @@ public: > * @stable ICU 2.0 > */ > UnicodeString& setCharAt(int32_t offset, >- UChar ch); >+ char16_t ch); > > > /* Append operations */ >@@ -2042,7 +2136,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& operator+= (UChar ch); >+ inline UnicodeString& operator+= (char16_t ch); > > /** > * Append operator. Append the code point <TT>ch</TT> to the UnicodeString >@@ -2102,7 +2196,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& append(const UChar *srcChars, >+ inline UnicodeString& append(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength); > >@@ -2115,7 +2209,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& append(const UChar *srcChars, >+ inline UnicodeString& append(ConstChar16Ptr srcChars, > int32_t srcLength); > > /** >@@ -2124,7 +2218,7 @@ public: > * @return a reference to this > * @stable ICU 2.0 > */ >- inline UnicodeString& append(UChar srcChar); >+ inline UnicodeString& append(char16_t srcChar); > > /** > * Append the code point <TT>srcChar</TT> to the UnicodeString object. >@@ -2180,7 +2274,7 @@ public: > * @stable ICU 2.0 > */ > inline UnicodeString& insert(int32_t start, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength); > >@@ -2194,7 +2288,7 @@ public: > * @stable ICU 2.0 > */ > inline UnicodeString& insert(int32_t start, >- const UChar *srcChars, >+ ConstChar16Ptr srcChars, > int32_t srcLength); > > /** >@@ -2206,7 +2300,7 @@ public: > * @stable ICU 2.0 > */ > inline UnicodeString& insert(int32_t start, >- UChar srcChar); >+ char16_t srcChar); > > /** > * Insert the code point <TT>srcChar</TT> into the UnicodeString object at >@@ -2280,7 +2374,7 @@ public: > */ > UnicodeString& replace(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength); > >@@ -2298,7 +2392,7 @@ public: > */ > inline UnicodeString& replace(int32_t start, > int32_t length, >- const UChar *srcChars, >+ ConstChar16Ptr srcChars, > int32_t srcLength); > > /** >@@ -2314,7 +2408,7 @@ public: > */ > inline UnicodeString& replace(int32_t start, > int32_t length, >- UChar srcChar); >+ char16_t srcChar); > > /** > * Replace the characters in the range >@@ -2512,7 +2606,7 @@ public: > * @stable ICU 2.0 > */ > UBool padLeading(int32_t targetLength, >- UChar padChar = 0x0020); >+ char16_t padChar = 0x0020); > > /** > * Pad the end of this UnicodeString with the character <TT>padChar</TT>. >@@ -2526,7 +2620,7 @@ public: > * @stable ICU 2.0 > */ > UBool padTrailing(int32_t targetLength, >- UChar padChar = 0x0020); >+ char16_t padChar = 0x0020); > > /** > * Truncate this UnicodeString to the <TT>targetLength</TT>. >@@ -2681,11 +2775,11 @@ public: > * break iterator is opened. > * Otherwise the provided iterator is set to the string's text. > * @param locale The locale to consider. >+ * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, >+ * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, >+ * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. > * @param options Options bit set, see ucasemap_open(). > * @return A reference to this. >- * @see U_TITLECASE_NO_LOWERCASE >- * @see U_TITLECASE_NO_BREAK_ADJUSTMENT >- * @see ucasemap_open > * @stable ICU 3.8 > */ > UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options); >@@ -2713,7 +2807,7 @@ public: > > /** > * Get a read/write pointer to the internal buffer. >- * The buffer is guaranteed to be large enough for at least minCapacity UChars, >+ * The buffer is guaranteed to be large enough for at least minCapacity char16_ts, > * writable, and is still owned by the UnicodeString object. > * Calls to getBuffer(minCapacity) must not be nested, and > * must be matched with calls to releaseBuffer(newLength). >@@ -2744,17 +2838,17 @@ public: > * - You must call releaseBuffer(newLength) before and in order to > * return to normal UnicodeString operation. > * >- * @param minCapacity the minimum number of UChars that are to be available >+ * @param minCapacity the minimum number of char16_ts that are to be available > * in the buffer, starting at the returned pointer; > * default to the current string capacity if minCapacity==-1 > * @return a writable pointer to the internal string buffer, >- * or 0 if an error occurs (nested calls, out of memory) >+ * or nullptr if an error occurs (nested calls, out of memory) > * > * @see releaseBuffer > * @see getTerminatedBuffer() > * @stable ICU 2.0 > */ >- UChar *getBuffer(int32_t minCapacity); >+ char16_t *getBuffer(int32_t minCapacity); > > /** > * Release a read/write buffer on a UnicodeString object with an >@@ -2802,13 +2896,13 @@ public: > * be modified. > * > * @return a read-only pointer to the internal string buffer, >- * or 0 if the string is empty or bogus >+ * or nullptr if the string is empty or bogus > * > * @see getBuffer(int32_t minCapacity) > * @see getTerminatedBuffer() > * @stable ICU 2.0 > */ >- inline const UChar *getBuffer() const; >+ inline const char16_t *getBuffer() const; > > /** > * Get a read-only pointer to the internal buffer, >@@ -2843,7 +2937,7 @@ public: > * @see getBuffer() > * @stable ICU 2.2 > */ >- const UChar *getTerminatedBuffer(); >+ const char16_t *getTerminatedBuffer(); > > //======================================== > // Constructors >@@ -2855,8 +2949,8 @@ public: > inline UnicodeString(); > > /** >- * Construct a UnicodeString with capacity to hold <TT>capacity</TT> UChars >- * @param capacity the number of UChars this UnicodeString should hold >+ * Construct a UnicodeString with capacity to hold <TT>capacity</TT> char16_ts >+ * @param capacity the number of char16_ts this UnicodeString should hold > * before a resize is necessary; if count is greater than 0 and count > * code points c take up more space than capacity, then capacity is adjusted > * accordingly. >@@ -2868,7 +2962,7 @@ public: > UnicodeString(int32_t capacity, UChar32 c, int32_t count); > > /** >- * Single UChar (code unit) constructor. >+ * Single char16_t (code unit) constructor. > * > * It is recommended to mark this constructor "explicit" by > * <code>-DUNISTR_FROM_CHAR_EXPLICIT=explicit</code> >@@ -2876,7 +2970,7 @@ public: > * @param ch the character to place in the UnicodeString > * @stable ICU 2.0 > */ >- UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar ch); >+ UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch); > > /** > * Single UChar32 (code point) constructor. >@@ -2890,7 +2984,7 @@ public: > UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch); > > /** >- * UChar* constructor. >+ * char16_t* constructor. > * > * It is recommended to mark this constructor "explicit" by > * <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> >@@ -2899,20 +2993,121 @@ public: > * must be NULL (U+0000) terminated. > * @stable ICU 2.0 > */ >- UNISTR_FROM_STRING_EXPLICIT UnicodeString(const UChar *text); >+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if !U_CHAR16_IS_TYPEDEF >+ /** >+ * uint16_t * constructor. >+ * Delegates to UnicodeString(const char16_t *). >+ * >+ * It is recommended to mark this constructor "explicit" by >+ * <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> >+ * on the compiler command line or similar. >+ * @param text NUL-terminated UTF-16 string >+ * @draft ICU 59 >+ */ >+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) : >+ UnicodeString(ConstChar16Ptr(text)) {} >+#endif >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) >+ /** >+ * wchar_t * constructor. >+ * (Only defined if U_SIZEOF_WCHAR_T==2.) >+ * Delegates to UnicodeString(const char16_t *). >+ * >+ * It is recommended to mark this constructor "explicit" by >+ * <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> >+ * on the compiler command line or similar. >+ * @param text NUL-terminated UTF-16 string >+ * @draft ICU 59 >+ */ >+ UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) : >+ UnicodeString(ConstChar16Ptr(text)) {} >+#endif > >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ > /** >- * UChar* constructor. >+ * nullptr_t constructor. >+ * Effectively the same as the default constructor, makes an empty string object. >+ * >+ * It is recommended to mark this constructor "explicit" by >+ * <code>-DUNISTR_FROM_STRING_EXPLICIT=explicit</code> >+ * on the compiler command line or similar. >+ * @param text nullptr >+ * @draft ICU 59 >+ */ >+ UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); >+ >+ /** >+ * char16_t* constructor. > * @param text The characters to place in the UnicodeString. > * @param textLength The number of Unicode characters in <TT>text</TT> > * to copy. > * @stable ICU 2.0 > */ >- UnicodeString(const UChar *text, >+ UnicodeString(const char16_t *text, > int32_t textLength); > >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if !U_CHAR16_IS_TYPEDEF > /** >- * Readonly-aliasing UChar* constructor. >+ * uint16_t * constructor. >+ * Delegates to UnicodeString(const char16_t *, int32_t). >+ * @param text UTF-16 string >+ * @param length string length >+ * @draft ICU 59 >+ */ >+ UnicodeString(const uint16_t *text, int32_t length) : >+ UnicodeString(ConstChar16Ptr(text), length) {} >+#endif >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) >+ /** >+ * wchar_t * constructor. >+ * (Only defined if U_SIZEOF_WCHAR_T==2.) >+ * Delegates to UnicodeString(const char16_t *, int32_t). >+ * @param text NUL-terminated UTF-16 string >+ * @param length string length >+ * @draft ICU 59 >+ */ >+ UnicodeString(const wchar_t *text, int32_t length) : >+ UnicodeString(ConstChar16Ptr(text), length) {} >+#endif >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+ /** >+ * nullptr_t constructor. >+ * Effectively the same as the default constructor, makes an empty string object. >+ * @param text nullptr >+ * @param length ignored >+ * @draft ICU 59 >+ */ >+ inline UnicodeString(const std::nullptr_t text, int32_t length); >+ >+ /** >+ * Readonly-aliasing char16_t* constructor. > * The text will be used for the UnicodeString object, but > * it will not be released when the UnicodeString is destroyed. > * This has copy-on-write semantics: >@@ -2934,11 +3129,11 @@ public: > * @stable ICU 2.0 > */ > UnicodeString(UBool isTerminated, >- const UChar *text, >+ ConstChar16Ptr text, > int32_t textLength); > > /** >- * Writable-aliasing UChar* constructor. >+ * Writable-aliasing char16_t* constructor. > * The text will be used for the UnicodeString object, but > * it will not be released when the UnicodeString is destroyed. > * This has write-through semantics: >@@ -2947,15 +3142,64 @@ public: > * a new buffer will be allocated and the contents copied as with regularly > * constructed strings. > * In an assignment to another UnicodeString, the buffer will be copied. >- * The extract(UChar *dst) function detects whether the dst pointer is the same >+ * The extract(Char16Ptr dst) function detects whether the dst pointer is the same > * as the string buffer itself and will in this case not copy the contents. > * > * @param buffer The characters to alias for the UnicodeString. > * @param buffLength The number of Unicode characters in <code>buffer</code> to alias. >- * @param buffCapacity The size of <code>buffer</code> in UChars. >+ * @param buffCapacity The size of <code>buffer</code> in char16_ts. > * @stable ICU 2.0 > */ >- UnicodeString(UChar *buffer, int32_t buffLength, int32_t buffCapacity); >+ UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if !U_CHAR16_IS_TYPEDEF >+ /** >+ * Writable-aliasing uint16_t * constructor. >+ * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). >+ * @param buffer writable buffer of/for UTF-16 text >+ * @param buffLength length of the current buffer contents >+ * @param buffCapacity buffer capacity >+ * @draft ICU 59 >+ */ >+ UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) : >+ UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} >+#endif >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) >+ /** >+ * Writable-aliasing wchar_t * constructor. >+ * (Only defined if U_SIZEOF_WCHAR_T==2.) >+ * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). >+ * @param buffer writable buffer of/for UTF-16 text >+ * @param buffLength length of the current buffer contents >+ * @param buffCapacity buffer capacity >+ * @draft ICU 59 >+ */ >+ UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) : >+ UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} >+#endif >+ >+ /* >+ * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, >+ * it should always be available regardless of U_HIDE_DRAFT_API status >+ */ >+ /** >+ * Writable-aliasing nullptr_t constructor. >+ * Effectively the same as the default constructor, makes an empty string object. >+ * @param buffer nullptr >+ * @param buffLength ignored >+ * @param buffCapacity ignored >+ * @draft ICU 59 >+ */ >+ inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); > > #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION > >@@ -3089,11 +3333,30 @@ public: > > /** > * Copy constructor. >+ * >+ * Starting with ICU 2.4, the assignment operator and the copy constructor >+ * allocate a new buffer and copy the buffer contents even for readonly aliases. >+ * By contrast, the fastCopyFrom() function implements the old, >+ * more efficient but less safe behavior >+ * of making this string also a readonly alias to the same buffer. >+ * >+ * If the source object has an "open" buffer from getBuffer(minCapacity), >+ * then the copy is an empty string. >+ * > * @param that The UnicodeString object to copy. > * @stable ICU 2.0 >+ * @see fastCopyFrom > */ > UnicodeString(const UnicodeString& that); > >+ /** >+ * Move constructor, might leave src in bogus state. >+ * This string will have the same contents and state that the source string had. >+ * @param src source string >+ * @stable ICU 56 >+ */ >+ UnicodeString(UnicodeString &&src) U_NOEXCEPT; >+ > /** > * 'Substring' constructor from tail of source string. > * @param src The UnicodeString object to copy. >@@ -3147,7 +3410,7 @@ public: > * @see toUTF8String > * @stable ICU 4.2 > */ >- static UnicodeString fromUTF8(const StringPiece &utf8); >+ static UnicodeString fromUTF8(StringPiece utf8); > > /** > * Create a UnicodeString from a UTF-32 string. >@@ -3251,7 +3514,7 @@ protected: > * UnicodeString::charAt() to be inline again (see jitterbug 709). > * @stable ICU 2.4 > */ >- virtual UChar getCharAt(int32_t offset) const; >+ virtual char16_t getCharAt(int32_t offset) const; > > /** > * The change in Replaceable to use virtual getChar32At() allows >@@ -3262,7 +3525,7 @@ protected: > > private: > // For char* constructors. Could be made public. >- UnicodeString &setToUTF8(const StringPiece &utf8); >+ UnicodeString &setToUTF8(StringPiece utf8); > // For extract(char*). > // We could make a toUTF8(target, capacity, errorCode) public but not > // this version: New API will be cleaner if we make callers create substrings >@@ -3287,7 +3550,7 @@ private: > > int8_t doCompare(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -3300,7 +3563,7 @@ private: > > int8_t doCompareCodePointOrder(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const; > >@@ -3315,12 +3578,12 @@ private: > int8_t > doCaseCompare(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength, > uint32_t options) const; > >- int32_t doIndexOf(UChar c, >+ int32_t doIndexOf(char16_t c, > int32_t start, > int32_t length) const; > >@@ -3328,7 +3591,7 @@ private: > int32_t start, > int32_t length) const; > >- int32_t doLastIndexOf(UChar c, >+ int32_t doLastIndexOf(char16_t c, > int32_t start, > int32_t length) const; > >@@ -3338,14 +3601,14 @@ private: > > void doExtract(int32_t start, > int32_t length, >- UChar *dst, >+ char16_t *dst, > int32_t dstStart) const; > > inline void doExtract(int32_t start, > int32_t length, > UnicodeString& target) const; > >- inline UChar doCharAt(int32_t offset) const; >+ inline char16_t doCharAt(int32_t offset) const; > > UnicodeString& doReplace(int32_t start, > int32_t length, >@@ -3355,10 +3618,13 @@ private: > > UnicodeString& doReplace(int32_t start, > int32_t length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength); > >+ UnicodeString& doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcLength); >+ UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); >+ > UnicodeString& doReverse(int32_t start, > int32_t length); > >@@ -3367,8 +3633,8 @@ private: > > // get pointer to start of array > // these do not check for kOpenGetBuffer, unlike the public getBuffer() function >- inline UChar* getArrayStart(void); >- inline const UChar* getArrayStart(void) const; >+ inline char16_t* getArrayStart(void); >+ inline const char16_t* getArrayStart(void) const; > > inline UBool hasShortLength() const; > inline int32_t getShortLength() const; >@@ -3385,7 +3651,7 @@ private: > inline void setShortLength(int32_t len); > inline void setLength(int32_t len); > inline void setToEmpty(); >- inline void setArray(UChar *array, int32_t len, int32_t capacity); // sets length but not flags >+ inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags > > // allocate the array; result may be the stack buffer > // sets refCount to 1 if appropriate >@@ -3403,6 +3669,9 @@ private: > // implements assigment operator, copy constructor, and fastCopyFrom() > UnicodeString ©From(const UnicodeString &src, UBool fastCopy=FALSE); > >+ // Copies just the fields without memory management. >+ void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT; >+ > // Pin start and limit to acceptable values. > inline void pinIndex(int32_t& start) const; > inline void pinIndices(int32_t& start, >@@ -3465,7 +3734,11 @@ private: > * as in ustr_imp.h for ustrcase_map(). > */ > UnicodeString & >- caseMap(const UCaseMap *csm, UStringCaseMapper *stringCaseMapper); >+ caseMap(int32_t caseLocale, uint32_t options, >+#if !UCONFIG_NO_BREAK_ITERATION >+ BreakIterator *iter, >+#endif >+ UStringCaseMapper *stringCaseMapper); > > // ref counting > void addRef(void); >@@ -3474,11 +3747,13 @@ private: > > // constants > enum { >- // Set the stack buffer size so that sizeof(UnicodeString) is, >- // naturally (without padding), a multiple of sizeof(pointer). >- US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer for short strings >+ /** >+ * Size of stack buffer for short strings. >+ * Must be at least U16_MAX_LENGTH for the single-code point constructor to work. >+ * @see UNISTR_OBJECT_SIZE >+ */ >+ US_STACKBUF_SIZE=(int32_t)(UNISTR_OBJECT_SIZE-sizeof(void *)-2)/U_SIZEOF_UCHAR, > kInvalidUChar=0xffff, // U+FFFF returned by charAt(invalid index) >- kGrowSize=128, // grow size for this buffer > kInvalidHashCode=0, // invalid hash code > kEmptyHashCode=1, // hash code for empty string > >@@ -3503,7 +3778,6 @@ private: > kWritableAlias=0 > }; > >- friend class StringThreadTest; > friend class UnicodeStringAppendable; > > union StackBufferOrFields; // forward declaration necessary before friend declaration >@@ -3544,9 +3818,10 @@ private: > * (Padding at the end of fFields is ok: > * As long as it is no larger than fStackFields, it is not wasted space.) > * >- * For some of the history of the UnicodeString class fields layout, >- * see ICU ticket #11336 "UnicodeString: recombine stack buffer arrays" >- * and ticket #8322 "why is sizeof(UnicodeString)==48?". >+ * For some of the history of the UnicodeString class fields layout, see >+ * - ICU ticket #11551 "longer UnicodeString contents in stack buffer" >+ * - ICU ticket #11336 "UnicodeString: recombine stack buffer arrays" >+ * - ICU ticket #8322 "why is sizeof(UnicodeString)==48?" > */ > // (implicit) *vtable; > union StackBufferOrFields { >@@ -3554,13 +3829,15 @@ private: > // Each struct of the union must begin with fLengthAndFlags. > struct { > int16_t fLengthAndFlags; // bit fields: see constants above >- UChar fBuffer[US_STACKBUF_SIZE]; // buffer for short strings >+ char16_t fBuffer[US_STACKBUF_SIZE]; // buffer for short strings > } fStackFields; > struct { > int16_t fLengthAndFlags; // bit fields: see constants above >- UChar *fArray; // the Unicode data >- int32_t fCapacity; // capacity of fArray (in UChars) > int32_t fLength; // number of characters in fArray if >127; else undefined >+ int32_t fCapacity; // capacity of fArray (in char16_ts) >+ // array pointer last to minimize padding for machines with P128 data model >+ // or pointer sizes that are not a power of 2 >+ char16_t *fArray; // the Unicode data > } fFields; > } fUnion; > }; >@@ -3613,13 +3890,13 @@ UnicodeString::pinIndices(int32_t& start, > } > } > >-inline UChar* >+inline char16_t* > UnicodeString::getArrayStart() { > return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? > fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; > } > >-inline const UChar* >+inline const char16_t* > UnicodeString::getArrayStart() const { > return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? > fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; >@@ -3634,6 +3911,18 @@ UnicodeString::UnicodeString() { > fUnion.fStackFields.fLengthAndFlags=kShortString; > } > >+inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { >+ fUnion.fStackFields.fLengthAndFlags=kShortString; >+} >+ >+inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) { >+ fUnion.fStackFields.fLengthAndFlags=kShortString; >+} >+ >+inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { >+ fUnion.fStackFields.fLengthAndFlags=kShortString; >+} >+ > //======================================== > // Read-only implementation methods > //======================================== >@@ -3680,10 +3969,10 @@ UnicodeString::isBufferWritable() const > (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1)); > } > >-inline const UChar * >+inline const char16_t * > UnicodeString::getBuffer() const { > if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) { >- return 0; >+ return nullptr; > } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) { > return fUnion.fStackFields.fBuffer; > } else { >@@ -3751,7 +4040,7 @@ UnicodeString::compare(int32_t start, > { return doCompare(start, _length, srcText, 0, srcText.length()); } > > inline int8_t >-UnicodeString::compare(const UChar *srcChars, >+UnicodeString::compare(ConstChar16Ptr srcChars, > int32_t srcLength) const > { return doCompare(0, length(), srcChars, 0, srcLength); } > >@@ -3766,13 +4055,13 @@ UnicodeString::compare(int32_t start, > inline int8_t > UnicodeString::compare(int32_t start, > int32_t _length, >- const UChar *srcChars) const >+ const char16_t *srcChars) const > { return doCompare(start, _length, srcChars, 0, _length); } > > inline int8_t > UnicodeString::compare(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const > { return doCompare(start, _length, srcChars, srcStart, srcLength); } >@@ -3812,7 +4101,7 @@ UnicodeString::compareCodePointOrder(int32_t start, > { return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); } > > inline int8_t >-UnicodeString::compareCodePointOrder(const UChar *srcChars, >+UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars, > int32_t srcLength) const > { return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); } > >@@ -3827,13 +4116,13 @@ UnicodeString::compareCodePointOrder(int32_t start, > inline int8_t > UnicodeString::compareCodePointOrder(int32_t start, > int32_t _length, >- const UChar *srcChars) const >+ const char16_t *srcChars) const > { return doCompareCodePointOrder(start, _length, srcChars, 0, _length); } > > inline int8_t > UnicodeString::compareCodePointOrder(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const > { return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); } >@@ -3877,7 +4166,7 @@ UnicodeString::caseCompare(int32_t start, > } > > inline int8_t >-UnicodeString::caseCompare(const UChar *srcChars, >+UnicodeString::caseCompare(ConstChar16Ptr srcChars, > int32_t srcLength, > uint32_t options) const { > return doCaseCompare(0, length(), srcChars, 0, srcLength, options); >@@ -3896,7 +4185,7 @@ UnicodeString::caseCompare(int32_t start, > inline int8_t > UnicodeString::caseCompare(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ const char16_t *srcChars, > uint32_t options) const { > return doCaseCompare(start, _length, srcChars, 0, _length, options); > } >@@ -3904,7 +4193,7 @@ UnicodeString::caseCompare(int32_t start, > inline int8_t > UnicodeString::caseCompare(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength, > uint32_t options) const { >@@ -3955,7 +4244,7 @@ UnicodeString::indexOf(const UnicodeString& text, > { return indexOf(text, 0, text.length(), start, _length); } > > inline int32_t >-UnicodeString::indexOf(const UChar *srcChars, >+UnicodeString::indexOf(const char16_t *srcChars, > int32_t srcLength, > int32_t start) const { > pinIndex(start); >@@ -3963,14 +4252,14 @@ UnicodeString::indexOf(const UChar *srcChars, > } > > inline int32_t >-UnicodeString::indexOf(const UChar *srcChars, >+UnicodeString::indexOf(ConstChar16Ptr srcChars, > int32_t srcLength, > int32_t start, > int32_t _length) const > { return indexOf(srcChars, 0, srcLength, start, _length); } > > inline int32_t >-UnicodeString::indexOf(UChar c, >+UnicodeString::indexOf(char16_t c, > int32_t start, > int32_t _length) const > { return doIndexOf(c, start, _length); } >@@ -3982,7 +4271,7 @@ UnicodeString::indexOf(UChar32 c, > { return doIndexOf(c, start, _length); } > > inline int32_t >-UnicodeString::indexOf(UChar c) const >+UnicodeString::indexOf(char16_t c) const > { return doIndexOf(c, 0, length()); } > > inline int32_t >@@ -3990,7 +4279,7 @@ UnicodeString::indexOf(UChar32 c) const > { return indexOf(c, 0, length()); } > > inline int32_t >-UnicodeString::indexOf(UChar c, >+UnicodeString::indexOf(char16_t c, > int32_t start) const { > pinIndex(start); > return doIndexOf(c, start, length() - start); >@@ -4004,14 +4293,14 @@ UnicodeString::indexOf(UChar32 c, > } > > inline int32_t >-UnicodeString::lastIndexOf(const UChar *srcChars, >+UnicodeString::lastIndexOf(ConstChar16Ptr srcChars, > int32_t srcLength, > int32_t start, > int32_t _length) const > { return lastIndexOf(srcChars, 0, srcLength, start, _length); } > > inline int32_t >-UnicodeString::lastIndexOf(const UChar *srcChars, >+UnicodeString::lastIndexOf(const char16_t *srcChars, > int32_t srcLength, > int32_t start) const { > pinIndex(start); >@@ -4052,7 +4341,7 @@ UnicodeString::lastIndexOf(const UnicodeString& text) const > { return lastIndexOf(text, 0, text.length(), 0, length()); } > > inline int32_t >-UnicodeString::lastIndexOf(UChar c, >+UnicodeString::lastIndexOf(char16_t c, > int32_t start, > int32_t _length) const > { return doLastIndexOf(c, start, _length); } >@@ -4065,7 +4354,7 @@ UnicodeString::lastIndexOf(UChar32 c, > } > > inline int32_t >-UnicodeString::lastIndexOf(UChar c) const >+UnicodeString::lastIndexOf(char16_t c) const > { return doLastIndexOf(c, 0, length()); } > > inline int32_t >@@ -4074,7 +4363,7 @@ UnicodeString::lastIndexOf(UChar32 c) const { > } > > inline int32_t >-UnicodeString::lastIndexOf(UChar c, >+UnicodeString::lastIndexOf(char16_t c, > int32_t start) const { > pinIndex(start); > return doLastIndexOf(c, start, length() - start); >@@ -4098,17 +4387,17 @@ UnicodeString::startsWith(const UnicodeString& srcText, > { return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } > > inline UBool >-UnicodeString::startsWith(const UChar *srcChars, int32_t srcLength) const { >+UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { > if(srcLength < 0) { >- srcLength = u_strlen(srcChars); >+ srcLength = u_strlen(toUCharPtr(srcChars)); > } > return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; > } > > inline UBool >-UnicodeString::startsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const { >+UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { > if(srcLength < 0) { >- srcLength = u_strlen(srcChars); >+ srcLength = u_strlen(toUCharPtr(srcChars)); > } > return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0; > } >@@ -4128,21 +4417,21 @@ UnicodeString::endsWith(const UnicodeString& srcText, > } > > inline UBool >-UnicodeString::endsWith(const UChar *srcChars, >+UnicodeString::endsWith(ConstChar16Ptr srcChars, > int32_t srcLength) const { > if(srcLength < 0) { >- srcLength = u_strlen(srcChars); >+ srcLength = u_strlen(toUCharPtr(srcChars)); > } > return doCompare(length() - srcLength, srcLength, > srcChars, 0, srcLength) == 0; > } > > inline UBool >-UnicodeString::endsWith(const UChar *srcChars, >+UnicodeString::endsWith(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) const { > if(srcLength < 0) { >- srcLength = u_strlen(srcChars + srcStart); >+ srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); > } > return doCompare(length() - srcLength, srcLength, > srcChars, srcStart, srcLength) == 0; >@@ -4168,14 +4457,14 @@ UnicodeString::replace(int32_t start, > inline UnicodeString& > UnicodeString::replace(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ ConstChar16Ptr srcChars, > int32_t srcLength) > { return doReplace(start, _length, srcChars, 0, srcLength); } > > inline UnicodeString& > UnicodeString::replace(int32_t start, > int32_t _length, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) > { return doReplace(start, _length, srcChars, srcStart, srcLength); } >@@ -4183,7 +4472,7 @@ UnicodeString::replace(int32_t start, > inline UnicodeString& > UnicodeString::replace(int32_t start, > int32_t _length, >- UChar srcChar) >+ char16_t srcChar) > { return doReplace(start, _length, &srcChar, 0, 1); } > > inline UnicodeString& >@@ -4226,7 +4515,7 @@ UnicodeString::doExtract(int32_t start, > inline void > UnicodeString::extract(int32_t start, > int32_t _length, >- UChar *target, >+ Char16Ptr target, > int32_t targetStart) const > { doExtract(start, _length, target, targetStart); } > >@@ -4254,7 +4543,7 @@ UnicodeString::extract(int32_t start, > inline void > UnicodeString::extractBetween(int32_t start, > int32_t limit, >- UChar *dst, >+ char16_t *dst, > int32_t dstStart) const { > pinIndex(start); > pinIndex(limit); >@@ -4266,7 +4555,7 @@ UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { > return tempSubString(start, limit - start); > } > >-inline UChar >+inline char16_t > UnicodeString::doCharAt(int32_t offset) const > { > if((uint32_t)offset < (uint32_t)length()) { >@@ -4276,11 +4565,11 @@ UnicodeString::doCharAt(int32_t offset) const > } > } > >-inline UChar >+inline char16_t > UnicodeString::charAt(int32_t offset) const > { return doCharAt(offset); } > >-inline UChar >+inline char16_t > UnicodeString::operator[] (int32_t offset) const > { return doCharAt(offset); } > >@@ -4321,14 +4610,14 @@ UnicodeString::setToEmpty() { > } > > inline void >-UnicodeString::setArray(UChar *array, int32_t len, int32_t capacity) { >+UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) { > setLength(len); > fUnion.fFields.fArray = array; > fUnion.fFields.fCapacity = capacity; > } > > inline UnicodeString& >-UnicodeString::operator= (UChar ch) >+UnicodeString::operator= (char16_t ch) > { return doReplace(0, length(), &ch, 0, 1); } > > inline UnicodeString& >@@ -4360,7 +4649,7 @@ UnicodeString::setTo(const UnicodeString& srcText) > } > > inline UnicodeString& >-UnicodeString::setTo(const UChar *srcChars, >+UnicodeString::setTo(const char16_t *srcChars, > int32_t srcLength) > { > unBogus(); >@@ -4368,7 +4657,7 @@ UnicodeString::setTo(const UChar *srcChars, > } > > inline UnicodeString& >-UnicodeString::setTo(UChar srcChar) >+UnicodeString::setTo(char16_t srcChar) > { > unBogus(); > return doReplace(0, length(), &srcChar, 0, 1); >@@ -4385,30 +4674,30 @@ inline UnicodeString& > UnicodeString::append(const UnicodeString& srcText, > int32_t srcStart, > int32_t srcLength) >-{ return doReplace(length(), 0, srcText, srcStart, srcLength); } >+{ return doAppend(srcText, srcStart, srcLength); } > > inline UnicodeString& > UnicodeString::append(const UnicodeString& srcText) >-{ return doReplace(length(), 0, srcText, 0, srcText.length()); } >+{ return doAppend(srcText, 0, srcText.length()); } > > inline UnicodeString& >-UnicodeString::append(const UChar *srcChars, >+UnicodeString::append(const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) >-{ return doReplace(length(), 0, srcChars, srcStart, srcLength); } >+{ return doAppend(srcChars, srcStart, srcLength); } > > inline UnicodeString& >-UnicodeString::append(const UChar *srcChars, >+UnicodeString::append(ConstChar16Ptr srcChars, > int32_t srcLength) >-{ return doReplace(length(), 0, srcChars, 0, srcLength); } >+{ return doAppend(srcChars, 0, srcLength); } > > inline UnicodeString& >-UnicodeString::append(UChar srcChar) >-{ return doReplace(length(), 0, &srcChar, 0, 1); } >+UnicodeString::append(char16_t srcChar) >+{ return doAppend(&srcChar, 0, 1); } > > inline UnicodeString& >-UnicodeString::operator+= (UChar ch) >-{ return doReplace(length(), 0, &ch, 0, 1); } >+UnicodeString::operator+= (char16_t ch) >+{ return doAppend(&ch, 0, 1); } > > inline UnicodeString& > UnicodeString::operator+= (UChar32 ch) { >@@ -4417,7 +4706,7 @@ UnicodeString::operator+= (UChar32 ch) { > > inline UnicodeString& > UnicodeString::operator+= (const UnicodeString& srcText) >-{ return doReplace(length(), 0, srcText, 0, srcText.length()); } >+{ return doAppend(srcText, 0, srcText.length()); } > > inline UnicodeString& > UnicodeString::insert(int32_t start, >@@ -4433,20 +4722,20 @@ UnicodeString::insert(int32_t start, > > inline UnicodeString& > UnicodeString::insert(int32_t start, >- const UChar *srcChars, >+ const char16_t *srcChars, > int32_t srcStart, > int32_t srcLength) > { return doReplace(start, 0, srcChars, srcStart, srcLength); } > > inline UnicodeString& > UnicodeString::insert(int32_t start, >- const UChar *srcChars, >+ ConstChar16Ptr srcChars, > int32_t srcLength) > { return doReplace(start, 0, srcChars, 0, srcLength); } > > inline UnicodeString& > UnicodeString::insert(int32_t start, >- UChar srcChar) >+ char16_t srcChar) > { return doReplace(start, 0, &srcChar, 0, 1); } > > inline UnicodeString& >diff --git a/Source/WTF/icu/unicode/unorm.h b/Source/WTF/icu/unicode/unorm.h >index fbb7b49b3648548437e41ff0530fde9b3c8e18f2..3839de129573c19b05247ae9d35c2b294ee41f38 100644 >--- a/Source/WTF/icu/unicode/unorm.h >+++ b/Source/WTF/icu/unicode/unorm.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (c) 1996-2010, International Business Machines Corporation >+* Copyright (c) 1996-2016, International Business Machines Corporation > * and others. All Rights Reserved. > ******************************************************************************* > * File unorm.h >@@ -24,14 +26,15 @@ > > /** > * \file >- * \brief C API: Unicode Normalization >+ * \brief C API: Unicode Normalization > * >- * <h2>Unicode normalization API</h2> >+ * Old Unicode normalization API. > * >- * Note: This API has been replaced by the unorm2.h API and is only available >+ * This API has been replaced by the unorm2.h API and is only available > * for backward compatibility. The functions here simply delegate to the > * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). > * There is one exception: The new API does not provide a replacement for unorm_compare(). >+ * Its declaration has been moved to unorm2.h. > * > * <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or > * decomposed form, allowing for easier sorting and searching of text. >@@ -57,7 +60,7 @@ > * > * To a user of your program, however, both of these sequences should be > * treated as the same "user-level" character "A with acute accent". When you are searching or >- * comparing text, you must ensure that these two sequences are treated >+ * comparing text, you must ensure that these two sequences are treated > * equivalently. In addition, you must handle characters with more than one > * accent. Sometimes the order of a character's combining accents is > * significant, while in other cases accent sequences in different orders are >@@ -85,8 +88,8 @@ > * will often want to use these mappings. > * > * <code>unorm_normalize</code> helps solve these problems by transforming text into the >- * canonical composed and decomposed forms as shown in the first example above. >- * In addition, you can have it perform compatibility decompositions so that >+ * canonical composed and decomposed forms as shown in the first example above. >+ * In addition, you can have it perform compatibility decompositions so that > * you can treat compatibility characters the same as their equivalents. > * Finally, <code>unorm_normalize</code> rearranges accents into the proper canonical > * order, so that you do not have to worry about accent rearrangement on your >@@ -126,43 +129,47 @@ > * For more usage examples, see the Unicode Standard Annex. > */ > >+// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API, >+// it is needed for layout of Normalizer object. > /** > * Constants for normalization modes. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ > typedef enum { >- /** No decomposition/composition. @stable ICU 2.0 */ >- UNORM_NONE = 1, >- /** Canonical decomposition. @stable ICU 2.0 */ >+ /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */ >+ UNORM_NONE = 1, >+ /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_NFD = 2, >- /** Compatibility decomposition. @stable ICU 2.0 */ >+ /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_NFKD = 3, >- /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */ >+ /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_NFC = 4, >- /** Default normalization. @stable ICU 2.0 */ >- UNORM_DEFAULT = UNORM_NFC, >- /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */ >+ /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */ >+ UNORM_DEFAULT = UNORM_NFC, >+ /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_NFKC =5, >- /** "Fast C or D" form. @stable ICU 2.0 */ >+ /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_FCD = 6, > >- /** One more than the highest normalization mode constant. @stable ICU 2.0 */ >+ /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */ > UNORM_MODE_COUNT > } UNormalizationMode; > >+#ifndef U_HIDE_DEPRECATED_API >+ > /** > * Constants for options flags for normalization. > * Use 0 for default options, > * including normalization according to the Unicode version > * that is currently supported by ICU (see u_getUnicodeVersion). >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ > enum { > /** > * Options bit set value to select Unicode 3.2 normalization > * (except NormalizationCorrections). > * At most one Unicode version can be selected at a time. >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ > UNORM_UNICODE_3_2=0x20 > }; >@@ -180,7 +187,7 @@ enum { > * internal normalization functions.) > * > * @see unorm_compare >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ > #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 > >@@ -192,7 +199,7 @@ enum { > * > * @param source The string to normalize. > * @param sourceLength The length of source, or -1 if NUL-terminated. >- * @param mode The normalization mode; one of UNORM_NONE, >+ * @param mode The normalization mode; one of UNORM_NONE, > * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. > * @param options The normalization options, ORed together (0 for no options). > * @param result A pointer to a buffer to receive the result string. >@@ -201,23 +208,23 @@ enum { > * @param status A pointer to a UErrorCode to receive any errors. > * @return The total buffer size needed; if greater than resultLength, > * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE int32_t U_EXPORT2 >+U_DEPRECATED int32_t U_EXPORT2 > unorm_normalize(const UChar *source, int32_t sourceLength, > UNormalizationMode mode, int32_t options, > UChar *result, int32_t resultLength, > UErrorCode *status); > > /** >- * Performing quick check on a string, to quickly determine if the string is >+ * Performing quick check on a string, to quickly determine if the string is > * in a particular normalization format. > * Three types of result can be returned UNORM_YES, UNORM_NO or > * UNORM_MAYBE. Result UNORM_YES indicates that the argument > * string is in the desired normalized format, UNORM_NO determines that >- * argument string is not in the desired normalized format. A >- * UNORM_MAYBE result indicates that a more thorough check is required, >- * the user may have to put the string in its normalized form and compare the >+ * argument string is not in the desired normalized format. A >+ * UNORM_MAYBE result indicates that a more thorough check is required, >+ * the user may have to put the string in its normalized form and compare the > * results. > * > * @param source string for determining if it is in a normalized format >@@ -227,9 +234,9 @@ unorm_normalize(const UChar *source, int32_t sourceLength, > * @return UNORM_YES, UNORM_NO or UNORM_MAYBE > * > * @see unorm_isNormalized >- * @stable ICU 2.0 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE UNormalizationCheckResult U_EXPORT2 >+U_DEPRECATED UNormalizationCheckResult U_EXPORT2 > unorm_quickCheck(const UChar *source, int32_t sourcelength, > UNormalizationMode mode, > UErrorCode *status); >@@ -248,10 +255,10 @@ unorm_quickCheck(const UChar *source, int32_t sourcelength, > * > * @see unorm_quickCheck > * @see unorm_isNormalized >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE UNormalizationCheckResult U_EXPORT2 >-unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, >+U_DEPRECATED UNormalizationCheckResult U_EXPORT2 >+unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, > UNormalizationMode mode, int32_t options, > UErrorCode *pErrorCode); > >@@ -274,9 +281,9 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, > * "mode" normalization form. > * > * @see unorm_quickCheck >- * @stable ICU 2.2 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE UBool U_EXPORT2 >+U_DEPRECATED UBool U_EXPORT2 > unorm_isNormalized(const UChar *src, int32_t srcLength, > UNormalizationMode mode, > UErrorCode *pErrorCode); >@@ -296,9 +303,9 @@ unorm_isNormalized(const UChar *src, int32_t srcLength, > * > * @see unorm_quickCheck > * @see unorm_isNormalized >- * @stable ICU 2.6 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE UBool U_EXPORT2 >+U_DEPRECATED UBool U_EXPORT2 > unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, > UNormalizationMode mode, int32_t options, > UErrorCode *pErrorCode); >@@ -374,9 +381,9 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, > * @see unorm_previous > * @see unorm_normalize > * >- * @stable ICU 2.1 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE int32_t U_EXPORT2 >+U_DEPRECATED int32_t U_EXPORT2 > unorm_next(UCharIterator *src, > UChar *dest, int32_t destCapacity, > UNormalizationMode mode, int32_t options, >@@ -407,9 +414,9 @@ unorm_next(UCharIterator *src, > * @see unorm_next > * @see unorm_normalize > * >- * @stable ICU 2.1 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE int32_t U_EXPORT2 >+U_DEPRECATED int32_t U_EXPORT2 > unorm_previous(UCharIterator *src, > UChar *dest, int32_t destCapacity, > UNormalizationMode mode, int32_t options, >@@ -451,111 +458,15 @@ unorm_previous(UCharIterator *src, > * @see unorm_next > * @see unorm_previous > * >- * @stable ICU 2.1 >+ * @deprecated ICU 56 Use unorm2.h instead. > */ >-U_STABLE int32_t U_EXPORT2 >+U_DEPRECATED int32_t U_EXPORT2 > unorm_concatenate(const UChar *left, int32_t leftLength, > const UChar *right, int32_t rightLength, > UChar *dest, int32_t destCapacity, > UNormalizationMode mode, int32_t options, > UErrorCode *pErrorCode); > >-/** >- * Option bit for unorm_compare: >- * Both input strings are assumed to fulfill FCD conditions. >- * @stable ICU 2.2 >- */ >-#define UNORM_INPUT_IS_FCD 0x20000 >- >-/** >- * Option bit for unorm_compare: >- * Perform case-insensitive comparison. >- * @stable ICU 2.2 >- */ >-#define U_COMPARE_IGNORE_CASE 0x10000 >- >-#ifndef U_COMPARE_CODE_POINT_ORDER >-/* see also unistr.h and ustring.h */ >-/** >- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: >- * Compare strings in code point order instead of code unit order. >- * @stable ICU 2.2 >- */ >-#define U_COMPARE_CODE_POINT_ORDER 0x8000 >-#endif >- >-/** >- * Compare two strings for canonical equivalence. >- * Further options include case-insensitive comparison and >- * code point order (as opposed to code unit order). >- * >- * Canonical equivalence between two strings is defined as their normalized >- * forms (NFD or NFC) being identical. >- * This function compares strings incrementally instead of normalizing >- * (and optionally case-folding) both strings entirely, >- * improving performance significantly. >- * >- * Bulk normalization is only necessary if the strings do not fulfill the FCD >- * conditions. Only in this case, and only if the strings are relatively long, >- * is memory allocated temporarily. >- * For FCD strings and short non-FCD strings there is no memory allocation. >- * >- * Semantically, this is equivalent to >- * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) >- * where code point order and foldCase are all optional. >- * >- * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match >- * the case folding must be performed first, then the normalization. >- * >- * @param s1 First source string. >- * @param length1 Length of first source string, or -1 if NUL-terminated. >- * >- * @param s2 Second source string. >- * @param length2 Length of second source string, or -1 if NUL-terminated. >- * >- * @param options A bit set of options: >- * - U_FOLD_CASE_DEFAULT or 0 is used for default options: >- * Case-sensitive comparison in code unit order, and the input strings >- * are quick-checked for FCD. >- * >- * - UNORM_INPUT_IS_FCD >- * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. >- * If not set, the function will quickCheck for FCD >- * and normalize if necessary. >- * >- * - U_COMPARE_CODE_POINT_ORDER >- * Set to choose code point order instead of code unit order >- * (see u_strCompare for details). >- * >- * - U_COMPARE_IGNORE_CASE >- * Set to compare strings case-insensitively using case folding, >- * instead of case-sensitively. >- * If set, then the following case folding options are used. >- * >- * - Options as used with case-insensitive comparisons, currently: >- * >- * - U_FOLD_CASE_EXCLUDE_SPECIAL_I >- * (see u_strCaseCompare for details) >- * >- * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT >- * >- * @param pErrorCode 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 >- * >- * @see unorm_normalize >- * @see UNORM_FCD >- * @see u_strCompare >- * @see u_strCaseCompare >- * >- * @stable ICU 2.2 >- */ >-U_STABLE int32_t U_EXPORT2 >-unorm_compare(const UChar *s1, int32_t length1, >- const UChar *s2, int32_t length2, >- uint32_t options, >- UErrorCode *pErrorCode); >- >+#endif /* U_HIDE_DEPRECATED_API */ > #endif /* #if !UCONFIG_NO_NORMALIZATION */ >- > #endif >diff --git a/Source/WTF/icu/unicode/unorm2.h b/Source/WTF/icu/unicode/unorm2.h >index 7152fc109466d07c50bbca5c9df7b77c1997f900..a9bd02f256361f3438cb75972d93d668e223b331 100644 >--- a/Source/WTF/icu/unicode/unorm2.h >+++ b/Source/WTF/icu/unicode/unorm2.h >@@ -1,12 +1,14 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >-* Copyright (C) 2009-2013, International Business Machines >+* Copyright (C) 2009-2015, International Business Machines > * Corporation and others. All Rights Reserved. > * > ******************************************************************************* > * file name: unorm2.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -30,6 +32,7 @@ > > #include "unicode/utypes.h" > #include "unicode/localpointer.h" >+#include "unicode/stringoptions.h" > #include "unicode/uset.h" > > /** >@@ -524,5 +527,77 @@ unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); > U_STABLE UBool U_EXPORT2 > unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); > >+/** >+ * Compares two strings for canonical equivalence. >+ * Further options include case-insensitive comparison and >+ * code point order (as opposed to code unit order). >+ * >+ * Canonical equivalence between two strings is defined as their normalized >+ * forms (NFD or NFC) being identical. >+ * This function compares strings incrementally instead of normalizing >+ * (and optionally case-folding) both strings entirely, >+ * improving performance significantly. >+ * >+ * Bulk normalization is only necessary if the strings do not fulfill the FCD >+ * conditions. Only in this case, and only if the strings are relatively long, >+ * is memory allocated temporarily. >+ * For FCD strings and short non-FCD strings there is no memory allocation. >+ * >+ * Semantically, this is equivalent to >+ * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) >+ * where code point order and foldCase are all optional. >+ * >+ * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match >+ * the case folding must be performed first, then the normalization. >+ * >+ * @param s1 First source string. >+ * @param length1 Length of first source string, or -1 if NUL-terminated. >+ * >+ * @param s2 Second source string. >+ * @param length2 Length of second source string, or -1 if NUL-terminated. >+ * >+ * @param options A bit set of options: >+ * - U_FOLD_CASE_DEFAULT or 0 is used for default options: >+ * Case-sensitive comparison in code unit order, and the input strings >+ * are quick-checked for FCD. >+ * >+ * - UNORM_INPUT_IS_FCD >+ * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. >+ * If not set, the function will quickCheck for FCD >+ * and normalize if necessary. >+ * >+ * - U_COMPARE_CODE_POINT_ORDER >+ * Set to choose code point order instead of code unit order >+ * (see u_strCompare for details). >+ * >+ * - U_COMPARE_IGNORE_CASE >+ * Set to compare strings case-insensitively using case folding, >+ * instead of case-sensitively. >+ * If set, then the following case folding options are used. >+ * >+ * - Options as used with case-insensitive comparisons, currently: >+ * >+ * - U_FOLD_CASE_EXCLUDE_SPECIAL_I >+ * (see u_strCaseCompare for details) >+ * >+ * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT >+ * >+ * @param pErrorCode 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 >+ * >+ * @see unorm_normalize >+ * @see UNORM_FCD >+ * @see u_strCompare >+ * @see u_strCaseCompare >+ * >+ * @stable ICU 2.2 >+ */ >+U_STABLE int32_t U_EXPORT2 >+unorm_compare(const UChar *s1, int32_t length1, >+ const UChar *s2, int32_t length2, >+ uint32_t options, >+ UErrorCode *pErrorCode); >+ > #endif /* !UCONFIG_NO_NORMALIZATION */ > #endif /* __UNORM2_H__ */ >diff --git a/Source/WTF/icu/unicode/unum.h b/Source/WTF/icu/unicode/unum.h >index 478089ff10468a0ccd0545bb13d66b69475d6072..2ab09b5d0d417aee066d2fa6a9f5dcd9837e8ad3 100644 >--- a/Source/WTF/icu/unicode/unum.h >+++ b/Source/WTF/icu/unicode/unum.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 1997-2015, International Business Machines Corporation and others. >@@ -23,6 +25,7 @@ > #include "unicode/parseerr.h" > #include "unicode/uformattable.h" > #include "unicode/udisplaycontext.h" >+#include "unicode/ufieldpositer.h" > > /** > * \file >@@ -112,7 +115,7 @@ > * <P> > * You can also control the display of numbers with such function as > * unum_getAttributes() and unum_setAttributes(), which let you set the >- * miminum fraction digits, grouping, etc. >+ * minimum fraction digits, grouping, etc. > * @see UNumberFormatAttributes for more details > * <P> > * You can also use forms of the parse and format methods with >@@ -123,7 +126,7 @@ > * </ul> > * <p> > * It is also possible to change or set the symbols used for a particular >- * locale like the currency symbol, the grouping seperator , monetary seperator >+ * locale like the currency symbol, the grouping separator , monetary separator > * etc by making use of functions unum_setSymbols() and unum_getSymbols(). > */ > >@@ -148,7 +151,11 @@ typedef enum UNumberFormatStyle { > */ > UNUM_DECIMAL=1, > /** >- * Currency format with a currency symbol, e.g., "$1.00". >+ * Currency format (generic). >+ * Defaults to UNUM_CURRENCY_STANDARD style >+ * (using currency symbol, e.g., "$1.00", with non-accounting >+ * style for negative values e.g. using minus sign). >+ * The specific style may be specified using the -cf- locale key. > * @stable ICU 2.0 > */ > UNUM_CURRENCY=2, >@@ -205,23 +212,45 @@ typedef enum UNumberFormatStyle { > /** > * Currency format for accounting, e.g., "($3.00)" for > * negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}). >+ * Overrides any style specified using -cf- key in locale. > * @stable ICU 53 > */ > UNUM_CURRENCY_ACCOUNTING=12, >-#ifndef U_HIDE_DRAFT_API > /** > * Currency format with a currency symbol given CASH usage, e.g., > * "NT$3" instead of "NT$3.23". >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UNUM_CASH_CURRENCY=13, >-#endif /* U_HIDE_DRAFT_API */ >+ /** >+ * Decimal format expressed using compact notation >+ * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT) >+ * e.g. "23K", "45B" >+ * @stable ICU 56 >+ */ >+ UNUM_DECIMAL_COMPACT_SHORT=14, >+ /** >+ * Decimal format expressed using compact notation >+ * (long form, corresponds to UNumberCompactStyle=UNUM_LONG) >+ * e.g. "23 thousand", "45 billion" >+ * @stable ICU 56 >+ */ >+ UNUM_DECIMAL_COMPACT_LONG=15, >+ /** >+ * Currency format with a currency symbol, e.g., "$1.00", >+ * using non-accounting style for negative values (e.g. minus sign). >+ * Overrides any style specified using -cf- key in locale. >+ * @stable ICU 56 >+ */ >+ UNUM_CURRENCY_STANDARD=16, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * One more than the highest number format style constant. >- * @stable ICU 4.8 >+ * One more than the highest normal UNumberFormatStyle value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ >- UNUM_FORMAT_STYLE_COUNT=14, >+ UNUM_FORMAT_STYLE_COUNT=17, >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * Default format >@@ -235,8 +264,13 @@ typedef enum UNumberFormatStyle { > UNUM_IGNORE = UNUM_PATTERN_DECIMAL > } UNumberFormatStyle; > >-/** The possible number format rounding modes. >- * @stable ICU 2.0 >+/** The possible number format rounding modes. >+ * >+ * <p> >+ * For more detail on rounding modes, see: >+ * http://userguide.icu-project.org/formatparse/numbers/rounding-modes >+ * >+ * @stable ICU 2.0 > */ > typedef enum UNumberFormatRoundingMode { > UNUM_ROUND_CEILING, >@@ -297,7 +331,13 @@ enum UCurrencySpacing { > UNUM_CURRENCY_SURROUNDING_MATCH, > /** @stable ICU 4.8 */ > UNUM_CURRENCY_INSERT, >- /** @stable ICU 4.8 */ >+ >+ /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, >+ * it is needed for layout of DecimalFormatSymbols object. */ >+ /** >+ * One more than the highest normal UCurrencySpacing value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UNUM_CURRENCY_SPACING_COUNT > }; > typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */ >@@ -331,8 +371,13 @@ typedef enum UNumberFormatFields { > UNUM_PERMILL_FIELD, > /** @stable ICU 49 */ > UNUM_SIGN_FIELD, >- /** @stable ICU 49 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UNumberFormatFields value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UNUM_FIELD_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ > } UNumberFormatFields; > > >@@ -514,6 +559,59 @@ unum_formatDouble( const UNumberFormat* fmt, > UFieldPosition *pos, /* 0 if ignore */ > UErrorCode* status); > >+#ifndef U_HIDE_DRAFT_API >+/** >+* Format a double using a UNumberFormat according to the UNumberFormat's locale, >+* and initialize a UFieldPositionIterator that enumerates the subcomponents of >+* the resulting string. >+* >+* @param format >+* The formatter to use. >+* @param number >+* The number to format. >+* @param result >+* A pointer to a buffer to receive the NULL-terminated formatted >+* number. If the formatted number fits into dest but cannot be >+* NULL-terminated (length == resultLength) then the error code is set >+* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't >+* fit into result then the error code is set to >+* U_BUFFER_OVERFLOW_ERROR. >+* @param resultLength >+* The maximum size of result. >+* @param fpositer >+* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} >+* (may be NULL if field position information is not needed, but in this >+* case it's preferable to use {@link #unum_formatDouble}). Iteration >+* information already present in the UFieldPositionIterator is deleted, >+* and the iterator is reset to apply to the fields in the formatted >+* string created by this function call. The field values and indexes >+* returned by {@link #ufieldpositer_next} represent fields denoted by >+* the UNumberFormatFields enum. Fields are not returned in a guaranteed >+* order. Fields cannot overlap, but they may nest. For example, 1234 >+* could format as "1,234" which might consist of a grouping separator >+* field for ',' and an integer field encompassing the entire string. >+* @param status >+* A pointer to an UErrorCode to receive any errors >+* @return >+* The total buffer size needed; if greater than resultLength, the >+* output was truncated. >+* @see unum_formatDouble >+* @see unum_parse >+* @see unum_parseDouble >+* @see UFieldPositionIterator >+* @see UNumberFormatFields >+* @draft ICU 59 >+*/ >+U_DRAFT int32_t U_EXPORT2 >+unum_formatDoubleForFields(const UNumberFormat* format, >+ double number, >+ UChar* result, >+ int32_t resultLength, >+ UFieldPositionIterator* fpositer, >+ UErrorCode* status); >+ >+#endif /* U_HIDE_DRAFT_API */ >+ > /** > * Format a decimal number using a UNumberFormat. > * The number will be formatted according to the UNumberFormat's locale. >@@ -615,6 +713,8 @@ unum_formatUFormattable(const UNumberFormat* fmt, > /** > * Parse a string into an integer using a UNumberFormat. > * The string will be parsed according to the UNumberFormat's locale. >+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT >+* and UNUM_DECIMAL_COMPACT_LONG. > * @param fmt The formatter to use. > * @param text The text to parse. > * @param textLength The length of text, or -1 if null-terminated. >@@ -639,6 +739,8 @@ unum_parse( const UNumberFormat* fmt, > /** > * Parse a string into an int64 using a UNumberFormat. > * The string will be parsed according to the UNumberFormat's locale. >+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT >+* and UNUM_DECIMAL_COMPACT_LONG. > * @param fmt The formatter to use. > * @param text The text to parse. > * @param textLength The length of text, or -1 if null-terminated. >@@ -663,6 +765,8 @@ unum_parseInt64(const UNumberFormat* fmt, > /** > * Parse a string into a double using a UNumberFormat. > * The string will be parsed according to the UNumberFormat's locale. >+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT >+* and UNUM_DECIMAL_COMPACT_LONG. > * @param fmt The formatter to use. > * @param text The text to parse. > * @param textLength The length of text, or -1 if null-terminated. >@@ -691,6 +795,8 @@ unum_parseDouble( const UNumberFormat* fmt, > * The syntax of the output is a "numeric string" > * as defined in the Decimal Arithmetic Specification, available at > * http://speleotrove.com/decimal >+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT >+* and UNUM_DECIMAL_COMPACT_LONG. > * @param fmt The formatter to use. > * @param text The text to parse. > * @param textLength The length of text, or -1 if null-terminated. >@@ -750,6 +856,8 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt, > * Parse a UChar string into a UFormattable. > * Example code: > * \snippet test/cintltst/cnumtst.c unum_parseToUFormattable >+ * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT >+ * and UNUM_DECIMAL_COMPACT_LONG. > * @param fmt the formatter to use > * @param result the UFormattable to hold the result. If NULL, a new UFormattable will be allocated (which the caller must close with ufmt_close). > * @param text the text to parse >@@ -780,7 +888,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt, > * @param localized TRUE if the pattern is localized, FALSE otherwise. > * @param pattern The new pattern > * @param patternLength The length of pattern, or -1 if null-terminated. >- * @param parseError A pointer to UParseError to recieve information >+ * @param parseError A pointer to UParseError to receive information > * about errors occurred during parsing, or NULL if no parse error > * information is desired. > * @param status A pointer to an input-output UErrorCode. >@@ -835,6 +943,9 @@ typedef enum UNumberFormatAttributeValue { > UNUM_YES = 1, > /** @internal */ > UNUM_MAYBE = 2 >+#else >+ /** @internal */ >+ UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN > #endif /* U_HIDE_INTERNAL_API */ > } UNumberFormatAttributeValue; > #endif >@@ -891,7 +1002,7 @@ typedef enum UNumberFormatAttribute { > * This is an internal ICU API. Do not use. > * @internal > */ >- UNUM_PARSE_ALL_INPUT = UNUM_LENIENT_PARSE + 1, >+ UNUM_PARSE_ALL_INPUT = 20, > #endif > /** > * Scale, which adjusts the position of the >@@ -902,23 +1013,25 @@ typedef enum UNumberFormatAttribute { > * <p>Example: setting the scale to -4, 123 formats as "0.0123" > * > * @stable ICU 51 */ >- UNUM_SCALE = UNUM_LENIENT_PARSE + 2, >- >+ UNUM_SCALE = 21, > #ifndef U_HIDE_INTERNAL_API >- /** Count of "regular" numeric attributes. >- * @internal */ >- UNUM_NUMERIC_ATTRIBUTE_COUNT = UNUM_LENIENT_PARSE + 3, >+ /** >+ * Minimum grouping digits, technology preview. >+ * See DecimalFormat::getMinimumGroupingDigits(). >+ * >+ * @internal technology preview >+ */ >+ UNUM_MINIMUM_GROUPING_DIGITS = 22, >+ /* TODO: test C API when it becomes @draft */ > #endif /* U_HIDE_INTERNAL_API */ > >-#ifndef U_HIDE_DRAFT_API > /** > * if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, > * otherwise it is UNUM_CURRENCY_CASH purpose > * Default: 0 (UNUM_CURRENCY_STANDARD purpose) >- * @draft ICU 54 >+ * @stable ICU 54 > */ >- UNUM_CURRENCY_USAGE = UNUM_LENIENT_PARSE + 4, >-#endif /* U_HIDE_DRAFT_API */ >+ UNUM_CURRENCY_USAGE = 23, > > /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ > /** One below the first bitfield-boolean item. >@@ -940,22 +1053,20 @@ typedef enum UNumberFormatAttribute { > */ > UNUM_PARSE_NO_EXPONENT, > >-#ifndef U_HIDE_DRAFT_API > /** > * if this attribute is set to 1, specifies that, if the pattern contains a > * decimal mark the input is required to have one. If this attribute is set to 0, > * specifies that input does not have to contain a decimal mark. > * Has no effect on formatting. > * Default: 0 (unset) >- * @draft ICU 54 >+ * @stable ICU 54 > */ >- UNUM_PARSE_DECIMAL_MARK_REQUIRED = UNUM_PARSE_NO_EXPONENT+1, >-#endif /* U_HIDE_DRAFT_API */ >+ UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002, > > /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ > /** Limit of boolean attributes. > * @internal */ >- UNUM_LIMIT_BOOLEAN_ATTRIBUTE = UNUM_PARSE_NO_EXPONENT+2 >+ UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003 > } UNumberFormatAttribute; > > /** >@@ -966,7 +1077,7 @@ typedef enum UNumberFormatAttribute { > * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, > * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, > * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, >-* UNUM_SCALE. >+* UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. > * @return The value of attr. > * @see unum_setAttribute > * @see unum_getDoubleAttribute >@@ -989,7 +1100,7 @@ unum_getAttribute(const UNumberFormat* fmt, > * UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, > * UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, > * UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, >-* UNUM_LENIENT_PARSE, or UNUM_SCALE. >+* UNUM_LENIENT_PARSE, UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. > * @param newValue The new value of attr. > * @see unum_getAttribute > * @see unum_getDoubleAttribute >@@ -1228,15 +1339,18 @@ typedef enum UNumberFormatSymbol { > */ > UNUM_NINE_DIGIT_SYMBOL = 26, > >-#ifndef U_HIDE_DRAFT_API > /** Multiplication sign >- * @draft ICU 54 >+ * @stable ICU 54 > */ > UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, >-#endif /* U_HIDE_DRAFT_API */ > >- /** count symbol constants */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UNumberFormatSymbol value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UNUM_FORMAT_SYMBOL_COUNT = 28 >+#endif /* U_HIDE_DEPRECATED_API */ > } UNumberFormatSymbol; > > /** >diff --git a/Source/WTF/icu/unicode/unumsys.h b/Source/WTF/icu/unicode/unumsys.h >index f5a2c43e928ee86f3dee28d97e3355a1d167da65..795ec60255f23efdb676a20d733c13cd7a415df1 100644 >--- a/Source/WTF/icu/unicode/unumsys.h >+++ b/Source/WTF/icu/unicode/unumsys.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** > * Copyright (C) 2013-2014, International Business Machines >diff --git a/Source/WTF/icu/unicode/uobject.h b/Source/WTF/icu/unicode/uobject.h >index 54ceace626d735cbac6d835bf6aba34833a9f43a..9782f272f6d7045a5c1c668468c73a62d3160162 100644 >--- a/Source/WTF/icu/unicode/uobject.h >+++ b/Source/WTF/icu/unicode/uobject.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -6,7 +8,7 @@ > * > ****************************************************************************** > * file name: uobject.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/upluralrules.h b/Source/WTF/icu/unicode/upluralrules.h >index 5bcadd4bda60f41c74a0f45ebe115e07a4b247d3..99d93a4e0517ab8d8779bd7b09afefeb9f946f4f 100644 >--- a/Source/WTF/icu/unicode/upluralrules.h >+++ b/Source/WTF/icu/unicode/upluralrules.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** > * Copyright (C) 2010-2013, International Business Machines >@@ -13,6 +15,10 @@ > #if !UCONFIG_NO_FORMATTING > > #include "unicode/localpointer.h" >+#include "unicode/uenum.h" >+#ifndef U_HIDE_INTERNAL_API >+#include "unicode/unum.h" >+#endif /* U_HIDE_INTERNAL_API */ > > /** > * \file >@@ -52,11 +58,13 @@ enum UPluralType { > * @stable ICU 50 > */ > UPLURAL_TYPE_ORDINAL, >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Number of Plural rules types. >- * @stable ICU 50 >+ * One more than the highest normal UPluralType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > UPLURAL_TYPE_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ > }; > /** > * @stable ICU 50 >@@ -79,7 +87,7 @@ typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRule > * @return A UPluralRules for the specified locale, or NULL if an error occurred. > * @stable ICU 4.8 > */ >-U_STABLE UPluralRules* U_EXPORT2 >+U_CAPI UPluralRules* U_EXPORT2 > uplrules_open(const char *locale, UErrorCode *status); > > /** >@@ -91,7 +99,7 @@ uplrules_open(const char *locale, UErrorCode *status); > * @return A UPluralRules for the specified locale, or NULL if an error occurred. > * @stable ICU 50 > */ >-U_DRAFT UPluralRules* U_EXPORT2 >+U_CAPI UPluralRules* U_EXPORT2 > uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); > > /** >@@ -99,7 +107,7 @@ uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); > * @param uplrules The UPluralRules object to close. > * @stable ICU 4.8 > */ >-U_STABLE void U_EXPORT2 >+U_CAPI void U_EXPORT2 > uplrules_close(UPluralRules *uplrules); > > >@@ -134,12 +142,55 @@ U_NAMESPACE_END > * @return The length of keyword. > * @stable ICU 4.8 > */ >-U_STABLE int32_t U_EXPORT2 >+U_CAPI int32_t U_EXPORT2 > uplrules_select(const UPluralRules *uplrules, > double number, > UChar *keyword, int32_t capacity, > UErrorCode *status); > >+#ifndef U_HIDE_INTERNAL_API >+/** >+ * Given a number, returns the keyword of the first rule that applies to the >+ * number, according to the UPluralRules object and given the number format >+ * specified by the UNumberFormat object. >+ * Note: This internal preview interface may be removed in the future if >+ * an architecturally cleaner solution reaches stable status. >+ * @param uplrules The UPluralRules object specifying the rules. >+ * @param number The number for which the rule has to be determined. >+ * @param fmt The UNumberFormat specifying how the number will be formatted >+ * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). >+ * If this is NULL, the function behaves like uplrules_select. >+ * @param keyword The keyword of the rule that applies to number. >+ * @param capacity The capacity of the keyword buffer. >+ * @param status A pointer to a UErrorCode to receive any errors. >+ * @return The length of keyword. >+ * @internal ICU 59 technology preview, may be removed in the future >+ */ >+U_INTERNAL int32_t U_EXPORT2 >+uplrules_selectWithFormat(const UPluralRules *uplrules, >+ double number, >+ const UNumberFormat *fmt, >+ UChar *keyword, int32_t capacity, >+ UErrorCode *status); >+ >+#endif /* U_HIDE_INTERNAL_API */ >+ >+#ifndef U_HIDE_DRAFT_API >+/** >+ * Creates a string enumeration of all plural rule keywords used in this >+ * UPluralRules object. The rule "other" is always present by default. >+ * @param uplrules The UPluralRules object specifying the rules for >+ * a given locale. >+ * @param status A pointer to a UErrorCode to receive any errors. >+ * @return a string enumeration over plural rule keywords, or NULL >+ * upon error. The caller is responsible for closing the result. >+ * @draft ICU 59 >+ */ >+U_DRAFT UEnumeration* U_EXPORT2 >+uplrules_getKeywords(const UPluralRules *uplrules, >+ UErrorCode *status); >+#endif /* U_HIDE_DRAFT_API */ >+ > #endif /* #if !UCONFIG_NO_FORMATTING */ > > #endif >diff --git a/Source/WTF/icu/unicode/uregex.h b/Source/WTF/icu/unicode/uregex.h >index b1b5d65d1506ecc999a4586a5c02d813d4ecf3fd..f3e82149444991d2992109906dc475a0584379ea 100644 >--- a/Source/WTF/icu/unicode/uregex.h >+++ b/Source/WTF/icu/unicode/uregex.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 2004-2015, International Business Machines >+* Copyright (C) 2004-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * file name: uregex.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * indentation:4 > * > * created on: 2004mar09 >@@ -487,7 +489,7 @@ uregex_matches64(URegularExpression *regexp, > * > * <p>If the match succeeds then more information can be obtained via the > * <code>uregexp_start()</code>, <code>uregexp_end()</code>, >- * and <code>uregexp_group()</code> functions.</p> >+ * and <code>uregex_group()</code> functions.</p> > * > * @param regexp The compiled regular expression. > * @param startIndex The input string (native) index at which to begin matching, or >@@ -516,7 +518,7 @@ uregex_lookingAt(URegularExpression *regexp, > * > * <p>If the match succeeds then more information can be obtained via the > * <code>uregexp_start()</code>, <code>uregexp_end()</code>, >- * and <code>uregexp_group()</code> functions.</p> >+ * and <code>uregex_group()</code> functions.</p> > * > * @param regexp The compiled regular expression. > * @param startIndex The input string (native) index at which to begin matching, or >@@ -607,7 +609,6 @@ U_STABLE int32_t U_EXPORT2 > uregex_groupCount(URegularExpression *regexp, > UErrorCode *status); > >-#ifndef U_HIDE_DRAFT_API > /** > * Get the group number corresponding to a named capture group. > * The returned number can be used with any function that access >@@ -622,9 +623,9 @@ uregex_groupCount(URegularExpression *regexp, > * nul-terminated string. > * @param status A pointer to a UErrorCode to receive any errors. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > uregex_groupNumberFromName(URegularExpression *regexp, > const UChar *groupName, > int32_t nameLength, >@@ -646,14 +647,13 @@ uregex_groupNumberFromName(URegularExpression *regexp, > * nul-terminated. > * @param status A pointer to a UErrorCode to receive any errors. > * >- * @draft ICU 55 >+ * @stable ICU 55 > */ >-U_DRAFT int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > uregex_groupNumberFromCName(URegularExpression *regexp, > const char *groupName, > int32_t nameLength, > UErrorCode *status); >-#endif /* U_HIDE_DRAFT_API */ > > /** Extract the string for the specified matching expression or subexpression. > * Group #0 is the complete string of matched text. >diff --git a/Source/WTF/icu/unicode/uregion.h b/Source/WTF/icu/unicode/uregion.h >index 99b381ffd4a66d56ee3ff3f65395d73f2cd1fc18..a5de49674b52d8e868c5156564531ebaef4d51d7 100644 >--- a/Source/WTF/icu/unicode/uregion.h >+++ b/Source/WTF/icu/unicode/uregion.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ***************************************************************************************** > * Copyright (C) 2014, International Business Machines >@@ -105,11 +107,13 @@ typedef enum URegionType { > */ > URGN_DEPRECATED, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Maximum value for this unumeration. >- * @stable ICU 51 >+ * One more than the highest normal URegionType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > URGN_LIMIT >+#endif /* U_HIDE_DEPRECATED_API */ > } URegionType; > > #if !UCONFIG_NO_FORMATTING >diff --git a/Source/WTF/icu/unicode/ureldatefmt.h b/Source/WTF/icu/unicode/ureldatefmt.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0fde188d0f497e58b76bdd85a9765d40f6a3042a >--- /dev/null >+++ b/Source/WTF/icu/unicode/ureldatefmt.h >@@ -0,0 +1,365 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html >+/* >+***************************************************************************************** >+* Copyright (C) 2016, International Business Machines >+* Corporation and others. All Rights Reserved. >+***************************************************************************************** >+*/ >+ >+#ifndef URELDATEFMT_H >+#define URELDATEFMT_H >+ >+#include "unicode/utypes.h" >+ >+#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION >+ >+#include "unicode/unum.h" >+#include "unicode/udisplaycontext.h" >+#include "unicode/localpointer.h" >+ >+/** >+ * \file >+ * \brief C API: URelativeDateTimeFormatter, relative date formatting of unit + numeric offset. >+ * >+ * Provides simple formatting of relative dates, in two ways >+ * <ul> >+ * <li>relative dates with a quantity e.g "in 5 days"</li> >+ * <li>relative dates without a quantity e.g "next Tuesday"</li> >+ * </ul> >+ * <p> >+ * This does not provide compound formatting for multiple units, >+ * other than the ability to combine a time string with a relative date, >+ * as in "next Tuesday at 3:45 PM". It also does not provide support >+ * for determining which unit to use, such as deciding between "in 7 days" >+ * and "in 1 week". >+ * >+ * @stable ICU 57 >+ */ >+ >+/** >+ * The formatting style >+ * @stable ICU 54 >+ */ >+typedef enum UDateRelativeDateTimeFormatterStyle { >+ /** >+ * Everything spelled out. >+ * @stable ICU 54 >+ */ >+ UDAT_STYLE_LONG, >+ >+ /** >+ * Abbreviations used when possible. >+ * @stable ICU 54 >+ */ >+ UDAT_STYLE_SHORT, >+ >+ /** >+ * Use the shortest possible form. >+ * @stable ICU 54 >+ */ >+ UDAT_STYLE_NARROW, >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UDateRelativeDateTimeFormatterStyle value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UDAT_STYLE_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ >+} UDateRelativeDateTimeFormatterStyle; >+ >+/** >+ * Represents the unit for formatting a relative date. e.g "in 5 days" >+ * or "next year" >+ * @stable ICU 57 >+ */ >+typedef enum URelativeDateTimeUnit { >+ /** >+ * Specifies that relative unit is year, e.g. "last year", >+ * "in 5 years". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_YEAR, >+ /** >+ * Specifies that relative unit is quarter, e.g. "last quarter", >+ * "in 5 quarters". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_QUARTER, >+ /** >+ * Specifies that relative unit is month, e.g. "last month", >+ * "in 5 months". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_MONTH, >+ /** >+ * Specifies that relative unit is week, e.g. "last week", >+ * "in 5 weeks". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_WEEK, >+ /** >+ * Specifies that relative unit is day, e.g. "yesterday", >+ * "in 5 days". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_DAY, >+ /** >+ * Specifies that relative unit is hour, e.g. "1 hour ago", >+ * "in 5 hours". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_HOUR, >+ /** >+ * Specifies that relative unit is minute, e.g. "1 minute ago", >+ * "in 5 minutes". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_MINUTE, >+ /** >+ * Specifies that relative unit is second, e.g. "1 second ago", >+ * "in 5 seconds". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_SECOND, >+ /** >+ * Specifies that relative unit is Sunday, e.g. "last Sunday", >+ * "this Sunday", "next Sunday", "in 5 Sundays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_SUNDAY, >+ /** >+ * Specifies that relative unit is Monday, e.g. "last Monday", >+ * "this Monday", "next Monday", "in 5 Mondays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_MONDAY, >+ /** >+ * Specifies that relative unit is Tuesday, e.g. "last Tuesday", >+ * "this Tuesday", "next Tuesday", "in 5 Tuesdays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_TUESDAY, >+ /** >+ * Specifies that relative unit is Wednesday, e.g. "last Wednesday", >+ * "this Wednesday", "next Wednesday", "in 5 Wednesdays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_WEDNESDAY, >+ /** >+ * Specifies that relative unit is Thursday, e.g. "last Thursday", >+ * "this Thursday", "next Thursday", "in 5 Thursdays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_THURSDAY, >+ /** >+ * Specifies that relative unit is Friday, e.g. "last Friday", >+ * "this Friday", "next Friday", "in 5 Fridays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_FRIDAY, >+ /** >+ * Specifies that relative unit is Saturday, e.g. "last Saturday", >+ * "this Saturday", "next Saturday", "in 5 Saturdays". >+ * @stable ICU 57 >+ */ >+ UDAT_REL_UNIT_SATURDAY, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal URelativeDateTimeUnit value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ UDAT_REL_UNIT_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ >+} URelativeDateTimeUnit; >+ >+/** >+ * Opaque URelativeDateTimeFormatter object for use in C programs. >+ * @stable ICU 57 >+ */ >+struct URelativeDateTimeFormatter; >+typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */ >+ >+ >+/** >+ * Open a new URelativeDateTimeFormatter object for a given locale using the >+ * specified width and capitalizationContext, along with a number formatter >+ * (if desired) to override the default formatter that would be used for >+ * display of numeric field offsets. The default formatter typically rounds >+ * toward 0 and has a minimum of 0 fraction digits and a maximum of 3 >+ * fraction digits (i.e. it will show as many decimal places as necessary >+ * up to 3, without showing trailing 0s). >+ * >+ * @param locale >+ * The locale >+ * @param nfToAdopt >+ * A number formatter to set for this URelativeDateTimeFormatter >+ * object (instead of the default decimal formatter). Ownership of >+ * this UNumberFormat object will pass to the URelativeDateTimeFormatter >+ * object (the URelativeDateTimeFormatter adopts the UNumberFormat), >+ * which becomes responsible for closing it. If the caller wishes to >+ * retain ownership of the UNumberFormat object, the caller must clone >+ * it (with unum_clone) and pass the clone to ureldatefmt_open. May be >+ * NULL to use the default decimal formatter. >+ * @param width >+ * The width - wide, short, narrow, etc. >+ * @param capitalizationContext >+ * A value from UDisplayContext that pertains to capitalization, e.g. >+ * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE. >+ * @param status >+ * A pointer to a UErrorCode to receive any errors. >+ * @return >+ * A pointer to a URelativeDateTimeFormatter object for the specified locale, >+ * or NULL if an error occurred. >+ * @stable ICU 57 >+ */ >+U_STABLE URelativeDateTimeFormatter* U_EXPORT2 >+ureldatefmt_open( const char* locale, >+ UNumberFormat* nfToAdopt, >+ UDateRelativeDateTimeFormatterStyle width, >+ UDisplayContext capitalizationContext, >+ UErrorCode* status ); >+ >+/** >+ * Close a URelativeDateTimeFormatter object. Once closed it may no longer be used. >+ * @param reldatefmt >+ * The URelativeDateTimeFormatter object to close. >+ * @stable ICU 57 >+ */ >+U_STABLE void U_EXPORT2 >+ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt); >+ >+#if U_SHOW_CPLUSPLUS_API >+ >+U_NAMESPACE_BEGIN >+ >+/** >+ * \class LocalURelativeDateTimeFormatterPointer >+ * "Smart pointer" class, closes a URelativeDateTimeFormatter via ureldatefmt_close(). >+ * For most methods see the LocalPointerBase base class. >+ * >+ * @see LocalPointerBase >+ * @see LocalPointer >+ * @stable ICU 57 >+ */ >+U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close); >+ >+U_NAMESPACE_END >+ >+#endif >+ >+/** >+ * Format a combination of URelativeDateTimeUnit and numeric >+ * offset using a numeric style, e.g. "1 week ago", "in 1 week", >+ * "5 weeks ago", "in 5 weeks". >+ * >+ * @param reldatefmt >+ * The URelativeDateTimeFormatter object specifying the >+ * format conventions. >+ * @param offset >+ * The signed offset for the specified unit. This will >+ * be formatted according to this object's UNumberFormat >+ * object. >+ * @param unit >+ * The unit to use when formatting the relative >+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. >+ * @param result >+ * A pointer to a buffer to receive the formatted result. >+ * @param resultCapacity >+ * The maximum size of result. >+ * @param status >+ * A pointer to a UErrorCode to receive any errors. In >+ * case of error status, the contents of result are >+ * undefined. >+ * @return >+ * The length of the formatted result; may be greater >+ * than resultCapacity, in which case an error is returned. >+ * @stable ICU 57 >+ */ >+U_STABLE int32_t U_EXPORT2 >+ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, >+ double offset, >+ URelativeDateTimeUnit unit, >+ UChar* result, >+ int32_t resultCapacity, >+ UErrorCode* status); >+ >+/** >+ * Format a combination of URelativeDateTimeUnit and numeric offset >+ * using a text style if possible, e.g. "last week", "this week", >+ * "next week", "yesterday", "tomorrow". Falls back to numeric >+ * style if no appropriate text term is available for the specified >+ * offset in the object's locale. >+ * >+ * @param reldatefmt >+ * The URelativeDateTimeFormatter object specifying the >+ * format conventions. >+ * @param offset >+ * The signed offset for the specified unit. >+ * @param unit >+ * The unit to use when formatting the relative >+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. >+ * @param result >+ * A pointer to a buffer to receive the formatted result. >+ * @param resultCapacity >+ * The maximum size of result. >+ * @param status >+ * A pointer to a UErrorCode to receive any errors. In >+ * case of error status, the contents of result are >+ * undefined. >+ * @return >+ * The length of the formatted result; may be greater >+ * than resultCapacity, in which case an error is returned. >+ * @stable ICU 57 >+ */ >+U_STABLE int32_t U_EXPORT2 >+ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, >+ double offset, >+ URelativeDateTimeUnit unit, >+ UChar* result, >+ int32_t resultCapacity, >+ UErrorCode* status); >+ >+/** >+ * Combines a relative date string and a time string in this object's >+ * locale. This is done with the same date-time separator used for the >+ * default calendar in this locale to produce a result such as >+ * "yesterday at 3:45 PM". >+ * >+ * @param reldatefmt >+ * The URelativeDateTimeFormatter object specifying the format conventions. >+ * @param relativeDateString >+ * The relative date string. >+ * @param relativeDateStringLen >+ * The length of relativeDateString; may be -1 if relativeDateString >+ * is zero-terminated. >+ * @param timeString >+ * The time string. >+ * @param timeStringLen >+ * The length of timeString; may be -1 if timeString is zero-terminated. >+ * @param result >+ * A pointer to a buffer to receive the formatted result. >+ * @param resultCapacity >+ * The maximum size of result. >+ * @param status >+ * A pointer to a UErrorCode to receive any errors. In case of error status, >+ * the contents of result are undefined. >+ * @return >+ * The length of the formatted result; may be greater than resultCapacity, >+ * in which case an error is returned. >+ * @stable ICU 57 >+ */ >+U_STABLE int32_t U_EXPORT2 >+ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt, >+ const UChar * relativeDateString, >+ int32_t relativeDateStringLen, >+ const UChar * timeString, >+ int32_t timeStringLen, >+ UChar* result, >+ int32_t resultCapacity, >+ UErrorCode* status ); >+ >+#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */ >+ >+#endif >diff --git a/Source/WTF/icu/unicode/urename.h b/Source/WTF/icu/unicode/urename.h >index 313f271ab31ea717512d8458a7ef5170b6e00daa..982655c4425e0b79586d3beb63db5fc2566a722a 100644 >--- a/Source/WTF/icu/unicode/urename.h >+++ b/Source/WTF/icu/unicode/urename.h >@@ -1,11 +1,13 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2002-2015, International Business Machines >+* Copyright (C) 2002-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * > * file name: urename.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -98,12 +100,17 @@ > #define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) > #define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) > #define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) >+#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) > #define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) > #define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) > #define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) > #define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) > #define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) >+#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) >+#define checkImpl U_ICU_ENTRY_POINT_RENAME(checkImpl) > #define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) >+#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) >+#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) > #define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) > #define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) > #define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) >@@ -119,16 +126,6 @@ > #define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) > #define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) > #define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) >-#define le_close U_ICU_ENTRY_POINT_RENAME(le_close) >-#define le_create U_ICU_ENTRY_POINT_RENAME(le_create) >-#define le_getCharIndices U_ICU_ENTRY_POINT_RENAME(le_getCharIndices) >-#define le_getCharIndicesWithBase U_ICU_ENTRY_POINT_RENAME(le_getCharIndicesWithBase) >-#define le_getGlyphCount U_ICU_ENTRY_POINT_RENAME(le_getGlyphCount) >-#define le_getGlyphPosition U_ICU_ENTRY_POINT_RENAME(le_getGlyphPosition) >-#define le_getGlyphPositions U_ICU_ENTRY_POINT_RENAME(le_getGlyphPositions) >-#define le_getGlyphs U_ICU_ENTRY_POINT_RENAME(le_getGlyphs) >-#define le_layoutChars U_ICU_ENTRY_POINT_RENAME(le_layoutChars) >-#define le_reset U_ICU_ENTRY_POINT_RENAME(le_reset) > #define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords) > #define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) > #define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) >@@ -474,6 +471,9 @@ > #define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) > #define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) > #define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) >+#define ubiditransform_close U_ICU_ENTRY_POINT_RENAME(ubiditransform_close) >+#define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open) >+#define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform) > #define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) > #define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) > #define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) >@@ -481,6 +481,7 @@ > #define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) > #define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) > #define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) >+#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) > #define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) > #define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) > #define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) >@@ -488,6 +489,7 @@ > #define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) > #define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) > #define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) >+#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) > #define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) > #define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) > #define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) >@@ -549,7 +551,6 @@ > #define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) > #define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) > #define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) >-#define ucase_getSingleton U_ICU_ENTRY_POINT_RENAME(ucase_getSingleton) > #define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) > #define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) > #define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) >@@ -944,6 +945,7 @@ > #define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) > #define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) > #define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) >+#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) > #define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) > #define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) > #define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) >@@ -1013,6 +1015,7 @@ > #define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) > #define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) > #define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) >+#define ulist_removeString U_ICU_ENTRY_POINT_RENAME(ulist_removeString) > #define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) > #define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) > #define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) >@@ -1077,6 +1080,7 @@ > #define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) > #define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) > #define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) >+#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) > #define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) > #define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) > #define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) >@@ -1143,6 +1147,7 @@ > #define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) > #define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) > #define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) >+#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) > #define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) > #define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) > #define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) >@@ -1174,9 +1179,11 @@ > #define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) > #define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) > #define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) >+#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) > #define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) > #define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) > #define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) >+#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) > #define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) > #define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) > #define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) >@@ -1213,6 +1220,7 @@ > #define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) > #define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) > #define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) >+#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) > #define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) > #define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) > #define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) >@@ -1354,6 +1362,7 @@ > #define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) > #define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) > #define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) >+#define uprv_tzname_clear_cache U_ICU_ENTRY_POINT_RENAME(uprv_tzname_clear_cache) > #define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) > #define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) > #define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) >@@ -1445,11 +1454,17 @@ > #define uregion_getRegionFromCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromCode) > #define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) > #define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) >+#define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) >+#define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) >+#define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) >+#define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) >+#define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) > #define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) > #define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) > #define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) > #define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) > #define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) >+#define ures_getAllItemsWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllItemsWithFallback) > #define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) > #define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) > #define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) >@@ -1597,13 +1612,20 @@ > #define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) > #define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) > #define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) >+#define uspoof_check2 U_ICU_ENTRY_POINT_RENAME(uspoof_check2) >+#define uspoof_check2UTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_check2UTF8) >+#define uspoof_check2UnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_check2UnicodeString) > #define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) > #define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) > #define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) > #define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) >+#define uspoof_closeCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_closeCheckResult) > #define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) > #define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) > #define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) >+#define uspoof_getCheckResultChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultChecks) >+#define uspoof_getCheckResultNumerics U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultNumerics) >+#define uspoof_getCheckResultRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultRestrictionLevel) > #define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) > #define uspoof_getInclusionSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionSet) > #define uspoof_getInclusionUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionUnicodeSet) >@@ -1613,7 +1635,9 @@ > #define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) > #define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) > #define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) >+#define uspoof_internalInitStatics U_ICU_ENTRY_POINT_RENAME(uspoof_internalInitStatics) > #define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) >+#define uspoof_openCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_openCheckResult) > #define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) > #define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) > #define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) >@@ -1631,12 +1655,14 @@ > #define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) > #define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) > #define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) >+#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) >+#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) > #define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) > #define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) > #define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) > #define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) > #define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) >-#define ustrcase_setTempCaseMapLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_setTempCaseMapLocale) >+#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) > #define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) > #define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) > #define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) >@@ -1681,7 +1707,6 @@ > #define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) > #define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) > #define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) >-#define utrace_level U_ICU_ENTRY_POINT_RENAME(utrace_level) > #define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) > #define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) > #define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) >diff --git a/Source/WTF/icu/unicode/urep.h b/Source/WTF/icu/unicode/urep.h >index c7b99476f00b8b3e897a35faa46282fedefc3774..932202ddb04b1c13eff4a2a489fddadfe5e614df 100644 >--- a/Source/WTF/icu/unicode/urep.h >+++ b/Source/WTF/icu/unicode/urep.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * Copyright (C) 1997-2010, International Business Machines >diff --git a/Source/WTF/icu/unicode/ures.h b/Source/WTF/icu/unicode/ures.h >index c91f030b1004541d13f83d88725f5de983bc4b38..918b9f208e2cd047306846cb5b529e6cd8f4f218 100644 >--- a/Source/WTF/icu/unicode/ures.h >+++ b/Source/WTF/icu/unicode/ures.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 1997-2012,2014, International Business Machines >+* Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -12,7 +14,7 @@ > * 04/01/97 aliu Creation. > * 02/22/99 damiba overhaul. > * 04/04/99 helena Fixed internal header inclusion. >-* 04/15/99 Madhu Updated Javadoc >+* 04/15/99 Madhu Updated Javadoc > * 06/14/99 stephen Removed functions taking a filename suffix. > * 07/20/99 stephen Language-independent ypedef to void* > * 11/09/99 weiv Added ures_getLocale() >@@ -29,7 +31,7 @@ > > /** > * \file >- * \brief C API: Resource Bundle >+ * \brief C API: Resource Bundle > * > * <h2>C API: Resource Bundle</h2> > * >@@ -40,7 +42,7 @@ > * <P> > * Resource bundles in ICU4C are currently defined using text files which conform to the following > * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt">BNF definition</a>. >- * More on resource bundle concepts and syntax can be found in the >+ * More on resource bundle concepts and syntax can be found in the > * <a href="http://icu-project.org/userguide/ResourceManagement.html">Users Guide</a>. > * <P> > */ >@@ -119,10 +121,14 @@ typedef enum { > /** @deprecated ICU 2.6 Use the URES_ constant instead. */ > RES_INT_VECTOR=URES_INT_VECTOR, > /** @deprecated ICU 2.6 Not used. */ >- RES_RESERVED=15, >-#endif /* U_HIDE_DEPRECATED_API */ >+ RES_RESERVED=15, > >+ /** >+ * One more than the highest normal UResType value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > URES_LIMIT = 16 >+#endif // U_HIDE_DEPRECATED_API > } UResType; > > /* >@@ -134,15 +140,15 @@ typedef enum { > * their corresponding keys. > * Note that the caller is responsible of calling <TT>ures_close</TT> on each succesfully > * opened resource bundle. >- * @param packageName The packageName and locale together point to an ICU udata object, >- * as defined by <code> udata_open( packageName, "res", locale, err) </code> >+ * @param packageName The packageName and locale together point to an ICU udata object, >+ * as defined by <code> udata_open( packageName, "res", locale, err) </code> > * or equivalent. Typically, packageName will refer to a (.dat) file, or to > * a package registered with udata_setAppData(). Using a full file or directory > * pathname for packageName is deprecated. If NULL, ICU data will be used. > * @param locale specifies the locale for which we want to open the resource > * if NULL, the default locale will be used. If strlen(locale) == 0 > * root locale will be used. >- * >+ * > * @param status fills in the outgoing error code. > * The UErrorCode err parameter is used to return status information to the user. To > * check whether the construction succeeded or not, you should check the value of >@@ -150,39 +156,39 @@ typedef enum { > * informational status results which still indicate success. U_USING_FALLBACK_WARNING > * indicates that a fall back locale was used. For example, 'de_CH' was requested, > * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that >- * the default locale data or root locale data was used; neither the requested locale >- * nor any of its fall back locales could be found. Please see the users guide for more >+ * the default locale data or root locale data was used; neither the requested locale >+ * nor any of its fall back locales could be found. Please see the users guide for more > * information on this topic. > * @return a newly allocated resource bundle. > * @see ures_close > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >+U_STABLE UResourceBundle* U_EXPORT2 > ures_open(const char* packageName, >- const char* locale, >+ const char* locale, > UErrorCode* status); > > >-/** This function does not care what kind of localeID is passed in. It simply opens a bundle with >+/** This function does not care what kind of localeID is passed in. It simply opens a bundle with > * that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains > * an %%ALIAS directive, the results are undefined. >- * @param packageName The packageName and locale together point to an ICU udata object, >- * as defined by <code> udata_open( packageName, "res", locale, err) </code> >+ * @param packageName The packageName and locale together point to an ICU udata object, >+ * as defined by <code> udata_open( packageName, "res", locale, err) </code> > * or equivalent. Typically, packageName will refer to a (.dat) file, or to > * a package registered with udata_setAppData(). Using a full file or directory > * pathname for packageName is deprecated. If NULL, ICU data will be used. > * @param locale specifies the locale for which we want to open the resource > * if NULL, the default locale will be used. If strlen(locale) == 0 > * root locale will be used. >- * >+ * > * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR > * @return a newly allocated resource bundle or NULL if it doesn't exist. > * @see ures_close > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >-ures_openDirect(const char* packageName, >- const char* locale, >+U_STABLE UResourceBundle* U_EXPORT2 >+ures_openDirect(const char* packageName, >+ const char* locale, > UErrorCode* status); > > /** >@@ -190,8 +196,8 @@ ures_openDirect(const char* packageName, > * This path will be converted to char * using the default converter, > * then ures_open() is called. > * >- * @param packageName The packageName and locale together point to an ICU udata object, >- * as defined by <code> udata_open( packageName, "res", locale, err) </code> >+ * @param packageName The packageName and locale together point to an ICU udata object, >+ * as defined by <code> udata_open( packageName, "res", locale, err) </code> > * or equivalent. Typically, packageName will refer to a (.dat) file, or to > * a package registered with udata_setAppData(). Using a full file or directory > * pathname for packageName is deprecated. If NULL, ICU data will be used. >@@ -203,21 +209,21 @@ ures_openDirect(const char* packageName, > * @see ures_open > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >-ures_openU(const UChar* packageName, >- const char* locale, >+U_STABLE UResourceBundle* U_EXPORT2 >+ures_openU(const UChar* packageName, >+ const char* locale, > UErrorCode* status); > > #ifndef U_HIDE_DEPRECATED_API > /** > * Returns the number of strings/arrays in resource bundles. >- * Better to use ures_getSize, as this function will be deprecated. >+ * Better to use ures_getSize, as this function will be deprecated. > * > *@param resourceBundle resource bundle containing the desired strings > *@param resourceKey key tagging the resource > *@param err fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_FALLBACK_WARNING </TT> > *@return: for <STRONG>Arrays</STRONG>: returns the number of resources in the array > * <STRONG>Tables</STRONG>: returns the number of resources in the table >@@ -225,7 +231,7 @@ ures_openU(const UChar* packageName, > *@see ures_getSize > * @deprecated ICU 2.8 User ures_getSize instead > */ >-U_DEPRECATED int32_t U_EXPORT2 >+U_DEPRECATED int32_t U_EXPORT2 > ures_countArrayItems(const UResourceBundle* resourceBundle, > const char* resourceKey, > UErrorCode* err); >@@ -239,7 +245,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle, > * @see ures_open > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_STABLE void U_EXPORT2 > ures_close(UResourceBundle* resourceBundle); > > #if U_SHOW_CPLUSPLUS_API >@@ -272,12 +278,12 @@ U_NAMESPACE_END > * @see ures_getVersion > * @deprecated ICU 2.8 Use ures_getVersion instead. > */ >-U_DEPRECATED const char* U_EXPORT2 >+U_DEPRECATED const char* U_EXPORT2 > ures_getVersionNumber(const UResourceBundle* resourceBundle); > #endif /* U_HIDE_DEPRECATED_API */ > > /** >- * Return the version number associated with this ResourceBundle as an >+ * Return the version number associated with this ResourceBundle as an > * UVersionInfo array. > * > * @param resB The resource bundle for which the version is checked. >@@ -285,15 +291,15 @@ ures_getVersionNumber(const UResourceBundle* resourceBundle); > * as specified in the resource bundle or its parent. > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >-ures_getVersion(const UResourceBundle* resB, >+U_STABLE void U_EXPORT2 >+ures_getVersion(const UResourceBundle* resB, > UVersionInfo versionInfo); > > #ifndef U_HIDE_DEPRECATED_API > /** > * Return the name of the Locale associated with this ResourceBundle. This API allows >- * you to query for the real locale of the resource. For example, if you requested >- * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. >+ * you to query for the real locale of the resource. For example, if you requested >+ * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. > * For subresources, the locale where this resource comes from will be returned. > * If fallback has occured, getLocale will reflect this. > * >@@ -302,13 +308,13 @@ ures_getVersion(const UResourceBundle* resB, > * @return A Locale name > * @deprecated ICU 2.8 Use ures_getLocaleByType instead. > */ >-U_DEPRECATED const char* U_EXPORT2 >-ures_getLocale(const UResourceBundle* resourceBundle, >+U_DEPRECATED const char* U_EXPORT2 >+ures_getLocale(const UResourceBundle* resourceBundle, > UErrorCode* status); > #endif /* U_HIDE_DEPRECATED_API */ > > /** >- * Return the name of the Locale associated with this ResourceBundle. >+ * Return the name of the Locale associated with this ResourceBundle. > * You can choose between requested, valid and real locale. > * > * @param resourceBundle resource bundle in question >@@ -319,9 +325,9 @@ ures_getLocale(const UResourceBundle* resourceBundle, > * @return A Locale name > * @stable ICU 2.8 > */ >-U_STABLE const char* U_EXPORT2 >-ures_getLocaleByType(const UResourceBundle* resourceBundle, >- ULocDataLocaleType type, >+U_STABLE const char* U_EXPORT2 >+ures_getLocaleByType(const UResourceBundle* resourceBundle, >+ ULocDataLocaleType type, > UErrorCode* status); > > >@@ -332,8 +338,8 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle, > * TODO need to revisit usefulness of this function > * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) > * @param r The resourcebundle to open >- * @param packageName The packageName and locale together point to an ICU udata object, >- * as defined by <code> udata_open( packageName, "res", locale, err) </code> >+ * @param packageName The packageName and locale together point to an ICU udata object, >+ * as defined by <code> udata_open( packageName, "res", locale, err) </code> > * or equivalent. Typically, packageName will refer to a (.dat) file, or to > * a package registered with udata_setAppData(). Using a full file or directory > * pathname for packageName is deprecated. If NULL, ICU data will be used. >@@ -342,10 +348,10 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle, > * @return a newly allocated resource bundle or NULL if it doesn't exist. > * @internal > */ >-U_INTERNAL void U_EXPORT2 >-ures_openFillIn(UResourceBundle *r, >+U_INTERNAL void U_EXPORT2 >+ures_openFillIn(UResourceBundle *r, > const char* packageName, >- const char* localeID, >+ const char* localeID, > UErrorCode* status); > #endif /* U_HIDE_INTERNAL_API */ > >@@ -357,7 +363,7 @@ ures_openFillIn(UResourceBundle *r, > * @param status fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found > * Always check the value of status. Don't count on returning NULL. >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> > * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. > * @see ures_getBinary >@@ -366,9 +372,9 @@ ures_openFillIn(UResourceBundle *r, > * @see ures_getUInt > * @stable ICU 2.0 > */ >-U_STABLE const UChar* U_EXPORT2 >-ures_getString(const UResourceBundle* resourceBundle, >- int32_t* len, >+U_STABLE const UChar* U_EXPORT2 >+ures_getString(const UResourceBundle* resourceBundle, >+ int32_t* len, > UErrorCode* status); > > /** >@@ -425,14 +431,14 @@ ures_getUTF8String(const UResourceBundle *resB, > UErrorCode *status); > > /** >- * Returns a binary data from a binary resource. >+ * Returns a binary data from a binary resource. > * > * @param resourceBundle a string resource > * @param len fills in the length of resulting byte chunk > * @param status fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found > * Always check the value of status. Don't count on returning NULL. >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> > * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. > * @see ures_getString >@@ -441,20 +447,20 @@ ures_getUTF8String(const UResourceBundle *resB, > * @see ures_getUInt > * @stable ICU 2.0 > */ >-U_STABLE const uint8_t* U_EXPORT2 >-ures_getBinary(const UResourceBundle* resourceBundle, >- int32_t* len, >+U_STABLE const uint8_t* U_EXPORT2 >+ures_getBinary(const UResourceBundle* resourceBundle, >+ int32_t* len, > UErrorCode* status); > > /** >- * Returns a 32 bit integer array from a resource. >+ * Returns a 32 bit integer array from a resource. > * > * @param resourceBundle an int vector resource > * @param len fills in the length of resulting byte chunk > * @param status fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found > * Always check the value of status. Don't count on returning NULL. >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> > * @return a pointer to a chunk of integers which live in a memory mapped/DLL file. > * @see ures_getBinary >@@ -463,19 +469,19 @@ ures_getBinary(const UResourceBundle* resourceBundle, > * @see ures_getUInt > * @stable ICU 2.0 > */ >-U_STABLE const int32_t* U_EXPORT2 >-ures_getIntVector(const UResourceBundle* resourceBundle, >- int32_t* len, >+U_STABLE const int32_t* U_EXPORT2 >+ures_getIntVector(const UResourceBundle* resourceBundle, >+ int32_t* len, > UErrorCode* status); > > /** >- * Returns an unsigned integer from a resource. >+ * Returns an unsigned integer from a resource. > * This integer is originally 28 bits. > * > * @param resourceBundle a string resource > * @param status fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> > * @return an integer value > * @see ures_getInt >@@ -484,18 +490,18 @@ ures_getIntVector(const UResourceBundle* resourceBundle, > * @see ures_getString > * @stable ICU 2.0 > */ >-U_STABLE uint32_t U_EXPORT2 >-ures_getUInt(const UResourceBundle* resourceBundle, >+U_STABLE uint32_t U_EXPORT2 >+ures_getUInt(const UResourceBundle* resourceBundle, > UErrorCode *status); > > /** >- * Returns a signed integer from a resource. >+ * Returns a signed integer from a resource. > * This integer is originally 28 bit and the sign gets propagated. > * > * @param resourceBundle a string resource > * @param status fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> > * @return an integer value > * @see ures_getUInt >@@ -504,21 +510,21 @@ ures_getUInt(const UResourceBundle* resourceBundle, > * @see ures_getString > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >-ures_getInt(const UResourceBundle* resourceBundle, >+U_STABLE int32_t U_EXPORT2 >+ures_getInt(const UResourceBundle* resourceBundle, > UErrorCode *status); > > /** >- * Returns the size of a resource. Size for scalar types is always 1, >+ * Returns the size of a resource. Size for scalar types is always 1, > * and for vector/table types is the number of child resources. >- * @warning Integer array is treated as a scalar type. There are no >+ * @warning Integer array is treated as a scalar type. There are no > * APIs to access individual members of an integer array. It > * is always returned as a whole. > * @param resourceBundle a resource > * @return number of resources in a given resource. > * @stable ICU 2.0 > */ >-U_STABLE int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > ures_getSize(const UResourceBundle *resourceBundle); > > /** >@@ -529,21 +535,21 @@ ures_getSize(const UResourceBundle *resourceBundle); > * @see UResType > * @stable ICU 2.0 > */ >-U_STABLE UResType U_EXPORT2 >+U_STABLE UResType U_EXPORT2 > ures_getType(const UResourceBundle *resourceBundle); > > /** >- * Returns the key associated with a given resource. Not all the resources have a key - only >+ * Returns the key associated with a given resource. Not all the resources have a key - only > * those that are members of a table. > * > * @param resourceBundle a resource > * @return a key associated to this resource, or NULL if it doesn't have a key > * @stable ICU 2.0 > */ >-U_STABLE const char * U_EXPORT2 >+U_STABLE const char * U_EXPORT2 > ures_getKey(const UResourceBundle *resourceBundle); > >-/* ITERATION API >+/* ITERATION API > This API provides means for iterating through a resource > */ > >@@ -553,7 +559,7 @@ ures_getKey(const UResourceBundle *resourceBundle); > * @param resourceBundle a resource > * @stable ICU 2.0 > */ >-U_STABLE void U_EXPORT2 >+U_STABLE void U_EXPORT2 > ures_resetIterator(UResourceBundle *resourceBundle); > > /** >@@ -563,12 +569,12 @@ ures_resetIterator(UResourceBundle *resourceBundle); > * @return TRUE if there are more elements, FALSE if there is no more elements > * @stable ICU 2.0 > */ >-U_STABLE UBool U_EXPORT2 >+U_STABLE UBool U_EXPORT2 > ures_hasNext(const UResourceBundle *resourceBundle); > > /** >- * Returns the next resource in a given resource or NULL if there are no more resources >- * to iterate over. Features a fill-in parameter. >+ * Returns the next resource in a given resource or NULL if there are no more resources >+ * to iterate over. Features a fill-in parameter. > * > * @param resourceBundle a resource > * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. >@@ -578,14 +584,14 @@ ures_hasNext(const UResourceBundle *resourceBundle); > * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >-ures_getNextResource(UResourceBundle *resourceBundle, >- UResourceBundle *fillIn, >+U_STABLE UResourceBundle* U_EXPORT2 >+ures_getNextResource(UResourceBundle *resourceBundle, >+ UResourceBundle *fillIn, > UErrorCode *status); > > /** >- * Returns the next string in a given resource or NULL if there are no more resources >- * to iterate over. >+ * Returns the next string in a given resource or NULL if there are no more resources >+ * to iterate over. > * > * @param resourceBundle a resource > * @param len fill in length of the string >@@ -595,14 +601,14 @@ ures_getNextResource(UResourceBundle *resourceBundle, > * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. > * @stable ICU 2.0 > */ >-U_STABLE const UChar* U_EXPORT2 >-ures_getNextString(UResourceBundle *resourceBundle, >- int32_t* len, >- const char ** key, >+U_STABLE const UChar* U_EXPORT2 >+ures_getNextString(UResourceBundle *resourceBundle, >+ int32_t* len, >+ const char ** key, > UErrorCode *status); > > /** >- * Returns the resource in a given resource at the specified index. Features a fill-in parameter. >+ * Returns the resource in a given resource at the specified index. Features a fill-in parameter. > * > * @param resourceBundle the resource bundle from which to get a sub-resource > * @param indexR an index to the wanted resource. >@@ -613,10 +619,10 @@ ures_getNextString(UResourceBundle *resourceBundle, > * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >-ures_getByIndex(const UResourceBundle *resourceBundle, >- int32_t indexR, >- UResourceBundle *fillIn, >+U_STABLE UResourceBundle* U_EXPORT2 >+ures_getByIndex(const UResourceBundle *resourceBundle, >+ int32_t indexR, >+ UResourceBundle *fillIn, > UErrorCode *status); > > /** >@@ -630,10 +636,10 @@ ures_getByIndex(const UResourceBundle *resourceBundle, > * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. > * @stable ICU 2.0 > */ >-U_STABLE const UChar* U_EXPORT2 >-ures_getStringByIndex(const UResourceBundle *resourceBundle, >- int32_t indexS, >- int32_t* len, >+U_STABLE const UChar* U_EXPORT2 >+ures_getStringByIndex(const UResourceBundle *resourceBundle, >+ int32_t indexS, >+ int32_t* len, > UErrorCode *status); > > /** >@@ -693,7 +699,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, > > /** > * Returns a resource in a given resource that has a given key. This procedure works only with table >- * resources. Features a fill-in parameter. >+ * resources. Features a fill-in parameter. > * > * @param resourceBundle a resource > * @param key a key associated with the wanted resource >@@ -703,15 +709,15 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB, > * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it > * @stable ICU 2.0 > */ >-U_STABLE UResourceBundle* U_EXPORT2 >-ures_getByKey(const UResourceBundle *resourceBundle, >- const char* key, >- UResourceBundle *fillIn, >+U_STABLE UResourceBundle* U_EXPORT2 >+ures_getByKey(const UResourceBundle *resourceBundle, >+ const char* key, >+ UResourceBundle *fillIn, > UErrorCode *status); > > /** > * Returns a string in a given resource that has a given key. This procedure works only with table >- * resources. >+ * resources. > * > * @param resB a resource > * @param key a key associated with the wanted string >@@ -721,10 +727,10 @@ ures_getByKey(const UResourceBundle *resourceBundle, > * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. > * @stable ICU 2.0 > */ >-U_STABLE const UChar* U_EXPORT2 >-ures_getStringByKey(const UResourceBundle *resB, >- const char* key, >- int32_t* len, >+U_STABLE const UChar* U_EXPORT2 >+ures_getStringByKey(const UResourceBundle *resB, >+ const char* key, >+ int32_t* len, > UErrorCode *status); > > /** >@@ -789,82 +795,97 @@ ures_getUTF8StringByKey(const UResourceBundle *resB, > > U_NAMESPACE_BEGIN > /** >- * returns a string from a string resource type >+ * Returns the string value from a string resource bundle. > * >- * @param resB a resource >+ * @param resB a resource, should have type URES_STRING > * @param status: fills in the outgoing error code > * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found >- * could be a non-failing error >+ * could be a non-failing error > * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> >- * @return a UnicodeString object. If there is an error, string is bogus >+ * @return The string value, or a bogus string if there is a failure UErrorCode. > * @stable ICU 2.0 > */ >-inline UnicodeString >-ures_getUnicodeString(const UResourceBundle *resB, >- UErrorCode* status) >-{ >+inline UnicodeString >+ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { >+ UnicodeString result; > int32_t len = 0; > const UChar *r = ures_getString(resB, &len, status); >- return UnicodeString(TRUE, r, len); >+ if(U_SUCCESS(*status)) { >+ result.setTo(TRUE, r, len); >+ } else { >+ result.setToBogus(); >+ } >+ return result; > } > > /** >- * Returns the next string in a resource or NULL if there are no more resources >- * to iterate over. >+ * Returns the next string in a resource, or an empty string if there are no more resources >+ * to iterate over. >+ * Use ures_getNextString() instead to distinguish between >+ * the end of the iteration and a real empty string value. > * > * @param resB a resource > * @param key fill in for key associated with this string > * @param status fills in the outgoing error code >- * @return an UnicodeString object. >+ * @return The string value, or a bogus string if there is a failure UErrorCode. > * @stable ICU 2.0 > */ >-inline UnicodeString >-ures_getNextUnicodeString(UResourceBundle *resB, >- const char ** key, >- UErrorCode* status) >-{ >+inline UnicodeString >+ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { >+ UnicodeString result; > int32_t len = 0; > const UChar* r = ures_getNextString(resB, &len, key, status); >- return UnicodeString(TRUE, r, len); >+ if(U_SUCCESS(*status)) { >+ result.setTo(TRUE, r, len); >+ } else { >+ result.setToBogus(); >+ } >+ return result; > } > > /** >- * Returns the string in a given resource at the specified index. >+ * Returns the string in a given resource array or table at the specified index. > * > * @param resB a resource > * @param indexS an index to the wanted string. > * @param status fills in the outgoing error code >- * @return an UnicodeString object. If there is an error, string is bogus >+ * @return The string value, or a bogus string if there is a failure UErrorCode. > * @stable ICU 2.0 > */ >-inline UnicodeString >-ures_getUnicodeStringByIndex(const UResourceBundle *resB, >- int32_t indexS, >- UErrorCode* status) >-{ >+inline UnicodeString >+ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { >+ UnicodeString result; > int32_t len = 0; > const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); >- return UnicodeString(TRUE, r, len); >+ if(U_SUCCESS(*status)) { >+ result.setTo(TRUE, r, len); >+ } else { >+ result.setToBogus(); >+ } >+ return result; > } > > /** >- * Returns a string in a resource that has a given key. This procedure works only with table >- * resources. >+ * Returns a string in a resource that has a given key. >+ * This procedure works only with table resources. > * > * @param resB a resource > * @param key a key associated with the wanted string > * @param status fills in the outgoing error code >- * @return an UnicodeString object. If there is an error, string is bogus >+ * @return The string value, or a bogus string if there is a failure UErrorCode. > * @stable ICU 2.0 > */ >-inline UnicodeString >-ures_getUnicodeStringByKey(const UResourceBundle *resB, >- const char* key, >- UErrorCode* status) >-{ >+inline UnicodeString >+ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { >+ UnicodeString result; > int32_t len = 0; > const UChar* r = ures_getStringByKey(resB, key, &len, status); >- return UnicodeString(TRUE, r, len); >+ if(U_SUCCESS(*status)) { >+ result.setTo(TRUE, r, len); >+ } else { >+ result.setToBogus(); >+ } >+ return result; > } > > U_NAMESPACE_END >@@ -872,7 +893,7 @@ U_NAMESPACE_END > #endif > > /** >- * Create a string enumerator, owned by the caller, of all locales located within >+ * Create a string enumerator, owned by the caller, of all locales located within > * the specified resource tree. > * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" > * This call is similar to uloc_getAvailable(). >diff --git a/Source/WTF/icu/unicode/uscript.h b/Source/WTF/icu/unicode/uscript.h >index b217c814728ac111d0a4cfa7550d39268a87a31d..3ec235d50ce2c288a603840ec30bab9a588829bc 100644 >--- a/Source/WTF/icu/unicode/uscript.h >+++ b/Source/WTF/icu/unicode/uscript.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >- * Copyright (C) 1997-2015, International Business Machines >+ * Copyright (C) 1997-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -32,13 +34,13 @@ > * See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/) > * and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt . > * >- * Starting with ICU 3.6, constants for most ISO 15924 script codes >+ * In addition, constants for many ISO 15924 script codes > * are included, for use with language tags, CLDR data, and similar. > * Some of those codes are not used in the Unicode Character Database (UCD). > * For example, there are no characters that have a UCD script property value of > * Hans or Hant. All Han ideographs have the Hani script property value in Unicode. > * >- * Private-use codes Qaaa..Qabx are not included. >+ * Private-use codes Qaaa..Qabx are not included, except as used in the UCD or in CLDR. > * > * Starting with ICU 55, script codes are only added when their scripts > * have been or will certainly be encoded in Unicode, >@@ -300,7 +302,7 @@ typedef enum UScriptCode { > USCRIPT_REJANG = 110,/* Rjng */ > /** @stable ICU 3.8 */ > USCRIPT_SAURASHTRA = 111,/* Saur */ >- /** @stable ICU 3.8 */ >+ /** Sutton SignWriting @stable ICU 3.8 */ > USCRIPT_SIGN_WRITING = 112,/* Sgnw */ > /** @stable ICU 3.8 */ > USCRIPT_SUNDANESE = 113,/* Sund */ >@@ -424,24 +426,46 @@ typedef enum UScriptCode { > /** @stable ICU 54 */ > USCRIPT_SIDDHAM = 166,/* Sidd */ > >- /** >- * One higher than the last script code constant. >- * This value increases as constants for script codes are added. >- * >- * There are constants for Unicode 7 script property values. >- * There are constants for ISO 15924 script codes assigned on or before 2013-10-12. >- * There are no constants for private use codes from Qaaa - Qabx >- * except as used in the UCD. >- * >- * @stable ICU 2.2 >- */ >- USCRIPT_CODE_LIMIT = 167 >+ /** @stable ICU 58 */ >+ USCRIPT_ADLAM = 167,/* Adlm */ >+ /** @stable ICU 58 */ >+ USCRIPT_BHAIKSUKI = 168,/* Bhks */ >+ /** @stable ICU 58 */ >+ USCRIPT_MARCHEN = 169,/* Marc */ >+ /** @stable ICU 58 */ >+ USCRIPT_NEWA = 170,/* Newa */ >+ /** @stable ICU 58 */ >+ USCRIPT_OSAGE = 171,/* Osge */ >+ >+ /** @stable ICU 58 */ >+ USCRIPT_HAN_WITH_BOPOMOFO = 172,/* Hanb */ >+ /** @stable ICU 58 */ >+ USCRIPT_JAMO = 173,/* Jamo */ >+ /** @stable ICU 58 */ >+ USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */ >+ >+ /** @stable ICU 60 */ >+ USCRIPT_MASARAM_GONDI = 175,/* Gonm */ >+ /** @stable ICU 60 */ >+ USCRIPT_SOYOMBO = 176,/* Soyo */ >+ /** @stable ICU 60 */ >+ USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */ >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UScriptCode value. >+ * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SCRIPT). >+ * >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ USCRIPT_CODE_LIMIT = 178 >+#endif // U_HIDE_DEPRECATED_API > } UScriptCode; > > /** >- * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. >+ * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. > * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". >- * Fills in USCRIPT_LATIN given "en" OR "en_US" >+ * Fills in USCRIPT_LATIN given "en" OR "en_US" > * If the required capacity is greater than the capacity of the destination buffer, > * then the error code is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned. > * >@@ -454,10 +478,10 @@ typedef enum UScriptCode { > * @param fillIn the UScriptCode buffer to fill in the script code > * @param capacity the capacity (size) fo UScriptCode buffer passed in. > * @param err the error status code. >- * @return The number of script codes filled in the buffer passed in >+ * @return The number of script codes filled in the buffer passed in > * @stable ICU 2.4 > */ >-U_STABLE int32_t U_EXPORT2 >+U_STABLE int32_t U_EXPORT2 > uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); > > /** >@@ -470,7 +494,7 @@ uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capac > * or NULL if scriptCode is invalid > * @stable ICU 2.4 > */ >-U_STABLE const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uscript_getName(UScriptCode scriptCode); > > /** >@@ -482,18 +506,18 @@ uscript_getName(UScriptCode scriptCode); > * @return short script name (4-letter code), or NULL if scriptCode is invalid > * @stable ICU 2.4 > */ >-U_STABLE const char* U_EXPORT2 >+U_STABLE const char* U_EXPORT2 > uscript_getShortName(UScriptCode scriptCode); > > /** > * Gets the script code associated with the given codepoint. >- * Returns USCRIPT_MALAYALAM given 0x0D02 >+ * Returns USCRIPT_MALAYALAM given 0x0D02 > * @param codepoint UChar32 codepoint > * @param err the error status code. >- * @return The UScriptCode, or 0 if codepoint is invalid >+ * @return The UScriptCode, or 0 if codepoint is invalid > * @stable ICU 2.4 > */ >-U_STABLE UScriptCode U_EXPORT2 >+U_STABLE UScriptCode U_EXPORT2 > uscript_getScript(UChar32 codepoint, UErrorCode *err); > > /** >@@ -503,9 +527,6 @@ uscript_getScript(UChar32 codepoint, UErrorCode *err); > * > * Some characters are commonly used in multiple scripts. > * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. >- * >- * The Script_Extensions property is provisional. It may be modified or removed >- * in future versions of the Unicode Standard, and thus in ICU. > * @param c code point > * @param sc script code > * @return TRUE if sc is in Script_Extensions(c) >@@ -532,8 +553,6 @@ uscript_hasScript(UChar32 c, UScriptCode sc); > * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned. > * (Usual ICU buffer handling behavior.) > * >- * The Script_Extensions property is provisional. It may be modified or removed >- * in future versions of the Unicode Standard, and thus in ICU. > * @param c code point > * @param scripts output script code array > * @param capacity capacity of the scripts array >diff --git a/Source/WTF/icu/unicode/usearch.h b/Source/WTF/icu/unicode/usearch.h >index 75521f528a410fae192358b070f38590d6626a3d..ebfcdf7ec6a494e342c2b351ead27ca721b5a029 100644 >--- a/Source/WTF/icu/unicode/usearch.h >+++ b/Source/WTF/icu/unicode/usearch.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 2001-2011,2014 IBM and others. All rights reserved. >@@ -188,11 +190,13 @@ typedef enum { > */ > USEARCH_ELEMENT_COMPARISON = 2, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of attribute types >- * @stable ICU 2.4 >+ * One more than the highest normal USearchAttribute value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > USEARCH_ATTRIBUTE_COUNT = 3 >+#endif /* U_HIDE_DEPRECATED_API */ > } USearchAttribute; > > /** >@@ -262,11 +266,13 @@ typedef enum { > */ > USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD, > >+#ifndef U_HIDE_DEPRECATED_API > /** >- * Count of attribute values >- * @stable ICU 2.4 >+ * One more than the highest normal USearchAttributeValue value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > USEARCH_ATTRIBUTE_VALUE_COUNT >+#endif /* U_HIDE_DEPRECATED_API */ > } USearchAttributeValue; > > /* open and close ------------------------------------------------------ */ >diff --git a/Source/WTF/icu/unicode/uset.h b/Source/WTF/icu/unicode/uset.h >index eb3c9e6a06a6f9ff94935ee810e9ca891df60105..59f46507d548aa48658f8478af79d5fd43a9f2cf 100644 >--- a/Source/WTF/icu/unicode/uset.h >+++ b/Source/WTF/icu/unicode/uset.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: uset.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -196,11 +198,13 @@ typedef enum USetSpanCondition { > * @stable ICU 3.8 > */ > USET_SPAN_SIMPLE = 2, >+#ifndef U_HIDE_DEPRECATED_API > /** > * One more than the last span condition. >- * @stable ICU 3.8 >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. > */ > USET_SPAN_CONDITION_COUNT >+#endif // U_HIDE_DEPRECATED_API > } USetSpanCondition; > > enum { >diff --git a/Source/WTF/icu/unicode/usetiter.h b/Source/WTF/icu/unicode/usetiter.h >index bf927b08cee86d0c1c8f99b88e8a8b81dd2f006d..d0d99185b7cdb7255e46cb5979d6b0dfe3ca3ca2 100644 >--- a/Source/WTF/icu/unicode/usetiter.h >+++ b/Source/WTF/icu/unicode/usetiter.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (c) 2002-2014, International Business Machines >diff --git a/Source/WTF/icu/unicode/ushape.h b/Source/WTF/icu/unicode/ushape.h >index 9fb5ab4e547f4cadc6431b3e39afc5222ea2737b..c64fe227c1f4a38f7f86dfedaa2e96b8ee74388e 100644 >--- a/Source/WTF/icu/unicode/ushape.h >+++ b/Source/WTF/icu/unicode/ushape.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ****************************************************************************** > * >@@ -6,7 +8,7 @@ > * > ****************************************************************************** > * file name: ushape.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/uspoof.h b/Source/WTF/icu/unicode/uspoof.h >index 8d665e1b3ed7aca91101309598eec1f17058c6d2..9fcfcd3ede836c5d80e518b9e58cf278891f0cf8 100644 >--- a/Source/WTF/icu/unicode/uspoof.h >+++ b/Source/WTF/icu/unicode/uspoof.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > *************************************************************************** >-* Copyright (C) 2008-2015, International Business Machines Corporation >+* Copyright (C) 2008-2016, International Business Machines Corporation > * and others. All Rights Reserved. > *************************************************************************** > * file name: uspoof.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -35,123 +37,349 @@ > * \file > * \brief Unicode Security and Spoofing Detection, C API. > * >- * These functions are intended to check strings, typically >- * identifiers of some type, such as URLs, for the presence of >- * characters that are likely to be visually confusing - >- * for cases where the displayed form of an identifier may >- * not be what it appears to be. >- * >- * Unicode Technical Report #36, http://unicode.org/reports/tr36, and >- * Unicode Technical Standard #39, http://unicode.org/reports/tr39 >- * "Unicode security considerations", give more background on >- * security an spoofing issues with Unicode identifiers. >- * The tests and checks provided by this module implement the recommendations >- * from those Unicode documents. >- * >- * The tests available on identifiers fall into two general categories: >- * -# Single identifier tests. Check whether an identifier is >- * potentially confusable with any other string, or is suspicious >- * for other reasons. >- * -# Two identifier tests. Check whether two specific identifiers are confusable. >- * This does not consider whether either of strings is potentially >- * confusable with any string other than the exact one specified. >- * >- * The steps to perform confusability testing are >- * -# Open a USpoofChecker. >- * -# Configure the USPoofChecker for the desired set of tests. The tests that will >- * be performed are specified by a set of USpoofChecks flags. >- * -# Perform the checks using the pre-configured USpoofChecker. The results indicate >- * which (if any) of the selected tests have identified possible problems with the identifier. >- * Results are reported as a set of USpoofChecks flags; this mirrors the form in which >- * the set of tests to perform was originally specified to the USpoofChecker. >- * >- * A USpoofChecker may be used repeatedly to perform checks on any number of identifiers. >- * >- * Thread Safety: The test functions for checking a single identifier, or for testing >- * whether two identifiers are possible confusable, are thread safe. >- * They may called concurrently, from multiple threads, using the same USpoofChecker instance. >- * >- * More generally, the standard ICU thread safety rules apply: functions that take a >- * const USpoofChecker parameter are thread safe. Those that take a non-const >- * USpoofChecier are not thread safe. >- * >- * >- * Descriptions of the available checks. >- * >- * When testing whether pairs of identifiers are confusable, with the uspoof_areConfusable() >- * family of functions, the relevant tests are >- * >- * -# USPOOF_SINGLE_SCRIPT_CONFUSABLE: All of the characters from the two identifiers are >- * from a single script, and the two identifiers are visually confusable. >- * -# USPOOF_MIXED_SCRIPT_CONFUSABLE: At least one of the identifiers contains characters >- * from more than one script, and the two identifiers are visually confusable. >- * -# USPOOF_WHOLE_SCRIPT_CONFUSABLE: Each of the two identifiers is of a single script, but >- * the two identifiers are from different scripts, and they are visually confusable. >- * >- * The safest approach is to enable all three of these checks as a group. >- * >- * USPOOF_ANY_CASE is a modifier for the above tests. If the identifiers being checked can >- * be of mixed case and are used in a case-sensitive manner, this option should be specified. >- * >- * If the identifiers being checked are used in a case-insensitive manner, and if they are >- * displayed to users in lower-case form only, the USPOOF_ANY_CASE option should not be >- * specified. Confusabality issues involving upper case letters will not be reported. >- * >- * When performing tests on a single identifier, with the uspoof_check() family of functions, >- * the relevant tests are: >- * >- * -# USPOOF_MIXED_SCRIPT_CONFUSABLE: the identifier contains characters from multiple >- * scripts, and there exists an identifier of a single script that is visually confusable. >- * -# USPOOF_WHOLE_SCRIPT_CONFUSABLE: the identifier consists of characters from a single >- * script, and there exists a visually confusable identifier. >- * The visually confusable identifier also consists of characters from a single script. >- * but not the same script as the identifier being checked. >- * -# USPOOF_ANY_CASE: modifies the mixed script and whole script confusables tests. If >- * specified, the checks will consider confusable characters of any case. If this flag is not >- * set, the test is performed assuming case folded identifiers. >- * -# USPOOF_SINGLE_SCRIPT: check that the identifier contains only characters from a >- * single script. (Characters from the 'common' and 'inherited' scripts are ignored.) >- * This is not a test for confusable identifiers >- * -# USPOOF_INVISIBLE: check an identifier for the presence of invisible characters, >- * such as zero-width spaces, or character sequences that are >- * likely not to display, such as multiple occurrences of the same >- * non-spacing mark. This check does not test the input string as a whole >- * for conformance to any particular syntax for identifiers. >- * -# USPOOF_CHAR_LIMIT: check that an identifier contains only characters from a specified set >- * of acceptable characters. See uspoof_setAllowedChars() and >- * uspoof_setAllowedLocales(). >- * >- * Note on Scripts: >- * Characters from the Unicode Scripts "Common" and "Inherited" are ignored when considering >- * the script of an identifier. Common characters include digits and symbols that >- * are normally used with text from more than one script. >- * >- * Identifier Skeletons: A skeleton is a transformation of an identifier, such that >- * all identifiers that are confusable with each other have the same skeleton. >- * Using skeletons, it is possible to build a dictionary data structure for >- * a set of identifiers, and then quickly test whether a new identifier is >- * confusable with an identifier already in the set. The uspoof_getSkeleton() >- * family of functions will produce the skeleton from an identifier. >- * >- * Note that skeletons are not guaranteed to be stable between versions >- * of Unicode or ICU, so an applications should not rely on creating a permanent, >- * or difficult to update, database of skeletons. Instabilities result from >- * identifying new pairs or sequences of characters that are visually >- * confusable, and thus must be mapped to the same skeleton character(s). >- * >- * Skeletons are computed using the algorithm and data describe in Unicode UAX 39. >- * The latest proposed update, UAX 39 Version 8 draft 1, says "the tables SL, SA, and ML >- * were still problematic, and discouraged from use in [Uniocde] 7.0. >- * They were thus removed from version 8.0" >- * >- * In light of this, the default mapping data included with ICU 55 uses the >- * Unicode 7 MA (Multi script Any case) table data for the other type options >- * (Single Script, Any Case), (Single Script, Lower Case) and (Multi Script, Lower Case). >+ * <p> >+ * This class, based on <a href="http://unicode.org/reports/tr36">Unicode Technical Report #36</a> and >+ * <a href="http://unicode.org/reports/tr39">Unicode Technical Standard #39</a>, has two main functions: >+ * >+ * <ol> >+ * <li>Checking whether two strings are visually <em>confusable</em> with each other, such as "Harvest" and >+ * "Ηarvest", where the second string starts with the Greek capital letter Eta.</li> >+ * <li>Checking whether an individual string is likely to be an attempt at confusing the reader (<em>spoof >+ * detection</em>), such as "paypal" with some Latin characters substituted with Cyrillic look-alikes.</li> >+ * </ol> >+ * >+ * <p> >+ * Although originally designed as a method for flagging suspicious identifier strings such as URLs, >+ * <code>USpoofChecker</code> has a number of other practical use cases, such as preventing attempts to evade bad-word >+ * content filters. >+ * >+ * <p> >+ * The functions of this class are exposed as C API, with a handful of syntactical conveniences for C++. >+ * >+ * <h2>Confusables</h2> >+ * >+ * <p> >+ * The following example shows how to use <code>USpoofChecker</code> to check for confusability between two strings: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UChar* str1 = (UChar*) u"Harvest"; >+ * UChar* str2 = (UChar*) u"\u0397arvest"; // with U+0397 GREEK CAPITAL LETTER ETA >+ * >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); >+ * >+ * int32_t bitmask = uspoof_areConfusable(sc, str1, -1, str2, -1, &status); >+ * UBool result = bitmask != 0; >+ * // areConfusable: 1 (status: U_ZERO_ERROR) >+ * printf("areConfusable: %d (status: %s)\n", result, u_errorName(status)); >+ * uspoof_close(sc); >+ * \endcode >+ * >+ * <p> >+ * The call to {@link uspoof_open} creates a <code>USpoofChecker</code> object; the call to {@link uspoof_setChecks} >+ * enables confusable checking and disables all other checks; the call to {@link uspoof_areConfusable} performs the >+ * confusability test; and the following line extracts the result out of the return value. For best performance, >+ * the instance should be created once (e.g., upon application startup), and the efficient >+ * {@link uspoof_areConfusable} method can be used at runtime. >+ * >+ * <p> >+ * The type {@link LocalUSpoofCheckerPointer} is exposed for C++ programmers. It will automatically call >+ * {@link uspoof_close} when the object goes out of scope: >+ * >+ * \code{.cpp} >+ * UErrorCode status = U_ZERO_ERROR; >+ * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); >+ * uspoof_setChecks(sc.getAlias(), USPOOF_CONFUSABLE, &status); >+ * // ... >+ * \endcode >+ * >+ * <p> >+ * UTS 39 defines two strings to be <em>confusable</em> if they map to the same <em>skeleton string</em>. A skeleton can >+ * be thought of as a "hash code". {@link uspoof_getSkeleton} computes the skeleton for a particular string, so >+ * the following snippet is equivalent to the example above: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UChar* str1 = (UChar*) u"Harvest"; >+ * UChar* str2 = (UChar*) u"\u0397arvest"; // with U+0397 GREEK CAPITAL LETTER ETA >+ * >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); >+ * >+ * // Get skeleton 1 >+ * int32_t skel1Len = uspoof_getSkeleton(sc, 0, str1, -1, NULL, 0, &status); >+ * UChar* skel1 = (UChar*) malloc(++skel1Len * sizeof(UChar)); >+ * status = U_ZERO_ERROR; >+ * uspoof_getSkeleton(sc, 0, str1, -1, skel1, skel1Len, &status); >+ * >+ * // Get skeleton 2 >+ * int32_t skel2Len = uspoof_getSkeleton(sc, 0, str2, -1, NULL, 0, &status); >+ * UChar* skel2 = (UChar*) malloc(++skel2Len * sizeof(UChar)); >+ * status = U_ZERO_ERROR; >+ * uspoof_getSkeleton(sc, 0, str2, -1, skel2, skel2Len, &status); >+ * >+ * // Are the skeletons the same? >+ * UBool result = u_strcmp(skel1, skel2) == 0; >+ * // areConfusable: 1 (status: U_ZERO_ERROR) >+ * printf("areConfusable: %d (status: %s)\n", result, u_errorName(status)); >+ * uspoof_close(sc); >+ * free(skel1); >+ * free(skel2); >+ * \endcode >+ * >+ * <p> >+ * If you need to check if a string is confusable with any string in a dictionary of many strings, rather than calling >+ * {@link uspoof_areConfusable} many times in a loop, {@link uspoof_getSkeleton} can be used instead, as shown below: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * #define DICTIONARY_LENGTH 2 >+ * UChar* dictionary[DICTIONARY_LENGTH] = { (UChar*) u"lorem", (UChar*) u"ipsum" }; >+ * UChar* skeletons[DICTIONARY_LENGTH]; >+ * UChar* str = (UChar*) u"1orern"; >+ * >+ * // Setup: >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); >+ * for (size_t i=0; i<DICTIONARY_LENGTH; i++) { >+ * UChar* word = dictionary[i]; >+ * int32_t len = uspoof_getSkeleton(sc, 0, word, -1, NULL, 0, &status); >+ * skeletons[i] = (UChar*) malloc(++len * sizeof(UChar)); >+ * status = U_ZERO_ERROR; >+ * uspoof_getSkeleton(sc, 0, word, -1, skeletons[i], len, &status); >+ * } >+ * >+ * // Live Check: >+ * { >+ * int32_t len = uspoof_getSkeleton(sc, 0, str, -1, NULL, 0, &status); >+ * UChar* skel = (UChar*) malloc(++len * sizeof(UChar)); >+ * status = U_ZERO_ERROR; >+ * uspoof_getSkeleton(sc, 0, str, -1, skel, len, &status); >+ * UBool result = FALSE; >+ * for (size_t i=0; i<DICTIONARY_LENGTH; i++) { >+ * result = u_strcmp(skel, skeletons[i]) == 0; >+ * if (result == TRUE) { break; } >+ * } >+ * // Has confusable in dictionary: 1 (status: U_ZERO_ERROR) >+ * printf("Has confusable in dictionary: %d (status: %s)\n", result, u_errorName(status)); >+ * free(skel); >+ * } >+ * >+ * for (size_t i=0; i<DICTIONARY_LENGTH; i++) { >+ * free(skeletons[i]); >+ * } >+ * uspoof_close(sc); >+ * \endcode >+ * >+ * <p> >+ * <b>Note:</b> Since the Unicode confusables mapping table is frequently updated, confusable skeletons are <em>not</em> >+ * guaranteed to be the same between ICU releases. We therefore recommend that you always compute confusable skeletons >+ * at runtime and do not rely on creating a permanent, or difficult to update, database of skeletons. >+ * >+ * <h2>Spoof Detection</h2> >+ * >+ * <p> >+ * The following snippet shows a minimal example of using <code>USpoofChecker</code> to perform spoof detection on a >+ * string: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UChar* str = (UChar*) u"p\u0430ypal"; // with U+0430 CYRILLIC SMALL LETTER A >+ * >+ * // Get the default set of allowable characters: >+ * USet* allowed = uset_openEmpty(); >+ * uset_addAll(allowed, uspoof_getRecommendedSet(&status)); >+ * uset_addAll(allowed, uspoof_getInclusionSet(&status)); >+ * >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setAllowedChars(sc, allowed, &status); >+ * uspoof_setRestrictionLevel(sc, USPOOF_MODERATELY_RESTRICTIVE); >+ * >+ * int32_t bitmask = uspoof_check(sc, str, -1, NULL, &status); >+ * UBool result = bitmask != 0; >+ * // fails checks: 1 (status: U_ZERO_ERROR) >+ * printf("fails checks: %d (status: %s)\n", result, u_errorName(status)); >+ * uspoof_close(sc); >+ * uset_close(allowed); >+ * \endcode >+ * >+ * <p> >+ * As in the case for confusability checking, it is good practice to create one <code>USpoofChecker</code> instance at >+ * startup, and call the cheaper {@link uspoof_check} online. We specify the set of >+ * allowed characters to be those with type RECOMMENDED or INCLUSION, according to the recommendation in UTS 39. >+ * >+ * <p> >+ * In addition to {@link uspoof_check}, the function {@link uspoof_checkUTF8} is exposed for UTF8-encoded char* strings, >+ * and {@link uspoof_checkUnicodeString} is exposed for C++ programmers. >+ * >+ * <p> >+ * If the {@link USPOOF_AUX_INFO} check is enabled, a limited amount of information on why a string failed the checks >+ * is available in the returned bitmask. For complete information, use the {@link uspoof_check2} class of functions >+ * with a {@link USpoofCheckResult} parameter: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UChar* str = (UChar*) u"p\u0430ypal"; // with U+0430 CYRILLIC SMALL LETTER A >+ * >+ * // Get the default set of allowable characters: >+ * USet* allowed = uset_openEmpty(); >+ * uset_addAll(allowed, uspoof_getRecommendedSet(&status)); >+ * uset_addAll(allowed, uspoof_getInclusionSet(&status)); >+ * >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setAllowedChars(sc, allowed, &status); >+ * uspoof_setRestrictionLevel(sc, USPOOF_MODERATELY_RESTRICTIVE); >+ * >+ * USpoofCheckResult* checkResult = uspoof_openCheckResult(&status); >+ * int32_t bitmask = uspoof_check2(sc, str, -1, checkResult, &status); >+ * >+ * int32_t failures1 = bitmask; >+ * int32_t failures2 = uspoof_getCheckResultChecks(checkResult, &status); >+ * assert(failures1 == failures2); >+ * // checks that failed: 0x00000010 (status: U_ZERO_ERROR) >+ * printf("checks that failed: %#010x (status: %s)\n", failures1, u_errorName(status)); >+ * >+ * // Cleanup: >+ * uspoof_close(sc); >+ * uset_close(allowed); >+ * uspoof_closeCheckResult(checkResult); >+ * \endcode >+ * >+ * C++ users can take advantage of a few syntactical conveniences. The following snippet is functionally >+ * equivalent to the one above: >+ * >+ * \code{.cpp} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UnicodeString str((UChar*) u"p\u0430ypal"); // with U+0430 CYRILLIC SMALL LETTER A >+ * >+ * // Get the default set of allowable characters: >+ * UnicodeSet allowed; >+ * allowed.addAll(*uspoof_getRecommendedUnicodeSet(&status)); >+ * allowed.addAll(*uspoof_getInclusionUnicodeSet(&status)); >+ * >+ * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); >+ * uspoof_setAllowedChars(sc.getAlias(), allowed.toUSet(), &status); >+ * uspoof_setRestrictionLevel(sc.getAlias(), USPOOF_MODERATELY_RESTRICTIVE); >+ * >+ * LocalUSpoofCheckResultPointer checkResult(uspoof_openCheckResult(&status)); >+ * int32_t bitmask = uspoof_check2UnicodeString(sc.getAlias(), str, checkResult.getAlias(), &status); >+ * >+ * int32_t failures1 = bitmask; >+ * int32_t failures2 = uspoof_getCheckResultChecks(checkResult.getAlias(), &status); >+ * assert(failures1 == failures2); >+ * // checks that failed: 0x00000010 (status: U_ZERO_ERROR) >+ * printf("checks that failed: %#010x (status: %s)\n", failures1, u_errorName(status)); >+ * >+ * // Explicit cleanup not necessary. >+ * \endcode >+ * >+ * <p> >+ * The return value is a bitmask of the checks that failed. In this case, there was one check that failed: >+ * {@link USPOOF_RESTRICTION_LEVEL}, corresponding to the fifth bit (16). The possible checks are: >+ * >+ * <ul> >+ * <li><code>RESTRICTION_LEVEL</code>: flags strings that violate the >+ * <a href="http://unicode.org/reports/tr39/#Restriction_Level_Detection">Restriction Level</a> test as specified in UTS >+ * 39; in most cases, this means flagging strings that contain characters from multiple different scripts.</li> >+ * <li><code>INVISIBLE</code>: flags strings that contain invisible characters, such as zero-width spaces, or character >+ * sequences that are likely not to display, such as multiple occurrences of the same non-spacing mark.</li> >+ * <li><code>CHAR_LIMIT</code>: flags strings that contain characters outside of a specified set of acceptable >+ * characters. See {@link uspoof_setAllowedChars} and {@link uspoof_setAllowedLocales}.</li> >+ * <li><code>MIXED_NUMBERS</code>: flags strings that contain digits from multiple different numbering systems.</li> >+ * </ul> >+ * >+ * <p> >+ * These checks can be enabled independently of each other. For example, if you were interested in checking for only the >+ * INVISIBLE and MIXED_NUMBERS conditions, you could do: >+ * >+ * \code{.c} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UChar* str = (UChar*) u"8\u09EA"; // 8 mixed with U+09EA BENGALI DIGIT FOUR >+ * >+ * USpoofChecker* sc = uspoof_open(&status); >+ * uspoof_setChecks(sc, USPOOF_INVISIBLE | USPOOF_MIXED_NUMBERS, &status); >+ * >+ * int32_t bitmask = uspoof_check2(sc, str, -1, NULL, &status); >+ * UBool result = bitmask != 0; >+ * // fails checks: 1 (status: U_ZERO_ERROR) >+ * printf("fails checks: %d (status: %s)\n", result, u_errorName(status)); >+ * uspoof_close(sc); >+ * \endcode >+ * >+ * <p> >+ * Here is an example in C++ showing how to compute the restriction level of a string: >+ * >+ * \code{.cpp} >+ * UErrorCode status = U_ZERO_ERROR; >+ * UnicodeString str((UChar*) u"p\u0430ypal"); // with U+0430 CYRILLIC SMALL LETTER A >+ * >+ * // Get the default set of allowable characters: >+ * UnicodeSet allowed; >+ * allowed.addAll(*uspoof_getRecommendedUnicodeSet(&status)); >+ * allowed.addAll(*uspoof_getInclusionUnicodeSet(&status)); >+ * >+ * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); >+ * uspoof_setAllowedChars(sc.getAlias(), allowed.toUSet(), &status); >+ * uspoof_setRestrictionLevel(sc.getAlias(), USPOOF_MODERATELY_RESTRICTIVE); >+ * uspoof_setChecks(sc.getAlias(), USPOOF_RESTRICTION_LEVEL | USPOOF_AUX_INFO, &status); >+ * >+ * LocalUSpoofCheckResultPointer checkResult(uspoof_openCheckResult(&status)); >+ * int32_t bitmask = uspoof_check2UnicodeString(sc.getAlias(), str, checkResult.getAlias(), &status); >+ * >+ * URestrictionLevel restrictionLevel = uspoof_getCheckResultRestrictionLevel(checkResult.getAlias(), &status); >+ * // Since USPOOF_AUX_INFO was enabled, the restriction level is also available in the upper bits of the bitmask: >+ * assert((restrictionLevel & bitmask) == restrictionLevel); >+ * // Restriction level: 0x50000000 (status: U_ZERO_ERROR) >+ * printf("Restriction level: %#010x (status: %s)\n", restrictionLevel, u_errorName(status)); >+ * \endcode >+ * >+ * <p> >+ * The code '0x50000000' corresponds to the restriction level USPOOF_MINIMALLY_RESTRICTIVE. Since >+ * USPOOF_MINIMALLY_RESTRICTIVE is weaker than USPOOF_MODERATELY_RESTRICTIVE, the string fails the check. >+ * >+ * <p> >+ * <b>Note:</b> The Restriction Level is the most powerful of the checks. The full logic is documented in >+ * <a href="http://unicode.org/reports/tr39/#Restriction_Level_Detection">UTS 39</a>, but the basic idea is that strings >+ * are restricted to contain characters from only a single script, <em>except</em> that most scripts are allowed to have >+ * Latin characters interspersed. Although the default restriction level is <code>HIGHLY_RESTRICTIVE</code>, it is >+ * recommended that users set their restriction level to <code>MODERATELY_RESTRICTIVE</code>, which allows Latin mixed >+ * with all other scripts except Cyrillic, Greek, and Cherokee, with which it is often confusable. For more details on >+ * the levels, see UTS 39 or {@link URestrictionLevel}. The Restriction Level test is aware of the set of >+ * allowed characters set in {@link uspoof_setAllowedChars}. Note that characters which have script code >+ * COMMON or INHERITED, such as numbers and punctuation, are ignored when computing whether a string has multiple >+ * scripts. >+ * >+ * <h2>Additional Information</h2> >+ * >+ * <p> >+ * A <code>USpoofChecker</code> instance may be used repeatedly to perform checks on any number of identifiers. >+ * >+ * <p> >+ * <b>Thread Safety:</b> The test functions for checking a single identifier, or for testing whether >+ * two identifiers are possible confusable, are thread safe. They may called concurrently, from multiple threads, >+ * using the same USpoofChecker instance. >+ * >+ * <p> >+ * More generally, the standard ICU thread safety rules apply: functions that take a const USpoofChecker parameter are >+ * thread safe. Those that take a non-const USpoofChecker are not thread safe.. >+ * >+ * @stable ICU 4.6 > */ > > struct USpoofChecker; >+/** >+ * @stable ICU 4.2 >+ */ > typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker */ > >+struct USpoofCheckResult; >+/** >+ * @see uspoof_openCheckResult >+ * @stable ICU 58 >+ */ >+typedef struct USpoofCheckResult USpoofCheckResult; >+ > /** > * Enum for the kinds of checks that USpoofChecker can perform. > * These enum values are used both to select the set of checks that >@@ -160,45 +388,59 @@ typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker > * @stable ICU 4.2 > */ > typedef enum USpoofChecks { >- /** Single script confusable test. >- * When testing whether two identifiers are confusable, report that they are if >- * both are from the same script and they are visually confusable. >- * Note: this test is not applicable to a check of a single identifier. >- */ >+ /** >+ * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates >+ * that the two strings are visually confusable and that they are from the same script, according to UTS 39 section >+ * 4. >+ * >+ * @see uspoof_areConfusable >+ * @stable ICU 4.2 >+ */ > USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1, > >- /** Mixed script confusable test. >- * When checking a single identifier, report a problem if >- * the identifier contains multiple scripts, and >- * is confusable with some other identifier in a single script >- * When testing whether two identifiers are confusable, report that they are if >- * the two IDs are visually confusable, >- * and at least one contains characters from more than one script. >+ /** >+ * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates >+ * that the two strings are visually confusable and that they are <b>not</b> from the same script, according to UTS >+ * 39 section 4. >+ * >+ * @see uspoof_areConfusable >+ * @stable ICU 4.2 > */ > USPOOF_MIXED_SCRIPT_CONFUSABLE = 2, > >- /** Whole script confusable test. >- * When checking a single identifier, report a problem if >- * The identifier is of a single script, and >- * there exists a confusable identifier in another script. >- * When testing whether two identifiers are confusable, report that they are if >- * each is of a single script, >- * the scripts of the two identifiers are different, and >- * the identifiers are visually confusable. >+ /** >+ * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates >+ * that the two strings are visually confusable and that they are not from the same script but both of them are >+ * single-script strings, according to UTS 39 section 4. >+ * >+ * @see uspoof_areConfusable >+ * @stable ICU 4.2 > */ > USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4, >- >- /** Any Case Modifier for confusable identifier tests. >- If specified, consider all characters, of any case, when looking for confusables. >- If USPOOF_ANY_CASE is not specified, identifiers being checked are assumed to have been >- case folded. Upper case confusable characters will not be checked. >- Selects between Lower Case Confusable and >- Any Case Confusable. */ >+ >+ /** >+ * Enable this flag in {@link uspoof_setChecks} to turn on all types of confusables. You may set >+ * the checks to some subset of SINGLE_SCRIPT_CONFUSABLE, MIXED_SCRIPT_CONFUSABLE, or WHOLE_SCRIPT_CONFUSABLE to >+ * make {@link uspoof_areConfusable} return only those types of confusables. >+ * >+ * @see uspoof_areConfusable >+ * @see uspoof_getSkeleton >+ * @stable ICU 58 >+ */ >+ USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE, >+ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * This flag is deprecated and no longer affects the behavior of SpoofChecker. >+ * >+ * @deprecated ICU 58 Any case confusable mappings were removed from UTS 39; the corresponding ICU API was deprecated. >+ */ > USPOOF_ANY_CASE = 8, >+#endif /* U_HIDE_DEPRECATED_API */ > > /** > * Check that an identifier is no looser than the specified RestrictionLevel. >- * The default if uspoof_setRestrctionLevel() is not called is HIGHLY_RESTRICTIVE. >+ * The default if {@link uspoof_setRestrictionLevel} is not called is HIGHLY_RESTRICTIVE. > * > * If USPOOF_AUX_INFO is enabled the actual restriction level of the > * identifier being tested will also be returned by uspoof_check(). >@@ -211,7 +453,7 @@ typedef enum USpoofChecks { > */ > USPOOF_RESTRICTION_LEVEL = 16, > >-#ifndef U_HIDE_DEPRECATED_API >+#ifndef U_HIDE_DEPRECATED_API > /** Check that an identifier contains only characters from a > * single script (plus chars from the common and inherited scripts.) > * Applies to checks of a single identifier check only. >@@ -219,7 +461,7 @@ typedef enum USpoofChecks { > */ > USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL, > #endif /* U_HIDE_DEPRECATED_API */ >- >+ > /** Check an identifier for the presence of invisible characters, > * such as zero-width spaces, or character sequences that are > * likely not to display, such as multiple occurrences of the same >@@ -229,97 +471,119 @@ typedef enum USpoofChecks { > USPOOF_INVISIBLE = 32, > > /** Check that an identifier contains only characters from a specified set >- * of acceptable characters. See uspoof_setAllowedChars() and >- * uspoof_setAllowedLocales(). >+ * of acceptable characters. See {@link uspoof_setAllowedChars} and >+ * {@link uspoof_setAllowedLocales}. Note that a string that fails this check >+ * will also fail the {@link USPOOF_RESTRICTION_LEVEL} check. > */ > USPOOF_CHAR_LIMIT = 64, > > /** >- * Check that an identifier does not include decimal digits from >- * more than one numbering system. >- * >+ * Check that an identifier does not mix numbers from different numbering systems. >+ * For more information, see UTS 39 section 5.3. >+ * > * @stable ICU 51 > */ > USPOOF_MIXED_NUMBERS = 128, > > /** > * Enable all spoof checks. >- * >+ * > * @stable ICU 4.6 > */ > USPOOF_ALL_CHECKS = 0xFFFF, > > /** > * Enable the return of auxillary (non-error) information in the >- * upper bits of the check results value. >+ * upper bits of the check results value. > * >- * If this "check" is not enabled, the results of uspoof_check() will be zero when an >- * identifier passes all of the enabled checks. >+ * If this "check" is not enabled, the results of {@link uspoof_check} will be >+ * zero when an identifier passes all of the enabled checks. > * >- * If this "check" is enabled, (uspoof_check() & USPOOF_ALL_CHECKS) will be zero >- * when an identifier passes all checks. >+ * If this "check" is enabled, (uspoof_check() & {@link USPOOF_ALL_CHECKS}) will >+ * be zero when an identifier passes all checks. > * > * @stable ICU 51 > */ > USPOOF_AUX_INFO = 0x40000000 > > } USpoofChecks; >- >- >+ >+ > /** >- * Constants from UAX #39 for use in setRestrictionLevel(), and >+ * Constants from UAX #39 for use in {@link uspoof_setRestrictionLevel}, and > * for returned identifier restriction levels in check results. >+ * > * @stable ICU 51 >+ * >+ * @see uspoof_setRestrictionLevel >+ * @see uspoof_check > */ > typedef enum URestrictionLevel { > /** >- * Only ASCII characters: U+0000..U+007F >- * >+ * All characters in the string are in the identifier profile and all characters in the string are in the >+ * ASCII range. >+ * > * @stable ICU 51 > */ > USPOOF_ASCII = 0x10000000, > /** >- * All characters in each identifier must be from a single script. >- * >- * @stable ICU 53 >- */ >+ * The string classifies as ASCII-Only, or all characters in the string are in the identifier profile and >+ * the string is single-script, according to the definition in UTS 39 section 5.1. >+ * >+ * @stable ICU 53 >+ */ > USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000, > /** >- * All characters in each identifier must be from a single script, or from the combinations: Latin + Han + >- * Hiragana + Katakana; Latin + Han + Bopomofo; or Latin + Han + Hangul. Note that this level will satisfy the >- * vast majority of Latin-script users; also that TR36 has ASCII instead of Latin. >- * >+ * The string classifies as Single Script, or all characters in the string are in the identifier profile and >+ * the string is covered by any of the following sets of scripts, according to the definition in UTS 39 >+ * section 5.1: >+ * <ul> >+ * <li>Latin + Han + Bopomofo (or equivalently: Latn + Hanb)</li> >+ * <li>Latin + Han + Hiragana + Katakana (or equivalently: Latn + Jpan)</li> >+ * <li>Latin + Han + Hangul (or equivalently: Latn +Kore)</li> >+ * </ul> >+ * This is the default restriction in ICU. >+ * > * @stable ICU 51 > */ > USPOOF_HIGHLY_RESTRICTIVE = 0x30000000, > /** >- * Allow Latin with other scripts except Cyrillic, Greek, Cherokee Otherwise, the same as Highly Restrictive >- * >+ * The string classifies as Highly Restrictive, or all characters in the string are in the identifier profile >+ * and the string is covered by Latin and any one other Recommended or Aspirational script, except Cyrillic, >+ * Greek, and Cherokee. >+ * > * @stable ICU 51 > */ > USPOOF_MODERATELY_RESTRICTIVE = 0x40000000, > /** >- * Allow arbitrary mixtures of scripts. Otherwise, the same as Moderately Restrictive. >- * >+ * All characters in the string are in the identifier profile. Allow arbitrary mixtures of scripts. >+ * > * @stable ICU 51 > */ > USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000, > /** > * Any valid identifiers, including characters outside of the Identifier Profile. >- * >+ * > * @stable ICU 51 > */ > USPOOF_UNRESTRICTIVE = 0x60000000, > /** >- * Mask for selecting the Restriction Level bits from the return value of uspoof_check(). >- * >- * @stable ICU 53 >- */ >- USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000 >+ * Mask for selecting the Restriction Level bits from the return value of {@link uspoof_check}. >+ * >+ * @stable ICU 53 >+ */ >+ USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000, >+#ifndef U_HIDE_INTERNAL_API >+ /** >+ * An undefined restriction level. >+ * @internal >+ */ >+ USPOOF_UNDEFINED_RESTRICTIVE = -1 >+#endif /* U_HIDE_INTERNAL_API */ > } URestrictionLevel; > > /** >- * Create a Unicode Spoof Checker, configured to perform all >+ * Create a Unicode Spoof Checker, configured to perform all > * checks except for USPOOF_LOCALE_LIMIT and USPOOF_CHAR_LIMIT. > * Note that additional checks may be added in the future, > * resulting in the changes to the default checking behavior. >@@ -359,10 +623,10 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng > > /** > * Open a Spoof Checker from the source form of the spoof data. >- * The two inputs correspond to the Unicode data files confusables.txt >- * and confusablesWholeScript.txt as described in Unicode UAX #39. >- * The syntax of the source data is as described in UAX #39 for >- * these files, and the content of these files is acceptable input. >+ * The input corresponds to the Unicode data file confusables.txt >+ * as described in Unicode UAX #39. The syntax of the source data >+ * is as described in UAX #39 for this file, and the content of >+ * this file is acceptable input. > * > * The character encoding of the (char *) input text is UTF-8. > * >@@ -371,10 +635,9 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng > * @param confusablesLen The length of the confusables text, or -1 if the > * input string is zero terminated. > * @param confusablesWholeScript >- * a pointer to the whole script confusables definitions, >- * as found in the file confusablesWholeScript.txt from unicode.org. >- * @param confusablesWholeScriptLen The length of the whole script confusables text, or >- * -1 if the input string is zero terminated. >+ * Deprecated in ICU 58. No longer used. >+ * @param confusablesWholeScriptLen >+ * Deprecated in ICU 58. No longer used. > * @param errType In the event of an error in the input, indicates > * which of the input files contains the error. > * The value is one of USPOOF_SINGLE_SCRIPT_CONFUSABLE or >@@ -435,8 +698,33 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status); > > > /** >- * Specify the set of checks that will be performed by the check >- * functions of this Spoof Checker. >+ * Specify the bitmask of checks that will be performed by {@link uspoof_check}. Calling this method >+ * overwrites any checks that may have already been enabled. By default, all checks are enabled. >+ * >+ * To enable specific checks and disable all others, the "whitelisted" checks should be ORed together. For >+ * example, to fail strings containing characters outside of the set specified by {@link uspoof_setAllowedChars} and >+ * also strings that contain digits from mixed numbering systems: >+ * >+ * <pre> >+ * {@code >+ * uspoof_setChecks(USPOOF_CHAR_LIMIT | USPOOF_MIXED_NUMBERS); >+ * } >+ * </pre> >+ * >+ * To disable specific checks and enable all others, the "blacklisted" checks should be ANDed away from >+ * ALL_CHECKS. For example, if you are not planning to use the {@link uspoof_areConfusable} functionality, >+ * it is good practice to disable the CONFUSABLE check: >+ * >+ * <pre> >+ * {@code >+ * uspoof_setChecks(USPOOF_ALL_CHECKS & ~USPOOF_CONFUSABLE); >+ * } >+ * </pre> >+ * >+ * Note that methods such as {@link uspoof_setAllowedChars}, {@link uspoof_setAllowedLocales}, and >+ * {@link uspoof_setRestrictionLevel} will enable certain checks when called. Those methods will OR the check they >+ * enable onto the existing bitmask specified by this method. For more details, see the documentation of those >+ * methods. > * > * @param sc The USpoofChecker > * @param checks The set of checks that this spoof checker will perform. >@@ -451,7 +739,7 @@ uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status); > > /** > * Get the set of checks that this Spoof Checker has been configured to perform. >- * >+ * > * @param sc The USpoofChecker > * @param status The error code, set if this function encounters a problem. > * @return The set of checks that this spoof checker will perform. >@@ -464,19 +752,22 @@ U_STABLE int32_t U_EXPORT2 > uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status); > > /** >- * Set the loosest restriction level allowed. The default if this function >- * is not called is HIGHLY_RESTRICTIVE. >- * Calling this function also enables the RESTRICTION_LEVEL check. >- * @param restrictionLevel The loosest restriction level allowed. >- * @see URestrictionLevel >- * @stable ICU 51 >- */ >+ * Set the loosest restriction level allowed for strings. The default if this is not called is >+ * {@link USPOOF_HIGHLY_RESTRICTIVE}. Calling this method enables the {@link USPOOF_RESTRICTION_LEVEL} and >+ * {@link USPOOF_MIXED_NUMBERS} checks, corresponding to Sections 5.1 and 5.2 of UTS 39. To customize which checks are >+ * to be performed by {@link uspoof_check}, see {@link uspoof_setChecks}. >+ * >+ * @param sc The USpoofChecker >+ * @param restrictionLevel The loosest restriction level allowed. >+ * @see URestrictionLevel >+ * @stable ICU 51 >+ */ > U_STABLE void U_EXPORT2 > uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel); > > > /** >- * Get the Restriction Level that will be tested if the checks include RESTRICTION_LEVEL. >+ * Get the Restriction Level that will be tested if the checks include {@link USPOOF_RESTRICTION_LEVEL}. > * > * @return The restriction level > * @see URestrictionLevel >@@ -486,7 +777,7 @@ U_STABLE URestrictionLevel U_EXPORT2 > uspoof_getRestrictionLevel(const USpoofChecker *sc); > > /** >- * Limit characters that are acceptable in identifiers being checked to those >+ * Limit characters that are acceptable in identifiers being checked to those > * normally used with the languages associated with the specified locales. > * Any previously specified list of locales is replaced by the new settings. > * >@@ -499,7 +790,7 @@ uspoof_getRestrictionLevel(const USpoofChecker *sc); > * Supplying an empty string removes all restrictions; > * characters from any script will be allowed. > * >- * The USPOOF_CHAR_LIMIT test is automatically enabled for this >+ * The {@link USPOOF_CHAR_LIMIT} test is automatically enabled for this > * USpoofChecker when calling this function with a non-empty list > * of locales. > * >@@ -511,9 +802,9 @@ uspoof_getRestrictionLevel(const USpoofChecker *sc); > * can be made to the result of uspoof_setAllowedLocales() by > * fetching the resulting set with uspoof_getAllowedChars(), > * manipulating it with the Unicode Set API, then resetting the >- * spoof detectors limits with uspoof_setAllowedChars() >+ * spoof detectors limits with uspoof_setAllowedChars(). > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param localesList A list list of locales, from which the language > * and associated script are extracted. The locales > * are comma-separated if there is more than one. >@@ -537,18 +828,18 @@ uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode > * > * uspoof_setAllowedChars() will reset the list of allowed to be empty. > * >- * The format of the returned list is the same as that supplied to >- * uspoof_setAllowedLocales(), but returned list may not be identical >- * to the originally specified string; the string may be reformatted, >+ * The format of the returned list is the same as that supplied to >+ * uspoof_setAllowedLocales(), but returned list may not be identical >+ * to the originally specified string; the string may be reformatted, > * and information other than languages from > * the originally specified locales may be omitted. > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param status The error code, set if this function encounters a problem. > * @return A string containing a list of locales corresponding > * to the acceptable scripts, formatted like an > * HTTP Accept Language value. >- * >+ * > * @stable ICU 4.2 > */ > U_STABLE const char * U_EXPORT2 >@@ -564,7 +855,7 @@ uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status); > * The USPOOF_CHAR_LIMIT test is automatically enabled for this > * USpoofChecker by this function. > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param chars A Unicode Set containing the list of > * characters that are permitted. Ownership of the set > * remains with the caller. The incoming set is cloned by >@@ -591,7 +882,7 @@ uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status) > * or if a new set of allowed characters is specified. > * > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param status The error code, set if this function encounters a problem. > * @return A USet containing the characters that are permitted by > * the USPOOF_CHAR_LIMIT test. >@@ -611,7 +902,7 @@ uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status); > * The USPOOF_CHAR_LIMIT test is automatically enabled for this > * USoofChecker by this function. > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param chars A Unicode Set containing the list of > * characters that are permitted. Ownership of the set > * remains with the caller. The incoming set is cloned by >@@ -626,7 +917,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UEr > > /** > * Get a UnicodeSet for the characters permitted in an identifier. >- * This corresponds to the limits imposed by the Set Allowed Characters / >+ * This corresponds to the limits imposed by the Set Allowed Characters / > * UnicodeSet functions. Limitations imposed by other checks will not be > * reflected in the set returned by this function. > * >@@ -638,7 +929,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UEr > * or if a new set of allowed characters is specified. > * > * >- * @param sc The USpoofChecker >+ * @param sc The USpoofChecker > * @param status The error code, set if this function encounters a problem. > * @return A UnicodeSet containing the characters that are permitted by > * the USPOOF_CHAR_LIMIT test. >@@ -653,17 +944,22 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); > * Check the specified string for possible security issues. > * The text to be checked will typically be an identifier of some sort. > * The set of checks to be performed is specified with uspoof_setChecks(). >- * >- * @param sc The USpoofChecker >+ * >+ * \note >+ * Consider using the newer API, {@link uspoof_check2}, instead. >+ * The newer API exposes additional information from the check procedure >+ * and is otherwise identical to this method. >+ * >+ * @param sc The USpoofChecker > * @param id The identifier to be checked for possible security issues, > * in UTF-16 format. > * @param length the length of the string to be checked, expressed in >- * 16 bit UTF-16 code units, or -1 if the string is >+ * 16 bit UTF-16 code units, or -1 if the string is > * zero terminated. >- * @param position An out parameter. >- * Originally, the index of the first string position that failed a check. >- * Now, always returns zero. >- * This parameter may be null. >+ * @param position Deprecated in ICU 51. Always returns zero. >+ * Originally, an out parameter for the index of the first >+ * string position that failed a check. >+ * This parameter may be NULL. > * @param status The error code, set if an error occurred while attempting to > * perform the check. > * Spoofing or security issues detected with the input string are >@@ -673,11 +969,12 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); > * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) > * will be zero if the input string passes all of the > * enabled checks. >+ * @see uspoof_check2 > * @stable ICU 4.2 > */ > U_STABLE int32_t U_EXPORT2 > uspoof_check(const USpoofChecker *sc, >- const UChar *id, int32_t length, >+ const UChar *id, int32_t length, > int32_t *position, > UErrorCode *status); > >@@ -686,16 +983,20 @@ uspoof_check(const USpoofChecker *sc, > * Check the specified string for possible security issues. > * The text to be checked will typically be an identifier of some sort. > * The set of checks to be performed is specified with uspoof_setChecks(). >- * >- * @param sc The USpoofChecker >+ * >+ * \note >+ * Consider using the newer API, {@link uspoof_check2UTF8}, instead. >+ * The newer API exposes additional information from the check procedure >+ * and is otherwise identical to this method. >+ * >+ * @param sc The USpoofChecker > * @param id A identifier to be checked for possible security issues, in UTF8 format. >- * @param length the length of the string to be checked, or -1 if the string is >+ * @param length the length of the string to be checked, or -1 if the string is > * zero terminated. >- * @param position An out parameter. >- * Originally, the index of the first string position that failed a check. >- * Now, always returns zero. >- * This parameter may be null. >- * @deprecated ICU 51 >+ * @param position Deprecated in ICU 51. Always returns zero. >+ * Originally, an out parameter for the index of the first >+ * string position that failed a check. >+ * This parameter may be NULL. > * @param status The error code, set if an error occurred while attempting to > * perform the check. > * Spoofing or security issues detected with the input string are >@@ -707,6 +1008,7 @@ uspoof_check(const USpoofChecker *sc, > * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) > * will be zero if the input string passes all of the > * enabled checks. >+ * @see uspoof_check2UTF8 > * @stable ICU 4.2 > */ > U_STABLE int32_t U_EXPORT2 >@@ -721,14 +1023,18 @@ uspoof_checkUTF8(const USpoofChecker *sc, > * Check the specified string for possible security issues. > * The text to be checked will typically be an identifier of some sort. > * The set of checks to be performed is specified with uspoof_setChecks(). >- * >- * @param sc The USpoofChecker >+ * >+ * \note >+ * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead. >+ * The newer API exposes additional information from the check procedure >+ * and is otherwise identical to this method. >+ * >+ * @param sc The USpoofChecker > * @param id A identifier to be checked for possible security issues. >- * @param position An out parameter. >- * Originally, the index of the first string position that failed a check. >- * Now, always returns zero. >- * This parameter may be null. >- * @deprecated ICU 51 >+ * @param position Deprecated in ICU 51. Always returns zero. >+ * Originally, an out parameter for the index of the first >+ * string position that failed a check. >+ * This parameter may be NULL. > * @param status The error code, set if an error occurred while attempting to > * perform the check. > * Spoofing or security issues detected with the input string are >@@ -738,45 +1044,247 @@ uspoof_checkUTF8(const USpoofChecker *sc, > * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) > * will be zero if the input string passes all of the > * enabled checks. >+ * @see uspoof_check2UnicodeString > * @stable ICU 4.2 > */ > U_STABLE int32_t U_EXPORT2 > uspoof_checkUnicodeString(const USpoofChecker *sc, >- const icu::UnicodeString &id, >+ const icu::UnicodeString &id, > int32_t *position, > UErrorCode *status); >+#endif >+ >+ >+/** >+ * Check the specified string for possible security issues. >+ * The text to be checked will typically be an identifier of some sort. >+ * The set of checks to be performed is specified with uspoof_setChecks(). >+ * >+ * @param sc The USpoofChecker >+ * @param id The identifier to be checked for possible security issues, >+ * in UTF-16 format. >+ * @param length the length of the string to be checked, or -1 if the string is >+ * zero terminated. >+ * @param checkResult An instance of USpoofCheckResult to be filled with >+ * details about the identifier. Can be NULL. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. >+ * Spoofing or security issues detected with the input string are >+ * not reported here, but through the function's return value. >+ * @return An integer value with bits set for any potential security >+ * or spoofing issues detected. The bits are defined by >+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) >+ * will be zero if the input string passes all of the >+ * enabled checks. Any information in this bitmask will be >+ * consistent with the information saved in the optional >+ * checkResult parameter. >+ * @see uspoof_openCheckResult >+ * @see uspoof_check2UTF8 >+ * @see uspoof_check2UnicodeString >+ * @stable ICU 58 >+ */ >+U_STABLE int32_t U_EXPORT2 >+uspoof_check2(const USpoofChecker *sc, >+ const UChar* id, int32_t length, >+ USpoofCheckResult* checkResult, >+ UErrorCode *status); >+ >+/** >+ * Check the specified string for possible security issues. >+ * The text to be checked will typically be an identifier of some sort. >+ * The set of checks to be performed is specified with uspoof_setChecks(). >+ * >+ * This version of {@link uspoof_check} accepts a USpoofCheckResult, which >+ * returns additional information about the identifier. For more >+ * information, see {@link uspoof_openCheckResult}. >+ * >+ * @param sc The USpoofChecker >+ * @param id A identifier to be checked for possible security issues, in UTF8 format. >+ * @param length the length of the string to be checked, or -1 if the string is >+ * zero terminated. >+ * @param checkResult An instance of USpoofCheckResult to be filled with >+ * details about the identifier. Can be NULL. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. >+ * Spoofing or security issues detected with the input string are >+ * not reported here, but through the function's return value. >+ * @return An integer value with bits set for any potential security >+ * or spoofing issues detected. The bits are defined by >+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) >+ * will be zero if the input string passes all of the >+ * enabled checks. Any information in this bitmask will be >+ * consistent with the information saved in the optional >+ * checkResult parameter. >+ * @see uspoof_openCheckResult >+ * @see uspoof_check2 >+ * @see uspoof_check2UnicodeString >+ * @stable ICU 58 >+ */ >+U_STABLE int32_t U_EXPORT2 >+uspoof_check2UTF8(const USpoofChecker *sc, >+ const char *id, int32_t length, >+ USpoofCheckResult* checkResult, >+ UErrorCode *status); >+ >+#if U_SHOW_CPLUSPLUS_API >+/** >+ * Check the specified string for possible security issues. >+ * The text to be checked will typically be an identifier of some sort. >+ * The set of checks to be performed is specified with uspoof_setChecks(). >+ * >+ * @param sc The USpoofChecker >+ * @param id A identifier to be checked for possible security issues. >+ * @param checkResult An instance of USpoofCheckResult to be filled with >+ * details about the identifier. Can be NULL. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. >+ * Spoofing or security issues detected with the input string are >+ * not reported here, but through the function's return value. >+ * @return An integer value with bits set for any potential security >+ * or spoofing issues detected. The bits are defined by >+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) >+ * will be zero if the input string passes all of the >+ * enabled checks. Any information in this bitmask will be >+ * consistent with the information saved in the optional >+ * checkResult parameter. >+ * @see uspoof_openCheckResult >+ * @see uspoof_check2 >+ * @see uspoof_check2UTF8 >+ * @stable ICU 58 >+ */ >+U_STABLE int32_t U_EXPORT2 >+uspoof_check2UnicodeString(const USpoofChecker *sc, >+ const icu::UnicodeString &id, >+ USpoofCheckResult* checkResult, >+ UErrorCode *status); >+#endif >+ >+/** >+ * Create a USpoofCheckResult, used by the {@link uspoof_check2} class of functions to return >+ * information about the identifier. Information includes: >+ * <ul> >+ * <li>A bitmask of the checks that failed</li> >+ * <li>The identifier's restriction level (UTS 39 section 5.2)</li> >+ * <li>The set of numerics in the string (UTS 39 section 5.3)</li> >+ * </ul> >+ * The data held in a USpoofCheckResult is cleared whenever it is passed into a new call >+ * of {@link uspoof_check2}. >+ * >+ * @param status The error code, set if this function encounters a problem. >+ * @return the newly created USpoofCheckResult >+ * @see uspoof_check2 >+ * @see uspoof_check2UTF8 >+ * @see uspoof_check2UnicodeString >+ * @stable ICU 58 >+ */ >+U_STABLE USpoofCheckResult* U_EXPORT2 >+uspoof_openCheckResult(UErrorCode *status); >+ >+/** >+ * Close a USpoofCheckResult, freeing any memory that was being held by >+ * its implementation. >+ * >+ * @param checkResult The instance of USpoofCheckResult to close >+ * @stable ICU 58 >+ */ >+U_STABLE void U_EXPORT2 >+uspoof_closeCheckResult(USpoofCheckResult *checkResult); >+ >+#if U_SHOW_CPLUSPLUS_API >+ >+U_NAMESPACE_BEGIN >+ >+/** >+ * \class LocalUSpoofCheckResultPointer >+ * "Smart pointer" class, closes a USpoofCheckResult via {@link uspoof_closeCheckResult}. >+ * For most methods see the LocalPointerBase base class. >+ * >+ * @see LocalPointerBase >+ * @see LocalPointer >+ * @stable ICU 58 >+ */ >+U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult); >+ >+U_NAMESPACE_END > > #endif > >+/** >+ * Indicates which of the spoof check(s) have failed. The value is a bitwise OR of the constants for the tests >+ * in question: USPOOF_RESTRICTION_LEVEL, USPOOF_CHAR_LIMIT, and so on. >+ * >+ * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} >+ * @param status The error code, set if an error occurred. >+ * @return An integer value with bits set for any potential security >+ * or spoofing issues detected. The bits are defined by >+ * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) >+ * will be zero if the input string passes all of the >+ * enabled checks. >+ * @see uspoof_setChecks >+ * @stable ICU 58 >+ */ >+U_STABLE int32_t U_EXPORT2 >+uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status); >+ >+/** >+ * Gets the restriction level that the text meets, if the USPOOF_RESTRICTION_LEVEL check >+ * was enabled; otherwise, undefined. >+ * >+ * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} >+ * @param status The error code, set if an error occurred. >+ * @return The restriction level contained in the USpoofCheckResult >+ * @see uspoof_setRestrictionLevel >+ * @stable ICU 58 >+ */ >+U_STABLE URestrictionLevel U_EXPORT2 >+uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status); >+ >+/** >+ * Gets the set of numerics found in the string, if the USPOOF_MIXED_NUMBERS check was enabled; >+ * otherwise, undefined. The set will contain the zero digit from each decimal number system found >+ * in the input string. Ownership of the returned USet remains with the USpoofCheckResult. >+ * The USet will be free'd when {@link uspoof_closeCheckResult} is called. >+ * >+ * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} >+ * @return The set of numerics contained in the USpoofCheckResult >+ * @param status The error code, set if an error occurred. >+ * @stable ICU 58 >+ */ >+U_STABLE const USet* U_EXPORT2 >+uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status); >+ > > /** > * Check the whether two specified strings are visually confusable. >- * The types of confusability to be tested - single script, mixed script, >- * or whole script - are determined by the check options set for the >- * USpoofChecker. >- * >- * The tests to be performed are controlled by the flags >- * USPOOF_SINGLE_SCRIPT_CONFUSABLE >- * USPOOF_MIXED_SCRIPT_CONFUSABLE >- * USPOOF_WHOLE_SCRIPT_CONFUSABLE >- * At least one of these tests must be selected. >- * >- * USPOOF_ANY_CASE is a modifier for the tests. Select it if the identifiers >- * may be of mixed case. >- * If identifiers are case folded for comparison and >- * display to the user, do not select the USPOOF_ANY_CASE option. >+ * >+ * If the strings are confusable, the return value will be nonzero, as long as >+ * {@link USPOOF_CONFUSABLE} was enabled in uspoof_setChecks(). >+ * >+ * The bits in the return value correspond to flags for each of the classes of >+ * confusables applicable to the two input strings. According to UTS 39 >+ * section 4, the possible flags are: >+ * >+ * <ul> >+ * <li>{@link USPOOF_SINGLE_SCRIPT_CONFUSABLE}</li> >+ * <li>{@link USPOOF_MIXED_SCRIPT_CONFUSABLE}</li> >+ * <li>{@link USPOOF_WHOLE_SCRIPT_CONFUSABLE}</li> >+ * </ul> >+ * >+ * If one or more of the above flags were not listed in uspoof_setChecks(), this >+ * function will never report that class of confusable. The check >+ * {@link USPOOF_CONFUSABLE} enables all three flags. > * > * > * @param sc The USpoofChecker >- * @param id1 The first of the two identifiers to be compared for >+ * @param id1 The first of the two identifiers to be compared for > * confusability. The strings are in UTF-16 format. > * @param length1 the length of the first identifer, expressed in >- * 16 bit UTF-16 code units, or -1 if the string is >+ * 16 bit UTF-16 code units, or -1 if the string is > * nul terminated. >- * @param id2 The second of the two identifiers to be compared for >+ * @param id2 The second of the two identifiers to be compared for > * confusability. The identifiers are in UTF-16 format. > * @param length2 The length of the second identifiers, expressed in >- * 16 bit UTF-16 code units, or -1 if the string is >+ * 16 bit UTF-16 code units, or -1 if the string is > * nul terminated. > * @param status The error code, set if an error occurred while attempting to > * perform the check. >@@ -786,6 +1294,7 @@ uspoof_checkUnicodeString(const USpoofChecker *sc, > * the type of confusability found, as defined by > * enum USpoofChecks. Zero is returned if the identifiers > * are not confusable. >+ * > * @stable ICU 4.2 > */ > U_STABLE int32_t U_EXPORT2 >@@ -797,19 +1306,16 @@ uspoof_areConfusable(const USpoofChecker *sc, > > > /** >- * Check the whether two specified strings are visually confusable. >- * The types of confusability to be tested - single script, mixed script, >- * or whole script - are determined by the check options set for the >- * USpoofChecker. >+ * A version of {@link uspoof_areConfusable} accepting strings in UTF-8 format. > * > * @param sc The USpoofChecker >- * @param id1 The first of the two identifiers to be compared for >+ * @param id1 The first of the two identifiers to be compared for > * confusability. The strings are in UTF-8 format. >- * @param length1 the length of the first identifiers, in bytes, or -1 >+ * @param length1 the length of the first identifiers, in bytes, or -1 > * if the string is nul terminated. >- * @param id2 The second of the two identifiers to be compared for >+ * @param id2 The second of the two identifiers to be compared for > * confusability. The strings are in UTF-8 format. >- * @param length2 The length of the second string in bytes, or -1 >+ * @param length2 The length of the second string in bytes, or -1 > * if the string is nul terminated. > * @param status The error code, set if an error occurred while attempting to > * perform the check. >@@ -819,7 +1325,10 @@ uspoof_areConfusable(const USpoofChecker *sc, > * the type of confusability found, as defined by > * enum USpoofChecks. Zero is returned if the strings > * are not confusable. >+ * > * @stable ICU 4.2 >+ * >+ * @see uspoof_areConfusable > */ > U_STABLE int32_t U_EXPORT2 > uspoof_areConfusableUTF8(const USpoofChecker *sc, >@@ -832,15 +1341,12 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc, > > #if U_SHOW_CPLUSPLUS_API > /** >- * Check the whether two specified strings are visually confusable. >- * The types of confusability to be tested - single script, mixed script, >- * or whole script - are determined by the check options set for the >- * USpoofChecker. >+ * A version of {@link uspoof_areConfusable} accepting UnicodeStrings. > * > * @param sc The USpoofChecker >- * @param s1 The first of the two identifiers to be compared for >+ * @param s1 The first of the two identifiers to be compared for > * confusability. The strings are in UTF-8 format. >- * @param s2 The second of the two identifiers to be compared for >+ * @param s2 The second of the two identifiers to be compared for > * confusability. The strings are in UTF-8 format. > * @param status The error code, set if an error occurred while attempting to > * perform the check. >@@ -850,7 +1356,10 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc, > * the type of confusability found, as defined by > * enum USpoofChecks. Zero is returned if the identifiers > * are not confusable. >+ * > * @stable ICU 4.2 >+ * >+ * @see uspoof_areConfusable > */ > U_STABLE int32_t U_EXPORT2 > uspoof_areConfusableUnicodeString(const USpoofChecker *sc, >@@ -861,112 +1370,107 @@ uspoof_areConfusableUnicodeString(const USpoofChecker *sc, > > > /** >- * Get the "skeleton" for an identifier. >- * Skeletons are a transformation of the input identifier; >- * Two identifiers are confusable if their skeletons are identical. >- * See Unicode UAX #39 for additional information. >- * >- * Using skeletons directly makes it possible to quickly check >- * whether an identifier is confusable with any of some large >- * set of existing identifiers, by creating an efficiently >- * searchable collection of the skeletons. >- * >- * @param sc The USpoofChecker >- * @param type The type of skeleton, corresponding to which >- * of the Unicode confusable data tables to use. >- * The default is Mixed-Script, Lowercase. >- * Allowed options are USPOOF_SINGLE_SCRIPT_CONFUSABLE and >- * USPOOF_ANY_CASE. The two flags may be ORed. >- * @param id The input identifier whose skeleton will be computed. >- * @param length The length of the input identifier, expressed in 16 bit >- * UTF-16 code units, or -1 if the string is zero terminated. >- * @param dest The output buffer, to receive the skeleton string. >- * @param destCapacity The length of the output buffer, in 16 bit units. >- * The destCapacity may be zero, in which case the function will >- * return the actual length of the skeleton. >- * @param status The error code, set if an error occurred while attempting to >- * perform the check. >- * @return The length of the skeleton string. The returned length >- * is always that of the complete skeleton, even when the >- * supplied buffer is too small (or of zero length) >- * >- * @stable ICU 4.2 >- */ >+ * Get the "skeleton" for an identifier. >+ * Skeletons are a transformation of the input identifier; >+ * Two identifiers are confusable if their skeletons are identical. >+ * See Unicode UAX #39 for additional information. >+ * >+ * Using skeletons directly makes it possible to quickly check >+ * whether an identifier is confusable with any of some large >+ * set of existing identifiers, by creating an efficiently >+ * searchable collection of the skeletons. >+ * >+ * @param sc The USpoofChecker >+ * @param type Deprecated in ICU 58. You may pass any number. >+ * Originally, controlled which of the Unicode confusable data >+ * tables to use. >+ * @param id The input identifier whose skeleton will be computed. >+ * @param length The length of the input identifier, expressed in 16 bit >+ * UTF-16 code units, or -1 if the string is zero terminated. >+ * @param dest The output buffer, to receive the skeleton string. >+ * @param destCapacity The length of the output buffer, in 16 bit units. >+ * The destCapacity may be zero, in which case the function will >+ * return the actual length of the skeleton. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. >+ * @return The length of the skeleton string. The returned length >+ * is always that of the complete skeleton, even when the >+ * supplied buffer is too small (or of zero length) >+ * >+ * @stable ICU 4.2 >+ * @see uspoof_areConfusable >+ */ > U_STABLE int32_t U_EXPORT2 > uspoof_getSkeleton(const USpoofChecker *sc, > uint32_t type, > const UChar *id, int32_t length, > UChar *dest, int32_t destCapacity, > UErrorCode *status); >- >+ > /** >- * Get the "skeleton" for an identifier. >- * Skeletons are a transformation of the input identifier; >- * Two identifiers are confusable if their skeletons are identical. >- * See Unicode UAX #39 for additional information. >- * >- * Using skeletons directly makes it possible to quickly check >- * whether an identifier is confusable with any of some large >- * set of existing identifiers, by creating an efficiently >- * searchable collection of the skeletons. >- * >- * @param sc The USpoofChecker >- * @param type The type of skeleton, corresponding to which >- * of the Unicode confusable data tables to use. >- * The default is Mixed-Script, Lowercase. >- * Allowed options are USPOOF_SINGLE_SCRIPT_CONFUSABLE and >- * USPOOF_ANY_CASE. The two flags may be ORed. >- * @param id The UTF-8 format identifier whose skeleton will be computed. >- * @param length The length of the input string, in bytes, >- * or -1 if the string is zero terminated. >- * @param dest The output buffer, to receive the skeleton string. >- * @param destCapacity The length of the output buffer, in bytes. >- * The destCapacity may be zero, in which case the function will >- * return the actual length of the skeleton. >- * @param status The error code, set if an error occurred while attempting to >- * perform the check. Possible Errors include U_INVALID_CHAR_FOUND >- * for invalid UTF-8 sequences, and >- * U_BUFFER_OVERFLOW_ERROR if the destination buffer is too small >- * to hold the complete skeleton. >- * @return The length of the skeleton string, in bytes. The returned length >- * is always that of the complete skeleton, even when the >- * supplied buffer is too small (or of zero length) >- * >- * @stable ICU 4.2 >- */ >+ * Get the "skeleton" for an identifier. >+ * Skeletons are a transformation of the input identifier; >+ * Two identifiers are confusable if their skeletons are identical. >+ * See Unicode UAX #39 for additional information. >+ * >+ * Using skeletons directly makes it possible to quickly check >+ * whether an identifier is confusable with any of some large >+ * set of existing identifiers, by creating an efficiently >+ * searchable collection of the skeletons. >+ * >+ * @param sc The USpoofChecker >+ * @param type Deprecated in ICU 58. You may pass any number. >+ * Originally, controlled which of the Unicode confusable data >+ * tables to use. >+ * @param id The UTF-8 format identifier whose skeleton will be computed. >+ * @param length The length of the input string, in bytes, >+ * or -1 if the string is zero terminated. >+ * @param dest The output buffer, to receive the skeleton string. >+ * @param destCapacity The length of the output buffer, in bytes. >+ * The destCapacity may be zero, in which case the function will >+ * return the actual length of the skeleton. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. Possible Errors include U_INVALID_CHAR_FOUND >+ * for invalid UTF-8 sequences, and >+ * U_BUFFER_OVERFLOW_ERROR if the destination buffer is too small >+ * to hold the complete skeleton. >+ * @return The length of the skeleton string, in bytes. The returned length >+ * is always that of the complete skeleton, even when the >+ * supplied buffer is too small (or of zero length) >+ * >+ * @stable ICU 4.2 >+ */ > U_STABLE int32_t U_EXPORT2 > uspoof_getSkeletonUTF8(const USpoofChecker *sc, > uint32_t type, > const char *id, int32_t length, > char *dest, int32_t destCapacity, > UErrorCode *status); >- >+ > #if U_SHOW_CPLUSPLUS_API > /** >- * Get the "skeleton" for an identifier. >- * Skeletons are a transformation of the input identifier; >- * Two identifiers are confusable if their skeletons are identical. >- * See Unicode UAX #39 for additional information. >- * >- * Using skeletons directly makes it possible to quickly check >- * whether an identifier is confusable with any of some large >- * set of existing identifiers, by creating an efficiently >- * searchable collection of the skeletons. >- * >- * @param sc The USpoofChecker. >- * @param type The type of skeleton, corresponding to which >- * of the Unicode confusable data tables to use. >- * The default is Mixed-Script, Lowercase. >- * Allowed options are USPOOF_SINGLE_SCRIPT_CONFUSABLE and >- * USPOOF_ANY_CASE. The two flags may be ORed. >- * @param id The input identifier whose skeleton will be computed. >- * @param dest The output identifier, to receive the skeleton string. >- * @param status The error code, set if an error occurred while attempting to >- * perform the check. >- * @return A reference to the destination (skeleton) string. >- * >- * @stable ICU 4.2 >- */ >+ * Get the "skeleton" for an identifier. >+ * Skeletons are a transformation of the input identifier; >+ * Two identifiers are confusable if their skeletons are identical. >+ * See Unicode UAX #39 for additional information. >+ * >+ * Using skeletons directly makes it possible to quickly check >+ * whether an identifier is confusable with any of some large >+ * set of existing identifiers, by creating an efficiently >+ * searchable collection of the skeletons. >+ * >+ * @param sc The USpoofChecker. >+ * @param type Deprecated in ICU 58. You may pass any number. >+ * Originally, controlled which of the Unicode confusable data >+ * tables to use. >+ * @param id The input identifier whose skeleton will be computed. >+ * @param dest The output identifier, to receive the skeleton string. >+ * @param status The error code, set if an error occurred while attempting to >+ * perform the check. >+ * @return A reference to the destination (skeleton) string. >+ * >+ * @stable ICU 4.2 >+ */ > U_I18N_API icu::UnicodeString & U_EXPORT2 > uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, > uint32_t type, >@@ -977,7 +1481,8 @@ uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, > > /** > * Get the set of Candidate Characters for Inclusion in Identifiers, as defined >- * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Inclusion_in_Identifiers >+ * in http://unicode.org/Public/security/latest/xidmodifications.txt >+ * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. > * > * The returned set is frozen. Ownership of the set remains with the ICU library; it must not > * be deleted by the caller. >@@ -991,7 +1496,8 @@ uspoof_getInclusionSet(UErrorCode *status); > > /** > * Get the set of characters from Recommended Scripts for Inclusion in Identifiers, as defined >- * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_Scripts >+ * in http://unicode.org/Public/security/latest/xidmodifications.txt >+ * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. > * > * The returned set is frozen. Ownership of the set remains with the ICU library; it must not > * be deleted by the caller. >@@ -1007,7 +1513,8 @@ uspoof_getRecommendedSet(UErrorCode *status); > > /** > * Get the set of Candidate Characters for Inclusion in Identifiers, as defined >- * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Inclusion_in_Identifiers >+ * in http://unicode.org/Public/security/latest/xidmodifications.txt >+ * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. > * > * The returned set is frozen. Ownership of the set remains with the ICU library; it must not > * be deleted by the caller. >@@ -1021,7 +1528,8 @@ uspoof_getInclusionUnicodeSet(UErrorCode *status); > > /** > * Get the set of characters from Recommended Scripts for Inclusion in Identifiers, as defined >- * in Unicode UAX #31, http://www.unicode.org/reports/tr31/#Table_Recommended_Scripts >+ * in http://unicode.org/Public/security/latest/xidmodifications.txt >+ * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. > * > * The returned set is frozen. Ownership of the set remains with the ICU library; it must not > * be deleted by the caller. >@@ -1041,7 +1549,7 @@ uspoof_getRecommendedUnicodeSet(UErrorCode *status); > * instantiate a new Spoof Detector. > * > * The serialized spoof checker includes only the data compiled from the >- * Unicode data tables by uspoof_openFromSource(); it does not include >+ * Unicode data tables by uspoof_openFromSource(); it does not include > * include any other state or configuration that may have been set. > * > * @param sc the Spoof Detector whose data is to be serialized. >diff --git a/Source/WTF/icu/unicode/usprep.h b/Source/WTF/icu/unicode/usprep.h >index 638c32ee16e2b041dbfe21895d71f979af6b26dc..da0848dac1bb46c384cf0b2e416b99fcbc526458 100644 >--- a/Source/WTF/icu/unicode/usprep.h >+++ b/Source/WTF/icu/unicode/usprep.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: usprep.h >- * encoding: US-ASCII >+ * encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/ustring.h b/Source/WTF/icu/unicode/ustring.h >index 6d141e8df6338dc8e4ed0c9f44b76bb3ac51a057..3daa28e555e5db2774f3d2c51f74662699916334 100644 >--- a/Source/WTF/icu/unicode/ustring.h >+++ b/Source/WTF/icu/unicode/ustring.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** > * Copyright (C) 1998-2014, International Business Machines >@@ -495,16 +497,6 @@ u_strCompare(const UChar *s1, int32_t length1, > U_STABLE int32_t U_EXPORT2 > u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); > >-#ifndef U_COMPARE_CODE_POINT_ORDER >-/* see also unistr.h and unorm.h */ >-/** >- * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: >- * Compare strings in code point order instead of code unit order. >- * @stable ICU 2.2 >- */ >-#define U_COMPARE_CODE_POINT_ORDER 0x8000 >-#endif >- > /** > * Compare two strings case-insensitively using full case folding. > * This is equivalent to >diff --git a/Source/WTF/icu/unicode/ustringtrie.h b/Source/WTF/icu/unicode/ustringtrie.h >index 871d0f887a376555020e7b90202951ea34c2418e..fd85648225408c804cb3384bf871c44af7b8306a 100644 >--- a/Source/WTF/icu/unicode/ustringtrie.h >+++ b/Source/WTF/icu/unicode/ustringtrie.h >@@ -1,10 +1,12 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2010-2012, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * file name: udicttrie.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/utext.h b/Source/WTF/icu/unicode/utext.h >index d431913d35b31e87719c26479ab2215e64ff339e..33f2f4cf27b4ba6b4ef865af18f733cec87b6daf 100644 >--- a/Source/WTF/icu/unicode/utext.h >+++ b/Source/WTF/icu/unicode/utext.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utext.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -387,7 +389,7 @@ utext_equals(const UText *a, const UText *b); > > /***************************************************************************** > * >- * Functions to work with the text represeted by a UText wrapper >+ * Functions to work with the text represented by a UText wrapper > * > *****************************************************************************/ > >@@ -431,7 +433,7 @@ utext_isLengthExpensive(const UText *ut); > * > * The iteration position will be set to the start of the returned code point. > * >- * This function is roughly equivalent to the the sequence >+ * This function is roughly equivalent to the sequence > * utext_setNativeIndex(index); > * utext_current32(); > * (There is a subtle difference if the index is out of bounds by being less than zero - >@@ -590,7 +592,7 @@ U_STABLE void U_EXPORT2 > utext_setNativeIndex(UText *ut, int64_t nativeIndex); > > /** >- * Move the iterator postion by delta code points. The number of code points >+ * Move the iterator position by delta code points. The number of code points > * is a signed number; a negative delta will move the iterator backwards, > * towards the start of the text. > * <p> >@@ -609,7 +611,7 @@ U_STABLE UBool U_EXPORT2 > utext_moveIndex32(UText *ut, int32_t delta); > > /** >- * Get the native index of the character preceeding the current position. >+ * Get the native index of the character preceding the current position. > * If the iteration position is already at the start of the text, zero > * is returned. > * The value returned is the same as that obtained from the following sequence, >@@ -626,7 +628,7 @@ utext_moveIndex32(UText *ut, int32_t delta); > * native index of the character most recently returned from utext_next(). > * > * @param ut the text to be accessed >- * @return the native index of the character preceeding the current index position, >+ * @return the native index of the character preceding the current index position, > * or zero if the current position is at the start of the text. > * @stable ICU 3.6 > */ >@@ -766,7 +768,7 @@ utext_extract(UText *ut, > */ > #define UTEXT_SETNATIVEINDEX(ut, ix) \ > { int64_t __offset = (ix) - (ut)->chunkNativeStart; \ >- if (__offset>=0 && __offset<=(int64_t)(ut)->nativeIndexingLimit) { \ >+ if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ > (ut)->chunkOffset=(int32_t)__offset; \ > } else { \ > utext_setNativeIndex((ut), (ix)); } } >@@ -1052,7 +1054,7 @@ UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); > * be NUL-terminated if there is sufficient space in the destination buffer. > * > * @param ut the UText from which to extract data. >- * @param nativeStart the native index of the first characer to extract. >+ * @param nativeStart the native index of the first character to extract. > * @param nativeLimit the native string index of the position following the last > * character to extract. > * @param dest the UChar (UTF-16) buffer into which the extracted text is placed >@@ -1209,7 +1211,7 @@ UTextClose(UText *ut); > struct UTextFuncs { > /** > * (public) Function table size, sizeof(UTextFuncs) >- * Intended for use should the table grow to accomodate added >+ * Intended for use should the table grow to accommodate added > * functions in the future, to allow tests for older format > * function tables that do not contain the extensions. > * >@@ -1343,7 +1345,7 @@ typedef struct UTextFuncs UTextFuncs; > struct UText { > /** > * (private) Magic. Used to help detect when UText functions are handed >- * invalid or unitialized UText structs. >+ * invalid or uninitialized UText structs. > * utext_openXYZ() functions take an initialized, > * but not necessarily open, UText struct as an > * optional fill-in parameter. This magic field >@@ -1365,7 +1367,7 @@ struct UText { > > > /** >- * Text provider properties. This set of flags is maintainted by the >+ * Text provider properties. This set of flags is maintained by the > * text provider implementation. > * @stable ICU 3.4 > */ >diff --git a/Source/WTF/icu/unicode/utf.h b/Source/WTF/icu/unicode/utf.h >index f5954fe9fe699893bd318e24772926c175a20c74..ef512997f05a15aca1b6a4ac36755de1d2b71088 100644 >--- a/Source/WTF/icu/unicode/utf.h >+++ b/Source/WTF/icu/unicode/utf.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utf.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -21,9 +23,6 @@ > * This file defines macros for checking whether a code point is > * a surrogate or a non-character etc. > * >- * The UChar and UChar32 data types for Unicode code units and code points >- * are defined in umachine.h because they can be machine-dependent. >- * > * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h > * and itself includes utf8.h and utf16.h after some > * common definitions. >@@ -48,11 +47,11 @@ > * but are optimized for the much more frequently occurring BMP code points. > * > * umachine.h defines UChar to be an unsigned 16-bit integer. >- * Where available, UChar is defined to be a char16_t >- * or a wchar_t (if that is an unsigned 16-bit type), otherwise uint16_t. >+ * Since ICU 59, ICU uses char16_t in C++, UChar only in C, >+ * and defines UChar=char16_t by default. See the UChar API docs for details. > * > * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit >- * Unicode code point (Unicode scalar value, 0..0x10ffff). >+ * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). > * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as > * the definition of UChar. For details see the documentation for UChar32 itself. > * >@@ -61,11 +60,20 @@ > * For actual Unicode character properties see uchar.h. > * > * By default, string operations must be done with error checking in case >- * a string is not well-formed UTF-16. >- * The macros will detect if a surrogate code unit is unpaired >+ * a string is not well-formed UTF-16 or UTF-8. >+ * >+ * The U16_ macros detect if a surrogate code unit is unpaired > * (lead unit without trail unit or vice versa) and just return the unit itself > * as the code point. > * >+ * The U8_ macros detect illegal byte sequences and return a negative value. >+ * Starting with ICU 60, the observable length of a single illegal byte sequence >+ * skipped by one of these macros follows the Unicode 6+ recommendation >+ * which is consistent with the W3C Encoding Standard. >+ * >+ * There are ..._OR_FFFD versions of both U16_ and U8_ macros >+ * that return U+FFFD for illegal code unit sequences. >+ * > * The regular "safe" macros require that the initial, passed-in string index > * is within bounds. They only check the index when they read more than one > * code unit. This is usually done with code similar to the following loop: >@@ -89,10 +97,7 @@ > * The performance differences are much larger here because UTF-8 provides so > * many opportunities for malformed sequences. > * The unsafe UTF-8 macros are entirely implemented inside the macro definitions >- * and are fast, while the safe UTF-8 macros call functions for all but the >- * trivial (ASCII) cases. >- * (ICU 3.6 optimizes U8_NEXT() and U8_APPEND() to handle most other common >- * characters inline as well.) >+ * and are fast, while the safe UTF-8 macros call functions for some complicated cases. > * > * Unlike with UTF-16, malformed sequences cannot be expressed with distinct > * code point values (0..U+10ffff). They are indicated with negative values instead. >@@ -124,8 +129,7 @@ > */ > #define U_IS_UNICODE_NONCHAR(c) \ > ((c)>=0xfdd0 && \ >- ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ >- (uint32_t)(c)<=0x10ffff) >+ ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff) > > /** > * Is c a Unicode code point value (0..U+10ffff) >@@ -146,9 +150,7 @@ > */ > #define U_IS_UNICODE_CHAR(c) \ > ((uint32_t)(c)<0xd800 || \ >- ((uint32_t)(c)>0xdfff && \ >- (uint32_t)(c)<=0x10ffff && \ >- !U_IS_UNICODE_NONCHAR(c))) >+ (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c))) > > /** > * Is this code point a BMP code point (U+0000..U+ffff)? >diff --git a/Source/WTF/icu/unicode/utf16.h b/Source/WTF/icu/unicode/utf16.h >index bdd88a8b9c4f00ea0df272ac02f6967ef61089b6..35fd09861143cdfb1fb0002ade64e1a734927498 100644 >--- a/Source/WTF/icu/unicode/utf16.h >+++ b/Source/WTF/icu/unicode/utf16.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utf16.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -183,8 +185,8 @@ > * > * The length can be negative for a NUL-terminated string. > * >- * If the offset points to a single, unpaired surrogate, then that itself >- * will be returned as the code point. >+ * If the offset points to a single, unpaired surrogate, then >+ * c is set to that unpaired surrogate. > * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. > * > * @param s const UChar * string >@@ -211,6 +213,53 @@ > } \ > } > >+#ifndef U_HIDE_DRAFT_API >+ >+/** >+ * Get a code point from a string at a random-access offset, >+ * without changing the offset. >+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries. >+ * >+ * The offset may point to either the lead or trail surrogate unit >+ * for a supplementary code point, in which case the macro will read >+ * the adjacent matching surrogate as well. >+ * >+ * The length can be negative for a NUL-terminated string. >+ * >+ * If the offset points to a single, unpaired surrogate, then >+ * c is set to U+FFFD. >+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD. >+ * >+ * @param s const UChar * string >+ * @param start starting string offset (usually 0) >+ * @param i string offset, must be start<=i<length >+ * @param length string length >+ * @param c output UChar32 variable >+ * @see U16_GET_UNSAFE >+ * @draft ICU 60 >+ */ >+#define U16_GET_OR_FFFD(s, start, i, length, c) { \ >+ (c)=(s)[i]; \ >+ if(U16_IS_SURROGATE(c)) { \ >+ uint16_t __c2; \ >+ if(U16_IS_SURROGATE_LEAD(c)) { \ >+ if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \ >+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ >+ } else { \ >+ (c)=0xfffd; \ >+ } \ >+ } else { \ >+ if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ >+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ >+ } else { \ >+ (c)=0xfffd; \ >+ } \ >+ } \ >+ } \ >+} >+ >+#endif // U_HIDE_DRAFT_API >+ > /* definitions with forward iteration --------------------------------------- */ > > /** >@@ -251,8 +300,7 @@ > * for a supplementary code point, in which case the macro will read > * the following trail surrogate as well. > * If the offset points to a trail surrogate or >- * to a single, unpaired lead surrogate, then that itself >- * will be returned as the code point. >+ * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate. > * > * @param s const UChar * string > * @param i string offset, must be i<length >@@ -272,6 +320,44 @@ > } \ > } > >+#ifndef U_HIDE_DRAFT_API >+ >+/** >+ * Get a code point from a string at a code point boundary offset, >+ * and advance the offset to the next code point boundary. >+ * (Post-incrementing forward iteration.) >+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries. >+ * >+ * The length can be negative for a NUL-terminated string. >+ * >+ * The offset may point to the lead surrogate unit >+ * for a supplementary code point, in which case the macro will read >+ * the following trail surrogate as well. >+ * If the offset points to a trail surrogate or >+ * to a single, unpaired lead surrogate, then c is set to U+FFFD. >+ * >+ * @param s const UChar * string >+ * @param i string offset, must be i<length >+ * @param length string length >+ * @param c output UChar32 variable >+ * @see U16_NEXT_UNSAFE >+ * @draft ICU 60 >+ */ >+#define U16_NEXT_OR_FFFD(s, i, length, c) { \ >+ (c)=(s)[(i)++]; \ >+ if(U16_IS_SURROGATE(c)) { \ >+ uint16_t __c2; \ >+ if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ >+ ++(i); \ >+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ >+ } else { \ >+ (c)=0xfffd; \ >+ } \ >+ } \ >+} >+ >+#endif // U_HIDE_DRAFT_API >+ > /** > * Append a code point to a string, overwriting 1 or 2 code units. > * The offset points to the current end of the string contents >@@ -479,8 +565,7 @@ > * for a supplementary code point, then the macro will read > * the preceding lead surrogate as well. > * If the offset is behind a lead surrogate or behind a single, unpaired >- * trail surrogate, then that itself >- * will be returned as the code point. >+ * trail surrogate, then c is set to that unpaired surrogate. > * > * @param s const UChar * string > * @param start starting string offset (usually 0) >@@ -500,6 +585,43 @@ > } \ > } > >+#ifndef U_HIDE_DRAFT_API >+ >+/** >+ * Move the string offset from one code point boundary to the previous one >+ * and get the code point between them. >+ * (Pre-decrementing backward iteration.) >+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries. >+ * >+ * The input offset may be the same as the string length. >+ * If the offset is behind a trail surrogate unit >+ * for a supplementary code point, then the macro will read >+ * the preceding lead surrogate as well. >+ * If the offset is behind a lead surrogate or behind a single, unpaired >+ * trail surrogate, then c is set to U+FFFD. >+ * >+ * @param s const UChar * string >+ * @param start starting string offset (usually 0) >+ * @param i string offset, must be start<i >+ * @param c output UChar32 variable >+ * @see U16_PREV_UNSAFE >+ * @draft ICU 60 >+ */ >+#define U16_PREV_OR_FFFD(s, start, i, c) { \ >+ (c)=(s)[--(i)]; \ >+ if(U16_IS_SURROGATE(c)) { \ >+ uint16_t __c2; \ >+ if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ >+ --(i); \ >+ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ >+ } else { \ >+ (c)=0xfffd; \ >+ } \ >+ } \ >+} >+ >+#endif // U_HIDE_DRAFT_API >+ > /** > * Move the string offset from one code point boundary to the previous one. > * (Pre-decrementing backward iteration.) >diff --git a/Source/WTF/icu/unicode/utf32.h b/Source/WTF/icu/unicode/utf32.h >index bf63e69dba00c79e74048f5655dc81c6698cec1a..8822c4dd0962c8ee8f62ba0f8abf448f04d5ab22 100644 >--- a/Source/WTF/icu/unicode/utf32.h >+++ b/Source/WTF/icu/unicode/utf32.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utf32.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/utf8.h b/Source/WTF/icu/unicode/utf8.h >index 7bd0b0e85260f020a885d59abc24bf305097d25b..df08d341ab868afbb6782f93b7d650df2b72e0cb 100644 >--- a/Source/WTF/icu/unicode/utf8.h >+++ b/Source/WTF/icu/unicode/utf8.h >@@ -1,12 +1,14 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >-* Copyright (C) 1999-2014, International Business Machines >+* Copyright (C) 1999-2015, International Business Machines > * Corporation and others. All Rights Reserved. > * > ******************************************************************************* > * file name: utf8.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -39,52 +41,24 @@ > > /* internal definitions ----------------------------------------------------- */ > >-/** >- * \var utf8_countTrailBytes >- * Internal array with numbers of trail bytes for any given byte used in >- * lead byte position. >- * >- * This is internal since it is not meant to be called directly by external clients; >- * however it is called by public macros in this file and thus must remain stable, >- * and should not be hidden when other internal functions are hidden (otherwise >- * public macros would fail to compile). >- * @internal >- */ >-#ifdef U_UTF8_IMPL >-U_EXPORT const uint8_t >-#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) >-U_CFUNC const uint8_t >-#else >-U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ >-#endif >-utf8_countTrailBytes[256]; >- > /** > * Counts the trail bytes for a UTF-8 lead byte. >- * Returns 0 for 0..0xbf as well as for 0xfe and 0xff. >+ * Returns 0 for 0..0xc1 as well as for 0xf5..0xff. >+ * leadByte might be evaluated multiple times. > * > * This is internal since it is not meant to be called directly by external clients; > * however it is called by public macros in this file and thus must remain stable. > * >- * Note: Beginning with ICU 50, the implementation uses a multi-condition expression >- * which was shown in 2012 (on x86-64) to compile to fast, branch-free code. >- * leadByte is evaluated multiple times. >- * >- * The pre-ICU 50 implementation used the exported array utf8_countTrailBytes: >- * #define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[leadByte]) >- * leadByte was evaluated exactly once. >- * > * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff. > * @internal > */ > #define U8_COUNT_TRAIL_BYTES(leadByte) \ >- ((uint8_t)(leadByte)<0xf0 ? \ >- ((uint8_t)(leadByte)>=0xc0)+((uint8_t)(leadByte)>=0xe0) : \ >- (uint8_t)(leadByte)<0xfe ? 3+((uint8_t)(leadByte)>=0xf8)+((uint8_t)(leadByte)>=0xfc) : 0) >+ (U8_IS_LEAD(leadByte) ? \ >+ ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0) > > /** > * Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence. >- * The maximum supported lead byte is 0xf4 corresponding to U+10FFFF. >+ * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff. > * leadByte might be evaluated multiple times. > * > * This is internal since it is not meant to be called directly by external clients; >@@ -94,7 +68,7 @@ utf8_countTrailBytes[256]; > * @internal > */ > #define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \ >- (((leadByte)>=0xc0)+((leadByte)>=0xe0)+((leadByte)>=0xf0)) >+ (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)) > > /** > * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. >@@ -105,6 +79,40 @@ utf8_countTrailBytes[256]; > */ > #define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) > >+/** >+ * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1. >+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. >+ * Lead byte E0..EF bits 3..0 are used as byte index, >+ * first trail byte bits 7..5 are used as bit index into that byte. >+ * @see U8_IS_VALID_LEAD3_AND_T1 >+ * @internal >+ */ >+#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30" >+ >+/** >+ * Internal 3-byte UTF-8 validity check. >+ * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence. >+ * @internal >+ */ >+#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5))) >+ >+/** >+ * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1. >+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. >+ * First trail byte bits 7..4 are used as byte index, >+ * lead byte F0..F4 bits 2..0 are used as bit index into that byte. >+ * @see U8_IS_VALID_LEAD4_AND_T1 >+ * @internal >+ */ >+#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00" >+ >+/** >+ * Internal 4-byte UTF-8 validity check. >+ * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence. >+ * @internal >+ */ >+#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7))) >+ > /** > * Function for handling "next code point" with error-checking. > * >@@ -164,20 +172,21 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > #define U8_IS_SINGLE(c) (((c)&0x80)==0) > > /** >- * Is this code unit (byte) a UTF-8 lead byte? >+ * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4) > * @param c 8-bit code unit (byte) > * @return TRUE or FALSE > * @stable ICU 2.4 > */ >-#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e) >+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32) >+// 0x32=0xf4-0xc2 > > /** >- * Is this code unit (byte) a UTF-8 trail byte? >+ * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF) > * @param c 8-bit code unit (byte) > * @return TRUE or FALSE > * @stable ICU 2.4 > */ >-#define U8_IS_TRAIL(c) (((c)&0xc0)==0x80) >+#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40) > > /** > * How many code units (bytes) are used for the UTF-8 encoding >@@ -305,7 +314,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > */ > #define U8_NEXT_UNSAFE(s, i, c) { \ > (c)=(uint8_t)(s)[(i)++]; \ >- if((c)>=0x80) { \ >+ if(!U8_IS_SINGLE(c)) { \ > if((c)<0xe0) { \ > (c)=(((c)&0x1f)<<6)|((s)[(i)++]&0x3f); \ > } else if((c)<0xf0) { \ >@@ -341,22 +350,19 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > */ > #define U8_NEXT(s, i, length, c) { \ > (c)=(uint8_t)(s)[(i)++]; \ >- if((c)>=0x80) { \ >+ if(!U8_IS_SINGLE(c)) { \ > uint8_t __t1, __t2; \ >- if( /* handle U+1000..U+CFFF inline */ \ >- (0xe0<(c) && (c)<=0xec) && \ >- (((i)+1)<(length) || (length)<0) && \ >- (__t1=(uint8_t)((s)[i]-0x80))<=0x3f && \ >- (__t2=(uint8_t)((s)[(i)+1]-0x80))<= 0x3f \ >- ) { \ >- /* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \ >- (c)=(UChar)(((c)<<12)|(__t1<<6)|__t2); \ >+ if( /* handle U+0800..U+FFFF inline */ \ >+ (0xe0<=(c) && (c)<0xf0) && \ >+ (((i)+1)<(length) || (length)<0) && \ >+ U8_IS_VALID_LEAD3_AND_T1((c), __t1=(s)[i]) && \ >+ (__t2=(s)[(i)+1]-0x80)<=0x3f) { \ >+ (c)=(((c)&0xf)<<12)|((__t1&0x3f)<<6)|__t2; \ > (i)+=2; \ > } else if( /* handle U+0080..U+07FF inline */ \ >- ((c)<0xe0 && (c)>=0xc2) && \ >- ((i)!=(length)) && \ >- (__t1=(uint8_t)((s)[i]-0x80))<=0x3f \ >- ) { \ >+ ((c)<0xe0 && (c)>=0xc2) && \ >+ ((i)!=(length)) && \ >+ (__t1=(s)[i]-0x80)<=0x3f) { \ > (c)=(((c)&0x1f)<<6)|__t1; \ > ++(i); \ > } else { \ >@@ -392,22 +398,19 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > */ > #define U8_NEXT_OR_FFFD(s, i, length, c) { \ > (c)=(uint8_t)(s)[(i)++]; \ >- if((c)>=0x80) { \ >+ if(!U8_IS_SINGLE(c)) { \ > uint8_t __t1, __t2; \ >- if( /* handle U+1000..U+CFFF inline */ \ >- (0xe0<(c) && (c)<=0xec) && \ >- (((i)+1)<(length) || (length)<0) && \ >- (__t1=(uint8_t)((s)[i]-0x80))<=0x3f && \ >- (__t2=(uint8_t)((s)[(i)+1]-0x80))<= 0x3f \ >- ) { \ >- /* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \ >- (c)=(UChar)(((c)<<12)|(__t1<<6)|__t2); \ >+ if( /* handle U+0800..U+FFFF inline */ \ >+ (0xe0<=(c) && (c)<0xf0) && \ >+ (((i)+1)<(length) || (length)<0) && \ >+ U8_IS_VALID_LEAD3_AND_T1((c), __t1=(s)[i]) && \ >+ (__t2=(s)[(i)+1]-0x80)<=0x3f) { \ >+ (c)=(((c)&0xf)<<12)|((__t1&0x3f)<<6)|__t2; \ > (i)+=2; \ > } else if( /* handle U+0080..U+07FF inline */ \ >- ((c)<0xe0 && (c)>=0xc2) && \ >- ((i)!=(length)) && \ >- (__t1=(uint8_t)((s)[i]-0x80))<=0x3f \ >- ) { \ >+ ((c)<0xe0 && (c)>=0xc2) && \ >+ ((i)!=(length)) && \ >+ (__t1=(s)[i]-0x80)<=0x3f) { \ > (c)=(((c)&0x1f)<<6)|__t1; \ > ++(i); \ > } else { \ >@@ -492,7 +495,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > * @stable ICU 2.4 > */ > #define U8_FWD_1_UNSAFE(s, i) { \ >- (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((uint8_t)(s)[i]); \ >+ (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \ > } > > /** >@@ -509,15 +512,24 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > * @stable ICU 2.4 > */ > #define U8_FWD_1(s, i, length) { \ >- uint8_t __b=(uint8_t)(s)[(i)++]; \ >- if(U8_IS_LEAD(__b)) { \ >- uint8_t __count=U8_COUNT_TRAIL_BYTES(__b); \ >- if((i)+__count>(length) && (length)>=0) { \ >- __count=(uint8_t)((length)-(i)); \ >- } \ >- while(__count>0 && U8_IS_TRAIL((s)[i])) { \ >- ++(i); \ >- --__count; \ >+ uint8_t __b=(s)[(i)++]; \ >+ if(U8_IS_LEAD(__b) && (i)!=(length)) { \ >+ uint8_t __t1=(s)[i]; \ >+ if((0xe0<=__b && __b<0xf0)) { \ >+ if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \ >+ ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ >+ ++(i); \ >+ } \ >+ } else if(__b<0xe0) { \ >+ if(U8_IS_TRAIL(__t1)) { \ >+ ++(i); \ >+ } \ >+ } else /* c>=0xf0 */ { \ >+ if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \ >+ ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \ >+ ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ >+ ++(i); \ >+ } \ > } \ > } \ > } >@@ -631,7 +643,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > /* c is a trail byte */ \ > (c)&=0x3f; \ > for(;;) { \ >- __b=(uint8_t)(s)[--(i)]; \ >+ __b=(s)[--(i)]; \ > if(__b>=0xc0) { \ > U8_MASK_LEAD_BYTE(__b, __count); \ > (c)|=(UChar32)__b<<__shift; \ >@@ -667,7 +679,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > */ > #define U8_PREV(s, start, i, c) { \ > (c)=(uint8_t)(s)[--(i)]; \ >- if((c)>=0x80) { \ >+ if(!U8_IS_SINGLE(c)) { \ > (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \ > } \ > } >@@ -698,7 +710,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > */ > #define U8_PREV_OR_FFFD(s, start, i, c) { \ > (c)=(uint8_t)(s)[--(i)]; \ >- if((c)>=0x80) { \ >+ if(!U8_IS_SINGLE(c)) { \ > (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \ > } \ > } >@@ -815,7 +827,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); > * @stable ICU 2.4 > */ > #define U8_SET_CP_LIMIT(s, start, i, length) { \ >- if((start)<(i) && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \ >+ if((start)<(i) && ((i)<(length) || (length)<0)) { \ > U8_BACK_1(s, start, i); \ > U8_FWD_1(s, i, length); \ > } \ >diff --git a/Source/WTF/icu/unicode/utf_old.h b/Source/WTF/icu/unicode/utf_old.h >index f9125b1dd2ed7e1c684da1654f5e47dd7cd5fb14..55c17c01df6db34f1a5041263f4dc5627f7537f3 100644 >--- a/Source/WTF/icu/unicode/utf_old.h >+++ b/Source/WTF/icu/unicode/utf_old.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utf_old.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -15,12 +17,12 @@ > */ > > /** >- * \file >+ * \file > * \brief C API: Deprecated macros for Unicode string handling > */ > > /** >- * >+ * > * The macros in utf_old.h are all deprecated and their use discouraged. > * Some of the design principles behind the set of UTF macros > * have changed or proved impractical. >@@ -143,7 +145,22 @@ > #ifndef __UTF_OLD_H__ > #define __UTF_OLD_H__ > >-#ifndef U_HIDE_DEPRECATED_API >+/** >+ * \def U_HIDE_OBSOLETE_UTF_OLD_H >+ * >+ * Hides the obsolete definitions in unicode/utf_old.h. >+ * Recommended to be set to 1 at compile time to make sure >+ * the long-deprecated macros are no longer used. >+ * >+ * For reasons for the deprecation see the utf_old.h file comments. >+ * >+ * @internal >+ */ >+#ifndef U_HIDE_OBSOLETE_UTF_OLD_H >+# define U_HIDE_OBSOLETE_UTF_OLD_H 0 >+#endif >+ >+#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H > > #include "unicode/utf.h" > #include "unicode/utf8.h" >@@ -265,6 +282,25 @@ typedef int32_t UTextOffset; > > /* Formerly utf8.h ---------------------------------------------------------- */ > >+/** >+* \var utf8_countTrailBytes >+* Internal array with numbers of trail bytes for any given byte used in >+* lead byte position. >+* >+* This is internal since it is not meant to be called directly by external clients; >+* however it is called by public macros in this file and thus must remain stable, >+* and should not be hidden when other internal functions are hidden (otherwise >+* public macros would fail to compile). >+* @internal >+*/ >+#ifdef U_UTF8_IMPL >+// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. >+#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) >+U_CFUNC const uint8_t utf8_countTrailBytes[]; >+#else >+U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ >+#endif >+ > /** > * Count the trail bytes for a UTF-8 lead byte. > * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. >@@ -1163,7 +1199,6 @@ typedef int32_t UTextOffset; > */ > #define UTF_SET_CHAR_LIMIT(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length) > >-#endif /* U_HIDE_DEPRECATED_API */ >+#endif // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H > > #endif >- >diff --git a/Source/WTF/icu/unicode/utmscale.h b/Source/WTF/icu/unicode/utmscale.h >index 472d776a62d10c3bb2ea9003e42aaabd524fe9ec..d8b8a2e668af1da0b3cf93ad806399afe07a7814 100644 >--- a/Source/WTF/icu/unicode/utmscale.h >+++ b/Source/WTF/icu/unicode/utmscale.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2004 - 2008, International Business Machines Corporation and >@@ -281,10 +283,14 @@ typedef enum UDateTimeScale { > */ > UDTS_UNIX_MICROSECONDS_TIME, > >+#ifndef U_HIDE_DEPRECATED_API > /** > * The first unused time scale value. The limit of this enum >+ * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. > */ > UDTS_MAX_SCALE >+#endif /* U_HIDE_DEPRECATED_API */ >+ > } UDateTimeScale; > > /** >@@ -421,12 +427,15 @@ typedef enum UTimeScaleValue { > > #endif /* U_HIDE_INTERNAL_API */ > >+#ifndef U_HIDE_DEPRECATED_API > /** > * The number of time scale values, in other words limit of this enum. > * > * @see utmscale_getTimeScaleValue >+ * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. > */ > UTSV_MAX_SCALE_VALUE=11 >+#endif /* U_HIDE_DEPRECATED_API */ > > } UTimeScaleValue; > >diff --git a/Source/WTF/icu/unicode/utrace.h b/Source/WTF/icu/unicode/utrace.h >index 2621cf9c8542070821e2a9e329d274568eb6c0a9..6b4c4df94026a7fd3cd1aeb0b6955810600e625e 100644 >--- a/Source/WTF/icu/unicode/utrace.h >+++ b/Source/WTF/icu/unicode/utrace.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * >@@ -6,7 +8,7 @@ > * > ******************************************************************************* > * file name: utrace.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -64,7 +66,13 @@ typedef enum UTraceFunctionNumber { > UTRACE_FUNCTION_START=0, > UTRACE_U_INIT=UTRACE_FUNCTION_START, > UTRACE_U_CLEANUP, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal collation trace location. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UTRACE_FUNCTION_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > UTRACE_CONVERSION_START=0x1000, > UTRACE_UCNV_OPEN=UTRACE_CONVERSION_START, >@@ -75,7 +83,13 @@ typedef enum UTraceFunctionNumber { > UTRACE_UCNV_FLUSH_CACHE, > UTRACE_UCNV_LOAD, > UTRACE_UCNV_UNLOAD, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal collation trace location. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UTRACE_CONVERSION_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > UTRACE_COLLATION_START=0x2000, > UTRACE_UCOL_OPEN=UTRACE_COLLATION_START, >@@ -87,7 +101,13 @@ typedef enum UTraceFunctionNumber { > UTRACE_UCOL_STRCOLLITER, > UTRACE_UCOL_OPEN_FROM_SHORT_STRING, > UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal collation trace location. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > UTRACE_COLLATION_LIMIT >+#endif // U_HIDE_DEPRECATED_API > } UTraceFunctionNumber; > > /** >diff --git a/Source/WTF/icu/unicode/utrans.h b/Source/WTF/icu/unicode/utrans.h >index e3fe1629c8cb5261f2770e72acf7af5779c212b1..d0f05cf2b60c32e6239ef078776a4d68f6db7ad0 100644 >--- a/Source/WTF/icu/unicode/utrans.h >+++ b/Source/WTF/icu/unicode/utrans.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 1997-2011,2014-2015 International Business Machines >diff --git a/Source/WTF/icu/unicode/utypes.h b/Source/WTF/icu/unicode/utypes.h >index 09037a81d5285c1754347d35adb05f3fc9d2d35d..033cbdc586249fa41cdb114c196310cedf7503cc 100644 >--- a/Source/WTF/icu/unicode/utypes.h >+++ b/Source/WTF/icu/unicode/utypes.h >@@ -1,6 +1,8 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ********************************************************************** >-* Copyright (C) 1996-2015, International Business Machines >+* Copyright (C) 1996-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ********************************************************************** > * >@@ -59,7 +61,7 @@ > */ > #ifdef __cplusplus > # ifndef U_SHOW_CPLUSPLUS_API >-# define U_SHOW_CPLUSPLUS_API 1 >+# define U_SHOW_CPLUSPLUS_API 0 > # endif > #else > # undef U_SHOW_CPLUSPLUS_API >@@ -137,7 +139,7 @@ > #define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER > #ifndef U_HIDE_INTERNAL_API > #define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */ >-#define U_USE_USRDATA 1 /**< @internal */ >+#define U_USE_USRDATA 0 /**< @internal */ > #endif /* U_HIDE_INTERNAL_API */ > > /** >@@ -176,12 +178,12 @@ > > /** > * \def NULL >- * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C. >+ * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C. > * @stable ICU 2.0 > */ > #ifndef NULL > #ifdef __cplusplus >-#define NULL 0 >+#define NULL nullptr > #else > #define NULL ((void *)0) > #endif >@@ -373,88 +375,6 @@ typedef double UDate; > #define U_STANDARD_CPP_NAMESPACE > #endif > >- >-/*===========================================================================*/ >-/* Global delete operator */ >-/*===========================================================================*/ >- >-/* >- * The ICU4C library must not use the global new and delete operators. >- * These operators here are defined to enable testing for this. >- * See Jitterbug 2581 for details of why this is necessary. >- * >- * Verification that ICU4C's memory usage is correct, i.e., >- * that global new/delete are not used: >- * >- * a) Check for imports of global new/delete (see uobject.cpp for details) >- * b) Verify that new is never imported. >- * c) Verify that delete is only imported from object code for interface/mixin classes. >- * d) Add global delete and delete[] only for the ICU4C library itself >- * and define them in a way that crashes or otherwise easily shows a problem. >- * >- * The following implements d). >- * The operator implementations crash; this is intentional and used for library debugging. >- * >- * Note: This is currently only done on Windows because >- * some Linux/Unix compilers have problems with defining global new/delete. >- * On Windows, it is _MSC_VER>=1200 for MSVC 6.0 and higher. >- */ >-#if defined(__cplusplus) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) >- >-#ifndef U_HIDE_INTERNAL_API >-/** >- * Global operator new, defined only inside ICU4C, must not be used. >- * Crashes intentionally. >- * @internal >- */ >-inline void * >-operator new(size_t /*size*/) { >- char *q=NULL; >- *q=5; /* break it */ >- return q; >-} >- >-#ifdef _Ret_bytecap_ >-/* This is only needed to suppress a Visual C++ 2008 warning for operator new[]. */ >-_Ret_bytecap_(_Size) >-#endif >-/** >- * Global operator new[], defined only inside ICU4C, must not be used. >- * Crashes intentionally. >- * @internal >- */ >-inline void * >-operator new[](size_t /*size*/) { >- char *q=NULL; >- *q=5; /* break it */ >- return q; >-} >- >-/** >- * Global operator delete, defined only inside ICU4C, must not be used. >- * Crashes intentionally. >- * @internal >- */ >-inline void >-operator delete(void * /*p*/) { >- char *q=NULL; >- *q=5; /* break it */ >-} >- >-/** >- * Global operator delete[], defined only inside ICU4C, must not be used. >- * Crashes intentionally. >- * @internal >- */ >-inline void >-operator delete[](void * /*p*/) { >- char *q=NULL; >- *q=5; /* break it */ >-} >- >-#endif /* U_HIDE_INTERNAL_API */ >-#endif >- > /*===========================================================================*/ > /* UErrorCode */ > /*===========================================================================*/ >@@ -499,8 +419,13 @@ typedef enum UErrorCode { > > U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */ > >- U_ERROR_WARNING_LIMIT, /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */ >- >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal UErrorCode warning value. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_ERROR_WARNING_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > U_ZERO_ERROR = 0, /**< No error, no warning. */ > >@@ -536,9 +461,16 @@ typedef enum UErrorCode { > U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ > U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ > >- U_STANDARD_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for standard errors */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest standard error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_STANDARD_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API >+ > /* >- * the error code range 0x10000 0x10100 are reserved for Transliterator >+ * Error codes in the range 0x10000 0x10100 are reserved for Transliterator. > */ > U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */ > U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */ >@@ -576,10 +508,16 @@ typedef enum UErrorCode { > U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */ > U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */ > U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */ >- U_PARSE_ERROR_LIMIT, /**< The limit for Transliterator errors */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal Transliterator error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_PARSE_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > /* >- * the error code range 0x10100 0x10200 are reserved for formatting API parsing error >+ * Error codes in the range 0x10100 0x10200 are reserved for the formatting API. > */ > U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */ > U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */ >@@ -601,10 +539,16 @@ typedef enum UErrorCode { > U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */ > U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */ > U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */ >- U_FMT_PARSE_ERROR_LIMIT, /**< The limit for format library errors */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal formatting API error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_FMT_PARSE_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > /* >- * the error code range 0x10200 0x102ff are reserved for Break Iterator related error >+ * Error codes in the range 0x10200 0x102ff are reserved for BreakIterator. > */ > U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */ > U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */ >@@ -621,10 +565,16 @@ typedef enum UErrorCode { > U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */ > U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */ > U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is mal formed */ >- U_BRK_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for Break Iterator failures */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal BreakIterator error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_BRK_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > > /* >- * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs >+ * Error codes in the range 0x10300-0x103ff are reserved for regular expression related errors. > */ > U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */ > U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */ >@@ -649,14 +599,18 @@ typedef enum UErrorCode { > U_REGEX_STACK_OVERFLOW, /**< Regular expression backtrack stack overflow. */ > U_REGEX_TIME_OUT, /**< Maximum allowed match time exceeded */ > U_REGEX_STOPPED_BY_CALLER, /**< Matching operation aborted by user callback fn. */ >-#ifndef U_HIDE_DRAFT_API >- U_REGEX_PATTERN_TOO_BIG, /**< Pattern exceeds limits on size or complexity. @draft ICU 55 */ >- U_REGEX_INVALID_CAPTURE_GROUP_NAME, /**< Invalid capture group name. @draft ICU 55 */ >-#endif /* U_HIDE_DRAFT_API */ >- U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3, /**< This must always be the last value to indicate the limit for regexp errors */ >+ U_REGEX_PATTERN_TOO_BIG, /**< Pattern exceeds limits on size or complexity. @stable ICU 55 */ >+ U_REGEX_INVALID_CAPTURE_GROUP_NAME, /**< Invalid capture group name. @stable ICU 55 */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal regular expression error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3, >+#endif // U_HIDE_DEPRECATED_API > > /* >- * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes >+ * Error codes in the range 0x10400-0x104ff are reserved for IDNA related error codes. > */ > U_IDNA_PROHIBITED_ERROR=0x10400, > U_IDNA_ERROR_START=0x10400, >@@ -668,7 +622,13 @@ typedef enum UErrorCode { > U_IDNA_LABEL_TOO_LONG_ERROR, > U_IDNA_ZERO_LENGTH_LABEL_ERROR, > U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal IDNA error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ > U_IDNA_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > /* > * Aliases for StringPrep > */ >@@ -677,14 +637,26 @@ typedef enum UErrorCode { > U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, > > /* >- * The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes >+ * Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes. > */ > U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */ > U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */ > U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */ >- U_PLUGIN_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for plugin errors */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal plug-in error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_PLUGIN_ERROR_LIMIT, >+#endif // U_HIDE_DEPRECATED_API > >- U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */ >+#ifndef U_HIDE_DEPRECATED_API >+ /** >+ * One more than the highest normal error code. >+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. >+ */ >+ U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT >+#endif // U_HIDE_DEPRECATED_API > } UErrorCode; > > /* Use the following to determine if an UErrorCode represents */ >diff --git a/Source/WTF/icu/unicode/uvernum.h b/Source/WTF/icu/unicode/uvernum.h >index 3e2eff631c105859400c2d702c53876894bcb047..d905a0f50d1d292a60c33db0a62598a4726e50a1 100644 >--- a/Source/WTF/icu/unicode/uvernum.h >+++ b/Source/WTF/icu/unicode/uvernum.h >@@ -1,11 +1,13 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* >-* Copyright (C) 2000-2015, International Business Machines >+* Copyright (C) 2000-2016, International Business Machines > * Corporation and others. All Rights Reserved. > ******************************************************************************* > * > * file name: uvernum.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >@@ -32,13 +34,12 @@ > * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. > * > * >- * source/common/common.vcproj - update 'Output file name' on the link tab so >+ * source/common/common.vcxproj - update 'Output file name' on the link tab so > * that it contains the new major/minor combination >- * source/i18n/i18n.vcproj - same as for the common.vcproj >- * source/layout/layout.vcproj - same as for the common.vcproj >+ * source/i18n/i18n.vcxproj - same as for the common.vcxproj > * source/layoutex/layoutex.vcproj - same >- * source/stubdata/stubdata.vcproj - same as for the common.vcproj >- * source/io/io.vcproj - same as for the common.vcproj >+ * source/stubdata/stubdata.vcproj - same as for the common.vcxproj >+ * source/io/io.vcproj - same as for the common.vcxproj > * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains > * the new major/minor combination and the Unicode version. > */ >@@ -51,19 +52,19 @@ > * @stable ICU 2.4 > */ > #define U_COPYRIGHT_STRING \ >- " Copyright (C) 2015, International Business Machines Corporation and others. All Rights Reserved. " >+ " Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html " > > /** The current ICU major version as an integer. > * This value will change in the subsequent releases of ICU > * @stable ICU 2.4 > */ >-#define U_ICU_VERSION_MAJOR_NUM 55 >+#define U_ICU_VERSION_MAJOR_NUM 60 > > /** The current ICU minor version as an integer. > * This value will change in the subsequent releases of ICU > * @stable ICU 2.6 > */ >-#define U_ICU_VERSION_MINOR_NUM 1 >+#define U_ICU_VERSION_MINOR_NUM 2 > > /** The current ICU patchlevel version as an integer. > * This value will change in the subsequent releases of ICU >@@ -83,7 +84,7 @@ > * This value will change in the subsequent releases of ICU > * @stable ICU 2.6 > */ >-#define U_ICU_VERSION_SUFFIX _55 >+#define U_ICU_VERSION_SUFFIX _60 > > /** > * \def U_DEF2_ICU_ENTRY_POINT_RENAME >@@ -118,19 +119,19 @@ > * This value will change in the subsequent releases of ICU > * @stable ICU 2.4 > */ >-#define U_ICU_VERSION "55.1" >+#define U_ICU_VERSION "60.2" > > /** The current ICU library major/minor version as a string without dots, for library name suffixes. > * This value will change in the subsequent releases of ICU > * @stable ICU 2.6 > */ >-#define U_ICU_VERSION_SHORT "55" >+#define U_ICU_VERSION_SHORT "60" > > #ifndef U_HIDE_INTERNAL_API > /** Data version in ICU4C. > * @internal ICU 4.4 Internal Use Only > **/ >-#define U_ICU_DATA_VERSION "55.1" >+#define U_ICU_DATA_VERSION "60.2" > #endif /* U_HIDE_INTERNAL_API */ > > /*=========================================================================== >diff --git a/Source/WTF/icu/unicode/uversion.h b/Source/WTF/icu/unicode/uversion.h >index 74e309105514adf38237a3b7a409801a815a5d56..e24068d0f953ac94ed448439ae706a60eb8a64c2 100644 >--- a/Source/WTF/icu/unicode/uversion.h >+++ b/Source/WTF/icu/unicode/uversion.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2000-2011, International Business Machines >@@ -5,7 +7,7 @@ > ******************************************************************************* > * > * file name: uversion.h >-* encoding: US-ASCII >+* encoding: UTF-8 > * tab size: 8 (not used) > * indentation:4 > * >diff --git a/Source/WTF/icu/unicode/vtzone.h b/Source/WTF/icu/unicode/vtzone.h >index 92817ba16baedadab89e1bd5d9ccfc7387f6f958..18265d341505cb0a63a292224003b3ae708f4712 100644 >--- a/Source/WTF/icu/unicode/vtzone.h >+++ b/Source/WTF/icu/unicode/vtzone.h >@@ -1,3 +1,5 @@ >+// © 2016 and later: Unicode, Inc. and others. >+// License & terms of use: http://www.unicode.org/copyright.html > /* > ******************************************************************************* > * Copyright (C) 2007-2013, International Business Machines Corporation and
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ap
:
review-
ap
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185502
:
340057
| 340062