diff options
Diffstat (limited to 'deps/icu-small/source/i18n/unicode')
78 files changed, 1297 insertions, 453 deletions
diff --git a/deps/icu-small/source/i18n/unicode/alphaindex.h b/deps/icu-small/source/i18n/unicode/alphaindex.h index 9116ccc26c..e9e8739ed2 100644 --- a/deps/icu-small/source/i18n/unicode/alphaindex.h +++ b/deps/icu-small/source/i18n/unicode/alphaindex.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * diff --git a/deps/icu-small/source/i18n/unicode/basictz.h b/deps/icu-small/source/i18n/unicode/basictz.h index 5b47038250..8da4a00bf8 100644 --- a/deps/icu-small/source/i18n/unicode/basictz.h +++ b/deps/icu-small/source/i18n/unicode/basictz.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/calendar.h b/deps/icu-small/source/i18n/unicode/calendar.h index 35252bb9c8..b7da5f3c5b 100644 --- a/deps/icu-small/source/i18n/unicode/calendar.h +++ b/deps/icu-small/source/i18n/unicode/calendar.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2014, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/choicfmt.h b/deps/icu-small/source/i18n/unicode/choicfmt.h index cfd520624d..ab3c28fe07 100644 --- a/deps/icu-small/source/i18n/unicode/choicfmt.h +++ b/deps/icu-small/source/i18n/unicode/choicfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/coleitr.h b/deps/icu-small/source/i18n/unicode/coleitr.h index f07ada7b67..628b461f94 100644 --- a/deps/icu-small/source/i18n/unicode/coleitr.h +++ b/deps/icu-small/source/i18n/unicode/coleitr.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * Copyright (C) 1997-2014, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/coll.h b/deps/icu-small/source/i18n/unicode/coll.h index 5468342716..e41be2ee81 100644 --- a/deps/icu-small/source/i18n/unicode/coll.h +++ b/deps/icu-small/source/i18n/unicode/coll.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * Copyright (C) 1996-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/compactdecimalformat.h b/deps/icu-small/source/i18n/unicode/compactdecimalformat.h index ced6bee599..1fcc5c581e 100644 --- a/deps/icu-small/source/i18n/unicode/compactdecimalformat.h +++ b/deps/icu-small/source/i18n/unicode/compactdecimalformat.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 2012-2016, International Business Machines @@ -157,7 +159,6 @@ public: FieldPositionIterator* posIter, UErrorCode& status) const; - /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual. */ /** * Format a long number using base-10 representation. * @@ -167,7 +168,7 @@ public: * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. * @return Reference to 'appendTo' parameter. - * @draft ICU 56 + * @stable ICU 56 */ virtual UnicodeString& format(int32_t number, UnicodeString& appendTo, @@ -274,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; diff --git a/deps/icu-small/source/i18n/unicode/curramt.h b/deps/icu-small/source/i18n/unicode/curramt.h index ce9acbfd5c..268d53c0b1 100644 --- a/deps/icu-small/source/i18n/unicode/curramt.h +++ b/deps/icu-small/source/i18n/unicode/curramt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2004-2006, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/currpinf.h b/deps/icu-small/source/i18n/unicode/currpinf.h index 4f1f8962c3..133de38fc2 100644 --- a/deps/icu-small/source/i18n/unicode/currpinf.h +++ b/deps/icu-small/source/i18n/unicode/currpinf.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2009-2015, International Business Machines Corporation and * diff --git a/deps/icu-small/source/i18n/unicode/currunit.h b/deps/icu-small/source/i18n/unicode/currunit.h index 93ecd2c489..313c92a6ac 100644 --- a/deps/icu-small/source/i18n/unicode/currunit.h +++ b/deps/icu-small/source/i18n/unicode/currunit.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2004-2014, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/datefmt.h b/deps/icu-small/source/i18n/unicode/datefmt.h index 2ccac79760..6e3a78f291 100644 --- a/deps/icu-small/source/i18n/unicode/datefmt.h +++ b/deps/icu-small/source/i18n/unicode/datefmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/dcfmtsym.h b/deps/icu-small/source/i18n/unicode/dcfmtsym.h index 9b406b1417..946227addb 100644 --- a/deps/icu-small/source/i18n/unicode/dcfmtsym.h +++ b/deps/icu-small/source/i18n/unicode/dcfmtsym.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/decimfmt.h b/deps/icu-small/source/i18n/unicode/decimfmt.h index e7f8ea592e..7339399f72 100644 --- a/deps/icu-small/source/i18n/unicode/decimfmt.h +++ b/deps/icu-small/source/i18n/unicode/decimfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2016, International Business Machines @@ -968,7 +970,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, @@ -1017,7 +1019,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, @@ -1066,7 +1068,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, @@ -1087,9 +1089,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; @@ -2101,6 +2103,8 @@ private: DecimalFormatSymbols* symbolsToAdopt = 0 ); + void handleCurrencySignInPattern(UErrorCode& status); + void parse(const UnicodeString& text, Formattable& result, ParsePosition& pos, diff --git a/deps/icu-small/source/i18n/unicode/dtfmtsym.h b/deps/icu-small/source/i18n/unicode/dtfmtsym.h index c338c46fac..507868e2c3 100644 --- a/deps/icu-small/source/i18n/unicode/dtfmtsym.h +++ b/deps/icu-small/source/i18n/unicode/dtfmtsym.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2016, International Business Machines @@ -270,9 +272,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 +288,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 }; /** diff --git a/deps/icu-small/source/i18n/unicode/dtitvfmt.h b/deps/icu-small/source/i18n/unicode/dtitvfmt.h index 181d46c8e0..68360b87df 100644 --- a/deps/icu-small/source/i18n/unicode/dtitvfmt.h +++ b/deps/icu-small/source/i18n/unicode/dtitvfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /******************************************************************************** * Copyright (C) 2008-2016, International Business Machines Corporation and * others. All Rights Reserved. diff --git a/deps/icu-small/source/i18n/unicode/dtitvinf.h b/deps/icu-small/source/i18n/unicode/dtitvinf.h index 1c7f3983df..b31061e16a 100644 --- a/deps/icu-small/source/i18n/unicode/dtitvinf.h +++ b/deps/icu-small/source/i18n/unicode/dtitvinf.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2008-2016, International Business Machines Corporation and @@ -150,7 +152,8 @@ U_NAMESPACE_BEGIN class U_I18N_API DateIntervalInfo U_FINAL : public UObject { public: -#ifndef U_HIDE_INTERNAL_API + // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public default constructor. /** * Default constructor. * It does not initialize any interval patterns except @@ -165,7 +168,6 @@ public: * @internal ICU 4.0 */ DateIntervalInfo(UErrorCode& status); -#endif /* U_HIDE_INTERNAL_API */ /** @@ -339,7 +341,10 @@ private: */ friend class DateIntervalFormat; - friend struct DateIntervalSink; + /** + * Internal struct used to load resource bundle data. + */ + struct DateIntervalSink; /** * Following is for saving the interval patterns. diff --git a/deps/icu-small/source/i18n/unicode/dtptngen.h b/deps/icu-small/source/i18n/unicode/dtptngen.h index eb8a44541e..fd617ce3cd 100644 --- a/deps/icu-small/source/i18n/unicode/dtptngen.h +++ b/deps/icu-small/source/i18n/unicode/dtptngen.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2007-2016, International Business Machines Corporation and @@ -116,7 +118,6 @@ public: */ UBool operator!=(const DateTimePatternGenerator& other) const; -#ifndef U_HIDE_DRAFT_API /** * Utility to return a unique skeleton from a given pattern. For example, * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". @@ -125,10 +126,9 @@ 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" - * @draft ICU 56 + * @stable ICU 56 */ static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorCode& status); -#endif /* U_HIDE_DRAFT_API */ /** * Utility to return a unique skeleton from a given pattern. For example, @@ -149,7 +149,6 @@ public: return staticGetSkeleton(pattern, status); }*/ -#ifndef U_HIDE_DRAFT_API /** * 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 @@ -161,10 +160,9 @@ public: * @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" - * @draft ICU 56 + * @stable ICU 56 */ static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); -#endif /* U_HIDE_DRAFT_API */ /** * Utility to return a unique base skeleton from a given pattern. This is @@ -518,7 +516,6 @@ private: UnicodeString decimal; DateTimeMatcher *skipMatcher; Hashtable *fAvailableFormatKeyHash; - UnicodeString hackPattern; UnicodeString emptyString; UChar fDefaultHourFormatChar; @@ -534,9 +531,11 @@ private: }; 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); @@ -544,6 +543,7 @@ 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); int32_t getCanonicalIndex(const UnicodeString& field); const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0); @@ -554,8 +554,12 @@ private: UBool isAvailableFormatSet(const UnicodeString &key) const; void copyHashtable(Hashtable *other, UErrorCode &status); UBool isCanonicalItem(const UnicodeString& item) const; - static void loadAllowedHourFormatsData(UErrorCode &status); + 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/deps/icu-small/source/i18n/unicode/dtrule.h b/deps/icu-small/source/i18n/unicode/dtrule.h index 3ef080b4eb..32d230ea77 100644 --- a/deps/icu-small/source/i18n/unicode/dtrule.h +++ b/deps/icu-small/source/i18n/unicode/dtrule.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/fieldpos.h b/deps/icu-small/source/i18n/unicode/fieldpos.h index b3d64b4e84..6091941106 100644 --- a/deps/icu-small/source/i18n/unicode/fieldpos.h +++ b/deps/icu-small/source/i18n/unicode/fieldpos.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/fmtable.h b/deps/icu-small/source/i18n/unicode/fmtable.h index 6cad276f42..ac5daba893 100644 --- a/deps/icu-small/source/i18n/unicode/fmtable.h +++ b/deps/icu-small/source/i18n/unicode/fmtable.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/format.h b/deps/icu-small/source/i18n/unicode/format.h index 7bbd32df6a..1484e9f00e 100644 --- a/deps/icu-small/source/i18n/unicode/format.h +++ b/deps/icu-small/source/i18n/unicode/format.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/fpositer.h b/deps/icu-small/source/i18n/unicode/fpositer.h index 20e78714dc..694a1d8770 100644 --- a/deps/icu-small/source/i18n/unicode/fpositer.h +++ b/deps/icu-small/source/i18n/unicode/fpositer.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 2010-2012, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/gender.h b/deps/icu-small/source/i18n/unicode/gender.h index cbb73916c6..0294895184 100644 --- a/deps/icu-small/source/i18n/unicode/gender.h +++ b/deps/icu-small/source/i18n/unicode/gender.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/gregocal.h b/deps/icu-small/source/i18n/unicode/gregocal.h index 1e507d3bb7..60ba0cc6ac 100644 --- a/deps/icu-small/source/i18n/unicode/gregocal.h +++ b/deps/icu-small/source/i18n/unicode/gregocal.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/measfmt.h b/deps/icu-small/source/i18n/unicode/measfmt.h index c177a963f8..866d7d3227 100644 --- a/deps/icu-small/source/i18n/unicode/measfmt.h +++ b/deps/icu-small/source/i18n/unicode/measfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2004-2016, International Business Machines @@ -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; @@ -206,6 +210,21 @@ class U_I18N_API MeasureFormat : public Format { FieldPosition &pos, UErrorCode &status) const; +#ifndef 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. + * + * @draft ICU 58 + */ + UnicodeString getUnitDisplayName(const MeasureUnit& unit, UErrorCode &status) const; +#endif /* U_HIDE_DRAFT_API */ + /** * Return a formatter for CurrencyAmount objects in the given diff --git a/deps/icu-small/source/i18n/unicode/measunit.h b/deps/icu-small/source/i18n/unicode/measunit.h index 8f8c92415b..9810b91194 100644 --- a/deps/icu-small/source/i18n/unicode/measunit.h +++ b/deps/icu-small/source/i18n/unicode/measunit.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2004-2016, International Business Machines @@ -255,15 +257,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createRadian(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of angle: revolution. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createRevolutionAngle(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of area: acre. @@ -375,15 +375,13 @@ class U_I18N_API MeasureUnit: public UObject { static MeasureUnit *createPartPerMillion(UErrorCode &status); #endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns unit of consumption: liter-per-100kilometers. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of consumption: liter-per-kilometer. @@ -411,6 +409,46 @@ class U_I18N_API MeasureUnit: public UObject { static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); #endif /* U_HIDE_DRAFT_API */ +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: east. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createEast(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: north. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createNorth(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: south. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createSouth(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: west. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createWest(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns unit of digital: bit. * Caller owns returned value and must free it. @@ -491,15 +529,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createTerabyte(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of duration: century. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createCentury(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of duration: day. @@ -789,15 +825,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createMile(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of length: mile-scandinavian. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createMileScandinavian(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of length: millimeter. @@ -1039,15 +1073,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createKilometerPerHour(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of speed: knot. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createKnot(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of speed: meter-per-second. @@ -1081,15 +1113,13 @@ 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. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createGenericTemperature(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of temperature: kelvin. @@ -1187,15 +1217,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createCup(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of volume: cup-metric. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createCupMetric(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of volume: deciliter. @@ -1271,15 +1299,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createPint(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of volume: pint-metric. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createPintMetric(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of volume: quart. diff --git a/deps/icu-small/source/i18n/unicode/measure.h b/deps/icu-small/source/i18n/unicode/measure.h index a9c7598996..719bc6bc8f 100644 --- a/deps/icu-small/source/i18n/unicode/measure.h +++ b/deps/icu-small/source/i18n/unicode/measure.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/msgfmt.h b/deps/icu-small/source/i18n/unicode/msgfmt.h index 5de91e41ff..1a9973872d 100644 --- a/deps/icu-small/source/i18n/unicode/msgfmt.h +++ b/deps/icu-small/source/i18n/unicode/msgfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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. diff --git a/deps/icu-small/source/i18n/unicode/numfmt.h b/deps/icu-small/source/i18n/unicode/numfmt.h index 072b566da1..9e3d5d34ec 100644 --- a/deps/icu-small/source/i18n/unicode/numfmt.h +++ b/deps/icu-small/source/i18n/unicode/numfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** * Copyright (C) 1997-2016, International Business Machines Corporation and others. @@ -266,7 +268,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, @@ -389,7 +391,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, @@ -441,7 +443,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, @@ -494,7 +496,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, @@ -515,9 +517,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; diff --git a/deps/icu-small/source/i18n/unicode/numsys.h b/deps/icu-small/source/i18n/unicode/numsys.h index 2b21afc074..da181551c2 100644 --- a/deps/icu-small/source/i18n/unicode/numsys.h +++ b/deps/icu-small/source/i18n/unicode/numsys.h @@ -1,3 +1,5 @@ +// Copyright (C) 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 diff --git a/deps/icu-small/source/i18n/unicode/plurfmt.h b/deps/icu-small/source/i18n/unicode/plurfmt.h index 6b417b8d57..b10e4179b6 100644 --- a/deps/icu-small/source/i18n/unicode/plurfmt.h +++ b/deps/icu-small/source/i18n/unicode/plurfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/plurrule.h b/deps/icu-small/source/i18n/unicode/plurrule.h index 7abd657408..146e6bea83 100644 --- a/deps/icu-small/source/i18n/unicode/plurrule.h +++ b/deps/icu-small/source/i18n/unicode/plurrule.h @@ -1,3 +1,5 @@ +// Copyright (C) 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 diff --git a/deps/icu-small/source/i18n/unicode/rbnf.h b/deps/icu-small/source/i18n/unicode/rbnf.h index 2cd02e70f1..14230f8982 100644 --- a/deps/icu-small/source/i18n/unicode/rbnf.h +++ b/deps/icu-small/source/i18n/unicode/rbnf.h @@ -1,3 +1,5 @@ +// Copyright (C) 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. @@ -54,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 }; /** diff --git a/deps/icu-small/source/i18n/unicode/rbtz.h b/deps/icu-small/source/i18n/unicode/rbtz.h index 79805dd64e..20de34bb17 100644 --- a/deps/icu-small/source/i18n/unicode/rbtz.h +++ b/deps/icu-small/source/i18n/unicode/rbtz.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/regex.h b/deps/icu-small/source/i18n/unicode/regex.h index 2333f96b25..96c64874a4 100644 --- a/deps/icu-small/source/i18n/unicode/regex.h +++ b/deps/icu-small/source/i18n/unicode/regex.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 2002-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/region.h b/deps/icu-small/source/i18n/unicode/region.h index 2e1ac82a62..47829944a3 100644 --- a/deps/icu-small/source/i18n/unicode/region.h +++ b/deps/icu-small/source/i18n/unicode/region.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2014-2016, International Business Machines Corporation and others. @@ -210,7 +212,7 @@ private: * anything meaningful. */ - static void loadRegionData(UErrorCode &status); + static void U_CALLCONV loadRegionData(UErrorCode &status); }; diff --git a/deps/icu-small/source/i18n/unicode/reldatefmt.h b/deps/icu-small/source/i18n/unicode/reldatefmt.h index b336e2fe3d..8e659e2bc8 100644 --- a/deps/icu-small/source/i18n/unicode/reldatefmt.h +++ b/deps/icu-small/source/i18n/unicode/reldatefmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************** * Copyright (C) 2014-2016, International Business Machines Corporation and @@ -23,7 +25,7 @@ * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" */ -#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION +#if !UCONFIG_NO_FORMATTING /** * Represents the unit for formatting a relative date. e.g "in 5 days" @@ -74,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; /** @@ -161,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; /** @@ -211,13 +217,16 @@ 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 @@ -509,5 +518,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/deps/icu-small/source/i18n/unicode/scientificnumberformatter.h b/deps/icu-small/source/i18n/unicode/scientificnumberformatter.h index 710238a796..0b34755dc2 100644 --- a/deps/icu-small/source/i18n/unicode/scientificnumberformatter.h +++ b/deps/icu-small/source/i18n/unicode/scientificnumberformatter.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (c) 2014-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/search.h b/deps/icu-small/source/i18n/unicode/search.h index 5b65e88b9c..35a0552623 100644 --- a/deps/icu-small/source/i18n/unicode/search.h +++ b/deps/icu-small/source/i18n/unicode/search.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/selfmt.h b/deps/icu-small/source/i18n/unicode/selfmt.h index 635144bb9b..37a8f2b821 100644..100755 --- a/deps/icu-small/source/i18n/unicode/selfmt.h +++ b/deps/icu-small/source/i18n/unicode/selfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/simpletz.h b/deps/icu-small/source/i18n/unicode/simpletz.h index a0639d6a70..7e41a4ab8a 100644 --- a/deps/icu-small/source/i18n/unicode/simpletz.h +++ b/deps/icu-small/source/i18n/unicode/simpletz.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/smpdtfmt.h b/deps/icu-small/source/i18n/unicode/smpdtfmt.h index b7fa42054d..e6cf28d22b 100644 --- a/deps/icu-small/source/i18n/unicode/smpdtfmt.h +++ b/deps/icu-small/source/i18n/unicode/smpdtfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 1997-2016, International Business Machines Corporation and * others. All Rights Reserved. @@ -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 diff --git a/deps/icu-small/source/i18n/unicode/sortkey.h b/deps/icu-small/source/i18n/unicode/sortkey.h index b4629d4e24..6f1543da40 100644 --- a/deps/icu-small/source/i18n/unicode/sortkey.h +++ b/deps/icu-small/source/i18n/unicode/sortkey.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/stsearch.h b/deps/icu-small/source/i18n/unicode/stsearch.h index 64317608b5..1cae53d128 100644 --- a/deps/icu-small/source/i18n/unicode/stsearch.h +++ b/deps/icu-small/source/i18n/unicode/stsearch.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/tblcoll.h b/deps/icu-small/source/i18n/unicode/tblcoll.h index 020c4b9606..c48ea38c13 100644 --- a/deps/icu-small/source/i18n/unicode/tblcoll.h +++ b/deps/icu-small/source/i18n/unicode/tblcoll.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * Copyright (C) 1996-2016, International Business Machines Corporation and @@ -854,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/deps/icu-small/source/i18n/unicode/timezone.h b/deps/icu-small/source/i18n/unicode/timezone.h index 6c72095537..58c84d062b 100644 --- a/deps/icu-small/source/i18n/unicode/timezone.h +++ b/deps/icu-small/source/i18n/unicode/timezone.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /************************************************************************* * Copyright (c) 1997-2016, International Business Machines Corporation * and others. All Rights Reserved. diff --git a/deps/icu-small/source/i18n/unicode/tmunit.h b/deps/icu-small/source/i18n/unicode/tmunit.h index e398ab96bd..a19a1f3c17 100644 --- a/deps/icu-small/source/i18n/unicode/tmunit.h +++ b/deps/icu-small/source/i18n/unicode/tmunit.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2009-2016, International Business Machines Corporation, * @@ -41,7 +43,13 @@ 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 }; /** diff --git a/deps/icu-small/source/i18n/unicode/tmutamt.h b/deps/icu-small/source/i18n/unicode/tmutamt.h index ad8047a1f1..887150121f 100644 --- a/deps/icu-small/source/i18n/unicode/tmutamt.h +++ b/deps/icu-small/source/i18n/unicode/tmutamt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/tmutfmt.h b/deps/icu-small/source/i18n/unicode/tmutfmt.h index 728ff13219..b90d4a096d 100644 --- a/deps/icu-small/source/i18n/unicode/tmutfmt.h +++ b/deps/icu-small/source/i18n/unicode/tmutfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/translit.h b/deps/icu-small/source/i18n/unicode/translit.h index d41b5c0a80..1e49bfb969 100644 --- a/deps/icu-small/source/i18n/unicode/translit.h +++ b/deps/icu-small/source/i18n/unicode/translit.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 1999-2014, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/tzfmt.h b/deps/icu-small/source/i18n/unicode/tzfmt.h index 9b39bf0ee4..dd86f1b48c 100644 --- a/deps/icu-small/source/i18n/unicode/tzfmt.h +++ b/deps/icu-small/source/i18n/unicode/tzfmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2011-2015, International Business Machines Corporation and diff --git a/deps/icu-small/source/i18n/unicode/tznames.h b/deps/icu-small/source/i18n/unicode/tznames.h index cbc9c1f3a8..8861a7d026 100644 --- a/deps/icu-small/source/i18n/unicode/tznames.h +++ b/deps/icu-small/source/i18n/unicode/tznames.h @@ -1,6 +1,8 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* -* Copyright (C) 2011-2015, 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 @@ -289,6 +291,18 @@ public: virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const; /** + * @internal For specific users only until proposed publicly. + * @deprecated This API is ICU internal only. + */ + virtual void loadAllDisplayNames(UErrorCode& status); + + /** + * @internal For specific users only until proposed publicly. + * @deprecated This API is ICU internal only. + */ + 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}. * @internal diff --git a/deps/icu-small/source/i18n/unicode/tzrule.h b/deps/icu-small/source/i18n/unicode/tzrule.h index c153afa1e9..5e020bc1a3 100644 --- a/deps/icu-small/source/i18n/unicode/tzrule.h +++ b/deps/icu-small/source/i18n/unicode/tzrule.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/tztrans.h b/deps/icu-small/source/i18n/unicode/tztrans.h index f5934d9125..b2e09999bb 100644 --- a/deps/icu-small/source/i18n/unicode/tztrans.h +++ b/deps/icu-small/source/i18n/unicode/tztrans.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/ucal.h b/deps/icu-small/source/i18n/unicode/ucal.h index 8f3bf71f99..18522f6475 100644 --- a/deps/icu-small/source/i18n/unicode/ucal.h +++ b/deps/icu-small/source/i18n/unicode/ucal.h @@ -1,3 +1,5 @@ +// Copyright (C) 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 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/deps/icu-small/source/i18n/unicode/ucol.h b/deps/icu-small/source/i18n/unicode/ucol.h index 25f90408c9..0b3fab90b1 100644 --- a/deps/icu-small/source/i18n/unicode/ucol.h +++ b/deps/icu-small/source/i18n/unicode/ucol.h @@ -1,3 +1,5 @@ +// Copyright (C) 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; /** diff --git a/deps/icu-small/source/i18n/unicode/ucoleitr.h b/deps/icu-small/source/i18n/unicode/ucoleitr.h index 7af783d37c..89fd9e85cf 100644 --- a/deps/icu-small/source/i18n/unicode/ucoleitr.h +++ b/deps/icu-small/source/i18n/unicode/ucoleitr.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 2001-2014, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/ucsdet.h b/deps/icu-small/source/i18n/unicode/ucsdet.h index b737b16047..a926d2f22c 100644 --- a/deps/icu-small/source/i18n/unicode/ucsdet.h +++ b/deps/icu-small/source/i18n/unicode/ucsdet.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 2005-2013, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/udat.h b/deps/icu-small/source/i18n/unicode/udat.h index 5baec62137..cacfbe8500 100644 --- a/deps/icu-small/source/i18n/unicode/udat.h +++ b/deps/icu-small/source/i18n/unicode/udat.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * Copyright (C) 1996-2016, International Business Machines @@ -787,16 +789,15 @@ typedef enum UDateFormatField { 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 = 38 - +#endif // U_HIDE_DEPRECATED_API } UDateFormatField; @@ -888,23 +889,24 @@ typedef enum UDateFormatBooleanAttribute { * @stable ICU 53 */ UDAT_PARSE_ALLOW_NUMERIC = 1, -#ifndef U_HIDE_DRAFT_API /** * indicates tolerance of a partial literal match * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy" - * @draft ICU 56 + * @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") - * @draft ICU 56 + * @stable ICU 56 */ 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; diff --git a/deps/icu-small/source/i18n/unicode/udateintervalformat.h b/deps/icu-small/source/i18n/unicode/udateintervalformat.h index 26d9b5a9dd..81bff16d6e 100644 --- a/deps/icu-small/source/i18n/unicode/udateintervalformat.h +++ b/deps/icu-small/source/i18n/unicode/udateintervalformat.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** * Copyright (C) 2010-2012,2015 International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/udatpg.h b/deps/icu-small/source/i18n/unicode/udatpg.h index f52ed4c34a..365d51c493 100644 --- a/deps/icu-small/source/i18n/unicode/udatpg.h +++ b/deps/icu-small/source/i18n/unicode/udatpg.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * @@ -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; /** diff --git a/deps/icu-small/source/i18n/unicode/ufieldpositer.h b/deps/icu-small/source/i18n/unicode/ufieldpositer.h index 836bfdf279..8dfa3df5a4 100644 --- a/deps/icu-small/source/i18n/unicode/ufieldpositer.h +++ b/deps/icu-small/source/i18n/unicode/ufieldpositer.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** * Copyright (C) 2015-2016, International Business Machines @@ -84,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. diff --git a/deps/icu-small/source/i18n/unicode/uformattable.h b/deps/icu-small/source/i18n/unicode/uformattable.h index a64ae14653..e4683d56c3 100644 --- a/deps/icu-small/source/i18n/unicode/uformattable.h +++ b/deps/icu-small/source/i18n/unicode/uformattable.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/ugender.h b/deps/icu-small/source/i18n/unicode/ugender.h index 86e229df61..c1e591ed28 100644 --- a/deps/icu-small/source/i18n/unicode/ugender.h +++ b/deps/icu-small/source/i18n/unicode/ugender.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/ulocdata.h b/deps/icu-small/source/i18n/unicode/ulocdata.h index 63495f681c..ecf6fdcb3f 100644 --- a/deps/icu-small/source/i18n/unicode/ulocdata.h +++ b/deps/icu-small/source/i18n/unicode/ulocdata.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * * @@ -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/deps/icu-small/source/i18n/unicode/umsg.h b/deps/icu-small/source/i18n/unicode/umsg.h index e79026f72e..0beb39d5ab 100644 --- a/deps/icu-small/source/i18n/unicode/umsg.h +++ b/deps/icu-small/source/i18n/unicode/umsg.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/unirepl.h b/deps/icu-small/source/i18n/unicode/unirepl.h index 974a3f5401..37815a9a24 100644 --- a/deps/icu-small/source/i18n/unicode/unirepl.h +++ b/deps/icu-small/source/i18n/unicode/unirepl.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/unum.h b/deps/icu-small/source/i18n/unicode/unum.h index 8747cc595f..7c652e09cf 100644 --- a/deps/icu-small/source/i18n/unicode/unum.h +++ b/deps/icu-small/source/i18n/unicode/unum.h @@ -1,3 +1,5 @@ +// Copyright (C) 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. @@ -219,35 +221,35 @@ typedef enum UNumberFormatStyle { * @stable ICU 54 */ UNUM_CASH_CURRENCY=13, -#ifndef U_HIDE_DRAFT_API /** * Decimal format expressed using compact notation * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT) * e.g. "23K", "45B" - * @draft ICU 56 + * @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" - * @draft ICU 56 + * @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. - * @draft ICU 56 + * @stable ICU 56 */ UNUM_CURRENCY_STANDARD=16, -#endif /* U_HIDE_DRAFT_API */ +#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=17, +#endif // U_HIDE_DEPRECATED_API /** * Default format @@ -323,7 +325,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 */ @@ -357,8 +365,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; @@ -1272,8 +1285,13 @@ typedef enum UNumberFormatSymbol { */ UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, - /** 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/deps/icu-small/source/i18n/unicode/unumsys.h b/deps/icu-small/source/i18n/unicode/unumsys.h index 8f9d386dd5..396d55d6b7 100644 --- a/deps/icu-small/source/i18n/unicode/unumsys.h +++ b/deps/icu-small/source/i18n/unicode/unumsys.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/upluralrules.h b/deps/icu-small/source/i18n/unicode/upluralrules.h index 5bcadd4bda..52e34d8d25 100644 --- a/deps/icu-small/source/i18n/unicode/upluralrules.h +++ b/deps/icu-small/source/i18n/unicode/upluralrules.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** * Copyright (C) 2010-2013, International Business Machines @@ -52,11 +54,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 diff --git a/deps/icu-small/source/i18n/unicode/uregex.h b/deps/icu-small/source/i18n/unicode/uregex.h index c51acd5f40..7806a74afc 100644 --- a/deps/icu-small/source/i18n/unicode/uregex.h +++ b/deps/icu-small/source/i18n/unicode/uregex.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 2004-2016, International Business Machines diff --git a/deps/icu-small/source/i18n/unicode/uregion.h b/deps/icu-small/source/i18n/unicode/uregion.h index 29347528e0..b5d03691ca 100644 --- a/deps/icu-small/source/i18n/unicode/uregion.h +++ b/deps/icu-small/source/i18n/unicode/uregion.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/ureldatefmt.h b/deps/icu-small/source/i18n/unicode/ureldatefmt.h index fce016f564..fad8ffd9e1 100644 --- a/deps/icu-small/source/i18n/unicode/ureldatefmt.h +++ b/deps/icu-small/source/i18n/unicode/ureldatefmt.h @@ -1,3 +1,5 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** * Copyright (C) 2016, International Business Machines @@ -58,11 +60,13 @@ typedef enum UDateRelativeDateTimeFormatterStyle { */ UDAT_STYLE_NARROW, - /** - * The number of styles. - * @stable ICU 54 - */ - UDAT_STYLE_COUNT +#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; #ifndef U_HIDE_DRAFT_API @@ -162,11 +166,13 @@ typedef enum URelativeDateTimeUnit { * @draft ICU 57 */ UDAT_REL_UNIT_SATURDAY, +#ifndef U_HIDE_DEPRECATED_API /** - * Count of URelativeDateTimeUnit values - * @draft ICU 57 + * 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; #endif /* U_HIDE_DRAFT_API */ diff --git a/deps/icu-small/source/i18n/unicode/usearch.h b/deps/icu-small/source/i18n/unicode/usearch.h index 10721bc726..dcdb7fe420 100644 --- a/deps/icu-small/source/i18n/unicode/usearch.h +++ b/deps/icu-small/source/i18n/unicode/usearch.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/uspoof.h b/deps/icu-small/source/i18n/unicode/uspoof.h index c2285a700e..40b73380c5 100644 --- a/deps/icu-small/source/i18n/unicode/uspoof.h +++ b/deps/icu-small/source/i18n/unicode/uspoof.h @@ -1,6 +1,8 @@ +// Copyright (C) 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 @@ -35,123 +37,350 @@ * \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; typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker */ +#ifndef U_HIDE_DRAFT_API +/** + * @see uspoof_openCheckResult + */ +struct USpoofCheckResult; +/** + * @see uspoof_openCheckResult + */ +typedef struct USpoofCheckResult USpoofCheckResult; +#endif /* U_HIDE_DRAFT_API */ + /** * 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 +389,61 @@ 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. */ +#ifndef U_HIDE_DRAFT_API + /** + * 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 + * @draft ICU 58 + */ + USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE, +#endif /* U_HIDE_DRAFT_API */ + +#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(). @@ -229,14 +474,15 @@ 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 */ @@ -253,11 +499,11 @@ typedef enum USpoofChecks { * Enable the return of auxillary (non-error) information in the * 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 */ @@ -267,39 +513,53 @@ typedef enum 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 */ @@ -311,11 +571,18 @@ typedef enum USpoofChecks { */ 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; /** @@ -359,10 +626,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 +638,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 +701,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. @@ -464,19 +755,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 @@ -499,7 +793,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,7 +805,7 @@ 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 localesList A list list of locales, from which the language @@ -654,16 +948,21 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); * 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(). * + * \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 * 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,6 +972,7 @@ 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 @@ -687,15 +987,19 @@ uspoof_check(const USpoofChecker *sc, * 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(). * + * \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 * 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 +1011,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 @@ -722,13 +1027,17 @@ uspoof_checkUTF8(const USpoofChecker *sc, * 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(). * + * \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,6 +1047,7 @@ 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 @@ -745,26 +1055,229 @@ uspoof_checkUnicodeString(const USpoofChecker *sc, const icu::UnicodeString &id, int32_t *position, UErrorCode *status); +#endif + + +#ifndef U_HIDE_DRAFT_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 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft 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 + * @draft ICU 58 + */ +U_DRAFT 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 + * @draft ICU 58 + */ +U_DRAFT 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. + * @draft ICU 58 + */ +U_DRAFT const USet* U_EXPORT2 +uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status); +#endif /* U_HIDE_DRAFT_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. * - * 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. + * 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> * - * 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 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 @@ -786,6 +1299,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,10 +1311,7 @@ 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 @@ -819,7 +1330,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,10 +1346,7 @@ 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 @@ -850,7 +1361,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,37 +1375,36 @@ 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, @@ -900,40 +1413,38 @@ uspoof_getSkeleton(const USpoofChecker *sc, 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, @@ -943,30 +1454,28 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc, #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 +1486,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 +1501,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 +1518,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 +1533,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. diff --git a/deps/icu-small/source/i18n/unicode/utmscale.h b/deps/icu-small/source/i18n/unicode/utmscale.h index e22b1bc5e6..6b4b389ac8 100644 --- a/deps/icu-small/source/i18n/unicode/utmscale.h +++ b/deps/icu-small/source/i18n/unicode/utmscale.h @@ -1,3 +1,5 @@ +// Copyright (C) 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 diff --git a/deps/icu-small/source/i18n/unicode/utrans.h b/deps/icu-small/source/i18n/unicode/utrans.h index 4ada5ef93c..661ee5d385 100644 --- a/deps/icu-small/source/i18n/unicode/utrans.h +++ b/deps/icu-small/source/i18n/unicode/utrans.h @@ -1,3 +1,5 @@ +// Copyright (C) 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/deps/icu-small/source/i18n/unicode/vtzone.h b/deps/icu-small/source/i18n/unicode/vtzone.h index 22992b197f..1682a3d526 100644 --- a/deps/icu-small/source/i18n/unicode/vtzone.h +++ b/deps/icu-small/source/i18n/unicode/vtzone.h @@ -1,3 +1,5 @@ +// Copyright (C) 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 |