diff options
Diffstat (limited to 'Build/source/libs/icu/icu-src/source/i18n/unicode')
13 files changed, 347 insertions, 131 deletions
diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/basictz.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/basictz.h index 250ea309279..d9f85e45eef 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/basictz.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/basictz.h @@ -152,17 +152,15 @@ public: virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const; -#ifndef U_FORCE_HIDE_DRAFT_API /** * Get time zone offsets from local wall time. - * @draft ICU 69 + * @stable ICU 69 */ virtual void getOffsetFromLocal( UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; -#endif /* U_FORCE_HIDE_DRAFT_API */ #ifndef U_HIDE_INTERNAL_API /** diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/dtptngen.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/dtptngen.h index 250a0e089fe..6be0e2a571c 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/dtptngen.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/dtptngen.h @@ -311,6 +311,11 @@ public: * for those two skeletons, so the result is put together with this pattern, * resulting in "d-MMM h:mm". * + * There are four DateTimeFormats in a DateTimePatternGenerator object, + * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method sets + * all of them to the specified pattern. To set them individually, see + * setDateTimeFormat(UDateFormatStyle style, ...). + * * @param dateTimeFormat * message format pattern, here {1} will be replaced by the date * pattern and {0} will be replaced by the time pattern. @@ -320,11 +325,66 @@ public: /** * Getter corresponding to setDateTimeFormat. + * + * There are four DateTimeFormats in a DateTimePatternGenerator object, + * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method gets + * the style for UDAT_MEDIUM (the default). To get them individually, see + * getDateTimeFormat(UDateFormatStyle style). + * * @return DateTimeFormat. * @stable ICU 3.8 */ const UnicodeString& getDateTimeFormat() const; +#if !UCONFIG_NO_FORMATTING +#ifndef U_HIDE_DRAFT_API + /** + * dateTimeFormats are message patterns used to compose combinations of date + * and time patterns. There are four length styles, corresponding to the + * inferred style of the date pattern; these are UDateFormatStyle values: + * - UDAT_FULL (for date pattern with weekday and long month), else + * - UDAT_LONG (for a date pattern with long month), else + * - UDAT_MEDIUM (for a date pattern with abbreviated month), else + * - UDAT_SHORT (for any other date pattern). + * For details on dateTimeFormats, see + * https://www.unicode.org/reports/tr35/tr35-dates.html#dateTimeFormats. + * The default pattern in the root locale for all styles is "{1} {0}". + * + * @param style + * one of DateFormat.FULL..DateFormat.SHORT. Error if out of range. + * @param dateTimeFormat + * the new dateTimeFormat to set for the the specified style + * @param status + * in/out parameter; if no failure status is already set, + * it will be set according to result of the function (e.g. + * U_ILLEGAL_ARGUMENT_ERROR for style out of range). + * @draft ICU 71 + */ + void setDateTimeFormat(UDateFormatStyle style, const UnicodeString& dateTimeFormat, + UErrorCode& status); + + /** + * Getter corresponding to setDateTimeFormat. + * + * @param style + * one of UDAT_FULL..UDAT_SHORT. Error if out of range. + * @param status + * in/out parameter; if no failure status is already set, + * it will be set according to result of the function (e.g. + * U_ILLEGAL_ARGUMENT_ERROR for style out of range). + * @return + * the current dateTimeFormat for the the specified style, or + * empty string in case of error. The UnicodeString reference, + * or the contents of the string, may no longer be valid if + * setDateTimeFormat is called, or the DateTimePatternGenerator + * object is deleted. + * @draft ICU 71 + */ + const UnicodeString& getDateTimeFormat(UDateFormatStyle style, + UErrorCode& status) const; +#endif /* U_HIDE_DRAFT_API */ +#endif /* #if !UCONFIG_NO_FORMATTING */ + /** * Return the best pattern matching the input skeleton. It is guaranteed to * have all of the fields in the skeleton. @@ -545,8 +605,7 @@ private: */ DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other); - // TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode. - // static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; + static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; Locale pLocale; // pattern locale FormatParser *fp; @@ -554,9 +613,8 @@ private: DistanceInfo *distanceInfo; PatternMap *patternMap; UnicodeString appendItemFormats[UDATPG_FIELD_COUNT]; - // TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT - UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3]; - UnicodeString dateTimeFormat; + UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][UDATPG_WIDTH_COUNT]; + UnicodeString dateTimeFormat[4]; UnicodeString decimal; DateTimeMatcher *skipMatcher; Hashtable *fAvailableFormatKeyHash; diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/measunit.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/measunit.h index 61da62e71f2..b7e8e1676a4 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/measunit.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/measunit.h @@ -77,14 +77,13 @@ enum UMeasureUnitComplexity { }; -#ifndef U_HIDE_DRAFT_API /** * Enumeration for SI and binary prefixes, e.g. "kilo-", "nano-", "mebi-". * * Enum values should be treated as opaque: use umeas_getPrefixPower() and * umeas_getPrefixBase() to find their corresponding values. * - * @draft ICU 69 + * @stable ICU 69 * @see umeas_getPrefixBase * @see umeas_getPrefixPower */ @@ -96,14 +95,14 @@ typedef enum UMeasurePrefix { * implementation detail and should not be relied upon: use * umeas_getPrefixPower() to obtain meaningful values. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_ONE = 30 + 0, /** * SI prefix: yotta, 10^24. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_YOTTA = UMEASURE_PREFIX_ONE + 24, @@ -119,133 +118,133 @@ typedef enum UMeasurePrefix { /** * SI prefix: zetta, 10^21. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_ZETTA = UMEASURE_PREFIX_ONE + 21, /** * SI prefix: exa, 10^18. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_EXA = UMEASURE_PREFIX_ONE + 18, /** * SI prefix: peta, 10^15. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_PETA = UMEASURE_PREFIX_ONE + 15, /** * SI prefix: tera, 10^12. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_TERA = UMEASURE_PREFIX_ONE + 12, /** * SI prefix: giga, 10^9. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_GIGA = UMEASURE_PREFIX_ONE + 9, /** * SI prefix: mega, 10^6. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_MEGA = UMEASURE_PREFIX_ONE + 6, /** * SI prefix: kilo, 10^3. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_KILO = UMEASURE_PREFIX_ONE + 3, /** * SI prefix: hecto, 10^2. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_HECTO = UMEASURE_PREFIX_ONE + 2, /** * SI prefix: deka, 10^1. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_DEKA = UMEASURE_PREFIX_ONE + 1, /** * SI prefix: deci, 10^-1. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_DECI = UMEASURE_PREFIX_ONE + -1, /** * SI prefix: centi, 10^-2. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_CENTI = UMEASURE_PREFIX_ONE + -2, /** * SI prefix: milli, 10^-3. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_MILLI = UMEASURE_PREFIX_ONE + -3, /** * SI prefix: micro, 10^-6. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_MICRO = UMEASURE_PREFIX_ONE + -6, /** * SI prefix: nano, 10^-9. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_NANO = UMEASURE_PREFIX_ONE + -9, /** * SI prefix: pico, 10^-12. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_PICO = UMEASURE_PREFIX_ONE + -12, /** * SI prefix: femto, 10^-15. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_FEMTO = UMEASURE_PREFIX_ONE + -15, /** * SI prefix: atto, 10^-18. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_ATTO = UMEASURE_PREFIX_ONE + -18, /** * SI prefix: zepto, 10^-21. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_ZEPTO = UMEASURE_PREFIX_ONE + -21, /** * SI prefix: yocto, 10^-24. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_YOCTO = UMEASURE_PREFIX_ONE + -24, @@ -270,7 +269,7 @@ typedef enum UMeasurePrefix { /** * Binary prefix: kibi, 1024^1. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_KIBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 1, @@ -286,49 +285,49 @@ typedef enum UMeasurePrefix { /** * Binary prefix: mebi, 1024^2. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_MEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 2, /** * Binary prefix: gibi, 1024^3. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_GIBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 3, /** * Binary prefix: tebi, 1024^4. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_TEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 4, /** * Binary prefix: pebi, 1024^5. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_PEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 5, /** * Binary prefix: exbi, 1024^6. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_EXBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 6, /** * Binary prefix: zebi, 1024^7. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_ZEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 7, /** * Binary prefix: yobi, 1024^8. * - * @draft ICU 69 + * @stable ICU 69 */ UMEASURE_PREFIX_YOBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 8, @@ -347,7 +346,7 @@ typedef enum UMeasurePrefix { * base is 10 for SI prefixes (kilo, micro) and 1024 for binary prefixes (kibi, * mebi). * - * @draft ICU 69 + * @stable ICU 69 */ U_CAPI int32_t U_EXPORT2 umeas_getPrefixBase(UMeasurePrefix unitPrefix); @@ -355,12 +354,10 @@ U_CAPI int32_t U_EXPORT2 umeas_getPrefixBase(UMeasurePrefix unitPrefix); * Returns the exponent of the factor associated with the given unit prefix, for * example 3 for kilo, -6 for micro, 1 for kibi, 2 for mebi, 3 for gibi. * - * @draft ICU 69 + * @stable ICU 69 */ U_CAPI int32_t U_EXPORT2 umeas_getPrefixPower(UMeasurePrefix unitPrefix); -#endif // U_HIDE_DRAFT_API - /** * A unit such as length, mass, volume, currency, etc. A unit is * coupled with a numeric amount to produce a Measure. @@ -481,7 +478,6 @@ class U_I18N_API MeasureUnit: public UObject { */ UMeasureUnitComplexity getComplexity(UErrorCode& status) const; -#ifndef U_HIDE_DRAFT_API /** * Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix. * For example, UMEASURE_PREFIX_KILO for "kilo", or UMEASURE_PREFIX_KIBI for "kibi". @@ -494,7 +490,7 @@ class U_I18N_API MeasureUnit: public UObject { * @param prefix The prefix, from UMeasurePrefix. * @param status Set if this is not a SINGLE unit or if another error occurs. * @return A new SINGLE unit. - * @draft ICU 69 + * @stable ICU 69 */ MeasureUnit withPrefix(UMeasurePrefix prefix, UErrorCode& status) const; @@ -510,10 +506,9 @@ class U_I18N_API MeasureUnit: public UObject { * @return The prefix of this SINGLE unit, from UMeasurePrefix. * @see umeas_getPrefixBase * @see umeas_getPrefixPower - * @draft ICU 69 + * @stable ICU 69 */ UMeasurePrefix getPrefix(UErrorCode& status) const; -#endif // U_HIDE_DRAFT_API /** * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality @@ -989,23 +984,21 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit getKarat(); -#ifndef U_HIDE_DRAFT_API /** * Returns by pointer, unit of concentr: milligram-ofglucose-per-deciliter. * Caller owns returned value and must free it. * Also see {@link #getMilligramOfglucosePerDeciliter()}. * @param status ICU error code. - * @draft ICU 69 + * @stable ICU 69 */ static MeasureUnit *createMilligramOfglucosePerDeciliter(UErrorCode &status); /** * Returns by value, unit of concentr: milligram-ofglucose-per-deciliter. * Also see {@link #createMilligramOfglucosePerDeciliter()}. - * @draft ICU 69 + * @stable ICU 69 */ static MeasureUnit getMilligramOfglucosePerDeciliter(); -#endif /* U_HIDE_DRAFT_API */ /** * Returns by pointer, unit of concentr: milligram-per-deciliter. diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/numberformatter.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/numberformatter.h index ece433b55f0..711064ece8d 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/numberformatter.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/numberformatter.h @@ -22,6 +22,7 @@ #include "unicode/parseerr.h" #include "unicode/plurrule.h" #include "unicode/ucurr.h" +#include "unicode/unounclass.h" #include "unicode/unum.h" #include "unicode/unumberformatter.h" #include "unicode/uobject.h" @@ -640,6 +641,33 @@ class U_I18N_API Precision : public UMemory { */ static IncrementPrecision increment(double roundingIncrement); +#ifndef U_HIDE_DRAFT_API + /** + * Version of `Precision::increment()` that takes an integer at a particular power of 10. + * + * To round to the nearest 0.5 and display 2 fraction digits, with this function, you should write one of the following: + * + * <pre> + * Precision::incrementExact(5, -1).withMinFraction(2) + * Precision::incrementExact(50, -2).withMinFraction(2) + * Precision::incrementExact(50, -2) + * </pre> + * + * This is analagous to ICU4J `Precision.increment(new BigDecimal("0.50"))`. + * + * This behavior is modeled after ECMA-402. For more information, see: + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#roundingincrement + * + * @param mantissa + * The increment to which to round numbers. + * @param magnitude + * The power of 10 of the ones digit of the mantissa. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @draft ICU 71 + */ + static IncrementPrecision incrementExact(uint64_t mantissa, int16_t magnitude); +#endif // U_HIDE_DRAFT_API + /** * Show numbers rounded and padded according to the rules for the currency unit. The most common * rounding precision settings for currencies include <code>Precision::fixedFraction(2)</code>, @@ -659,16 +687,14 @@ class U_I18N_API Precision : public UMemory { */ static CurrencyPrecision currency(UCurrencyUsage currencyUsage); -#ifndef U_HIDE_DRAFT_API /** * Configure how trailing zeros are displayed on numbers. For example, to hide trailing zeros * when the number is an integer, use UNUM_TRAILING_ZERO_HIDE_IF_WHOLE. * * @param trailingZeroDisplay Option to configure the display of trailing zeros. - * @draft ICU 69 + * @stable ICU 69 */ Precision trailingZeroDisplay(UNumberTrailingZeroDisplay trailingZeroDisplay) const; -#endif // U_HIDE_DRAFT_API private: enum PrecisionType { @@ -707,16 +733,23 @@ class U_I18N_API Precision : public UMemory { impl::digits_t fMaxSig; /** @internal (private) */ UNumberRoundingPriority fPriority; + /** + * Whether to retain trailing zeros based on the looser strategy. + * @internal (private) + */ + bool fRetain; } fracSig; /** @internal (private) */ struct IncrementSettings { // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE + // Note: This is a union, so we shouldn't own memory, since + // the default destructor would leak it. /** @internal (private) */ - double fIncrement; + uint64_t fIncrement; /** @internal (private) */ - impl::digits_t fMinFrac; + impl::digits_t fIncrementMagnitude; /** @internal (private) */ - impl::digits_t fMaxFrac; + impl::digits_t fMinFrac; } increment; UCurrencyUsage currencyUsage; // For RND_CURRENCY UErrorCode errorCode; // For RND_ERROR @@ -759,9 +792,10 @@ class U_I18N_API Precision : public UMemory { const FractionPrecision &base, int32_t minSig, int32_t maxSig, - UNumberRoundingPriority priority); + UNumberRoundingPriority priority, + bool retain); - static IncrementPrecision constructIncrement(double increment, int32_t minFrac); + static IncrementPrecision constructIncrement(uint64_t increment, impl::digits_t magnitude); static CurrencyPrecision constructCurrency(UCurrencyUsage usage); @@ -801,7 +835,6 @@ class U_I18N_API Precision : public UMemory { */ class U_I18N_API FractionPrecision : public Precision { public: -#ifndef U_HIDE_DRAFT_API /** * Override maximum fraction digits with maximum significant digits depending on the magnitude * of the number. See UNumberRoundingPriority. @@ -814,13 +847,12 @@ class U_I18N_API FractionPrecision : public Precision { * How to disambiguate between fraction digits and significant digits. * @return A precision for chaining or passing to the NumberFormatter precision() setter. * - * @draft ICU 69 + * @stable ICU 69 */ Precision withSignificantDigits( int32_t minSignificantDigits, int32_t maxSignificantDigits, UNumberRoundingPriority priority) const; -#endif // U_HIDE_DRAFT_API /** * Ensure that no less than this number of significant digits are retained when rounding @@ -1170,22 +1202,26 @@ class U_I18N_API Scale : public UMemory { namespace impl { -// Do not enclose entire StringProp with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +// Do not enclose entire StringProp with #ifndef U_HIDE_INTERNAL_API, needed for a protected field. +// And do not enclose its class boilerplate within #ifndef U_HIDE_INTERNAL_API. /** * Manages NumberFormatterSettings::usage()'s char* instance on the heap. * @internal */ class U_I18N_API StringProp : public UMemory { -#ifndef U_HIDE_INTERNAL_API - public: /** @internal */ + ~StringProp(); + + /** @internal */ StringProp(const StringProp &other); /** @internal */ StringProp &operator=(const StringProp &other); +#ifndef U_HIDE_INTERNAL_API + /** @internal */ StringProp(StringProp &&src) U_NOEXCEPT; @@ -1193,9 +1229,6 @@ class U_I18N_API StringProp : public UMemory { StringProp &operator=(StringProp &&src) U_NOEXCEPT; /** @internal */ - ~StringProp(); - - /** @internal */ int16_t length() const { return fLength; } @@ -2735,14 +2768,20 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { */ MeasureUnit getOutputUnit(UErrorCode& status) const; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_DRAFT_API + /** - * Gets the gender of the formatted output. Returns "" when the gender is - * unknown, or for ungendered languages. + * Gets the noun class of the formatted output. Returns `OTHER` when the noun class + * is not supported yet. * - * @internal ICU 69 technology preview. + * @return `NounClass` + * @draft ICU 71. */ - const char *getGender(UErrorCode& status) const; + NounClass getNounClass(UErrorCode &status) const; + +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API /** * Gets the raw DecimalQuantity for plural rule selection. @@ -2758,6 +2797,18 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { #endif /* U_HIDE_INTERNAL_API */ +#ifndef U_HIDE_DEPRECATED_API + + /** + * Gets the gender of the formatted output. Returns "" when the gender is + * unknown, or for ungendered languages. + * + * @deprecated This API is for ICU internal use only. + */ + const char *getGender(UErrorCode &status) const; + +#endif /* U_HIDE_DEPRECATED_API */ + private: // Can't use LocalPointer because UFormattedNumberData is forward-declared const impl::UFormattedNumberData *fData; diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/rbtz.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/rbtz.h index 1eca70c338b..4fbf330cef1 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/rbtz.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/rbtz.h @@ -303,16 +303,14 @@ public: virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const override; -#ifndef U_FORCE_HIDE_DRAFT_API /** * Get time zone offsets from local wall time. - * @draft ICU 69 + * @stable ICU 69 */ virtual void getOffsetFromLocal( UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const override; -#endif /* U_FORCE_HIDE_DRAFT_API */ private: void deleteRules(void); diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/simpletz.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/simpletz.h index f5c155de466..f73d823ee58 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/simpletz.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/simpletz.h @@ -620,16 +620,14 @@ public: virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& ec) const override; -#ifndef U_FORCE_HIDE_DRAFT_API /** * Get time zone offsets from local wall time. - * @draft ICU 69 + * @stable ICU 69 */ virtual void getOffsetFromLocal( UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const override; -#endif /* U_FORCE_HIDE_DRAFT_API */ /** * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/ucal.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/ucal.h index 94abae83919..3a4fb69fc3e 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/ucal.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/ucal.h @@ -1617,25 +1617,23 @@ U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, UChar* id, int32_t idCapacity, UErrorCode* status); -#ifndef U_FORCE_HIDE_DRAFT_API /** * Options used by ucal_getTimeZoneOffsetFromLocal and BasicTimeZone::getOffsetFromLocal() * to specify how to interpret an input time when it does not exist, or when it is ambiguous, * around a time zone transition. - * @draft ICU 69 + * @stable ICU 69 */ enum UTimeZoneLocalOption { -#ifndef U_HIDE_DRAFT_API /** * An input time is always interpreted as local time before * a time zone transition. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_FORMER = 0x04, /** * An input time is always interpreted as local time after * a time zone transition. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_LATTER = 0x0C, /** @@ -1644,7 +1642,7 @@ enum UTimeZoneLocalOption { * sides of a time zone transition are standard time, * or daylight saving time, the local time before the * transition is used. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_STANDARD_FORMER = UCAL_TZ_LOCAL_FORMER | 0x01, /** @@ -1653,7 +1651,7 @@ enum UTimeZoneLocalOption { * sides of a time zone transition are standard time, * or daylight saving time, the local time after the * transition is used. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_STANDARD_LATTER = UCAL_TZ_LOCAL_LATTER | 0x01, /** @@ -1662,7 +1660,7 @@ enum UTimeZoneLocalOption { * sides of a time zone transition are standard time, * or daylight saving time, the local time before the * transition is used. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_DAYLIGHT_FORMER = UCAL_TZ_LOCAL_FORMER | 0x03, /** @@ -1671,19 +1669,11 @@ enum UTimeZoneLocalOption { * sides of a time zone transition are standard time, * or daylight saving time, the local time after the * transition is used. - * @draft ICU 69 + * @stable ICU 69 */ UCAL_TZ_LOCAL_DAYLIGHT_LATTER = UCAL_TZ_LOCAL_LATTER | 0x03, -#else /* U_HIDE_DRAFT_API */ - /** - * Dummy value to prevent empty enum if U_HIDE_DRAFT_API. - * This will go away when draft conditionals are removed. - * @internal - */ - UCAL_TZ_LOCAL_NONE = 0, -#endif /* U_HIDE_DRAFT_API */ }; -typedef enum UTimeZoneLocalOption UTimeZoneLocalOption; /**< @draft ICU 69 */ +typedef enum UTimeZoneLocalOption UTimeZoneLocalOption; /**< @stable ICU 69 */ /** * Returns the time zone raw and GMT offset for the given moment @@ -1710,7 +1700,7 @@ typedef enum UTimeZoneLocalOption UTimeZoneLocalOption; /**< @draft ICU 69 */ * typically one hour. * If the status is set to one of the error code, the value set is unspecified. * @param status A pointer to a UErrorCode to receive any errors. -* @draft ICU 69 +* @stable ICU 69 */ U_CAPI void U_EXPORT2 ucal_getTimeZoneOffsetFromLocal( @@ -1718,7 +1708,6 @@ ucal_getTimeZoneOffsetFromLocal( UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t* rawOffset, int32_t* dstOffset, UErrorCode* status); -#endif /* U_FORCE_HIDE_DRAFT_API */ #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/ucol.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/ucol.h index 6d22eb6069e..24963312216 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/ucol.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/ucol.h @@ -397,7 +397,7 @@ typedef enum { * @param status A pointer to a UErrorCode to receive any errors * @return A pointer to a UCollator, or 0 if an error occurred. * @see ucol_openRules - * @see ucol_safeClone + * @see ucol_clone * @see ucol_close * @stable ICU 2.0 */ @@ -425,7 +425,7 @@ ucol_open(const char *loc, UErrorCode *status); * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case * of error - please use status argument to check for errors. * @see ucol_open - * @see ucol_safeClone + * @see ucol_clone * @see ucol_close * @stable ICU 2.0 */ @@ -521,7 +521,7 @@ ucol_getContractionsAndExpansions( const UCollator *coll, * @param coll The UCollator to close. * @see ucol_open * @see ucol_openRules - * @see ucol_safeClone + * @see ucol_clone * @stable ICU 2.0 */ U_CAPI void U_EXPORT2 @@ -985,7 +985,6 @@ ucol_getShortDefinitionString(const UCollator *coll, * * @deprecated ICU 54 */ - U_DEPRECATED int32_t U_EXPORT2 ucol_normalizeShortDefinitionString(const char *source, char *destination, @@ -1313,6 +1312,20 @@ ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *stat /** * Thread safe cloning operation. The result is a clone of a given collator. * @param coll collator to be cloned + * @param status to indicate whether the operation went on smoothly or there were errors + * @return pointer to the new clone + * @see ucol_open + * @see ucol_openRules + * @see ucol_close + * @stable ICU 71 + */ +U_CAPI UCollator* U_EXPORT2 ucol_clone(const UCollator *coll, UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Thread safe cloning operation. The result is a clone of a given collator. + * @param coll collator to be cloned * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br> * user allocated space for the new clone. * If NULL new memory will be allocated. @@ -1325,21 +1338,20 @@ ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *stat * If *pBufferSize is not enough for a stack-based safe clone, * new memory will be allocated. * @param status to indicate whether the operation went on smoothly or there were errors - * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any - * allocations were necessary. + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used + * if pBufferSize != NULL and any allocations were necessary * @return pointer to the new clone * @see ucol_open * @see ucol_openRules * @see ucol_close - * @stable ICU 2.0 + * @deprecated ICU 71 Use ucol_clone() instead. */ -U_CAPI UCollator* U_EXPORT2 +U_DEPRECATED UCollator* U_EXPORT2 ucol_safeClone(const UCollator *coll, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status); -#ifndef U_HIDE_DEPRECATED_API /** default memory size for the new clone. * @deprecated ICU 52. Do not rely on ucol_safeClone() cloning into any provided buffer. diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/udatpg.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/udatpg.h index efe4357bfee..684a905e426 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/udatpg.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/udatpg.h @@ -492,6 +492,11 @@ udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, * for those two skeletons, so the result is put together with this pattern, * resulting in "d-MMM h:mm". * + * There are four DateTimeFormats in a UDateTimePatternGenerator object, + * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method sets + * all of them to the specified pattern. To set them individually, see + * udatpg_setDateTimeFormatForStyle. + * * @param dtpg a pointer to UDateTimePatternGenerator. * @param dtFormat * message format pattern, here {1} will be replaced by the date @@ -505,6 +510,12 @@ udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, /** * Getter corresponding to setDateTimeFormat. + * + * There are four DateTimeFormats in a UDateTimePatternGenerator object, + * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method gets + * the style for UDAT_MEDIUM (the default). To get them individually, see + * udatpg_getDateTimeFormatForStyle. + * * @param dtpg a pointer to UDateTimePatternGenerator. * @param pLength A pointer that will receive the length of the format * @return dateTimeFormat. @@ -514,6 +525,70 @@ U_CAPI const UChar * U_EXPORT2 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, int32_t *pLength); +#if !UCONFIG_NO_FORMATTING +#ifndef U_HIDE_DRAFT_API +/** + * dateTimeFormats are message patterns used to compose combinations of date + * and time patterns. There are four length styles, corresponding to the + * inferred style of the date pattern; these are UDateFormatStyle values: + * - UDAT_FULL (for date pattern with weekday and long month), else + * - UDAT_LONG (for a date pattern with long month), else + * - UDAT_MEDIUM (for a date pattern with abbreviated month), else + * - UDAT_SHORT (for any other date pattern). + * For details on dateTimeFormats, see + * https://www.unicode.org/reports/tr35/tr35-dates.html#dateTimeFormats. + * The default pattern in the root locale for all styles is "{1} {0}". + * + * @param udtpg + * a pointer to the UDateTimePatternGenerator + * @param style + * one of UDAT_FULL..UDAT_SHORT. Error if out of range. + * @param dateTimeFormat + * the new dateTimeFormat to set for the the specified style + * @param length + * the length of dateTimeFormat, or -1 if unknown and pattern + * is null-terminated + * @param pErrorCode + * a pointer to the UErrorCode (in/out parameter); if no failure + * status is already set, it will be set according to result of the + * function (e.g. U_ILLEGAL_ARGUMENT_ERROR for style out of range). + * @draft ICU 71 + */ +U_CAPI void U_EXPORT2 +udatpg_setDateTimeFormatForStyle(UDateTimePatternGenerator *udtpg, + UDateFormatStyle style, + const UChar *dateTimeFormat, int32_t length, + UErrorCode *pErrorCode); + +/** + * Getter corresponding to udatpg_setDateTimeFormatForStyle. + * + * @param udtpg + * a pointer to the UDateTimePatternGenerator + * @param style + * one of UDAT_FULL..UDAT_SHORT. Error if out of range. + * @param pLength + * a pointer that will receive the length of the format. May be NULL + * if length is not desired. + * @param pErrorCode + * a pointer to the UErrorCode (in/out parameter); if no failure + * status is already set, it will be set according to result of the + * function (e.g. U_ILLEGAL_ARGUMENT_ERROR for style out of range). + * @return + * pointer to the current dateTimeFormat (0 terminated) for the specified + * style, or empty string in case of error. The pointer and its contents + * may no longer be valid if udatpg_setDateTimeFormat is called, or + * udatpg_setDateTimeFormatForStyle for the same style is called, or the + * UDateTimePatternGenerator object is closed. + * @draft ICU 71 + */ +U_CAPI const UChar* U_EXPORT2 +udatpg_getDateTimeFormatForStyle(const UDateTimePatternGenerator *udtpg, + UDateFormatStyle style, int32_t *pLength, + UErrorCode *pErrorCode); +#endif /* U_HIDE_DRAFT_API */ +#endif /* #if !UCONFIG_NO_FORMATTING */ + /** * The decimal value is used in formatting fractions of seconds. If the * skeleton contains fractional seconds, then this is used with the diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/unounclass.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/unounclass.h new file mode 100644 index 00000000000..1721dbd584f --- /dev/null +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/unounclass.h @@ -0,0 +1,43 @@ +// © 2022 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __UNOUNCLASS_H__ +#define __UNOUNCLASS_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uversion.h" + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DRAFT_API + +/** + * Represents all the grammatical noun classes that are supported by CLDR. + * + * @draft ICU 71. + */ +enum NounClass { + OTHER = 0, + NEUTER = 1, + FEMININE = 2, + MASCULINE = 3, + ANIMATE = 4, + INANIMATE = 5, + PERSONAL = 6, + COMMON = 7, +}; + +#endif // U_HIDE_DRAFT_API + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __UNOUNCLASS_H__ diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/unum.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/unum.h index 14f76168b61..863695591ab 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/unum.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/unum.h @@ -303,23 +303,21 @@ typedef enum UNumberFormatRoundingMode { * @stable ICU 4.8 */ UNUM_ROUND_UNNECESSARY, -#ifndef U_HIDE_DRAFT_API /** * Rounds ties toward the odd number. - * @draft ICU 69 + * @stable ICU 69 */ UNUM_ROUND_HALF_ODD, /** * Rounds ties toward +∞. - * @draft ICU 69 + * @stable ICU 69 */ UNUM_ROUND_HALF_CEILING, /** * Rounds ties toward -∞. - * @draft ICU 69 + * @stable ICU 69 */ UNUM_ROUND_HALF_FLOOR, -#endif // U_HIDE_DRAFT_API } UNumberFormatRoundingMode; /** The possible number format pad positions. @@ -401,13 +399,24 @@ typedef enum UNumberFormatFields { UNUM_MEASURE_UNIT_FIELD, /** @stable ICU 64 */ UNUM_COMPACT_FIELD, +#ifndef U_HIDE_DRAFT_API + /** + * Approximately sign. In ICU 70, this was categorized under the generic SIGN field. + * @draft ICU 71 + */ + UNUM_APPROXIMATELY_SIGN_FIELD, +#endif // U_HIDE_DRAFT_API #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 = UNUM_SIGN_FIELD + 3 +#ifndef U_HIDE_DRAFT_API + UNUM_FIELD_COUNT = UNUM_COMPACT_FIELD + 2 +#else // U_HIDE_DRAFT_API (for UNUM_APPROXIMATELY_SIGN_FIELD) + UNUM_FIELD_COUNT = UNUM_COMPACT_FIELD + 1 +#endif // U_HIDE_DRAFT_API (for UNUM_APPROXIMATELY_SIGN_FIELD) #endif /* U_HIDE_DEPRECATED_API */ } UNumberFormatFields; diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/unumberformatter.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/unumberformatter.h index cb980cd94dd..58a75baf073 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/unumberformatter.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/unumberformatter.h @@ -78,7 +78,6 @@ * </pre> */ -#ifndef U_FORCE_HIDE_DRAFT_API /** * An enum declaring how to resolve conflicts between maximum fraction digits and maximum * significant digits. @@ -115,24 +114,23 @@ * Here, RELAXED favors Max-Fraction and STRICT favors Max-Significant. Note that this larger * number caused the two modes to favor the opposite result. * - * @draft ICU 69 + * @stable ICU 69 */ typedef enum UNumberRoundingPriority { /** * Favor greater precision by relaxing one of the rounding constraints. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_ROUNDING_PRIORITY_RELAXED, /** * Favor adherence to all rounding constraints by producing lower precision. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_ROUNDING_PRIORITY_STRICT, } UNumberRoundingPriority; -#endif // U_FORCE_HIDE_DRAFT_API /** * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123 @@ -435,21 +433,19 @@ typedef enum UNumberSignDisplay { */ UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO, -#ifndef U_HIDE_DRAFT_API /** * Same as AUTO, but do not show the sign on negative zero. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_SIGN_NEGATIVE, /** * Same as ACCOUNTING, but do not show the sign on negative zero. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_SIGN_ACCOUNTING_NEGATIVE, -#endif // U_HIDE_DRAFT_API // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, // needed for unconditionalized struct MacroProps @@ -498,31 +494,29 @@ typedef enum UNumberDecimalSeparatorDisplay { UNUM_DECIMAL_SEPARATOR_COUNT } UNumberDecimalSeparatorDisplay; -#ifndef U_FORCE_HIDE_DRAFT_API /** * An enum declaring how to render trailing zeros. * * - UNUM_TRAILING_ZERO_AUTO: 0.90, 1.00, 1.10 * - UNUM_TRAILING_ZERO_HIDE_IF_WHOLE: 0.90, 1, 1.10 * - * @draft ICU 69 + * @stable ICU 69 */ typedef enum UNumberTrailingZeroDisplay { /** * Display trailing zeros according to the settings for minimum fraction and significant digits. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_TRAILING_ZERO_AUTO, /** * Same as AUTO, but hide trailing zeros after the decimal separator if they are all zero. * - * @draft ICU 69 + * @stable ICU 69 */ UNUM_TRAILING_ZERO_HIDE_IF_WHOLE, } UNumberTrailingZeroDisplay; -#endif // U_FORCE_HIDE_DRAFT_API struct UNumberFormatter; /** diff --git a/Build/source/libs/icu/icu-src/source/i18n/unicode/vtzone.h b/Build/source/libs/icu/icu-src/source/i18n/unicode/vtzone.h index e7d2f515410..ecf335bbe34 100644 --- a/Build/source/libs/icu/icu-src/source/i18n/unicode/vtzone.h +++ b/Build/source/libs/icu/icu-src/source/i18n/unicode/vtzone.h @@ -264,16 +264,14 @@ public: virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& ec) const override; -#ifndef U_FORCE_HIDE_DRAFT_API /** * Get time zone offsets from local wall time. - * @draft ICU 69 + * @stable ICU 69 */ virtual void getOffsetFromLocal( UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const override; -#endif /* U_FORCE_HIDE_DRAFT_API */ /** * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add |