summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/unicode
diff options
context:
space:
mode:
Diffstat (limited to 'deps/icu-small/source/i18n/unicode')
-rw-r--r--deps/icu-small/source/i18n/unicode/alphaindex.h2
-rw-r--r--deps/icu-small/source/i18n/unicode/currunit.h14
-rw-r--r--deps/icu-small/source/i18n/unicode/decimfmt.h180
-rw-r--r--deps/icu-small/source/i18n/unicode/dtitvfmt.h173
-rw-r--r--deps/icu-small/source/i18n/unicode/dtitvinf.h1
-rw-r--r--deps/icu-small/source/i18n/unicode/dtptngen.h5
-rw-r--r--deps/icu-small/source/i18n/unicode/formattedvalue.h317
-rw-r--r--deps/icu-small/source/i18n/unicode/listformatter.h102
-rw-r--r--deps/icu-small/source/i18n/unicode/measfmt.h30
-rw-r--r--deps/icu-small/source/i18n/unicode/measunit.h2072
-rw-r--r--deps/icu-small/source/i18n/unicode/msgfmt.h27
-rw-r--r--deps/icu-small/source/i18n/unicode/nounit.h4
-rw-r--r--deps/icu-small/source/i18n/unicode/numberformatter.h373
-rw-r--r--deps/icu-small/source/i18n/unicode/numberrangeformatter.h85
-rw-r--r--deps/icu-small/source/i18n/unicode/numfmt.h6
-rw-r--r--deps/icu-small/source/i18n/unicode/numsys.h28
-rw-r--r--deps/icu-small/source/i18n/unicode/plurrule.h35
-rw-r--r--deps/icu-small/source/i18n/unicode/regex.h230
-rw-r--r--deps/icu-small/source/i18n/unicode/reldatefmt.h218
-rw-r--r--deps/icu-small/source/i18n/unicode/smpdtfmt.h3
-rw-r--r--deps/icu-small/source/i18n/unicode/timezone.h37
-rw-r--r--deps/icu-small/source/i18n/unicode/ucal.h14
-rw-r--r--deps/icu-small/source/i18n/unicode/udat.h21
-rw-r--r--deps/icu-small/source/i18n/unicode/udateintervalformat.h100
-rw-r--r--deps/icu-small/source/i18n/unicode/udatpg.h16
-rw-r--r--deps/icu-small/source/i18n/unicode/uformattedvalue.h440
-rw-r--r--deps/icu-small/source/i18n/unicode/ulistformatter.h107
-rw-r--r--deps/icu-small/source/i18n/unicode/unum.h57
-rw-r--r--deps/icu-small/source/i18n/unicode/unumberformatter.h125
-rw-r--r--deps/icu-small/source/i18n/unicode/unumsys.h1
-rw-r--r--deps/icu-small/source/i18n/unicode/upluralrules.h40
-rw-r--r--deps/icu-small/source/i18n/unicode/uregex.h2
-rw-r--r--deps/icu-small/source/i18n/unicode/ureldatefmt.h152
33 files changed, 4269 insertions, 748 deletions
diff --git a/deps/icu-small/source/i18n/unicode/alphaindex.h b/deps/icu-small/source/i18n/unicode/alphaindex.h
index 4ebdf1cc56..dfb6110a36 100644
--- a/deps/icu-small/source/i18n/unicode/alphaindex.h
+++ b/deps/icu-small/source/i18n/unicode/alphaindex.h
@@ -651,7 +651,7 @@ private:
/**
* No assignment.
*/
- AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;};
+ AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;}
/**
* No Equality operators.
diff --git a/deps/icu-small/source/i18n/unicode/currunit.h b/deps/icu-small/source/i18n/unicode/currunit.h
index 48cadc10b7..63739c37fd 100644
--- a/deps/icu-small/source/i18n/unicode/currunit.h
+++ b/deps/icu-small/source/i18n/unicode/currunit.h
@@ -44,6 +44,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
/**
* Construct an object with the given ISO currency code.
+ *
* @param isoCode the 3-letter ISO 4217 currency code; must have
* length 3 and need not be NUL-terminated. If NULL, the currency
* is initialized to the unknown currency XXX.
@@ -53,6 +54,19 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
*/
CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Construct an object with the given ISO currency code.
+ *
+ * @param isoCode the 3-letter ISO 4217 currency code; must have
+ * length 3. If invalid, the currency is initialized to XXX.
+ * @param ec input-output error code. If the isoCode is invalid,
+ * then this will be set to a failing value.
+ * @draft ICU 64
+ */
+ CurrencyUnit(StringPiece isoCode, UErrorCode &ec);
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Copy constructor
* @stable ICU 3.0
diff --git a/deps/icu-small/source/i18n/unicode/decimfmt.h b/deps/icu-small/source/i18n/unicode/decimfmt.h
index b3a5cc0495..097a38fb88 100644
--- a/deps/icu-small/source/i18n/unicode/decimfmt.h
+++ b/deps/icu-small/source/i18n/unicode/decimfmt.h
@@ -64,18 +64,6 @@ class NumberParserImpl;
}
/**
- * \cond
- * explicit template instantiation. see digitlst.h
- * (When building DLLs for Windows this is required.)
- */
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
-template class U_I18N_API EnumSet<UNumberFormatAttribute,
- UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
- UNUM_LIMIT_BOOLEAN_ATTRIBUTE>;
-#endif
-/** \endcond */
-
-/**
* **IMPORTANT:** New users are strongly encouraged to see if
* numberformatter.h fits their use case. Although not deprecated, this header
* is provided for backwards compatibility only.
@@ -288,7 +276,7 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute,
* <td>Pad escape, precedes pad character
* </table>
*
- * <p>A DecimalFormat pattern contains a postive and negative
+ * <p>A DecimalFormat pattern contains a positive and negative
* subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a
* prefix, a numeric part, and a suffix. If there is no explicit negative
* subpattern, the negative subpattern is the localized minus sign prefixed to the
@@ -423,7 +411,7 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute,
*
* <li>If the number of actual fraction digits is less than the
* <em>minimum fraction digits</em>, then trailing zeros are added.
- * For example, 0.125 is formatted as "0.1250" if the mimimum fraction
+ * For example, 0.125 is formatted as "0.1250" if the minimum fraction
* digits is set to 4.
*
* <li>Trailing fractional zeros are not displayed if they occur
@@ -588,9 +576,9 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute,
* count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
* pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
*
- * <li>If signficant digits are in use, then the integer and fraction
+ * <li>If significant digits are in use, then the integer and fraction
* digit counts, as set via the API, are ignored. If significant
- * digits are not in use, then the signficant digit counts, as set via
+ * digits are not in use, then the significant digit counts, as set via
* the API, are ignored.
*
* </ul>
@@ -644,7 +632,7 @@ template class U_I18N_API EnumSet<UNumberFormatAttribute,
* increment in the pattern itself. "#,#50" specifies a rounding increment of
* 50. "#,##0.05" specifies a rounding increment of 0.05.
*
- * <p>In the absense of an explicit rounding increment numbers are
+ * <p>In the absence of an explicit rounding increment numbers are
* rounded to their formatted width.
*
* <ul>
@@ -849,7 +837,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @param pattern a non-localized pattern string
* @param symbolsToAdopt the set of symbols to be used. The caller should not
* delete this object after making this call.
- * @param parseError Output param to receive errors occured during parsing
+ * @param parseError Output param to receive errors occurred during parsing
* @param status Output param set to success/failure code. If the
* pattern is invalid this will be set to a failure code.
* @stable ICU 2.0
@@ -1127,7 +1115,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* does string comparisons to try to find an optimal match.
* If no object can be parsed, index is unchanged, and NULL is
* returned. The result is returned as the most parsimonious
- * type of Formattable that will accomodate all of the
+ * type of Formattable that will accommodate all of the
* necessary precision. For example, if the result is exactly 12,
* it will be returned as a long. However, if it is 1.5, it will
* be returned as a double.
@@ -1292,20 +1280,27 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setNegativeSuffix(const UnicodeString& newValue);
-#ifndef U_HIDE_INTERNAL_API
+#ifndef U_HIDE_DRAFT_API
/**
* Whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
- * @internal Technical Preview
+ *
+ * For more control over sign display, use NumberFormatter.
+ *
+ * @return Whether the sign is shown on positive numbers and zero.
+ * @draft ICU 64
*/
UBool isSignAlwaysShown() const;
-#endif /* U_HIDE_INTERNAL_API */
/**
- * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
- * @param value The new setting for whether to show plus sign on positive numbers
- * @internal Technical Preview
+ * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12".
+ *
+ * For more control over sign display, use NumberFormatter.
+ *
+ * @param value true to always show a sign; false to hide the sign on positive numbers and zero.
+ * @draft ICU 64
*/
- virtual void setSignAlwaysShown(UBool value);
+ void setSignAlwaysShown(UBool value);
+#endif /* U_HIDE_DRAFT_API */
/**
* Get the multiplier for use in percent, permill, etc.
@@ -1350,7 +1345,6 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @draft ICU 62
*/
int32_t getMultiplierScale(void) const;
-#endif /* U_HIDE_DRAFT_API */
/**
* Sets a power of ten by which number should be multiplied before formatting, which
@@ -1371,7 +1365,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* @param newValue the new value of the power-of-ten multiplier.
* @draft ICU 62
*/
- virtual void setMultiplierScale(int32_t newValue);
+ void setMultiplierScale(int32_t newValue);
+#endif /* U_HIDE_DRAFT_API */
/**
* Get the rounding increment.
@@ -1464,8 +1459,8 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Set the character used to pad to the format width. If padding
* is not enabled, then this will take effect if padding is later
* enabled.
- * @param padChar a string containing the pad charcter. If the string
- * has length 0, then the pad characer is set to ' '. Otherwise
+ * @param padChar a string containing the pad character. If the string
+ * has length 0, then the pad character is set to ' '. Otherwise
* padChar.char32At(0) will be used as the pad character.
* @see #setFormatWidth
* @see #getFormatWidth
@@ -1654,8 +1649,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setSecondaryGroupingSize(int32_t newValue);
-#ifndef U_HIDE_INTERNAL_API
-
+#ifndef U_HIDE_DRAFT_API
/**
* Returns the minimum number of grouping digits.
* Grouping separators are output if there are at least this many
@@ -1666,31 +1660,33 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* For example, if this value is 2, and the grouping size is 3, then
* 9999 -> "9999" and 10000 -> "10,000"
*
- * This is a technology preview. This API may change behavior or may be removed.
- *
* The default value for this attribute is 0.
* A value of 1, 0, or lower, means that the use of grouping separators
* only depends on the grouping size (and on isGroupingUsed()).
- * Currently, the corresponding CLDR data is not used; this is likely to change.
+ *
+ * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat.
+ * This is for backwards compatibility reasons.
+ *
+ * For more control over grouping strategies, use NumberFormatter.
*
* @see setMinimumGroupingDigits
* @see getGroupingSize
- * @internal technology preview
+ * @draft ICU 64
*/
int32_t getMinimumGroupingDigits() const;
-#endif /* U_HIDE_INTERNAL_API */
-
- /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following draft method since it is virtual. */
/**
* Sets the minimum grouping digits. Setting to a value less than or
* equal to 1 turns off minimum grouping digits.
*
+ * For more control over grouping strategies, use NumberFormatter.
+ *
* @param newValue the new value of minimum grouping digits.
* @see getMinimumGroupingDigits
- * @internal technology preview
+ * @draft ICU 64
*/
- virtual void setMinimumGroupingDigits(int32_t newValue);
+ void setMinimumGroupingDigits(int32_t newValue);
+#endif /* U_HIDE_DRAFT_API */
/**
@@ -1732,13 +1728,15 @@ class U_I18N_API DecimalFormat : public NumberFormat {
*/
virtual void setDecimalPatternMatchRequired(UBool newValue);
+#ifndef U_HIDE_DRAFT_API
/**
* Returns whether to ignore exponents when parsing.
*
+ * @return Whether to ignore exponents when parsing.
* @see #setParseNoExponent
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @draft ICU 64
*/
- virtual UBool isParseNoExponent() const;
+ UBool isParseNoExponent() const;
/**
* Specifies whether to stop parsing when an exponent separator is encountered. For
@@ -1746,17 +1744,18 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* 5).
*
* @param value true to prevent exponents from being parsed; false to allow them to be parsed.
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @draft ICU 64
*/
- virtual void setParseNoExponent(UBool value);
+ void setParseNoExponent(UBool value);
/**
* Returns whether parsing is sensitive to case (lowercase/uppercase).
*
+ * @return Whether parsing is case-sensitive.
* @see #setParseCaseSensitive
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @draft ICU 64
*/
- virtual UBool isParseCaseSensitive() const;
+ UBool isParseCaseSensitive() const;
/**
* Whether to pay attention to case when parsing; default is to ignore case (perform
@@ -1765,26 +1764,31 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive
* mode, even though "US$1.00" parses.
*
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @param value true to enable case-sensitive parsing (the default); false to force
+ * case-sensitive parsing behavior.
+ * @draft ICU 64
*/
- virtual void setParseCaseSensitive(UBool value);
+ void setParseCaseSensitive(UBool value);
/**
* Returns whether truncation of high-order integer digits should result in an error.
* By default, setMaximumIntegerDigits truncates high-order digits silently.
*
+ * @return Whether an error code is set if high-order digits are truncated.
* @see setFormatFailIfMoreThanMaxDigits
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @draft ICU 64
*/
- virtual UBool isFormatFailIfMoreThanMaxDigits() const;
+ UBool isFormatFailIfMoreThanMaxDigits() const;
/**
* Sets whether truncation of high-order integer digits should result in an error.
* By default, setMaximumIntegerDigits truncates high-order digits silently.
*
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * @param value Whether to set an error code if high-order digits are truncated.
+ * @draft ICU 64
*/
- virtual void setFormatFailIfMoreThanMaxDigits(UBool value);
+ void setFormatFailIfMoreThanMaxDigits(UBool value);
+#endif /* U_HIDE_DRAFT_API */
/**
@@ -2062,8 +2066,32 @@ class U_I18N_API DecimalFormat : public NumberFormat {
#ifndef U_HIDE_DRAFT_API
/**
- * Converts this DecimalFormat to a NumberFormatter. Starting in ICU 60,
- * NumberFormatter is the recommended way to format numbers.
+ * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting
+ * in ICU 60, NumberFormatter is the recommended way to format numbers.
+ * You can use the returned LocalizedNumberFormatter to format numbers and
+ * get a FormattedNumber, which contains a string as well as additional
+ * annotations about the formatted value.
+ *
+ * If a memory allocation failure occurs, the return value of this method
+ * might be null. If you are concerned about correct recovery from
+ * out-of-memory situations, use this pattern:
+ *
+ * <pre>
+ * FormattedNumber result;
+ * if (auto* ptr = df->toNumberFormatter(status)) {
+ * result = ptr->formatDouble(123, status);
+ * }
+ * </pre>
+ *
+ * If you are not concerned about out-of-memory situations, or if your
+ * environment throws exceptions when memory allocation failure occurs,
+ * you can chain the methods, like this:
+ *
+ * <pre>
+ * FormattedNumber result = df
+ * ->toNumberFormatter(status)
+ * ->formatDouble(123, status);
+ * </pre>
*
* NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat.
* If a non-const method is called on the DecimalFormat, or if the DecimalFormat
@@ -2071,20 +2099,35 @@ class U_I18N_API DecimalFormat : public NumberFormat {
* beyond the lifetime of the DecimalFormat, copy it to a local variable:
*
* <pre>
- * LocalizedNumberFormatter f = df->toNumberFormatter();
+ * LocalizedNumberFormatter lnf;
+ * if (auto* ptr = df->toNumberFormatter(status)) {
+ * lnf = *ptr;
+ * }
* </pre>
*
- * It is, however, safe to use the return value for chaining:
+ * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR.
+ * @return A pointer to an internal object, or nullptr on failure.
+ * Do not delete the return value!
+ * @draft ICU 64
+ */
+ const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DEPRECATED_API
+ /**
+ * Deprecated: Like {@link #toNumberFormatter(UErrorCode&) const},
+ * but does not take an error code.
*
- * <pre>
- * FormattedNumber result = df->toNumberFormatter().formatDouble(123, status);
- * </pre>
+ * The new signature should be used in case an error occurs while returning the
+ * LocalizedNumberFormatter.
*
- * @return The output variable, for chaining.
- * @draft ICU 62
+ * This old signature will be removed in ICU 65.
+ *
+ * @return A reference to an internal object.
+ * @deprecated ICU 64
*/
const number::LocalizedNumberFormatter& toNumberFormatter() const;
-#endif /* U_HIDE_DRAFT_API */
+#endif /* U_HIDE_DEPRECATED_API */
/**
* Return the class ID for this class. This is useful only for
@@ -2117,7 +2160,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
/** Rebuilds the formatter object from the property bag. */
void touch(UErrorCode& status);
- /** Rebuilds the formatter object, hiding the error code. */
+ /** Rebuilds the formatter object, ignoring any error code. */
void touchNoError();
/**
@@ -2156,12 +2199,17 @@ class U_I18N_API DecimalFormat : public NumberFormat {
// INSTANCE FIELDS //
//=====================================================================================//
- // Only one instance field: keep all fields inside of an implementation class defined in number_mapper.h
- number::impl::DecimalFormatFields* fields;
+
+ // One instance field for the implementation, keep all fields inside of an implementation
+ // class defined in number_mapper.h
+ number::impl::DecimalFormatFields* fields = nullptr;
// Allow child class CompactDecimalFormat to access fProperties:
friend class CompactDecimalFormat;
+ // Allow MeasureFormat to use fieldPositionHelper:
+ friend class MeasureFormat;
+
};
U_NAMESPACE_END
diff --git a/deps/icu-small/source/i18n/unicode/dtitvfmt.h b/deps/icu-small/source/i18n/unicode/dtitvfmt.h
index 5eaa559d0e..42d77d041f 100644
--- a/deps/icu-small/source/i18n/unicode/dtitvfmt.h
+++ b/deps/icu-small/source/i18n/unicode/dtitvfmt.h
@@ -28,10 +28,87 @@
#include "unicode/dtintrv.h"
#include "unicode/dtitvinf.h"
#include "unicode/dtptngen.h"
+#include "unicode/formattedvalue.h"
U_NAMESPACE_BEGIN
+class FormattedDateIntervalData;
+class DateIntervalFormat;
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * An immutable class containing the result of a date interval formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * When calling nextPosition():
+ * The fields are returned from left to right. The special field category
+ * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
+ * primitives came from which arguments: 0 means fromCalendar, and 1 means
+ * toCalendar. The span category will always occur before the
+ * corresponding fields in UFIELD_CATEGORY_DATE
+ * in the nextPosition() iterator.
+ *
+ * Not intended for public subclassing.
+ *
+ * @draft ICU 64
+ */
+class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedDateInterval.
+ * @draft ICU 64
+ */
+ FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedDateInterval in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedDateInterval.
+ * @draft ICU 64
+ */
+ virtual ~FormattedDateInterval() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedDateInterval(const FormattedDateInterval&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedDateInterval& operator=(const FormattedDateInterval&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedDateInterval in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedDateIntervalData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedDateInterval(FormattedDateIntervalData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedDateInterval(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class DateIntervalFormat;
+};
+#endif /* U_HIDE_DRAFT_API */
+
/**
* DateIntervalFormat is a class for formatting and parsing date
@@ -218,7 +295,6 @@ U_NAMESPACE_BEGIN
* \endcode
* </pre>
*/
-
class U_I18N_API DateIntervalFormat : public Format {
public:
@@ -425,6 +501,21 @@ public:
FieldPosition& fieldPosition,
UErrorCode& status) const ;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Format a DateInterval to produce a FormattedDateInterval.
+ *
+ * The FormattedDateInterval exposes field information about the formatted string.
+ *
+ * @param dtInterval DateInterval to be formatted.
+ * @param status Set if an error occurs.
+ * @return A FormattedDateInterval containing the format result.
+ * @draft ICU 64
+ */
+ FormattedDateInterval formatToValue(
+ const DateInterval& dtInterval,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
/**
* Format 2 Calendars to produce a string.
@@ -455,6 +546,29 @@ public:
FieldPosition& fieldPosition,
UErrorCode& status) const ;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Format 2 Calendars to produce a FormattedDateInterval.
+ *
+ * The FormattedDateInterval exposes field information about the formatted string.
+ *
+ * Note: "fromCalendar" and "toCalendar" are not const,
+ * since calendar is not const in SimpleDateFormat::format(Calendar&),
+ *
+ * @param fromCalendar calendar set to the from date in date interval
+ * to be formatted into date interval string
+ * @param toCalendar calendar set to the to date in date interval
+ * to be formatted into date interval string
+ * @param status Set if an error occurs.
+ * @return A FormattedDateInterval containing the format result.
+ * @draft ICU 64
+ */
+ FormattedDateInterval formatToValue(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Date interval parsing is not supported. Please do not use.
* <P>
@@ -664,28 +778,14 @@ private:
* Below are for generating interval patterns local to the formatter
*/
- /**
- * Provide an updated FieldPosition posResult based on two formats,
- * the FieldPosition values for each of them, and the pattern used
- * to combine them. The idea is for posResult to indicate the first
- * instance (if any) of the specified field in the combined result,
- * with correct offsets.
- *
- * @param combiningPattern Pattern used to combine pat0 and pat1
- * @param pat0 Formatted date/time value to replace {0}
- * @param pos0 FieldPosition within pat0
- * @param pat1 Formatted date/time value to replace {1}
- * @param pos1 FieldPosition within pat1
- * @param posResult FieldPosition to be set to the correct
- * position of the first field instance when
- * pat0 and pat1 are combined using combiningPattern
- */
- static void
- adjustPosition(UnicodeString& combiningPattern, // has {0} and {1} in it
- UnicodeString& pat0, FieldPosition& pos0, // pattern and pos corresponding to {0}
- UnicodeString& pat1, FieldPosition& pos1, // pattern and pos corresponding to {1}
- FieldPosition& posResult);
-
+ /** Like fallbackFormat, but only formats the range part of the fallback. */
+ void fallbackFormatRange(
+ Calendar& fromCalendar,
+ Calendar& toCalendar,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const;
/**
* Format 2 Calendars using fall-back interval pattern
@@ -703,8 +803,8 @@ private:
* (any difference is in ampm/hours or below)
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
- * @param pos On input: an alignment field, if desired.
- * On output: the offsets of the alignment field.
+ * @param firstIndex See formatImpl for more information.
+ * @param fphandler See formatImpl for more information.
* @param status output param set to success/failure code on exit
* @return Reference to 'appendTo' parameter.
* @internal (private)
@@ -713,7 +813,8 @@ private:
Calendar& toCalendar,
UBool fromToOnSameDay,
UnicodeString& appendTo,
- FieldPosition& pos,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const;
@@ -977,11 +1078,11 @@ private:
* to be formatted into date interval string
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
- * @param fieldPosition On input: an alignment field, if desired.
- * On output: the offsets of the alignment field.
- * There may be multiple instances of a given field type
- * in an interval format; in this case the fieldPosition
- * offsets refer to the first instance.
+ * @param firstIndex 0 if the first output date is fromCalendar;
+ * 1 if it corresponds to toCalendar;
+ * -1 if there is only one date printed.
+ * @param fphandler Handler for field position information.
+ * The fields will be from the UDateFormatField enum.
* @param status Output param filled with success/failure status.
* Caller needs to make sure it is SUCCESS
* at the function entrance
@@ -991,9 +1092,17 @@ private:
UnicodeString& formatImpl(Calendar& fromCalendar,
Calendar& toCalendar,
UnicodeString& appendTo,
- FieldPosition& fieldPosition,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
UErrorCode& status) const ;
+ /** Version of formatImpl for DateInterval. */
+ UnicodeString& formatIntervalImpl(const DateInterval& dtInterval,
+ UnicodeString& appendTo,
+ int8_t& firstIndex,
+ FieldPositionHandler& fphandler,
+ UErrorCode& status) const;
+
// from calendar field to pattern letter
static const char16_t fgCalendarFieldToPatternLetter[];
diff --git a/deps/icu-small/source/i18n/unicode/dtitvinf.h b/deps/icu-small/source/i18n/unicode/dtitvinf.h
index fac88581a2..65f568c070 100644
--- a/deps/icu-small/source/i18n/unicode/dtitvinf.h
+++ b/deps/icu-small/source/i18n/unicode/dtitvinf.h
@@ -149,7 +149,6 @@ U_NAMESPACE_BEGIN
* calendar; non-Gregorian calendars are supported from ICU 4.4.1.
* @stable ICU 4.0
**/
-
class U_I18N_API DateIntervalInfo U_FINAL : public UObject {
public:
/**
diff --git a/deps/icu-small/source/i18n/unicode/dtptngen.h b/deps/icu-small/source/i18n/unicode/dtptngen.h
index 26ccc64060..e50c01b4e3 100644
--- a/deps/icu-small/source/i18n/unicode/dtptngen.h
+++ b/deps/icu-small/source/i18n/unicode/dtptngen.h
@@ -273,7 +273,6 @@ public:
*/
const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
-#ifndef U_HIDE_DRAFT_API
/**
* The general interface to get a display name for a particular date/time field,
* in one of several possible display widths.
@@ -281,10 +280,9 @@ public:
* @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
* @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
* @return. The display name for field
- * @draft ICU 61
+ * @stable ICU 61
*/
UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const;
-#endif // U_HIDE_DRAFT_API
/**
* The DateTimeFormat is a message format pattern used to compose date and
@@ -564,6 +562,7 @@ private:
void setDecimalSymbols(const Locale& locale, UErrorCode& status);
UDateTimePatternField getAppendFormatNumber(const char* field) const;
#ifndef U_HIDE_DRAFT_API
+ // The following three have to be U_HIDE_DRAFT_API (though private) because UDateTimePGDisplayWidth is
UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const;
void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value);
UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width);
diff --git a/deps/icu-small/source/i18n/unicode/formattedvalue.h b/deps/icu-small/source/i18n/unicode/formattedvalue.h
new file mode 100644
index 0000000000..2e24c8d99e
--- /dev/null
+++ b/deps/icu-small/source/i18n/unicode/formattedvalue.h
@@ -0,0 +1,317 @@
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __FORMATTEDVALUE_H__
+#define __FORMATTEDVALUE_H__
+
+#include "unicode/utypes.h"
+#if !UCONFIG_NO_FORMATTING
+#ifndef U_HIDE_DRAFT_API
+
+#include "unicode/appendable.h"
+#include "unicode/fpositer.h"
+#include "unicode/unistr.h"
+#include "unicode/uformattedvalue.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \file
+ * \brief C++ API: Abstract operations for localized strings.
+ *
+ * This file contains declarations for classes that deal with formatted strings. A number
+ * of APIs throughout ICU use these classes for expressing their localized output.
+ */
+
+
+/**
+ * Represents a span of a string containing a given field.
+ *
+ * This class differs from FieldPosition in the following ways:
+ *
+ * 1. It has information on the field category.
+ * 2. It allows you to set constraints to use when iterating over field positions.
+ * 3. It is used for the newer FormattedValue APIs.
+ *
+ * This class is not intended for public subclassing.
+ *
+ * @draft ICU 64
+ */
+class U_I18N_API ConstrainedFieldPosition : public UMemory {
+ public:
+
+ /**
+ * Initializes a ConstrainedFieldPosition.
+ *
+ * By default, the ConstrainedFieldPosition has no iteration constraints.
+ *
+ * @draft ICU 64
+ */
+ ConstrainedFieldPosition();
+
+ /** @draft ICU 64 */
+ ~ConstrainedFieldPosition();
+
+ /**
+ * Resets this ConstrainedFieldPosition to its initial state, as if it were newly created:
+ *
+ * - Removes any constraints that may have been set on the instance.
+ * - Resets the iteration position.
+ *
+ * @draft ICU 64
+ */
+ void reset();
+
+ /**
+ * Sets a constraint on the field category.
+ *
+ * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
+ * positions are skipped unless they have the given category.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over only the number-related fields:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * cfpos.constrainCategory(UFIELDCATEGORY_NUMBER_FORMAT);
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the number-related field position
+ * }
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param category The field category to fix when iterating.
+ * @draft ICU 64
+ */
+ void constrainCategory(int32_t category);
+
+ /**
+ * Sets a constraint on the category and field.
+ *
+ * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition,
+ * positions are skipped unless they have the given category and field.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over all grouping separators:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * cfpos.constrainField(UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD);
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the grouping separator position
+ * }
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param category The field category to fix when iterating.
+ * @param field The field to fix when iterating.
+ * @draft ICU 64
+ */
+ void constrainField(int32_t category, int32_t field);
+
+ /**
+ * Gets the field category for the current position.
+ *
+ * The return value is well-defined only after
+ * FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The field category saved in the instance.
+ * @draft ICU 64
+ */
+ inline int32_t getCategory() const {
+ return fCategory;
+ }
+
+ /**
+ * Gets the field for the current position.
+ *
+ * The return value is well-defined only after
+ * FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The field saved in the instance.
+ * @draft ICU 64
+ */
+ inline int32_t getField() const {
+ return fField;
+ }
+
+ /**
+ * Gets the INCLUSIVE start index for the current position.
+ *
+ * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The start index saved in the instance.
+ * @draft ICU 64
+ */
+ inline int32_t getStart() const {
+ return fStart;
+ }
+
+ /**
+ * Gets the EXCLUSIVE end index stored for the current position.
+ *
+ * The return value is well-defined only after FormattedValue#nextPosition returns TRUE.
+ *
+ * @return The end index saved in the instance.
+ * @draft ICU 64
+ */
+ inline int32_t getLimit() const {
+ return fLimit;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ //// The following methods are for FormattedValue implementers; ////
+ //// most users can ignore them. ////
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Gets an int64 that FormattedValue implementations may use for storage.
+ *
+ * The initial value is zero.
+ *
+ * Users of FormattedValue should not need to call this method.
+ *
+ * @return The current iteration context from {@link #setInt64IterationContext}.
+ * @draft ICU 64
+ */
+ inline int64_t getInt64IterationContext() const {
+ return fContext;
+ }
+
+ /**
+ * Sets an int64 that FormattedValue implementations may use for storage.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param context The new iteration context.
+ * @draft ICU 64
+ */
+ void setInt64IterationContext(int64_t context);
+
+ /**
+ * Determines whether a given field should be included given the
+ * constraints.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param category The category to test.
+ * @param field The field to test.
+ * @draft ICU 64
+ */
+ UBool matchesField(int32_t category, int32_t field) const;
+
+ /**
+ * Sets new values for the primary public getters.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * It is up to the implementation to ensure that the user-requested
+ * constraints are satisfied. This method does not check!
+ *
+ * @param category The new field category.
+ * @param field The new field.
+ * @param start The new inclusive start index.
+ * @param limit The new exclusive end index.
+ * @draft ICU 64
+ */
+ void setState(
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit);
+
+ private:
+ int64_t fContext = 0LL;
+ int32_t fField = 0;
+ int32_t fStart = 0;
+ int32_t fLimit = 0;
+ int32_t fCategory = UFIELD_CATEGORY_UNDEFINED;
+ int8_t fConstraint = 0;
+};
+
+
+/**
+ * An abstract formatted value: a string with associated field attributes.
+ * Many formatters format to classes implementing FormattedValue.
+ *
+ * @draft ICU 64
+ */
+class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ {
+ public:
+ /** @draft ICU 64 */
+ virtual ~FormattedValue();
+
+ /**
+ * Returns the formatted string as a self-contained UnicodeString.
+ *
+ * If you need the string within the current scope only, consider #toTempString.
+ *
+ * @param status Set if an error occurs.
+ * @return a UnicodeString containing the formatted string.
+ *
+ * @draft ICU 64
+ */
+ virtual UnicodeString toString(UErrorCode& status) const = 0;
+
+ /**
+ * Returns the formatted string as a read-only alias to memory owned by the FormattedValue.
+ *
+ * The return value is valid only as long as this FormattedValue is present and unchanged in
+ * memory. If you need the string outside the current scope, consider #toString.
+ *
+ * The buffer returned by calling UnicodeString#getBuffer() on the return value is
+ * guaranteed to be NUL-terminated.
+ *
+ * @param status Set if an error occurs.
+ * @return a temporary UnicodeString containing the formatted string.
+ *
+ * @draft ICU 64
+ */
+ virtual UnicodeString toTempString(UErrorCode& status) const = 0;
+
+ /**
+ * Appends the formatted string to an Appendable.
+ *
+ * @param appendable
+ * The Appendable to which to append the string output.
+ * @param status Set if an error occurs.
+ * @return The same Appendable, for chaining.
+ *
+ * @draft ICU 64
+ * @see Appendable
+ */
+ virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0;
+
+ /**
+ * Iterates over field positions in the FormattedValue. This lets you determine the position
+ * of specific types of substrings, like a month or a decimal separator.
+ *
+ * To loop over all field positions:
+ *
+ * ConstrainedFieldPosition cfpos;
+ * while (fmtval.nextPosition(cfpos, status)) {
+ * // handle the field position; get information from cfpos
+ * }
+ *
+ * @param cfpos
+ * The object used for iteration state. This can provide constraints to iterate over
+ * only one specific category or field;
+ * see ConstrainedFieldPosition#constrainCategory
+ * and ConstrainedFieldPosition#constrainField.
+ * @param status Set if an error occurs.
+ * @return TRUE if a new occurrence of the field was found;
+ * FALSE otherwise or if an error was set.
+ *
+ * @draft ICU 64
+ */
+ virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0;
+};
+
+
+U_NAMESPACE_END
+
+#endif /* U_HIDE_DRAFT_API */
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif // __FORMATTEDVALUE_H__
diff --git a/deps/icu-small/source/i18n/unicode/listformatter.h b/deps/icu-small/source/i18n/unicode/listformatter.h
index 5e36cf71cc..9ce8ec8617 100644
--- a/deps/icu-small/source/i18n/unicode/listformatter.h
+++ b/deps/icu-small/source/i18n/unicode/listformatter.h
@@ -23,11 +23,14 @@
#include "unicode/unistr.h"
#include "unicode/locid.h"
+#include "unicode/formattedvalue.h"
U_NAMESPACE_BEGIN
class FieldPositionIterator;
class FieldPositionHandler;
+class FormattedListData;
+class ListFormatter;
/** @internal */
class Hashtable;
@@ -58,6 +61,81 @@ struct ListFormatData : public UMemory {
*/
+#if !UCONFIG_NO_FORMATTING
+#ifndef U_HIDE_DRAFT_API
+/**
+ * An immutable class containing the result of a list formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * When calling nextPosition():
+ * The fields are returned from start to end. The special field category
+ * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
+ * was inserted at the given position. The span category will
+ * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
+ * in the nextPosition() iterator.
+ *
+ * Not intended for public subclassing.
+ *
+ * @draft ICU 64
+ */
+class U_I18N_API FormattedList : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedList.
+ * @draft ICU 64
+ */
+ FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedList in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedList(FormattedList&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedList.
+ * @draft ICU 64
+ */
+ virtual ~FormattedList() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedList(const FormattedList&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedList& operator=(const FormattedList&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedList in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedList& operator=(FormattedList&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedListData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedList(FormattedListData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedList(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class ListFormatter;
+};
+#endif /* U_HIDE_DRAFT_API */
+#endif // !UCONFIG_NO_FORMATTING
+
+
/**
* An immutable class for formatting a list, using data from CLDR (or supplied
* separately).
@@ -110,7 +188,7 @@ class U_I18N_API ListFormatter : public UObject{
* Creates a ListFormatter appropriate for a locale and style.
*
* @param locale The locale.
- * @param style the style, either "standard", "duration", or "duration-short"
+ * @param style the style, either "standard", "or", "unit", "unit-narrow", or "unit-short"
* @param errorCode ICU error code, set if no data available for the given locale.
* @return A ListFormatter object created from internal data derived from
* CLDR data.
@@ -161,6 +239,26 @@ class U_I18N_API ListFormatter : public UObject{
UErrorCode& errorCode) const;
#endif /* U_HIDE_DRAFT_API */
+#if !UCONFIG_NO_FORMATTING
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Formats a list of strings to a FormattedList, which exposes field
+ * position information. The FormattedList contains more information than
+ * a FieldPositionIterator.
+ *
+ * @param items An array of strings to be combined and formatted.
+ * @param n_items Length of the array items.
+ * @param errorCode ICU error code returned here.
+ * @return A FormattedList containing field information.
+ * @draft ICU 64
+ */
+ FormattedList formatStringsToValue(
+ const UnicodeString items[],
+ int32_t n_items,
+ UErrorCode& errorCode) const;
+#endif /* U_HIDE_DRAFT_API */
+#endif // !UCONFIG_NO_FORMATTING
+
#ifndef U_HIDE_INTERNAL_API
/**
@internal for MeasureFormat
@@ -200,4 +298,4 @@ class U_I18N_API ListFormatter : public UObject{
U_NAMESPACE_END
-#endif
+#endif // __LISTFORMATTER_H__
diff --git a/deps/icu-small/source/i18n/unicode/measfmt.h b/deps/icu-small/source/i18n/unicode/measfmt.h
index bbdd2364bd..d518665e14 100644
--- a/deps/icu-small/source/i18n/unicode/measfmt.h
+++ b/deps/icu-small/source/i18n/unicode/measfmt.h
@@ -322,7 +322,14 @@ class U_I18N_API MeasureFormat : public Format {
* ICU use only.
* @internal.
*/
- const NumberFormat &getNumberFormat() const;
+ const NumberFormat &getNumberFormatInternal() const;
+
+ /**
+ * ICU use only.
+ * Always returns the short form currency formatter.
+ * @internal.
+ */
+ const NumberFormat& getCurrencyFormatInternal() const;
/**
* ICU use only.
@@ -355,27 +362,6 @@ class U_I18N_API MeasureFormat : public Format {
// shared across instances.
ListFormatter *listFormatter;
- const SimpleFormatter *getFormatterOrNull(
- const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index) const;
-
- const SimpleFormatter *getFormatter(
- const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index,
- UErrorCode &errorCode) const;
-
- const SimpleFormatter *getPluralFormatter(
- const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index,
- UErrorCode &errorCode) const;
-
- const SimpleFormatter *getPerFormatter(
- UMeasureFormatWidth width,
- UErrorCode &status) const;
-
- int32_t withPerUnitAndAppend(
- const UnicodeString &formatted,
- const MeasureUnit &perUnit,
- UnicodeString &appendTo,
- UErrorCode &status) const;
-
UnicodeString &formatMeasure(
const Measure &measure,
const NumberFormat &nf,
diff --git a/deps/icu-small/source/i18n/unicode/measunit.h b/deps/icu-small/source/i18n/unicode/measunit.h
index 676fdeb9c8..d8e3c73956 100644
--- a/deps/icu-small/source/i18n/unicode/measunit.h
+++ b/deps/icu-small/source/i18n/unicode/measunit.h
@@ -209,160 +209,387 @@ class U_I18N_API MeasureUnit: public UObject {
// Start generated createXXX methods
/**
- * Returns unit of acceleration: g-force.
+ * Returns by pointer, unit of acceleration: g-force.
* Caller owns returned value and must free it.
+ * Also see {@link #getGForce()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createGForce(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of acceleration: g-force.
+ * Also see {@link #createGForce()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGForce();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of acceleration: meter-per-second-squared.
+ * Returns by pointer, unit of acceleration: meter-per-second-squared.
* Caller owns returned value and must free it.
+ * Also see {@link #getMeterPerSecondSquared()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of angle: arc-minute.
+ * Returns by value, unit of acceleration: meter-per-second-squared.
+ * Also see {@link #createMeterPerSecondSquared()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMeterPerSecondSquared();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of angle: arc-minute.
* Caller owns returned value and must free it.
+ * Also see {@link #getArcMinute()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createArcMinute(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of angle: arc-minute.
+ * Also see {@link #createArcMinute()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getArcMinute();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of angle: arc-second.
+ * Returns by pointer, unit of angle: arc-second.
* Caller owns returned value and must free it.
+ * Also see {@link #getArcSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createArcSecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of angle: degree.
+ * Returns by value, unit of angle: arc-second.
+ * Also see {@link #createArcSecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getArcSecond();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of angle: degree.
* Caller owns returned value and must free it.
+ * Also see {@link #getDegree()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createDegree(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of angle: degree.
+ * Also see {@link #createDegree()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDegree();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of angle: radian.
+ * Returns by pointer, unit of angle: radian.
* Caller owns returned value and must free it.
+ * Also see {@link #getRadian()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createRadian(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of angle: radian.
+ * Also see {@link #createRadian()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getRadian();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of angle: revolution.
+ * Returns by pointer, unit of angle: revolution.
* Caller owns returned value and must free it.
+ * Also see {@link #getRevolutionAngle()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createRevolutionAngle(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of area: acre.
+ * Returns by value, unit of angle: revolution.
+ * Also see {@link #createRevolutionAngle()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getRevolutionAngle();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of area: acre.
* Caller owns returned value and must free it.
+ * Also see {@link #getAcre()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createAcre(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: acre.
+ * Also see {@link #createAcre()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getAcre();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of area: dunam.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getDunam()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createDunam(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of area: dunam.
+ * Also see {@link #createDunam()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDunam();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: hectare.
+ * Returns by pointer, unit of area: hectare.
* Caller owns returned value and must free it.
+ * Also see {@link #getHectare()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHectare(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: hectare.
+ * Also see {@link #createHectare()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHectare();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: square-centimeter.
+ * Returns by pointer, unit of area: square-centimeter.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareCentimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareCentimeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: square-centimeter.
+ * Also see {@link #createSquareCentimeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareCentimeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: square-foot.
+ * Returns by pointer, unit of area: square-foot.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareFoot()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareFoot(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of area: square-inch.
+ * Returns by value, unit of area: square-foot.
+ * Also see {@link #createSquareFoot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareFoot();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of area: square-inch.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareInch()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareInch(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of area: square-kilometer.
+ * Returns by value, unit of area: square-inch.
+ * Also see {@link #createSquareInch()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareInch();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of area: square-kilometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareKilometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: square-kilometer.
+ * Also see {@link #createSquareKilometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareKilometer();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: square-meter.
+ * Returns by pointer, unit of area: square-meter.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareMeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareMeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: square-meter.
+ * Also see {@link #createSquareMeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareMeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: square-mile.
+ * Returns by pointer, unit of area: square-mile.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSquareMile(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: square-mile.
+ * Also see {@link #createSquareMile()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareMile();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of area: square-yard.
+ * Returns by pointer, unit of area: square-yard.
* Caller owns returned value and must free it.
+ * Also see {@link #getSquareYard()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createSquareYard(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of area: square-yard.
+ * Also see {@link #createSquareYard()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSquareYard();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of concentr: karat.
+ * Returns by pointer, unit of concentr: karat.
* Caller owns returned value and must free it.
+ * Also see {@link #getKarat()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKarat(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of concentr: karat.
+ * Also see {@link #createKarat()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKarat();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of concentr: milligram-per-deciliter.
+ * Returns by pointer, unit of concentr: milligram-per-deciliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilligramPerDeciliter()}.
* @param status ICU error code.
* @stable ICU 57
*/
static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of concentr: milligram-per-deciliter.
+ * Also see {@link #createMilligramPerDeciliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilligramPerDeciliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of concentr: millimole-per-liter.
+ * Returns by pointer, unit of concentr: millimole-per-liter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMillimolePerLiter()}.
* @param status ICU error code.
* @stable ICU 57
*/
static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of concentr: millimole-per-liter.
+ * Also see {@link #createMillimolePerLiter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMillimolePerLiter();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of concentr: mole.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getMole()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createMole(UErrorCode &status);
+
/**
- * Returns unit of concentr: part-per-million.
+ * Returns by value, unit of concentr: mole.
+ * Also see {@link #createMole()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMole();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of concentr: part-per-million.
* Caller owns returned value and must free it.
+ * Also see {@link #getPartPerMillion()}.
* @param status ICU error code.
* @stable ICU 57
*/
@@ -370,115 +597,273 @@ class U_I18N_API MeasureUnit: public UObject {
#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of concentr: percent.
+ * Returns by value, unit of concentr: part-per-million.
+ * Also see {@link #createPartPerMillion()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPartPerMillion();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of concentr: percent.
* Caller owns returned value and must free it.
+ * Also see {@link #getPercent()}.
* @param status ICU error code.
* @draft ICU 63
*/
static MeasureUnit *createPercent(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of concentr: percent.
+ * Also see {@link #createPercent()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPercent();
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of concentr: permille.
+ * Returns by pointer, unit of concentr: permille.
* Caller owns returned value and must free it.
+ * Also see {@link #getPermille()}.
* @param status ICU error code.
* @draft ICU 63
*/
static MeasureUnit *createPermille(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of concentr: permille.
+ * Also see {@link #createPermille()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPermille();
#endif /* U_HIDE_DRAFT_API */
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of consumption: liter-per-100kilometers.
+ * Returns by pointer, unit of concentr: permyriad.
* Caller owns returned value and must free it.
+ * Also see {@link #getPermyriad()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createPermyriad(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of concentr: permyriad.
+ * Also see {@link #createPermyriad()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPermyriad();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of consumption: liter-per-100kilometers.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getLiterPer100Kilometers()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of consumption: liter-per-100kilometers.
+ * Also see {@link #createLiterPer100Kilometers()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getLiterPer100Kilometers();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of consumption: liter-per-kilometer.
+ * Returns by pointer, unit of consumption: liter-per-kilometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getLiterPerKilometer()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of consumption: mile-per-gallon.
+ * Returns by value, unit of consumption: liter-per-kilometer.
+ * Also see {@link #createLiterPerKilometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getLiterPerKilometer();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of consumption: mile-per-gallon.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilePerGallon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilePerGallon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of consumption: mile-per-gallon.
+ * Also see {@link #createMilePerGallon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilePerGallon();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of consumption: mile-per-gallon-imperial.
+ * Returns by pointer, unit of consumption: mile-per-gallon-imperial.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilePerGallonImperial()}.
* @param status ICU error code.
* @stable ICU 57
*/
static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of consumption: mile-per-gallon-imperial.
+ * Also see {@link #createMilePerGallonImperial()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilePerGallonImperial();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: bit.
+ * Returns by pointer, unit of digital: bit.
* Caller owns returned value and must free it.
+ * Also see {@link #getBit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createBit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: bit.
+ * Also see {@link #createBit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getBit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: byte.
+ * Returns by pointer, unit of digital: byte.
* Caller owns returned value and must free it.
+ * Also see {@link #getByte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createByte(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: byte.
+ * Also see {@link #createByte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getByte();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: gigabit.
+ * Returns by pointer, unit of digital: gigabit.
* Caller owns returned value and must free it.
+ * Also see {@link #getGigabit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigabit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: gigabit.
+ * Also see {@link #createGigabit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGigabit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: gigabyte.
+ * Returns by pointer, unit of digital: gigabyte.
* Caller owns returned value and must free it.
+ * Also see {@link #getGigabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigabyte(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of digital: kilobit.
+ * Returns by value, unit of digital: gigabyte.
+ * Also see {@link #createGigabyte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGigabyte();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of digital: kilobit.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilobit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilobit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: kilobit.
+ * Also see {@link #createKilobit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilobit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: kilobyte.
+ * Returns by pointer, unit of digital: kilobyte.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilobyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilobyte(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: kilobyte.
+ * Also see {@link #createKilobyte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilobyte();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: megabit.
+ * Returns by pointer, unit of digital: megabit.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegabit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegabit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: megabit.
+ * Also see {@link #createMegabit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegabit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: megabyte.
+ * Returns by pointer, unit of digital: megabyte.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
@@ -486,529 +871,1431 @@ class U_I18N_API MeasureUnit: public UObject {
#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of digital: petabyte.
+ * Returns by value, unit of digital: megabyte.
+ * Also see {@link #createMegabyte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegabyte();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of digital: petabyte.
* Caller owns returned value and must free it.
+ * Also see {@link #getPetabyte()}.
* @param status ICU error code.
* @draft ICU 63
*/
static MeasureUnit *createPetabyte(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: petabyte.
+ * Also see {@link #createPetabyte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPetabyte();
#endif /* U_HIDE_DRAFT_API */
/**
- * Returns unit of digital: terabit.
+ * Returns by pointer, unit of digital: terabit.
* Caller owns returned value and must free it.
+ * Also see {@link #getTerabit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTerabit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: terabit.
+ * Also see {@link #createTerabit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getTerabit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of digital: terabyte.
+ * Returns by pointer, unit of digital: terabyte.
* Caller owns returned value and must free it.
+ * Also see {@link #getTerabyte()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTerabyte(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of digital: terabyte.
+ * Also see {@link #createTerabyte()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getTerabyte();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: century.
+ * Returns by pointer, unit of duration: century.
* Caller owns returned value and must free it.
+ * Also see {@link #getCentury()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createCentury(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: century.
+ * Also see {@link #createCentury()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCentury();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: day.
+ * Returns by pointer, unit of duration: day.
* Caller owns returned value and must free it.
+ * Also see {@link #getDay()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createDay(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: day.
+ * Also see {@link #createDay()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDay();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of duration: day-person.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getDayPerson()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createDayPerson(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: day-person.
+ * Also see {@link #createDayPerson()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDayPerson();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: hour.
+ * Returns by pointer, unit of duration: hour.
* Caller owns returned value and must free it.
+ * Also see {@link #getHour()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHour(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of duration: microsecond.
+ * Returns by value, unit of duration: hour.
+ * Also see {@link #createHour()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHour();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of duration: microsecond.
* Caller owns returned value and must free it.
+ * Also see {@link #getMicrosecond()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrosecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of duration: millisecond.
+ * Returns by value, unit of duration: microsecond.
+ * Also see {@link #createMicrosecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMicrosecond();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of duration: millisecond.
* Caller owns returned value and must free it.
+ * Also see {@link #getMillisecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillisecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of duration: minute.
+ * Returns by value, unit of duration: millisecond.
+ * Also see {@link #createMillisecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMillisecond();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of duration: minute.
* Caller owns returned value and must free it.
+ * Also see {@link #getMinute()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMinute(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: minute.
+ * Also see {@link #createMinute()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMinute();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: month.
+ * Returns by pointer, unit of duration: month.
* Caller owns returned value and must free it.
+ * Also see {@link #getMonth()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMonth(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: month.
+ * Also see {@link #createMonth()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMonth();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of duration: nanosecond.
+ * Returns by pointer, unit of duration: month-person.
* Caller owns returned value and must free it.
+ * Also see {@link #getMonthPerson()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createMonthPerson(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: month-person.
+ * Also see {@link #createMonthPerson()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMonthPerson();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of duration: nanosecond.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getNanosecond()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNanosecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: nanosecond.
+ * Also see {@link #createNanosecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getNanosecond();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: second.
+ * Returns by pointer, unit of duration: second.
* Caller owns returned value and must free it.
+ * Also see {@link #getSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createSecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: second.
+ * Also see {@link #createSecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSecond();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: week.
+ * Returns by pointer, unit of duration: week.
* Caller owns returned value and must free it.
+ * Also see {@link #getWeek()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createWeek(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: week.
+ * Also see {@link #createWeek()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getWeek();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of duration: week-person.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getWeekPerson()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createWeekPerson(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: week-person.
+ * Also see {@link #createWeekPerson()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getWeekPerson();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of duration: year.
+ * Returns by pointer, unit of duration: year.
* Caller owns returned value and must free it.
+ * Also see {@link #getYear()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createYear(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: year.
+ * Also see {@link #createYear()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getYear();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of electric: ampere.
+ * Returns by pointer, unit of duration: year-person.
* Caller owns returned value and must free it.
+ * Also see {@link #getYearPerson()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createYearPerson(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of duration: year-person.
+ * Also see {@link #createYearPerson()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getYearPerson();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of electric: ampere.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getAmpere()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAmpere(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of electric: milliampere.
+ * Returns by value, unit of electric: ampere.
+ * Also see {@link #createAmpere()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getAmpere();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of electric: milliampere.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilliampere()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliampere(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of electric: milliampere.
+ * Also see {@link #createMilliampere()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilliampere();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of electric: ohm.
+ * Returns by pointer, unit of electric: ohm.
* Caller owns returned value and must free it.
+ * Also see {@link #getOhm()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createOhm(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of electric: ohm.
+ * Also see {@link #createOhm()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getOhm();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of electric: volt.
+ * Returns by pointer, unit of electric: volt.
* Caller owns returned value and must free it.
+ * Also see {@link #getVolt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createVolt(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of electric: volt.
+ * Also see {@link #createVolt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getVolt();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of energy: british-thermal-unit.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getBritishThermalUnit()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of energy: british-thermal-unit.
+ * Also see {@link #createBritishThermalUnit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getBritishThermalUnit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of energy: calorie.
+ * Returns by pointer, unit of energy: calorie.
* Caller owns returned value and must free it.
+ * Also see {@link #getCalorie()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCalorie(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of energy: foodcalorie.
+ * Returns by value, unit of energy: calorie.
+ * Also see {@link #createCalorie()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCalorie();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of energy: electronvolt.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getElectronvolt()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createElectronvolt(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of energy: electronvolt.
+ * Also see {@link #createElectronvolt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getElectronvolt();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of energy: foodcalorie.
* Caller owns returned value and must free it.
+ * Also see {@link #getFoodcalorie()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFoodcalorie(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of energy: foodcalorie.
+ * Also see {@link #createFoodcalorie()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFoodcalorie();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of energy: joule.
+ * Returns by pointer, unit of energy: joule.
* Caller owns returned value and must free it.
+ * Also see {@link #getJoule()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createJoule(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of energy: joule.
+ * Also see {@link #createJoule()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getJoule();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of energy: kilocalorie.
+ * Returns by pointer, unit of energy: kilocalorie.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilocalorie()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilocalorie(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of energy: kilocalorie.
+ * Also see {@link #createKilocalorie()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilocalorie();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of energy: kilojoule.
+ * Returns by pointer, unit of energy: kilojoule.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilojoule()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilojoule(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of energy: kilojoule.
+ * Also see {@link #createKilojoule()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilojoule();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of energy: kilowatt-hour.
+ * Returns by pointer, unit of energy: kilowatt-hour.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilowattHour()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilowattHour(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of energy: kilowatt-hour.
+ * Also see {@link #createKilowattHour()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilowattHour();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of force: newton.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getNewton()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createNewton(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of force: newton.
+ * Also see {@link #createNewton()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getNewton();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of frequency: gigahertz.
+ * Returns by pointer, unit of force: pound-force.
* Caller owns returned value and must free it.
+ * Also see {@link #getPoundForce()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createPoundForce(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of force: pound-force.
+ * Also see {@link #createPoundForce()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPoundForce();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of frequency: gigahertz.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGigahertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigahertz(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of frequency: gigahertz.
+ * Also see {@link #createGigahertz()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGigahertz();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of frequency: hertz.
+ * Returns by pointer, unit of frequency: hertz.
* Caller owns returned value and must free it.
+ * Also see {@link #getHertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createHertz(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of frequency: hertz.
+ * Also see {@link #createHertz()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHertz();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of frequency: kilohertz.
+ * Returns by pointer, unit of frequency: kilohertz.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilohertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKilohertz(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of frequency: kilohertz.
+ * Also see {@link #createKilohertz()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilohertz();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of frequency: megahertz.
+ * Returns by pointer, unit of frequency: megahertz.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegahertz()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegahertz(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of frequency: megahertz.
+ * Also see {@link #createMegahertz()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegahertz();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: astronomical-unit.
+ * Returns by pointer, unit of length: astronomical-unit.
* Caller owns returned value and must free it.
+ * Also see {@link #getAstronomicalUnit()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: astronomical-unit.
+ * Also see {@link #createAstronomicalUnit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getAstronomicalUnit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: centimeter.
+ * Returns by pointer, unit of length: centimeter.
* Caller owns returned value and must free it.
+ * Also see {@link #getCentimeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCentimeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: centimeter.
+ * Also see {@link #createCentimeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCentimeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: decimeter.
+ * Returns by pointer, unit of length: decimeter.
* Caller owns returned value and must free it.
+ * Also see {@link #getDecimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createDecimeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: decimeter.
+ * Also see {@link #createDecimeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDecimeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: fathom.
+ * Returns by pointer, unit of length: fathom.
* Caller owns returned value and must free it.
+ * Also see {@link #getFathom()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFathom(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: fathom.
+ * Also see {@link #createFathom()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFathom();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: foot.
+ * Returns by pointer, unit of length: foot.
* Caller owns returned value and must free it.
+ * Also see {@link #getFoot()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createFoot(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: foot.
+ * Also see {@link #createFoot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFoot();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: furlong.
+ * Returns by pointer, unit of length: furlong.
* Caller owns returned value and must free it.
+ * Also see {@link #getFurlong()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFurlong(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: furlong.
+ * Also see {@link #createFurlong()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFurlong();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: inch.
+ * Returns by pointer, unit of length: inch.
* Caller owns returned value and must free it.
+ * Also see {@link #getInch()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createInch(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: inch.
+ * Also see {@link #createInch()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getInch();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: kilometer.
+ * Returns by pointer, unit of length: kilometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: kilometer.
+ * Also see {@link #createKilometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilometer();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: light-year.
+ * Returns by pointer, unit of length: light-year.
* Caller owns returned value and must free it.
+ * Also see {@link #getLightYear()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createLightYear(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of length: meter.
+ * Returns by value, unit of length: light-year.
+ * Also see {@link #createLightYear()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getLightYear();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of length: meter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: meter.
+ * Also see {@link #createMeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: micrometer.
+ * Returns by pointer, unit of length: micrometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getMicrometer()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of length: mile.
+ * Returns by value, unit of length: micrometer.
+ * Also see {@link #createMicrometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMicrometer();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of length: mile.
* Caller owns returned value and must free it.
+ * Also see {@link #getMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMile(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: mile.
+ * Also see {@link #createMile()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMile();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: mile-scandinavian.
+ * Returns by pointer, unit of length: mile-scandinavian.
* Caller owns returned value and must free it.
+ * Also see {@link #getMileScandinavian()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createMileScandinavian(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: mile-scandinavian.
+ * Also see {@link #createMileScandinavian()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMileScandinavian();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: millimeter.
+ * Returns by pointer, unit of length: millimeter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMillimeter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillimeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of length: nanometer.
+ * Returns by value, unit of length: millimeter.
+ * Also see {@link #createMillimeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMillimeter();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of length: nanometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getNanometer()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNanometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: nanometer.
+ * Also see {@link #createNanometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getNanometer();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: nautical-mile.
+ * Returns by pointer, unit of length: nautical-mile.
* Caller owns returned value and must free it.
+ * Also see {@link #getNauticalMile()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createNauticalMile(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: nautical-mile.
+ * Also see {@link #createNauticalMile()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getNauticalMile();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: parsec.
+ * Returns by pointer, unit of length: parsec.
* Caller owns returned value and must free it.
+ * Also see {@link #getParsec()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createParsec(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: parsec.
+ * Also see {@link #createParsec()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getParsec();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: picometer.
+ * Returns by pointer, unit of length: picometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getPicometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createPicometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: picometer.
+ * Also see {@link #createPicometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPicometer();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of length: point.
+ * Returns by pointer, unit of length: point.
* Caller owns returned value and must free it.
+ * Also see {@link #getPoint()}.
* @param status ICU error code.
* @stable ICU 59
*/
static MeasureUnit *createPoint(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: point.
+ * Also see {@link #createPoint()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPoint();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of length: solar-radius.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getSolarRadius()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createSolarRadius(UErrorCode &status);
+
/**
- * Returns unit of length: yard.
+ * Returns by value, unit of length: solar-radius.
+ * Also see {@link #createSolarRadius()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSolarRadius();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of length: yard.
* Caller owns returned value and must free it.
+ * Also see {@link #getYard()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createYard(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of length: yard.
+ * Also see {@link #createYard()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getYard();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of light: lux.
+ * Returns by pointer, unit of light: lux.
* Caller owns returned value and must free it.
+ * Also see {@link #getLux()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createLux(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of light: lux.
+ * Also see {@link #createLux()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getLux();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of mass: carat.
+ * Returns by pointer, unit of light: solar-luminosity.
* Caller owns returned value and must free it.
+ * Also see {@link #getSolarLuminosity()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createSolarLuminosity(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of light: solar-luminosity.
+ * Also see {@link #createSolarLuminosity()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSolarLuminosity();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: carat.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getCarat()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCarat(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: carat.
+ * Also see {@link #createCarat()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCarat();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of mass: dalton.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getDalton()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createDalton(UErrorCode &status);
+
/**
- * Returns unit of mass: gram.
+ * Returns by value, unit of mass: dalton.
+ * Also see {@link #createDalton()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDalton();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of mass: earth-mass.
* Caller owns returned value and must free it.
+ * Also see {@link #getEarthMass()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createEarthMass(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of mass: earth-mass.
+ * Also see {@link #createEarthMass()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getEarthMass();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: gram.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGram()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createGram(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of mass: kilogram.
+ * Returns by value, unit of mass: gram.
+ * Also see {@link #createGram()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGram();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: kilogram.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilogram()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilogram(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of mass: metric-ton.
+ * Returns by value, unit of mass: kilogram.
+ * Also see {@link #createKilogram()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilogram();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: metric-ton.
* Caller owns returned value and must free it.
+ * Also see {@link #getMetricTon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMetricTon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of mass: microgram.
+ * Returns by value, unit of mass: metric-ton.
+ * Also see {@link #createMetricTon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMetricTon();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: microgram.
* Caller owns returned value and must free it.
+ * Also see {@link #getMicrogram()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMicrogram(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: microgram.
+ * Also see {@link #createMicrogram()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMicrogram();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of mass: milligram.
+ * Returns by pointer, unit of mass: milligram.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilligram()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilligram(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: milligram.
+ * Also see {@link #createMilligram()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilligram();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of mass: ounce.
+ * Returns by pointer, unit of mass: ounce.
* Caller owns returned value and must free it.
+ * Also see {@link #getOunce()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createOunce(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of mass: ounce-troy.
+ * Returns by value, unit of mass: ounce.
+ * Also see {@link #createOunce()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getOunce();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of mass: ounce-troy.
* Caller owns returned value and must free it.
+ * Also see {@link #getOunceTroy()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createOunceTroy(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: ounce-troy.
+ * Also see {@link #createOunceTroy()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getOunceTroy();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of mass: pound.
+ * Returns by pointer, unit of mass: pound.
* Caller owns returned value and must free it.
+ * Also see {@link #getPound()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createPound(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: pound.
+ * Also see {@link #createPound()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPound();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of mass: solar-mass.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getSolarMass()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createSolarMass(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of mass: solar-mass.
+ * Also see {@link #createSolarMass()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getSolarMass();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of mass: stone.
+ * Returns by pointer, unit of mass: stone.
* Caller owns returned value and must free it.
+ * Also see {@link #getStone()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createStone(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of mass: stone.
+ * Also see {@link #createStone()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getStone();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of mass: ton.
+ * Returns by pointer, unit of mass: ton.
* Caller owns returned value and must free it.
+ * Also see {@link #getTon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of power: gigawatt.
+ * Returns by value, unit of mass: ton.
+ * Also see {@link #createTon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getTon();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of power: gigawatt.
* Caller owns returned value and must free it.
+ * Also see {@link #getGigawatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGigawatt(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of power: gigawatt.
+ * Also see {@link #createGigawatt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGigawatt();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of power: horsepower.
+ * Returns by pointer, unit of power: horsepower.
* Caller owns returned value and must free it.
+ * Also see {@link #getHorsepower()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHorsepower(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of power: horsepower.
+ * Also see {@link #createHorsepower()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHorsepower();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of power: kilowatt.
+ * Returns by pointer, unit of power: kilowatt.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilowatt()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilowatt(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of power: kilowatt.
+ * Also see {@link #createKilowatt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilowatt();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of power: megawatt.
+ * Returns by pointer, unit of power: megawatt.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegawatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegawatt(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of power: megawatt.
+ * Also see {@link #createMegawatt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegawatt();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of power: milliwatt.
+ * Returns by pointer, unit of power: milliwatt.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilliwatt()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliwatt(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of power: milliwatt.
+ * Also see {@link #createMilliwatt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilliwatt();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of power: watt.
+ * Returns by pointer, unit of power: watt.
* Caller owns returned value and must free it.
+ * Also see {@link #getWatt()}.
* @param status ICU error code.
* @stable ICU 53
*/
@@ -1016,318 +2303,825 @@ class U_I18N_API MeasureUnit: public UObject {
#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of pressure: atmosphere.
+ * Returns by value, unit of power: watt.
+ * Also see {@link #createWatt()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getWatt();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of pressure: atmosphere.
* Caller owns returned value and must free it.
+ * Also see {@link #getAtmosphere()}.
* @param status ICU error code.
* @draft ICU 63
*/
static MeasureUnit *createAtmosphere(UErrorCode &status);
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of pressure: atmosphere.
+ * Also see {@link #createAtmosphere()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getAtmosphere();
#endif /* U_HIDE_DRAFT_API */
/**
- * Returns unit of pressure: hectopascal.
+ * Returns by pointer, unit of pressure: hectopascal.
* Caller owns returned value and must free it.
+ * Also see {@link #getHectopascal()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createHectopascal(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of pressure: hectopascal.
+ * Also see {@link #createHectopascal()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHectopascal();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of pressure: inch-hg.
+ * Returns by pointer, unit of pressure: inch-hg.
* Caller owns returned value and must free it.
+ * Also see {@link #getInchHg()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createInchHg(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of pressure: inch-hg.
+ * Also see {@link #createInchHg()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getInchHg();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of pressure: kilopascal.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getKilopascal()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createKilopascal(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: kilopascal.
+ * Also see {@link #createKilopascal()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilopascal();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of pressure: millibar.
+ * Returns by pointer, unit of pressure: megapascal.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegapascal()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createMegapascal(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of pressure: megapascal.
+ * Also see {@link #createMegapascal()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegapascal();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of pressure: millibar.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getMillibar()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMillibar(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of pressure: millimeter-of-mercury.
+ * Returns by value, unit of pressure: millibar.
+ * Also see {@link #createMillibar()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMillibar();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of pressure: millimeter-of-mercury.
* Caller owns returned value and must free it.
+ * Also see {@link #getMillimeterOfMercury()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of pressure: millimeter-of-mercury.
+ * Also see {@link #createMillimeterOfMercury()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMillimeterOfMercury();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of pressure: pound-per-square-inch.
+ * Returns by pointer, unit of pressure: pound-per-square-inch.
* Caller owns returned value and must free it.
+ * Also see {@link #getPoundPerSquareInch()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of pressure: pound-per-square-inch.
+ * Also see {@link #createPoundPerSquareInch()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPoundPerSquareInch();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of speed: kilometer-per-hour.
+ * Returns by pointer, unit of speed: kilometer-per-hour.
* Caller owns returned value and must free it.
+ * Also see {@link #getKilometerPerHour()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createKilometerPerHour(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of speed: knot.
+ * Returns by value, unit of speed: kilometer-per-hour.
+ * Also see {@link #createKilometerPerHour()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKilometerPerHour();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of speed: knot.
* Caller owns returned value and must free it.
+ * Also see {@link #getKnot()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createKnot(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of speed: knot.
+ * Also see {@link #createKnot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKnot();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of speed: meter-per-second.
+ * Returns by pointer, unit of speed: meter-per-second.
* Caller owns returned value and must free it.
+ * Also see {@link #getMeterPerSecond()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMeterPerSecond(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of speed: meter-per-second.
+ * Also see {@link #createMeterPerSecond()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMeterPerSecond();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of speed: mile-per-hour.
+ * Returns by pointer, unit of speed: mile-per-hour.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilePerHour()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createMilePerHour(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of speed: mile-per-hour.
+ * Also see {@link #createMilePerHour()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilePerHour();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of temperature: celsius.
+ * Returns by pointer, unit of temperature: celsius.
* Caller owns returned value and must free it.
+ * Also see {@link #getCelsius()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCelsius(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of temperature: celsius.
+ * Also see {@link #createCelsius()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCelsius();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of temperature: fahrenheit.
+ * Returns by pointer, unit of temperature: fahrenheit.
* Caller owns returned value and must free it.
+ * Also see {@link #getFahrenheit()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createFahrenheit(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of temperature: fahrenheit.
+ * Also see {@link #createFahrenheit()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFahrenheit();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of temperature: generic.
+ * Returns by pointer, unit of temperature: generic.
* Caller owns returned value and must free it.
+ * Also see {@link #getGenericTemperature()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createGenericTemperature(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of temperature: generic.
+ * Also see {@link #createGenericTemperature()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGenericTemperature();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of temperature: kelvin.
+ * Returns by pointer, unit of temperature: kelvin.
* Caller owns returned value and must free it.
+ * Also see {@link #getKelvin()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createKelvin(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of temperature: kelvin.
+ * Also see {@link #createKelvin()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getKelvin();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of volume: acre-foot.
+ * Returns by pointer, unit of torque: newton-meter.
* Caller owns returned value and must free it.
+ * Also see {@link #getNewtonMeter()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createNewtonMeter(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of torque: newton-meter.
+ * Also see {@link #createNewtonMeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getNewtonMeter();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of torque: pound-foot.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getPoundFoot()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createPoundFoot(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of torque: pound-foot.
+ * Also see {@link #createPoundFoot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPoundFoot();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of volume: acre-foot.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getAcreFoot()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createAcreFoot(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: acre-foot.
+ * Also see {@link #createAcreFoot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getAcreFoot();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by pointer, unit of volume: barrel.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getBarrel()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createBarrel(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of volume: barrel.
+ * Also see {@link #createBarrel()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getBarrel();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: bushel.
+ * Returns by pointer, unit of volume: bushel.
* Caller owns returned value and must free it.
+ * Also see {@link #getBushel()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createBushel(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: bushel.
+ * Also see {@link #createBushel()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getBushel();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: centiliter.
+ * Returns by pointer, unit of volume: centiliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getCentiliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCentiliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: centiliter.
+ * Also see {@link #createCentiliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCentiliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cubic-centimeter.
+ * Returns by pointer, unit of volume: cubic-centimeter.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicCentimeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicCentimeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of volume: cubic-foot.
+ * Returns by value, unit of volume: cubic-centimeter.
+ * Also see {@link #createCubicCentimeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicCentimeter();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of volume: cubic-foot.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicFoot()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicFoot(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cubic-foot.
+ * Also see {@link #createCubicFoot()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicFoot();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cubic-inch.
+ * Returns by pointer, unit of volume: cubic-inch.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicInch()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicInch(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cubic-inch.
+ * Also see {@link #createCubicInch()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicInch();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cubic-kilometer.
+ * Returns by pointer, unit of volume: cubic-kilometer.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicKilometer()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCubicKilometer(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of volume: cubic-meter.
+ * Returns by value, unit of volume: cubic-kilometer.
+ * Also see {@link #createCubicKilometer()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicKilometer();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of volume: cubic-meter.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicMeter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicMeter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cubic-meter.
+ * Also see {@link #createCubicMeter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicMeter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cubic-mile.
+ * Returns by pointer, unit of volume: cubic-mile.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicMile()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createCubicMile(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cubic-mile.
+ * Also see {@link #createCubicMile()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicMile();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cubic-yard.
+ * Returns by pointer, unit of volume: cubic-yard.
* Caller owns returned value and must free it.
+ * Also see {@link #getCubicYard()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCubicYard(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of volume: cup.
+ * Returns by value, unit of volume: cubic-yard.
+ * Also see {@link #createCubicYard()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCubicYard();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of volume: cup.
* Caller owns returned value and must free it.
+ * Also see {@link #getCup()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createCup(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cup.
+ * Also see {@link #createCup()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCup();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: cup-metric.
+ * Returns by pointer, unit of volume: cup-metric.
* Caller owns returned value and must free it.
+ * Also see {@link #getCupMetric()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createCupMetric(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: cup-metric.
+ * Also see {@link #createCupMetric()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getCupMetric();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: deciliter.
+ * Returns by pointer, unit of volume: deciliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getDeciliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createDeciliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: deciliter.
+ * Also see {@link #createDeciliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getDeciliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: fluid-ounce.
+ * Returns by pointer, unit of volume: fluid-ounce.
* Caller owns returned value and must free it.
+ * Also see {@link #getFluidOunce()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createFluidOunce(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: fluid-ounce.
+ * Also see {@link #createFluidOunce()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFluidOunce();
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Returns unit of volume: gallon.
+ * Returns by pointer, unit of volume: fluid-ounce-imperial.
* Caller owns returned value and must free it.
+ * Also see {@link #getFluidOunceImperial()}.
+ * @param status ICU error code.
+ * @draft ICU 64
+ */
+ static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
+
+ /**
+ * Returns by value, unit of volume: fluid-ounce-imperial.
+ * Also see {@link #createFluidOunceImperial()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getFluidOunceImperial();
+#endif /* U_HIDE_DRAFT_API */
+
+ /**
+ * Returns by pointer, unit of volume: gallon.
+ * Caller owns returned value and must free it.
+ * Also see {@link #getGallon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createGallon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: gallon.
+ * Also see {@link #createGallon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGallon();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: gallon-imperial.
+ * Returns by pointer, unit of volume: gallon-imperial.
* Caller owns returned value and must free it.
+ * Also see {@link #getGallonImperial()}.
* @param status ICU error code.
* @stable ICU 57
*/
static MeasureUnit *createGallonImperial(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: gallon-imperial.
+ * Also see {@link #createGallonImperial()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getGallonImperial();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: hectoliter.
+ * Returns by pointer, unit of volume: hectoliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getHectoliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createHectoliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: hectoliter.
+ * Also see {@link #createHectoliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getHectoliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: liter.
+ * Returns by pointer, unit of volume: liter.
* Caller owns returned value and must free it.
+ * Also see {@link #getLiter()}.
* @param status ICU error code.
* @stable ICU 53
*/
static MeasureUnit *createLiter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: liter.
+ * Also see {@link #createLiter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getLiter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: megaliter.
+ * Returns by pointer, unit of volume: megaliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMegaliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMegaliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: megaliter.
+ * Also see {@link #createMegaliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMegaliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: milliliter.
+ * Returns by pointer, unit of volume: milliliter.
* Caller owns returned value and must free it.
+ * Also see {@link #getMilliliter()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createMilliliter(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: milliliter.
+ * Also see {@link #createMilliliter()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getMilliliter();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: pint.
+ * Returns by pointer, unit of volume: pint.
* Caller owns returned value and must free it.
+ * Also see {@link #getPint()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createPint(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: pint.
+ * Also see {@link #createPint()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPint();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: pint-metric.
+ * Returns by pointer, unit of volume: pint-metric.
* Caller owns returned value and must free it.
+ * Also see {@link #getPintMetric()}.
* @param status ICU error code.
* @stable ICU 56
*/
static MeasureUnit *createPintMetric(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: pint-metric.
+ * Also see {@link #createPintMetric()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getPintMetric();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: quart.
+ * Returns by pointer, unit of volume: quart.
* Caller owns returned value and must free it.
+ * Also see {@link #getQuart()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createQuart(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: quart.
+ * Also see {@link #createQuart()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getQuart();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: tablespoon.
+ * Returns by pointer, unit of volume: tablespoon.
* Caller owns returned value and must free it.
+ * Also see {@link #getTablespoon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTablespoon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: tablespoon.
+ * Also see {@link #createTablespoon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getTablespoon();
+#endif /* U_HIDE_DRAFT_API */
+
/**
- * Returns unit of volume: teaspoon.
+ * Returns by pointer, unit of volume: teaspoon.
* Caller owns returned value and must free it.
+ * Also see {@link #getTeaspoon()}.
* @param status ICU error code.
* @stable ICU 54
*/
static MeasureUnit *createTeaspoon(UErrorCode &status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns by value, unit of volume: teaspoon.
+ * Also see {@link #createTeaspoon()}.
+ * @draft ICU 64
+ */
+ static MeasureUnit getTeaspoon();
+#endif /* U_HIDE_DRAFT_API */
+
// End generated createXXX methods
diff --git a/deps/icu-small/source/i18n/unicode/msgfmt.h b/deps/icu-small/source/i18n/unicode/msgfmt.h
index 074d933540..8e1bf9b45f 100644
--- a/deps/icu-small/source/i18n/unicode/msgfmt.h
+++ b/deps/icu-small/source/i18n/unicode/msgfmt.h
@@ -69,9 +69,8 @@ class NumberFormat;
* if the pattern has named arguments (see {@link #usesNamedArguments()}).
*
* <p>An argument might not specify any format type. In this case,
- * a Number value is formatted with a default (for the locale) NumberFormat,
- * a Date value is formatted with a default (for the locale) DateFormat,
- * and for any other value its toString() value is used.
+ * a numeric value is formatted with a default (for the locale) NumberFormat,
+ * and a date/time value is formatted with a default (for the locale) DateFormat.
*
* <p>An argument might specify a "simple" type for which the specified
* Format object is created, cached and used.
@@ -204,6 +203,9 @@ class NumberFormat;
* <td><i>argStyleText</i>
* <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
* <tr>
+ * <td><i>argSkeletonText</i>
+ * <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</code>
+ * <tr>
* <td rowspan=6><code>time</code>
* <td><i>(none)</i>
* <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), status)</code>
@@ -240,6 +242,19 @@ class NumberFormat;
* </table>
* <p>
*
+ * <h4>Argument formatting</h4>
+ *
+ * <p>Arguments are formatted according to their type, using the default
+ * ICU formatters for those types, unless otherwise specified.</p>
+ *
+ * <p>There are also several ways to control the formatting.</p>
+ *
+ * <p>We recommend you use default styles, predefined style values, skeletons,
+ * or preformatted values, but not pattern strings or custom format objects.</p>
+ *
+ * <p>For more details, see the
+ * <a href="http://userguide.icu-project.org/formatparse/messages">ICU User Guide</a>.</p>
+ *
* <h4>Usage Information</h4>
*
* <p>Here are some examples of usage:
@@ -257,11 +272,11 @@ class NumberFormat;
*
* UnicodeString result;
* MessageFormat::format(
- * "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.",
* arguments, 3, result, success );
*
* cout << "result: " << result << endl;
- * //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance
+ * //<output>: At 4:34 PM on March 23, there was a disturbance
* // in the Force on planet 7.
* \endcode
* </pre>
@@ -994,6 +1009,8 @@ private:
void cacheExplicitFormats(UErrorCode& status);
+ int32_t skipLeadingSpaces(UnicodeString& style);
+
Format* createAppropriateFormat(UnicodeString& type,
UnicodeString& style,
Formattable::Type& formattableType,
diff --git a/deps/icu-small/source/i18n/unicode/nounit.h b/deps/icu-small/source/i18n/unicode/nounit.h
index 288f268d66..879849b16b 100644
--- a/deps/icu-small/source/i18n/unicode/nounit.h
+++ b/deps/icu-small/source/i18n/unicode/nounit.h
@@ -13,6 +13,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
+#ifndef U_HIDE_DRAFT_API
#include "unicode/measunit.h"
@@ -23,7 +24,6 @@
U_NAMESPACE_BEGIN
-#ifndef U_HIDE_DRAFT_API
/**
* Dimensionless unit for percent and permille.
* @see NumberFormatter
@@ -100,10 +100,10 @@ private:
NoUnit(const char* subtype);
};
-#endif /* U_HIDE_DRAFT_API */
U_NAMESPACE_END
+#endif /* U_HIDE_DRAFT_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // __NOUNIT_H__
diff --git a/deps/icu-small/source/i18n/unicode/numberformatter.h b/deps/icu-small/source/i18n/unicode/numberformatter.h
index 469949a287..e9fe39a931 100644
--- a/deps/icu-small/source/i18n/unicode/numberformatter.h
+++ b/deps/icu-small/source/i18n/unicode/numberformatter.h
@@ -11,9 +11,11 @@
#include "unicode/dcfmtsym.h"
#include "unicode/currunit.h"
#include "unicode/fieldpos.h"
+#include "unicode/formattedvalue.h"
#include "unicode/fpositer.h"
#include "unicode/measunit.h"
#include "unicode/nounit.h"
+#include "unicode/parseerr.h"
#include "unicode/plurrule.h"
#include "unicode/ucurr.h"
#include "unicode/unum.h"
@@ -42,25 +44,27 @@
* .format(1234)
* .toString(); // €1.2K in en-US
*
- * // Create a formatter in a singleton for use later:
+ * // Create a formatter in a singleton by value for use later:
* static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...)
* .unit(NoUnit::percent())
* .precision(Precision::fixedFraction(3));
* formatter.format(5.9831).toString(); // 5.983% in en-US
*
- * // Create a "template" in a singleton but without setting a locale until the call site:
- * static const UnlocalizedNumberFormatter template = NumberFormatter::with()
+ * // Create a "template" in a singleton unique_ptr but without setting a locale until the call site:
+ * std::unique_ptr<UnlocalizedNumberFormatter> template = NumberFormatter::with()
* .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
- * .adoptUnit(MeasureUnit::createMeter(status))
- * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME);
- * template.locale(...).format(1234).toString(); // +1,234 meters in en-US
+ * .unit(MeasureUnit::getMeter())
+ * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
+ * .clone();
+ * template->locale(...).format(1234).toString(); // +1,234 meters in en-US
* </pre>
*
* <p>
* This API offers more features than DecimalFormat and is geared toward new users of ICU.
*
* <p>
- * NumberFormatter instances are immutable and thread safe. This means that invoking a configuration method has no
+ * NumberFormatter instances (i.e., LocalizedNumberFormatter and UnlocalizedNumberFormatter)
+ * are immutable and thread safe. This means that invoking a configuration method has no
* effect on the receiving instance; you must store and use the new number formatter instance it returns instead.
*
* <pre>
@@ -108,6 +112,7 @@ class IntegerWidth;
namespace impl {
+// can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes
/**
* Datatype for minimum/maximum fraction digits. Must be able to hold kMaxIntFracSig.
*
@@ -115,20 +120,21 @@ namespace impl {
*/
typedef int16_t digits_t;
+// can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization
/**
* Use a default threshold of 3. This means that the third time .format() is called, the data structures get built
* using the "safe" code path. The first two calls to .format() will trigger the unsafe code path.
*
* @internal
*/
-static constexpr int32_t DEFAULT_THRESHOLD = 3;
+static constexpr int32_t kInternalDefaultThreshold = 3;
// Forward declarations:
class Padder;
struct MacroProps;
struct MicroProps;
class DecimalQuantity;
-struct UFormattedNumberData;
+class UFormattedNumberData;
class NumberFormatterImpl;
struct ParsedPatternInfo;
class ScientificModifier;
@@ -146,6 +152,7 @@ class GeneratorHelpers;
class DecNum;
class NumberRangeFormatterImpl;
struct RangeMacroProps;
+struct UFormattedNumberImpl;
/**
* Used for NumberRangeFormatter and implemented in numrange_fluent.cpp.
@@ -439,34 +446,6 @@ class U_I18N_API ScientificNotation : public Notation {
*/
typedef Precision SignificantDigitsPrecision;
-// Typedefs for ICU 60/61 compatibility.
-// These will be removed in ICU 64.
-// See http://bugs.icu-project.org/trac/ticket/13746
-
-/**
- * This will be removed in ICU 64. See ICU-13746.
- * @deprecated ICU 63
- */
-typedef Precision Rounder;
-
-/**
- * This will be removed in ICU 64. See ICU-13746.
- * @deprecated ICU 63
- */
-typedef FractionPrecision FractionRounder;
-
-/**
- * This will be removed in ICU 64. See ICU-13746.
- * @deprecated ICU 63
- */
-typedef IncrementPrecision IncrementRounder;
-
-/**
- * This will be removed in ICU 64. See ICU-13746.
- * @deprecated ICU 63
- */
-typedef CurrencyPrecision CurrencyRounder;
-
/**
* A class that defines the rounding precision to be used when formatting numbers in NumberFormatter.
*
@@ -483,10 +462,11 @@ class U_I18N_API Precision : public UMemory {
*
* <p>
* <strong>NOTE:</strong> When formatting a <em>double</em>, this method, along with {@link #minFraction} and
- * {@link #minDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the low-order digits
- * and the number of digits to display based on the value of the double. If the number of fraction places or
- * significant digits can be bounded, consider using {@link #maxFraction} or {@link #maxDigits} instead to maximize
- * performance. For more information, read the following blog post.
+ * {@link #minSignificantDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the
+ * low-order digits and the number of digits to display based on the value of the double.
+ * If the number of fraction places or significant digits can be bounded, consider using {@link #maxFraction}
+ * or {@link #maxSignificantDigits} instead to maximize performance.
+ * For more information, read the following blog post.
*
* <p>
* http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/
@@ -580,7 +560,7 @@ class U_I18N_API Precision : public UMemory {
* pad with zeros to ensure that this number of significant digits/figures are always shown.
*
* <p>
- * This method is equivalent to {@link #minMaxDigits} with both arguments equal.
+ * This method is equivalent to {@link #minMaxSignificantDigits} with both arguments equal.
*
* @param minMaxSignificantDigits
* The minimum and maximum number of significant digits to display (rounding if too long or padding with
@@ -628,31 +608,6 @@ class U_I18N_API Precision : public UMemory {
static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits,
int32_t maxSignificantDigits);
-#ifndef U_HIDE_DEPRECATED_API
- // Compatiblity methods that will be removed in ICU 64.
- // See http://bugs.icu-project.org/trac/ticket/13746
-
- /** @deprecated ICU 62 */
- static inline SignificantDigitsPrecision fixedDigits(int32_t a) {
- return fixedSignificantDigits(a);
- }
-
- /** @deprecated ICU 62 */
- static inline SignificantDigitsPrecision minDigits(int32_t a) {
- return minSignificantDigits(a);
- }
-
- /** @deprecated ICU 62 */
- static inline SignificantDigitsPrecision maxDigits(int32_t a) {
- return maxSignificantDigits(a);
- }
-
- /** @deprecated ICU 62 */
- static inline SignificantDigitsPrecision minMaxDigits(int32_t a, int32_t b) {
- return minMaxSignificantDigits(a, b);
- }
-#endif /* U_HIDE_DEPRECATED_API */
-
/**
* Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the
* rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5.
@@ -693,21 +648,6 @@ class U_I18N_API Precision : public UMemory {
*/
static CurrencyPrecision currency(UCurrencyUsage currencyUsage);
-#ifndef U_HIDE_DEPRECATED_API
- /**
- * Sets the rounding mode to use when picking the direction to round (up or down). Common values
- * include HALF_EVEN, HALF_UP, and FLOOR. The default is HALF_EVEN.
- *
- * @param roundingMode
- * The RoundingMode to use.
- * @return A Precision for passing to the NumberFormatter precision() setter.
- * @deprecated ICU 62 Use the top-level roundingMode() setting instead.
- * This method will be removed in ICU 64.
- * See http://bugs.icu-project.org/trac/ticket/13746
- */
- Precision withMode(UNumberFormatRoundingMode roundingMode) const;
-#endif /* U_HIDE_DEPRECATED_API */
-
private:
enum PrecisionType {
RND_BOGUS,
@@ -715,7 +655,18 @@ class U_I18N_API Precision : public UMemory {
RND_FRACTION,
RND_SIGNIFICANT,
RND_FRACTION_SIGNIFICANT,
+
+ // Used for strange increments like 3.14.
RND_INCREMENT,
+
+ // Used for increments with 1 as the only digit. This is different than fraction
+ // rounding because it supports having additional trailing zeros. For example, this
+ // class is used to round with the increment 0.010.
+ RND_INCREMENT_ONE,
+
+ // Used for increments with 5 as the only digit (nickel rounding).
+ RND_INCREMENT_FIVE,
+
RND_CURRENCY,
RND_ERROR
} fType;
@@ -735,13 +686,14 @@ class U_I18N_API Precision : public UMemory {
} fracSig;
/** @internal */
struct IncrementSettings {
+ // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE
/** @internal */
double fIncrement;
/** @internal */
impl::digits_t fMinFrac;
/** @internal */
impl::digits_t fMaxFrac;
- } increment; // For RND_INCREMENT
+ } increment;
UCurrencyUsage currencyUsage; // For RND_CURRENCY
UErrorCode errorCode; // For RND_ERROR
} fUnion;
@@ -1314,7 +1266,7 @@ class U_I18N_API Grouper : public UMemory {
*/
UNumberGroupingStrategy fStrategy;
- Grouper() : fGrouping1(-3) {};
+ Grouper() : fGrouping1(-3) {}
bool isBogus() const {
return fGrouping1 == -3;
@@ -1459,7 +1411,7 @@ struct U_I18N_API MacroProps : public UMemory {
const CurrencySymbols* currencySymbols = nullptr; // no ownership
/** @internal */
- int32_t threshold = DEFAULT_THRESHOLD;
+ int32_t threshold = kInternalDefaultThreshold;
/** @internal */
Locale locale;
@@ -1540,11 +1492,10 @@ class U_I18N_API NumberFormatterSettings {
* All units will be properly localized with locale data, and all units are compatible with notation styles,
* rounding precisions, and other number formatter settings.
*
- * Pass this method any instance of {@link MeasureUnit}. For units of measure (which often involve the
- * factory methods that return a pointer):
+ * Pass this method any instance of {@link MeasureUnit}. For units of measure:
*
* <pre>
- * NumberFormatter::with().adoptUnit(MeasureUnit::createMeter(status))
+ * NumberFormatter::with().unit(MeasureUnit::getMeter())
* </pre>
*
* Currency:
@@ -1587,11 +1538,9 @@ class U_I18N_API NumberFormatterSettings {
/**
* Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
- * methods, which return pointers that need ownership. Example:
+ * methods that return pointers that need ownership.
*
- * <pre>
- * NumberFormatter::with().adoptUnit(MeasureUnit::createMeter(status))
- * </pre>
+ * Note: consider using the MeasureFormat factory methods that return by value.
*
* @param unit
* The unit to render.
@@ -1617,8 +1566,13 @@ class U_I18N_API NumberFormatterSettings {
* Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to
* the perUnit.
*
- * Pass this method any instance of {@link MeasureUnit}. Since MeasureUnit factory methods return pointers, the
- * {@link #adoptPerUnit} version of this method is often more useful.
+ * Pass this method any instance of {@link MeasureUnit}. Example:
+ *
+ * <pre>
+ * NumberFormatter::with()
+ * .unit(MeasureUnit::getMeter())
+ * .perUnit(MeasureUnit::getSecond())
+ * </pre>
*
* The default is not to display any unit in the denominator.
*
@@ -1645,13 +1599,9 @@ class U_I18N_API NumberFormatterSettings {
/**
* Like perUnit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory
- * methods, which return pointers that need ownership. Example:
+ * methods that return pointers that need ownership.
*
- * <pre>
- * NumberFormatter::with()
- * .adoptUnit(MeasureUnit::createMeter(status))
- * .adoptPerUnit(MeasureUnit::createSecond(status))
- * </pre>
+ * Note: consider using the MeasureFormat factory methods that return by value.
*
* @param perUnit
* The unit to render in the denominator.
@@ -1716,16 +1666,6 @@ class U_I18N_API NumberFormatterSettings {
*/
Derived precision(const Precision& precision) &&;
-#ifndef U_HIDE_DEPRECATED_API
- // Compatibility method that will be removed in ICU 64.
- // Use precision() instead.
- // See http://bugs.icu-project.org/trac/ticket/13746
- /** @deprecated ICU 62 */
- Derived rounding(const Rounder& rounder) const & {
- return precision(rounder);
- }
-#endif /* U_HIDE_DEPRECATED_API */
-
/**
* Specifies how to determine the direction to round a number when it has more digits than fit in the
* desired precision. When formatting 1.235:
@@ -2141,6 +2081,28 @@ class U_I18N_API NumberFormatterSettings {
UnicodeString toSkeleton(UErrorCode& status) const;
/**
+ * Returns the current (Un)LocalizedNumberFormatter as a LocalPointer
+ * wrapping a heap-allocated copy of the current object.
+ *
+ * This is equivalent to new-ing the move constructor with a value object
+ * as the argument.
+ *
+ * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @draft ICU 64
+ */
+ LocalPointer<Derived> clone() const &;
+
+ /**
+ * Overload of clone for use on an rvalue reference.
+ *
+ * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @draft ICU 64
+ */
+ LocalPointer<Derived> clone() &&;
+
+ /**
* Sets the UErrorCode if an error occurred in the fluent chain.
* Preserves older error codes in the outErrorCode.
* @return TRUE if U_FAILURE(outErrorCode)
@@ -2153,7 +2115,7 @@ class U_I18N_API NumberFormatterSettings {
}
fMacros.copyErrorTo(outErrorCode);
return U_FAILURE(outErrorCode);
- };
+ }
// NOTE: Uses default copy and move constructors.
@@ -2174,6 +2136,8 @@ class U_I18N_API NumberFormatterSettings {
/**
* A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @see NumberFormatter
* @draft ICU 60
*/
@@ -2252,6 +2216,8 @@ class U_I18N_API UnlocalizedNumberFormatter
/**
* A NumberFormatter that has a locale associated with it; this means .format() methods are available.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @see NumberFormatter
* @draft ICU 60
*/
@@ -2433,89 +2399,79 @@ class U_I18N_API LocalizedNumberFormatter
* The result of a number formatting operation. This class allows the result to be exported in several data types,
* including a UnicodeString and a FieldPositionIterator.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @draft ICU 60
*/
-class U_I18N_API FormattedNumber : public UMemory {
+class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
public:
-#ifndef U_HIDE_DEPRECATED_API
+
/**
- * Returns a UnicodeString representation of the formatted number.
- *
- * @return a UnicodeString containing the localized number.
- * @deprecated ICU 62 Use the version of this method with an error code instead.
- * This method was never @stable and will be removed in a future release.
- * See http://bugs.icu-project.org/trac/ticket/13746
+ * Default constructor; makes an empty FormattedNumber.
+ * @draft ICU 64
*/
- UnicodeString toString() const;
-#endif /* U_HIDE_DEPRECATED_API */
+ FormattedNumber()
+ : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
/**
- * Returns a UnicodeString representation of the formatted number.
- *
- * @param status
- * Set if an error occurs while formatting the number to the UnicodeString.
- * @return a UnicodeString containing the localized number.
+ * Move constructor: Leaves the source FormattedNumber in an undefined state.
* @draft ICU 62
*/
- UnicodeString toString(UErrorCode& status) const;
+ FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
-#ifndef U_HIDE_DEPRECATED_API
/**
- * Appends the formatted number to an Appendable.
- *
- * @param appendable
- * The Appendable to which to append the formatted number string.
- * @return The same Appendable, for chaining.
- * @deprecated ICU 62 Use the version of this method with an error code instead.
- * This method was never @stable and will be removed in a future release.
- * See http://bugs.icu-project.org/trac/ticket/13746
- * @see Appendable
+ * Destruct an instance of FormattedNumber.
+ * @draft ICU 60
*/
- Appendable &appendTo(Appendable &appendable);
-#endif /* U_HIDE_DEPRECATED_API */
+ virtual ~FormattedNumber() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedNumber(const FormattedNumber&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedNumber& operator=(const FormattedNumber&) = delete;
/**
- * Appends the formatted number to an Appendable.
- *
- * @param appendable
- * The Appendable to which to append the formatted number string.
- * @param status
- * Set if an error occurs while formatting the number to the Appendable.
- * @return The same Appendable, for chaining.
+ * Move assignment: Leaves the source FormattedNumber in an undefined state.
* @draft ICU 62
- * @see Appendable
*/
- Appendable &appendTo(Appendable &appendable, UErrorCode& status) const;
+ FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
-#ifndef U_HIDE_DEPRECATED_API
+ // Copybrief: this method is older than the parent method
/**
- * Determine the start and end indices of the first occurrence of the given <em>field</em> in the output string.
- * This allows you to determine the locations of the integer part, fraction part, and sign.
+ * @copybrief FormattedValue::toString()
*
- * <p>
- * If multiple different field attributes are needed, this method can be called repeatedly, or if <em>all</em> field
- * attributes are needed, consider using populateFieldPositionIterator().
+ * For more information, see FormattedValue::toString()
*
- * <p>
- * If a field occurs multiple times in an output string, such as a grouping separator, this method will only ever
- * return the first occurrence. Use populateFieldPositionIterator() to access all occurrences of an attribute.
+ * @draft ICU 62
+ */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copybrief: this method is older than the parent method
+ /**
+ * @copybrief FormattedValue::appendTo()
*
- * @param fieldPosition
- * The FieldPosition to populate with the start and end indices of the desired field.
- * @param status
- * Set if an error occurs while populating the FieldPosition.
- * @deprecated ICU 62 Use {@link #nextFieldPosition} instead. This method will be removed in a future
- * release. See http://bugs.icu-project.org/trac/ticket/13746
- * @see UNumberFormatFields
+ * For more information, see FormattedValue::appendTo()
+ *
+ * @draft ICU 62
*/
- void populateFieldPosition(FieldPosition &fieldPosition, UErrorCode &status);
-#endif /* U_HIDE_DEPRECATED_API */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
/**
* Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the given
* <em>field</em> in the output string. This allows you to determine the locations of, for example,
* the integer part, fraction part, or symbols.
*
+ * This is a simpler but less powerful alternative to {@link #nextPosition}.
+ *
* If a field occurs just once, calling this method will find that occurrence and return it. If a
* field occurs multiple times, this method may be called repeatedly with the following pattern:
*
@@ -2527,7 +2483,7 @@ class U_I18N_API FormattedNumber : public UMemory {
* </pre>
*
* This method is useful if you know which field to query. If you want all available field position
- * information, use #getAllFieldPositions().
+ * information, use {@link #nextPosition} or {@link #getAllFieldPositions}.
*
* @param fieldPosition
* Input+output variable. On input, the "field" property determines which field to look
@@ -2544,30 +2500,13 @@ class U_I18N_API FormattedNumber : public UMemory {
*/
UBool nextFieldPosition(FieldPosition& fieldPosition, UErrorCode& status) const;
-#ifndef U_HIDE_DEPRECATED_API
/**
* Export the formatted number to a FieldPositionIterator. This allows you to determine which characters in
* the output string correspond to which <em>fields</em>, such as the integer part, fraction part, and sign.
*
- * <p>
- * If information on only one field is needed, consider using populateFieldPosition() instead.
- *
- * @param iterator
- * The FieldPositionIterator to populate with all of the fields present in the formatted number.
- * @param status
- * Set if an error occurs while populating the FieldPositionIterator.
- * @deprecated ICU 62 Use {@link #getAllFieldPositions} instead. This method will be removed in a
- * future release. See http://bugs.icu-project.org/trac/ticket/13746
- * @see UNumberFormatFields
- */
- void populateFieldPositionIterator(FieldPositionIterator &iterator, UErrorCode &status);
-#endif /* U_HIDE_DEPRECATED_API */
-
- /**
- * Export the formatted number to a FieldPositionIterator. This allows you to determine which characters in
- * the output string correspond to which <em>fields</em>, such as the integer part, fraction part, and sign.
+ * This is an alternative to the more powerful #nextPosition() API.
*
- * If information on only one field is needed, use #nextFieldPosition() instead.
+ * If information on only one field is needed, use #nextPosition() or #nextFieldPosition() instead.
*
* @param iterator
* The FieldPositionIterator to populate with all of the fields present in the formatted number.
@@ -2594,39 +2533,9 @@ class U_I18N_API FormattedNumber : public UMemory {
#endif /* U_HIDE_INTERNAL_API */
- /**
- * Copying not supported; use move constructor instead.
- */
- FormattedNumber(const FormattedNumber&) = delete;
-
- /**
- * Copying not supported; use move assignment instead.
- */
- FormattedNumber& operator=(const FormattedNumber&) = delete;
-
- /**
- * Move constructor:
- * Leaves the source FormattedNumber in an undefined state.
- * @draft ICU 62
- */
- FormattedNumber(FormattedNumber&& src) U_NOEXCEPT;
-
- /**
- * Move assignment:
- * Leaves the source FormattedNumber in an undefined state.
- * @draft ICU 62
- */
- FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT;
-
- /**
- * Destruct an instance of FormattedNumber, cleaning up any memory it might own.
- * @draft ICU 60
- */
- ~FormattedNumber();
-
private:
// Can't use LocalPointer because UFormattedNumberData is forward-declared
- const impl::UFormattedNumberData *fResults;
+ const impl::UFormattedNumberData *fData;
// Error code for the terminal methods
UErrorCode fErrorCode;
@@ -2636,13 +2545,16 @@ class U_I18N_API FormattedNumber : public UMemory {
* @internal
*/
explicit FormattedNumber(impl::UFormattedNumberData *results)
- : fResults(results), fErrorCode(U_ZERO_ERROR) {};
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
explicit FormattedNumber(UErrorCode errorCode)
- : fResults(nullptr), fErrorCode(errorCode) {};
+ : fData(nullptr), fErrorCode(errorCode) {}
// To give LocalizedNumberFormatter format methods access to this class's constructor:
friend class LocalizedNumberFormatter;
+
+ // To give C API access to internals
+ friend struct impl::UFormattedNumberImpl;
};
/**
@@ -2676,6 +2588,9 @@ class U_I18N_API NumberFormatter final {
* Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
* on a given number skeleton string.
*
+ * It is possible for an error to occur while parsing. See the overload of this method if you are
+ * interested in the location of a possible parse error.
+ *
* @param skeleton
* The skeleton string off of which to base this NumberFormatter.
* @param status
@@ -2686,6 +2601,26 @@ class U_I18N_API NumberFormatter final {
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
/**
+ * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based
+ * on a given number skeleton string.
+ *
+ * If an error occurs while parsing the skeleton string, the offset into the skeleton string at
+ * which the error occurred will be saved into the UParseError, if provided.
+ *
+ * @param skeleton
+ * The skeleton string off of which to base this NumberFormatter.
+ * @param perror
+ * A parse error struct populated if an error occurs when parsing.
+ * If no error occurs, perror.offset will be set to -1.
+ * @param status
+ * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid.
+ * @return An UnlocalizedNumberFormatter, to be used for chaining.
+ * @draft ICU 64
+ */
+ static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton,
+ UParseError& perror, UErrorCode& status);
+
+ /**
* Use factory methods instead of the constructor to create a NumberFormatter.
*/
NumberFormatter() = delete;
diff --git a/deps/icu-small/source/i18n/unicode/numberrangeformatter.h b/deps/icu-small/source/i18n/unicode/numberrangeformatter.h
index 3e6248d934..47c4bfe3f5 100644
--- a/deps/icu-small/source/i18n/unicode/numberrangeformatter.h
+++ b/deps/icu-small/source/i18n/unicode/numberrangeformatter.h
@@ -8,6 +8,7 @@
#include <atomic>
#include "unicode/appendable.h"
#include "unicode/fieldpos.h"
+#include "unicode/formattedvalue.h"
#include "unicode/fpositer.h"
#include "unicode/numberformatter.h"
@@ -32,7 +33,8 @@
* // => "750 m - 1.2 km"
* </pre>
* <p>
- * Like NumberFormatter, NumberRangeFormatter instances are immutable and thread-safe. This API is based on the
+ * Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter
+ * and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on the
* <em>fluent</em> design pattern popularized by libraries such as Google's Guava.
*
* @author Shane Carr
@@ -175,7 +177,7 @@ namespace impl {
// Forward declarations:
struct RangeMacroProps;
class DecimalQuantity;
-struct UFormattedNumberRangeData;
+class UFormattedNumberRangeData;
class NumberRangeFormatterImpl;
} // namespace impl
@@ -185,8 +187,14 @@ class NumberRangeFormatterImpl;
* Export an explicit template instantiation. See datefmt.h
* (When building DLLs for Windows this is required.)
*/
-#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
-template struct U_I18N_API std::atomic<impl::NumberRangeFormatterImpl*>;
+#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN)
+} // namespace icu::number
+U_NAMESPACE_END
+
+template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>;
+
+U_NAMESPACE_BEGIN
+namespace number { // icu::number
#endif
/** \endcond */
@@ -439,6 +447,28 @@ class U_I18N_API NumberRangeFormatterSettings {
Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&;
/**
+ * Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer
+ * wrapping a heap-allocated copy of the current object.
+ *
+ * This is equivalent to new-ing the move constructor with a value object
+ * as the argument.
+ *
+ * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @draft ICU 64
+ */
+ LocalPointer<Derived> clone() const &;
+
+ /**
+ * Overload of clone for use on an rvalue reference.
+ *
+ * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped
+ * nullptr on failure.
+ * @draft ICU 64
+ */
+ LocalPointer<Derived> clone() &&;
+
+ /**
* Sets the UErrorCode if an error occurred in the fluent chain.
* Preserves older error codes in the outErrorCode.
* @return TRUE if U_FAILURE(outErrorCode)
@@ -451,7 +481,7 @@ class U_I18N_API NumberRangeFormatterSettings {
}
fMacros.copyErrorTo(outErrorCode);
return U_FAILURE(outErrorCode);
- };
+ }
// NOTE: Uses default copy and move constructors.
@@ -468,6 +498,8 @@ class U_I18N_API NumberRangeFormatterSettings {
/**
* A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @see NumberRangeFormatter
* @draft ICU 63
*/
@@ -547,6 +579,8 @@ class U_I18N_API UnlocalizedNumberRangeFormatter
/**
* A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @see NumberFormatter
* @draft ICU 63
*/
@@ -654,32 +688,39 @@ class U_I18N_API LocalizedNumberRangeFormatter
* The result of a number range formatting operation. This class allows the result to be exported in several data types,
* including a UnicodeString and a FieldPositionIterator.
*
+ * Instances of this class are immutable and thread-safe.
+ *
* @draft ICU 63
*/
-class U_I18N_API FormattedNumberRange : public UMemory {
+class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
public:
+ // Copybrief: this method is older than the parent method
/**
- * Returns a UnicodeString representation of the formatted number range.
+ * @copybrief FormattedValue::toString()
+ *
+ * For more information, see FormattedValue::toString()
*
- * @param status
- * Set if an error occurs while formatting the number to the UnicodeString.
- * @return a UnicodeString containing the localized number range.
* @draft ICU 63
*/
- UnicodeString toString(UErrorCode& status) const;
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+ // Copybrief: this method is older than the parent method
/**
- * Appends the formatted number range to an Appendable.
+ * @copybrief FormattedValue::appendTo()
+ *
+ * For more information, see FormattedValue::appendTo()
*
- * @param appendable
- * The Appendable to which to append the formatted number range string.
- * @param status
- * Set if an error occurs while formatting the number range to the Appendable.
- * @return The same Appendable, for chaining.
* @draft ICU 63
- * @see Appendable
*/
- Appendable &appendTo(Appendable &appendable, UErrorCode& status) const;
+ Appendable &appendTo(Appendable &appendable, UErrorCode& status) const U_OVERRIDE;
+
+ // Copydoc: this method is new in ICU 64
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
/**
* Determines the start (inclusive) and end (exclusive) indices of the next occurrence of the given
@@ -802,7 +843,7 @@ class U_I18N_API FormattedNumberRange : public UMemory {
private:
// Can't use LocalPointer because UFormattedNumberRangeData is forward-declared
- const impl::UFormattedNumberRangeData *fResults;
+ const impl::UFormattedNumberRangeData *fData;
// Error code for the terminal methods
UErrorCode fErrorCode;
@@ -812,10 +853,10 @@ class U_I18N_API FormattedNumberRange : public UMemory {
* @internal
*/
explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results)
- : fResults(results), fErrorCode(U_ZERO_ERROR) {};
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
explicit FormattedNumberRange(UErrorCode errorCode)
- : fResults(nullptr), fErrorCode(errorCode) {};
+ : fData(nullptr), fErrorCode(errorCode) {}
void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const;
diff --git a/deps/icu-small/source/i18n/unicode/numfmt.h b/deps/icu-small/source/i18n/unicode/numfmt.h
index 871fbd93e1..d8704754dc 100644
--- a/deps/icu-small/source/i18n/unicode/numfmt.h
+++ b/deps/icu-small/source/i18n/unicode/numfmt.h
@@ -237,6 +237,12 @@ public:
kPermillField = UNUM_PERMILL_FIELD,
/** @stable ICU 2.0 */
kSignField = UNUM_SIGN_FIELD,
+#ifndef U_HIDE_DRAFT_API
+ /** @draft ICU 64 */
+ kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD,
+ /** @draft ICU 64 */
+ kCompactField = UNUM_COMPACT_FIELD,
+#endif // U_HIDE_DRAFT_API
/**
* These constants are provided for backwards compatibility only.
diff --git a/deps/icu-small/source/i18n/unicode/numsys.h b/deps/icu-small/source/i18n/unicode/numsys.h
index 5f52721278..9e32478cf8 100644
--- a/deps/icu-small/source/i18n/unicode/numsys.h
+++ b/deps/icu-small/source/i18n/unicode/numsys.h
@@ -21,26 +21,24 @@
#include "unicode/utypes.h"
/**
- * \def NUMSYS_NAME_CAPACITY
- * Size of a numbering system name.
- * @internal
- */
-#define NUMSYS_NAME_CAPACITY 8
-
-
-/**
* \file
* \brief C++ API: NumberingSystem object
*/
#if !UCONFIG_NO_FORMATTING
-
#include "unicode/format.h"
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
+// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size
+/**
+ * Size of a numbering system name.
+ * @internal
+ */
+constexpr const size_t kInternalNumSysNameCapacity = 8;
+
/**
* Defines numbering systems. A numbering system describes the scheme by which
* numbers are to be presented to the end user. In its simplest form, a numbering
@@ -106,9 +104,13 @@ public:
/**
* Return a StringEnumeration over all the names of numbering systems known to ICU.
+ * The numbering system names will be in alphabetical (invariant) order.
+ *
+ * The returned StringEnumeration is owned by the caller, who must delete it when
+ * finished with it.
+ *
* @stable ICU 4.2
*/
-
static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status);
/**
@@ -119,8 +121,10 @@ public:
* default, native, traditional, finance - do not identify specific numbering systems,
* but rather key values that may only be used as part of a locale, which in turn
* defines how they are mapped to a specific numbering system such as "latn" or "hant".
+ *
* @param name The name of the numbering system.
- * @param status ICU status
+ * @param status ICU status; set to U_UNSUPPORTED_ERROR if numbering system not found.
+ * @return The NumberingSystem instance, or nullptr if not found.
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status);
@@ -187,7 +191,7 @@ private:
UnicodeString desc;
int32_t radix;
UBool algorithmic;
- char name[NUMSYS_NAME_CAPACITY+1];
+ char name[kInternalNumSysNameCapacity+1];
void setRadix(int32_t radix);
diff --git a/deps/icu-small/source/i18n/unicode/plurrule.h b/deps/icu-small/source/i18n/unicode/plurrule.h
index daeed52bee..04bf3970ba 100644
--- a/deps/icu-small/source/i18n/unicode/plurrule.h
+++ b/deps/icu-small/source/i18n/unicode/plurrule.h
@@ -50,6 +50,10 @@ class PluralKeywordEnumeration;
class AndConstraint;
class SharedPluralRules;
+namespace number {
+class FormattedNumber;
+}
+
/**
* Defines rules for mapping non-negative numeric values onto a small set of
* keywords. Rules are constructed from a text description, consisting
@@ -323,9 +327,9 @@ public:
#endif /* U_HIDE_INTERNAL_API */
/**
- * Given a number, returns the keyword of the first rule that applies to
- * the number. This function can be used with isKeyword* functions to
- * determine the keyword for default plural rules.
+ * Given an integer, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
*
* @param number The number for which the rule has to be determined.
* @return The keyword of the selected rule.
@@ -334,9 +338,9 @@ public:
UnicodeString select(int32_t number) const;
/**
- * Given a number, returns the keyword of the first rule that applies to
- * the number. This function can be used with isKeyword* functions to
- * determine the keyword for default plural rules.
+ * Given a floating-point number, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
*
* @param number The number for which the rule has to be determined.
* @return The keyword of the selected rule.
@@ -344,6 +348,25 @@ public:
*/
UnicodeString select(double number) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Given a formatted number, returns the keyword of the first rule
+ * that applies to the number. This function can be used with
+ * isKeyword* functions to determine the keyword for default plural rules.
+ *
+ * A FormattedNumber allows you to specify an exponent or trailing zeros,
+ * which can affect the plural category. To get a FormattedNumber, see
+ * NumberFormatter.
+ *
+ * @param number The number for which the rule has to be determined.
+ * @param status Set if an error occurs while selecting plural keyword.
+ * This could happen if the FormattedNumber is invalid.
+ * @return The keyword of the selected rule.
+ * @draft ICU 64
+ */
+ UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
#ifndef U_HIDE_INTERNAL_API
/**
* @internal
diff --git a/deps/icu-small/source/i18n/unicode/regex.h b/deps/icu-small/source/i18n/unicode/regex.h
index 7a68039fe8..a0f9839fe7 100644
--- a/deps/icu-small/source/i18n/unicode/regex.h
+++ b/deps/icu-small/source/i18n/unicode/regex.h
@@ -24,24 +24,22 @@
* \file
* \brief C++ API: Regular Expressions
*
- * <h2>Regular Expression API</h2>
- *
- * <p>The ICU API for processing regular expressions consists of two classes,
- * <code>RegexPattern</code> and <code>RegexMatcher</code>.
- * <code>RegexPattern</code> objects represent a pre-processed, or compiled
+ * The ICU API for processing regular expressions consists of two classes,
+ * `RegexPattern` and `RegexMatcher`.
+ * `RegexPattern` objects represent a pre-processed, or compiled
* regular expression. They are created from a regular expression pattern string,
- * and can be used to create <code>RegexMatcher</code> objects for the pattern.</p>
+ * and can be used to create `RegexMatcher` objects for the pattern.
*
- * <p>Class <code>RegexMatcher</code> bundles together a regular expression
+ * Class `RegexMatcher` bundles together a regular expression
* pattern and a target string to which the search pattern will be applied.
- * <code>RegexMatcher</code> includes API for doing plain find or search
+ * `RegexMatcher` includes API for doing plain find or search
* operations, for search and replace operations, and for obtaining detailed
- * information about bounds of a match. </p>
+ * information about bounds of a match.
*
- * <p>Note that by constructing <code>RegexMatcher</code> objects directly from regular
+ * Note that by constructing `RegexMatcher` objects directly from regular
* expression pattern strings application code can be simplified and the explicit
- * need for <code>RegexPattern</code> objects can usually be eliminated.
- * </p>
+ * need for `RegexPattern` objects can usually be eliminated.
+ *
*/
#include "unicode/utypes.h"
@@ -74,13 +72,13 @@ class UVector64;
/**
- * Class <code>RegexPattern</code> represents a compiled regular expression. It includes
+ * Class `RegexPattern` represents a compiled regular expression. It includes
* factory methods for creating a RegexPattern object from the source (string) form
* of a regular expression, methods for creating RegexMatchers that allow the pattern
* to be applied to input text, and a few convenience methods for simple common
* uses of regular expressions.
*
- * <p>Class RegexPattern is not intended to be subclassed.</p>
+ * Class RegexPattern is not intended to be subclassed.
*
* @stable ICU 2.4
*/
@@ -90,7 +88,7 @@ public:
/**
* default constructor. Create a RegexPattern object that refers to no actual
* pattern. Not normally needed; RegexPattern objects are usually
- * created using the factory method <code>compile()</code>.
+ * created using the factory method `compile()`.
*
* @stable ICU 2.4
*/
@@ -113,7 +111,7 @@ public:
/**
* Comparison operator. Two RegexPattern objects are considered equal if they
- * were constructed from identical source patterns using the same match flag
+ * were constructed from identical source patterns using the same #URegexpFlag
* settings.
* @param that a RegexPattern object to compare with "this".
* @return TRUE if the objects are equivalent.
@@ -123,7 +121,7 @@ public:
/**
* Comparison operator. Two RegexPattern objects are considered equal if they
- * were constructed from identical source patterns using the same match flag
+ * were constructed from identical source patterns using the same #URegexpFlag
* settings.
* @param that a RegexPattern object to compare with "this".
* @return TRUE if the objects are different.
@@ -153,16 +151,16 @@ public:
* object. These compile methods, rather than the constructors, are the usual
* way that RegexPattern objects are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>All pattern match mode flags are set to their default values.</p>
+ * All #URegexpFlag pattern match mode flags are set to their default values.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string rather than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
* @param pe Receives the position (line and column nubers) of any error
@@ -181,16 +179,16 @@ public:
* object. These compile methods, rather than the constructors, are the usual
* way that RegexPattern objects are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>All pattern match mode flags are set to their default values.</p>
+ * All #URegexpFlag pattern match mode flags are set to their default values.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string rather than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
@@ -208,21 +206,21 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
- * @param flags The match mode flags to be used.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param pe Receives the position (line and column numbers) of any error
* within the regular expression.)
* @param status A reference to a UErrorCode to receive any errors.
@@ -237,23 +235,23 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
- * @param flags The match mode flags to be used.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param pe Receives the position (line and column numbers) of any error
* within the regular expression.)
* @param status A reference to a UErrorCode to receive any errors.
@@ -268,21 +266,21 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled.
- * @param flags The match mode flags to be used.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param status A reference to a UErrorCode to receive any errors.
* @return A regexPattern object for the compiled pattern.
*
@@ -294,23 +292,23 @@ public:
/**
* Compiles the regular expression in string form into a RegexPattern
- * object using the specified match mode flags. These compile methods,
+ * object using the specified #URegexpFlag match mode flags. These compile methods,
* rather than the constructors, are the usual way that RegexPattern objects
* are created.
*
- * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * Note that RegexPattern objects must not be deleted while RegexMatcher
* objects created from the pattern are active. RegexMatchers keep a pointer
* back to their pattern, so premature deletion of the pattern is a
- * catastrophic error.</p>
+ * catastrophic error.
*
- * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * Note that it is often more convenient to construct a RegexMatcher directly
* from a pattern string instead of than separately compiling the pattern and
- * then creating a RegexMatcher object from the pattern.</p>
+ * then creating a RegexMatcher object from the pattern.
*
* @param regex The regular expression to be compiled. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
- * @param flags The match mode flags to be used.
+ * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE.
* @param status A reference to a UErrorCode to receive any errors.
* @return A regexPattern object for the compiled pattern.
*
@@ -321,8 +319,8 @@ public:
UErrorCode &status);
/**
- * Get the match mode flags that were used when compiling this pattern.
- * @return the match mode flags
+ * Get the #URegexpFlag match mode flags that were used when compiling this pattern.
+ * @return the #URegexpFlag match mode flags
* @stable ICU 2.4
*/
virtual uint32_t flags() const;
@@ -332,7 +330,7 @@ public:
* RegexMatcher can then be used to perform match, find or replace operations
* on the input. Note that a RegexPattern object must not be deleted while
* RegexMatchers created from it still exist and might possibly be used again.
- * <p>
+ *
* The matcher will retain a reference to the supplied input string, and all regexp
* pattern matching operations happen directly on this original string. It is
* critical that the string not be altered or deleted before use by the regular
@@ -352,12 +350,12 @@ private:
* Cause a compilation error if an application accidentally attempts to
* create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- * <p>
+ *
* To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*
*/
RegexMatcher *matcher(const char16_t *input,
@@ -521,7 +519,7 @@ public:
/**
- * Split a string into fields. Somewhat like split() from Perl or Java.
+ * Split a string into fields. Somewhat like %split() from Perl or Java.
* Pattern matches identify delimiters that separate the input
* into fields. The input data between the delimiters becomes the
* fields themselves.
@@ -540,7 +538,7 @@ public:
* This behavior differs from Java, which ignores capture groups.
*
* For the best performance on split() operations,
- * <code>RegexMatcher::split</code> is preferable to this function
+ * `RegexMatcher::split()` is preferable to this function
*
* @param input The string to be split into fields. The field delimiters
* match the pattern (in the "this" object)
@@ -673,8 +671,7 @@ public:
* its matcher() method to create the RegexMatcher objects.
*
* @param regexp The Regular Expression to be compiled.
- * @param flags Regular expression options, such as case insensitive matching.
- * @see UREGEX_CASE_INSENSITIVE
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
* @stable ICU 2.6
*/
@@ -689,8 +686,7 @@ public:
* its matcher() method to create the RegexMatcher objects.
*
* @param regexp The regular expression to be compiled.
- * @param flags Regular expression options, such as case insensitive matching.
- * @see UREGEX_CASE_INSENSITIVE
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
*
* @stable ICU 4.6
@@ -704,7 +700,7 @@ public:
* created for the same expression, it will be more efficient to
* separately create and cache a RegexPattern object, and use
* its matcher() method to create the RegexMatcher objects.
- * <p>
+ *
* The matcher will retain a reference to the supplied input string, and all regexp
* pattern matching operations happen directly on the original string. It is
* critical that the string not be altered or deleted before use by the regular
@@ -713,8 +709,7 @@ public:
* @param regexp The Regular Expression to be compiled.
* @param input The string to match. The matcher retains a reference to the
* caller's string; mo copy is made.
- * @param flags Regular expression options, such as case insensitive matching.
- * @see UREGEX_CASE_INSENSITIVE
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
* @stable ICU 2.6
*/
@@ -728,7 +723,7 @@ public:
* created for the same expression, it will be more efficient to
* separately create and cache a RegexPattern object, and use
* its matcher() method to create the RegexMatcher objects.
- * <p>
+ *
* The matcher will make a shallow clone of the supplied input text, and all regexp
* pattern matching operations happen on this clone. While read-only operations on
* the supplied text are permitted, it is critical that the underlying string not be
@@ -736,8 +731,7 @@ public:
*
* @param regexp The Regular Expression to be compiled.
* @param input The string to match. The matcher retains a shallow clone of the text.
- * @param flags Regular expression options, such as case insensitive matching.
- * @see UREGEX_CASE_INSENSITIVE
+ * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE.
* @param status Any errors are reported by setting this UErrorCode variable.
*
* @stable ICU 4.6
@@ -750,13 +744,12 @@ private:
* Cause a compilation error if an application accidentally attempts to
* create a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- * <p>
+ *
* To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
- *
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*/
RegexMatcher(const UnicodeString &regexp, const char16_t *input,
uint32_t flags, UErrorCode &status);
@@ -799,8 +792,8 @@ public:
* always starts at the beginning of the input region;
* unlike that function, it does not require that the entire region be matched.
*
- * <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
- * <code>end()</code>, and <code>group()</code> functions.</p>
+ * If the match succeeds then more information can be obtained via the start(),
+ * end(), and group() functions.
*
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if there is a match at the start of the input string.
@@ -814,8 +807,8 @@ public:
* The match may be of any length, and is not required to extend to the end
* of the input string. Contrast with match().
*
- * <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
- * <code>end()</code>, and <code>group()</code> functions.</p>
+ * If the match succeeds then more information can be obtained via the start(),
+ * end(), and group() functions.
*
* @param startIndex The input string (native) index at which to begin matching.
* @param status A reference to a UErrorCode to receive any errors.
@@ -829,11 +822,11 @@ public:
* Find the next pattern match in the input string.
* The find begins searching the input at the location following the end of
* the previous match, or at the start of the string if there is no previous match.
- * If a match is found, <code>start(), end()</code> and <code>group()</code>
+ * If a match is found, `start()`, `end()` and `group()`
* will provide more information regarding the match.
- * <p>Note that if the input string is changed by the application,
+ * Note that if the input string is changed by the application,
* use find(startPos, status) instead of find(), because the saved starting
- * position may not be valid with the altered input string.</p>
+ * position may not be valid with the altered input string.
* @return TRUE if a match is found.
* @stable ICU 2.4
*/
@@ -844,11 +837,12 @@ public:
* Find the next pattern match in the input string.
* The find begins searching the input at the location following the end of
* the previous match, or at the start of the string if there is no previous match.
- * If a match is found, <code>start(), end()</code> and <code>group()</code>
+ * If a match is found, `start()`, `end()` and `group()`
* will provide more information regarding the match.
- * <p>Note that if the input string is changed by the application,
- * use find(startPos, status) instead of find(), because the saved starting
- * position may not be valid with the altered input string.</p>
+ *
+ * Note that if the input string is changed by the application,
+ * use find(startPos, status) instead of find(), because the saved starting
+ * position may not be valid with the altered input string.
* @param status A reference to a UErrorCode to receive any errors.
* @return TRUE if a match is found.
* @stable ICU 55
@@ -1078,10 +1072,10 @@ public:
* The effect is to remove any memory of previous matches,
* and to cause subsequent find() operations to begin at
* the specified (native) position in the input string.
- * <p>
+ *
* The matcher's region is reset to its default, which is the entire
* input string.
- * <p>
+ *
* An alternative to this function is to set a match region
* beginning at the desired index.
*
@@ -1158,12 +1152,12 @@ private:
* Cause a compilation error if an application accidentally attempts to
* reset a matcher with a (char16_t *) string as input rather than
* a UnicodeString. Avoids a dangling reference to a temporary string.
- * <p>
+ *
* To efficiently work with char16_t *strings, wrap the data in a UnicodeString
* using one of the aliasing constructors, such as
- * <code>UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);</code>
+ * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);`
* or in a UText, using
- * <code>utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);</code>
+ * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);`
*
*/
RegexMatcher &reset(const char16_t *input);
@@ -1412,15 +1406,15 @@ public:
* the pattern with the replacement string. This is a convenience
* function that provides a complete find-and-replace operation.
*
- * <p>This function first resets this RegexMatcher. It then scans the input string
+ * This function first resets this RegexMatcher. It then scans the input string
* looking for a match of the pattern. Input that is not part
* of the match is appended directly to the result string; the match is replaced
* in the result by the replacement string. The replacement string may contain
- * references to captured groups.</p>
+ * references to captured groups.
*
- * <p>The state of the matcher (the position at which a subsequent find()
+ * The state of the matcher (the position at which a subsequent find()
* would begin) after completing a replaceFirst() is not specified. The
- * RegexMatcher should be reset before doing additional find() operations.</p>
+ * RegexMatcher should be reset before doing additional find() operations.
*
* @param replacement a string containing the replacement text.
* @param status a reference to a UErrorCode to receive any errors.
@@ -1435,15 +1429,15 @@ public:
* the pattern with the replacement string. This is a convenience
* function that provides a complete find-and-replace operation.
*
- * <p>This function first resets this RegexMatcher. It then scans the input string
+ * This function first resets this RegexMatcher. It then scans the input string
* looking for a match of the pattern. Input that is not part
* of the match is appended directly to the result string; the match is replaced
* in the result by the replacement string. The replacement string may contain
- * references to captured groups.</p>
+ * references to captured groups.
*
- * <p>The state of the matcher (the position at which a subsequent find()
+ * The state of the matcher (the position at which a subsequent find()
* would begin) after completing a replaceFirst() is not specified. The
- * RegexMatcher should be reset before doing additional find() operations.</p>
+ * RegexMatcher should be reset before doing additional find() operations.
*
* @param replacement a string containing the replacement text.
* @param dest a mutable UText in which the results are placed.
@@ -1461,13 +1455,13 @@ public:
* Implements a replace operation intended to be used as part of an
* incremental find-and-replace.
*
- * <p>The input string, starting from the end of the previous replacement and ending at
+ * The input string, starting from the end of the previous replacement and ending at
* the start of the current match, is appended to the destination string. Then the
* replacement string is appended to the output string,
- * including handling any substitutions of captured text.</p>
+ * including handling any substitutions of captured text.
*
- * <p>For simple, prepackaged, non-incremental find-and-replace
- * operations, see replaceFirst() or replaceAll().</p>
+ * For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().
*
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
* @param replacement A UnicodeString that provides the text to be substituted for
@@ -1492,13 +1486,13 @@ public:
* Implements a replace operation intended to be used as part of an
* incremental find-and-replace.
*
- * <p>The input string, starting from the end of the previous replacement and ending at
+ * The input string, starting from the end of the previous replacement and ending at
* the start of the current match, is appended to the destination string. Then the
* replacement string is appended to the output string,
- * including handling any substitutions of captured text.</p>
+ * including handling any substitutions of captured text.
*
- * <p>For simple, prepackaged, non-incremental find-and-replace
- * operations, see replaceFirst() or replaceAll().</p>
+ * For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().
*
* @param dest A mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
@@ -1522,8 +1516,8 @@ public:
/**
* As the final step in a find-and-replace operation, append the remainder
* of the input string, starting at the position following the last appendReplacement(),
- * to the destination string. <code>appendTail()</code> is intended to be invoked after one
- * or more invocations of the <code>RegexMatcher::appendReplacement()</code>.
+ * to the destination string. `appendTail()` is intended to be invoked after one
+ * or more invocations of the `RegexMatcher::appendReplacement()`.
*
* @param dest A UnicodeString to which the results of the find-and-replace are appended.
* @return the destination string.
@@ -1535,8 +1529,8 @@ public:
/**
* As the final step in a find-and-replace operation, append the remainder
* of the input string, starting at the position following the last appendReplacement(),
- * to the destination string. <code>appendTail()</code> is intended to be invoked after one
- * or more invocations of the <code>RegexMatcher::appendReplacement()</code>.
+ * to the destination string. `appendTail()` is intended to be invoked after one
+ * or more invocations of the `RegexMatcher::appendReplacement()`.
*
* @param dest A mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
@@ -1549,7 +1543,7 @@ public:
/**
- * Split a string into fields. Somewhat like split() from Perl.
+ * Split a string into fields. Somewhat like %split() from Perl.
* The pattern matches identify delimiters that separate the input
* into fields. The input data between the matches becomes the
* fields themselves.
@@ -1578,7 +1572,7 @@ public:
/**
- * Split a string into fields. Somewhat like split() from Perl.
+ * Split a string into fields. Somewhat like %split() from Perl.
* The pattern matches identify delimiters that separate the input
* into fields. The input data between the matches becomes the
* fields themselves.
@@ -1613,14 +1607,14 @@ public:
* infinite loop.
* When a limit is set a match operation will fail with an error if the
* limit is exceeded.
- * <p>
+ *
* The units of the limit are steps of the match engine.
* Correspondence with actual processor time will depend on the speed
* of the processor and the details of the specific pattern, but will
* typically be on the order of milliseconds.
- * <p>
+ *
* By default, the matching time is not limited.
- * <p>
+ *
*
* @param limit The limit value, or 0 for no limit.
* @param status A reference to a UErrorCode to receive any errors.
@@ -1639,16 +1633,16 @@ public:
/**
* Set the amount of heap storage available for use by the match backtracking stack.
* The matcher is also reset, discarding any results from previous matches.
- * <p>
+ *
* ICU uses a backtracking regular expression engine, with the backtrack stack
* maintained on the heap. This function sets the limit to the amount of memory
- * that can be used for this purpose. A backtracking stack overflow will
+ * that can be used for this purpose. A backtracking stack overflow will
* result in an error from the match operation that caused it.
- * <p>
+ *
* A limit is desirable because a malicious or poorly designed pattern can use
* excessive memory, potentially crashing the process. A limit is enabled
* by default.
- * <p>
+ *
* @param limit The maximum size, in bytes, of the matching backtrack stack.
* A value of zero means no limit.
* The limit must be greater or equal to zero.
diff --git a/deps/icu-small/source/i18n/unicode/reldatefmt.h b/deps/icu-small/source/i18n/unicode/reldatefmt.h
index dd8bc53d55..cfcba09026 100644
--- a/deps/icu-small/source/i18n/unicode/reldatefmt.h
+++ b/deps/icu-small/source/i18n/unicode/reldatefmt.h
@@ -19,6 +19,7 @@
#include "unicode/udisplaycontext.h"
#include "unicode/ureldatefmt.h"
#include "unicode/locid.h"
+#include "unicode/formattedvalue.h"
/**
* \file
@@ -245,6 +246,72 @@ class SharedPluralRules;
class SharedBreakIterator;
class NumberFormat;
class UnicodeString;
+class FormattedRelativeDateTimeData;
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * An immutable class containing the result of a relative datetime formatting operation.
+ *
+ * Instances of this class are immutable and thread-safe.
+ *
+ * Not intended for public subclassing.
+ *
+ * @draft ICU 64
+ */
+class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue {
+ public:
+ /**
+ * Default constructor; makes an empty FormattedRelativeDateTime.
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
+
+ /**
+ * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT;
+
+ /**
+ * Destruct an instance of FormattedRelativeDateTime.
+ * @draft ICU 64
+ */
+ virtual ~FormattedRelativeDateTime() U_OVERRIDE;
+
+ /** Copying not supported; use move constructor instead. */
+ FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete;
+
+ /** Copying not supported; use move assignment instead. */
+ FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete;
+
+ /**
+ * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state.
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT;
+
+ /** @copydoc FormattedValue::toString() */
+ UnicodeString toString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::toTempString() */
+ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::appendTo() */
+ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE;
+
+ /** @copydoc FormattedValue::nextPosition() */
+ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE;
+
+ private:
+ FormattedRelativeDateTimeData *fData;
+ UErrorCode fErrorCode;
+ explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results)
+ : fData(results), fErrorCode(U_ZERO_ERROR) {}
+ explicit FormattedRelativeDateTime(UErrorCode errorCode)
+ : fData(nullptr), fErrorCode(errorCode) {}
+ friend class RelativeDateTimeFormatter;
+};
+#endif /* U_HIDE_DRAFT_API */
/**
* Formats simple relative dates. There are two types of relative dates that
@@ -386,6 +453,10 @@ public:
/**
* Formats a relative date with a quantity such as "in 5 days" or
* "3 months ago"
+ *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param quantity The numerical amount e.g 5. This value is formatted
* according to this object's NumberFormat object.
* @param direction NEXT means a future relative date; LAST means a past
@@ -405,8 +476,37 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Formats a relative date with a quantity such as "in 5 days" or
+ * "3 months ago"
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * @param quantity The numerical amount e.g 5. This value is formatted
+ * according to this object's NumberFormat object.
+ * @param direction NEXT means a future relative date; LAST means a past
+ * relative date. If direction is anything else, this method sets
+ * status to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param unit the unit e.g day? month? year?
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Formats a relative date without a quantity.
+ *
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param direction NEXT, LAST, THIS, etc.
* @param unit e.g SATURDAY, DAY, MONTH
* @param appendTo The string to which the formatted result will be
@@ -423,11 +523,36 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Formats a relative date without a quantity.
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * If the string is not available in the requested locale, the return
+ * value will be empty (calling toString will give an empty string).
+ *
+ * @param direction NEXT, LAST, THIS, etc.
+ * @param unit e.g SATURDAY, DAY, MONTH
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a numeric style, e.g. "1 week ago", "in 1 week",
* "5 weeks ago", "in 5 weeks".
*
+ * This method returns a String. To get more information about the
+ * formatting result, use formatNumericToValue().
+ *
* @param offset The signed offset for the specified unit. This
* will be formatted according to this object's
* NumberFormat object.
@@ -446,6 +571,31 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a numeric style, e.g. "1 week ago", "in 1 week",
+ * "5 weeks ago", "in 5 weeks".
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by formatNumeric().
+ *
+ * @param offset The signed offset for the specified unit. This
+ * will be formatted according to this object's
+ * NumberFormat object.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime formatNumericToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
@@ -453,6 +603,9 @@ public:
* style if no appropriate text term is available for the specified
* offset in the object's locale.
*
+ * This method returns a String. To get more information about the
+ * formatting result, use formatToValue().
+ *
* @param offset The signed offset for the specified unit.
* @param unit The unit to use when formatting the relative
* date, e.g. UDAT_REL_UNIT_WEEK,
@@ -469,6 +622,31 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a text style if possible, e.g. "last week", "this week",
+ * "next week", "yesterday", "tomorrow". Falls back to numeric
+ * style if no appropriate text term is available for the specified
+ * offset in the object's locale.
+ *
+ * This method returns a FormattedRelativeDateTime, which exposes more
+ * information than the String returned by format().
+ *
+ * @param offset The signed offset for the specified unit.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param status ICU error code returned here.
+ * @return The formatted relative datetime
+ * @draft ICU 64
+ */
+ FormattedRelativeDateTime formatToValue(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UErrorCode& status) const;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Combines a relative date string and a time string in this object's
* locale. This is done with the same date-time separator used for the
@@ -520,7 +698,45 @@ private:
NumberFormat *nfToAdopt,
BreakIterator *brkIter,
UErrorCode &status);
- void adjustForContext(UnicodeString &) const;
+ UnicodeString& adjustForContext(UnicodeString &) const;
+ UBool checkNoAdjustForContext(UErrorCode& status) const;
+
+ template<typename F, typename... Args>
+ UnicodeString& doFormat(
+ F callback,
+ UnicodeString& appendTo,
+ UErrorCode& status,
+ Args... args) const;
+
+#ifndef U_HIDE_DRAFT_API // for FormattedRelativeDateTime
+ template<typename F, typename... Args>
+ FormattedRelativeDateTime doFormatToValue(
+ F callback,
+ UErrorCode& status,
+ Args... args) const;
+#endif // U_HIDE_DRAFT_API
+
+ void formatImpl(
+ double quantity,
+ UDateDirection direction,
+ UDateRelativeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatAbsoluteImpl(
+ UDateDirection direction,
+ UDateAbsoluteUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatNumericImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
+ void formatRelativeImpl(
+ double offset,
+ URelativeDateTimeUnit unit,
+ FormattedRelativeDateTimeData& output,
+ UErrorCode& status) const;
};
U_NAMESPACE_END
diff --git a/deps/icu-small/source/i18n/unicode/smpdtfmt.h b/deps/icu-small/source/i18n/unicode/smpdtfmt.h
index 929c1b4675..a015c5be5c 100644
--- a/deps/icu-small/source/i18n/unicode/smpdtfmt.h
+++ b/deps/icu-small/source/i18n/unicode/smpdtfmt.h
@@ -49,6 +49,7 @@ class FieldPositionHandler;
class TimeZoneFormat;
class SharedNumberFormat;
class SimpleDateFormatMutableNFs;
+class DateIntervalFormat;
namespace number {
class LocalizedNumberFormatter;
@@ -1217,6 +1218,7 @@ public:
private:
friend class DateFormat;
+ friend class DateIntervalFormat;
void initializeDefaultCentury(void);
@@ -1597,6 +1599,7 @@ private:
UBool fHasMinute;
UBool fHasSecond;
+ UBool fHasHanYearChar; // pattern contains the Han year character \u5E74
/**
* Sets fHasMinutes and fHasSeconds.
diff --git a/deps/icu-small/source/i18n/unicode/timezone.h b/deps/icu-small/source/i18n/unicode/timezone.h
index bbbb6b958e..237ed911d0 100644
--- a/deps/icu-small/source/i18n/unicode/timezone.h
+++ b/deps/icu-small/source/i18n/unicode/timezone.h
@@ -277,17 +277,25 @@ public:
/**
* Creates an instance of TimeZone detected from the current host
- * system configuration. Note that ICU4C does not change the default
- * time zone unless TimeZone::adoptDefault(TimeZone*) or
- * TimeZone::setDefault(const TimeZone&) is explicitly called by a
+ * system configuration. If the host system detection routines fail,
+ * or if they specify a TimeZone or TimeZone offset which is not
+ * recognized, then the special TimeZone "Etc/Unknown" is returned.
+ *
+ * Note that ICU4C does not change the default time zone unless
+ * `TimeZone::adoptDefault(TimeZone*)` or
+ * `TimeZone::setDefault(const TimeZone&)` is explicitly called by a
* user. This method does not update the current ICU's default,
* and may return a different TimeZone from the one returned by
- * TimeZone::createDefault().
+ * `TimeZone::createDefault()`.
*
* <p>This function is not thread safe.</p>
*
* @return A new instance of TimeZone detected from the current host system
* configuration.
+ * @see adoptDefault
+ * @see setDefault
+ * @see createDefault
+ * @see getUnknown
* @stable ICU 55
*/
static TimeZone* U_EXPORT2 detectHostTimeZone();
@@ -295,13 +303,14 @@ public:
/**
* Creates a new copy of the default TimeZone for this host. Unless the default time
* zone has already been set using adoptDefault() or setDefault(), the default is
- * determined by querying the system using methods in TPlatformUtilities. If the
- * system routines fail, or if they specify a TimeZone or TimeZone offset which is not
- * recognized, the TimeZone indicated by the ID kLastResortID is instantiated
- * and made the default.
+ * determined by querying the host system configuration. If the host system detection
+ * routines fail, or if they specify a TimeZone or TimeZone offset which is not
+ * recognized, then the special TimeZone "Etc/Unknown" is instantiated and made the
+ * default.
*
* @return A default TimeZone. Clients are responsible for deleting the time zone
* object returned.
+ * @see getUnknown
* @stable ICU 2.0
*/
static TimeZone* U_EXPORT2 createDefault(void);
@@ -657,13 +666,13 @@ public:
* If the display name is not available for the locale,
* then this method returns a string in the localized GMT offset format
* such as <code>GMT[+-]HH:mm</code>.
- * @param daylight if true, return the daylight savings name.
+ * @param inDaylight if true, return the daylight savings name.
* @param style
* @param result the human-readable name of this time zone in the default locale.
* @return A reference to 'result'.
* @stable ICU 2.0
*/
- UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
+ UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const;
/**
* Returns a name of this time zone suitable for presentation to the user
@@ -671,15 +680,15 @@ public:
* If the display name is not available for the locale,
* then this method returns a string in the localized GMT offset format
* such as <code>GMT[+-]HH:mm</code>.
- * @param daylight if true, return the daylight savings name.
+ * @param inDaylight if true, return the daylight savings name.
* @param style
* @param locale the locale in which to supply the display name.
* @param result the human-readable name of this time zone in the given locale
* or in the default locale if the given locale is not recognized.
- * @return A refence to 'result'.
+ * @return A reference to 'result'.
* @stable ICU 2.0
*/
- UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
+ UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
/**
* Queries if this time zone uses daylight savings time.
@@ -926,7 +935,7 @@ private:
UErrorCode& status);
/**
- * Returns the normalized custome time zone ID for the given offset fields.
+ * Returns the normalized custom time zone ID for the given offset fields.
* @param hour offset hours
* @param min offset minutes
* @param sec offset seconds
diff --git a/deps/icu-small/source/i18n/unicode/ucal.h b/deps/icu-small/source/i18n/unicode/ucal.h
index 889a1ec51d..71120b7aed 100644
--- a/deps/icu-small/source/i18n/unicode/ucal.h
+++ b/deps/icu-small/source/i18n/unicode/ucal.h
@@ -105,7 +105,7 @@
* <p>
* <strong>Note:</strong> for some non-Gregorian calendars, different
* fields may be necessary for complete disambiguation. For example, a full
- * specification of the historial Arabic astronomical calendar requires year,
+ * specification of the historical Arabic astronomical calendar requires year,
* month, day-of-month <em>and</em> day-of-week in some cases.
*
* <p>
@@ -157,6 +157,7 @@
/**
* The time zone ID reserved for unknown time zone.
+ * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown".
* @stable ICU 4.8
*/
#define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
@@ -620,8 +621,13 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
/**
* Return the default time zone. The default is determined initially
- * by querying the host operating system. It may be changed with
- * ucal_setDefaultTimeZone() or with the C++ TimeZone API.
+ * by querying the host operating system. If the host system detection
+ * routines fail, or if they specify a TimeZone or TimeZone offset
+ * which is not recognized, then the special TimeZone "Etc/Unknown"
+ * is returned.
+ *
+ * The default may be changed with `ucal_setDefaultTimeZone()` or with
+ * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`.
*
* @param result A buffer to receive the result, or NULL
*
@@ -632,6 +638,8 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
* @return The result string length, not including the terminating
* null
*
+ * @see #UCAL_UNKNOWN_ZONE_ID
+ *
* @stable ICU 2.6
*/
U_STABLE int32_t U_EXPORT2
diff --git a/deps/icu-small/source/i18n/unicode/udat.h b/deps/icu-small/source/i18n/unicode/udat.h
index 90aff20df2..c67a6d6d4b 100644
--- a/deps/icu-small/source/i18n/unicode/udat.h
+++ b/deps/icu-small/source/i18n/unicode/udat.h
@@ -482,6 +482,27 @@ typedef enum UDateFormatStyle {
#define UDAT_HOUR_TZ "jz"
#endif /* U_HIDE_DEPRECATED_API */
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root/English abbreviated version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_ROOT "Reiwa"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * Japanese abbreviated version (Han, or fullwidth Latin for testing).
+ * @internal
+ */
+#define JP_ERA_2019_JA "\\u4EE4\\u548C"
+/**
+ * Constant for Unicode string name of new (in 2019) Japanese calendar era,
+ * root and Japanese narrow version (ASCII-range characters).
+ * @internal
+ */
+#define JP_ERA_2019_NARROW "R"
+#endif // U_HIDE_INTERNAL_API
+
/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by DateFormat and UDateFormat.
diff --git a/deps/icu-small/source/i18n/unicode/udateintervalformat.h b/deps/icu-small/source/i18n/unicode/udateintervalformat.h
index 70cbadeb57..112f81b31e 100644
--- a/deps/icu-small/source/i18n/unicode/udateintervalformat.h
+++ b/deps/icu-small/source/i18n/unicode/udateintervalformat.h
@@ -16,6 +16,7 @@
#include "unicode/umisc.h"
#include "unicode/localpointer.h"
+#include "unicode/uformattedvalue.h"
/**
* \file
@@ -81,6 +82,15 @@
struct UDateIntervalFormat;
typedef struct UDateIntervalFormat UDateIntervalFormat; /**< C typedef for struct UDateIntervalFormat. @stable ICU 4.8 */
+#ifndef U_HIDE_DRAFT_API
+struct UFormattedDateInterval;
+/**
+ * Opaque struct to contain the results of a UDateIntervalFormat operation.
+ * @draft ICU 64
+ */
+typedef struct UFormattedDateInterval UFormattedDateInterval;
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Open a new UDateIntervalFormat object using the predefined rules for a
* given locale plus a specified skeleton.
@@ -123,6 +133,55 @@ U_STABLE void U_EXPORT2
udtitvfmt_close(UDateIntervalFormat *formatter);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Creates an object to hold the result of a UDateIntervalFormat
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @draft ICU 64
+ */
+U_CAPI UFormattedDateInterval* U_EXPORT2
+udtitvfmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedDateInterval as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedDateInterval and is valid
+ * only as long as the UFormattedDateInterval is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * When calling ufmtval_nextPosition():
+ * The fields are returned from left to right. The special field category
+ * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime
+ * primitives came from which arguments: 0 means fromCalendar, and 1 means
+ * toCalendar. The span category will always occur before the
+ * corresponding fields in UFIELD_CATEGORY_DATE
+ * in the ufmtval_nextPosition() iterator.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @draft ICU 64
+ */
+U_CAPI const UFormattedValue* U_EXPORT2
+udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedDateInterval created by udtitvfmt_openResult().
+ *
+ * @param uresult The object to release.
+ * @draft ICU 64
+ */
+U_CAPI void U_EXPORT2
+udtitvfmt_closeResult(UFormattedDateInterval* uresult);
+#endif /* U_HIDE_DRAFT_API */
+
+
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -138,6 +197,19 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * \class LocalUFormattedDateIntervalPointer
+ * "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @draft ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
+#endif /* U_HIDE_DRAFT_API */
+
U_NAMESPACE_END
#endif
@@ -181,6 +253,34 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
UFieldPosition* position,
UErrorCode* status);
+
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Formats a date/time range using the conventions established for the
+ * UDateIntervalFormat object.
+ * @param formatter
+ * The UDateIntervalFormat object specifying the format conventions.
+ * @param result
+ * The UFormattedDateInterval to contain the result of the
+ * formatting operation.
+ * @param fromDate
+ * The starting point of the range.
+ * @param toDate
+ * The ending point of the range.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+udtitvfmt_formatToResult(
+ const UDateIntervalFormat* formatter,
+ UFormattedDateInterval* result,
+ UDate fromDate,
+ UDate toDate,
+ UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
+
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
diff --git a/deps/icu-small/source/i18n/unicode/udatpg.h b/deps/icu-small/source/i18n/unicode/udatpg.h
index 54f1254346..238a27b4f4 100644
--- a/deps/icu-small/source/i18n/unicode/udatpg.h
+++ b/deps/icu-small/source/i18n/unicode/udatpg.h
@@ -95,20 +95,18 @@ typedef enum UDateTimePatternField {
UDATPG_FIELD_COUNT
} UDateTimePatternField;
-#ifndef U_HIDE_DRAFT_API
/**
* Field display name width constants for udatpg_getFieldDisplayName().
- * @draft ICU 61
+ * @stable ICU 61
*/
typedef enum UDateTimePGDisplayWidth {
- /** @draft ICU 61 */
+ /** @stable ICU 61 */
UDATPG_WIDE,
- /** @draft ICU 61 */
+ /** @stable ICU 61 */
UDATPG_ABBREVIATED,
- /** @draft ICU 61 */
+ /** @stable ICU 61 */
UDATPG_NARROW
} UDateTimePGDisplayWidth;
-#endif // U_HIDE_DRAFT_API
/**
* Masks to control forcing the length of specified fields in the returned
@@ -440,7 +438,6 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
int32_t *pLength);
-#ifndef U_HIDE_DRAFT_API
/**
* The general interface to get a display name for a particular date/time field,
* in one of several possible display widths.
@@ -464,15 +461,14 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
* @return
* The full length of the name; if greater than capacity, fieldName contains a
* truncated result.
- * @draft ICU 61
+ * @stable ICU 61
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
UDateTimePGDisplayWidth width,
UChar *fieldName, int32_t capacity,
UErrorCode *pErrorCode);
-#endif // U_HIDE_DRAFT_API
/**
* The DateTimeFormat is a message format pattern used to compose date and
diff --git a/deps/icu-small/source/i18n/unicode/uformattedvalue.h b/deps/icu-small/source/i18n/unicode/uformattedvalue.h
new file mode 100644
index 0000000000..d1c2ad1e49
--- /dev/null
+++ b/deps/icu-small/source/i18n/unicode/uformattedvalue.h
@@ -0,0 +1,440 @@
+// © 2018 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __UFORMATTEDVALUE_H__
+#define __UFORMATTEDVALUE_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+#ifndef U_HIDE_DRAFT_API
+
+#include "unicode/ufieldpositer.h"
+
+/**
+ * \file
+ * \brief C API: Abstract operations for localized strings.
+ *
+ * This file contains declarations for classes that deal with formatted strings. A number
+ * of APIs throughout ICU use these classes for expressing their localized output.
+ */
+
+
+/**
+ * All possible field categories in ICU. Every entry in this enum corresponds
+ * to another enum that exists in ICU.
+ *
+ * In the APIs that take a UFieldCategory, an int32_t type is used. Field
+ * categories having any of the top four bits turned on are reserved as
+ * private-use for external APIs implementing FormattedValue. This means that
+ * categories 2^28 and higher or below zero (with the highest bit turned on)
+ * are private-use and will not be used by ICU in the future.
+ *
+ * @draft ICU 64
+ */
+typedef enum UFieldCategory {
+ /**
+ * For an undefined field category.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_UNDEFINED = 0,
+
+ /**
+ * For fields in UDateFormatField (udat.h), from ICU 3.0.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_DATE,
+
+ /**
+ * For fields in UNumberFormatFields (unum.h), from ICU 49.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_NUMBER,
+
+ /**
+ * For fields in UListFormatterField (ulistformatter.h), from ICU 63.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_LIST,
+
+ /**
+ * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_RELATIVE_DATETIME,
+
+ /**
+ * Reserved for possible future fields in UDateIntervalFormatField.
+ *
+ * @internal
+ */
+ UFIELD_CATEGORY_DATE_INTERVAL,
+
+#ifndef U_HIDE_INTERNAL_API
+ /** @internal */
+ UFIELD_CATEGORY_COUNT,
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Category for spans in a list.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST,
+
+ /**
+ * Category for spans in a date interval.
+ *
+ * @draft ICU 64
+ */
+ UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL,
+
+} UFieldCategory;
+
+
+struct UConstrainedFieldPosition;
+/**
+ * Represents a span of a string containing a given field.
+ *
+ * This struct differs from UFieldPosition in the following ways:
+ *
+ * 1. It has information on the field category.
+ * 2. It allows you to set constraints to use when iterating over field positions.
+ * 3. It is used for the newer FormattedValue APIs.
+ *
+ * @draft ICU 64
+ */
+typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
+
+
+/**
+ * Creates a new UConstrainedFieldPosition.
+ *
+ * By default, the UConstrainedFieldPosition has no iteration constraints.
+ *
+ * @param ec Set if an error occurs.
+ * @return The new object, or NULL if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT UConstrainedFieldPosition* U_EXPORT2
+ucfpos_open(UErrorCode* ec);
+
+
+/**
+ * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created.
+ *
+ * Removes any constraints that may have been set on the instance.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_reset(
+ UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Destroys a UConstrainedFieldPosition and releases its memory.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_close(UConstrainedFieldPosition* ucfpos);
+
+
+/**
+ * Sets a constraint on the field category.
+ *
+ * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
+ * positions are skipped unless they have the given category.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over only the number-related fields:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the number-related field position
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The field category to fix when iterating.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_constrainCategory(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ UErrorCode* ec);
+
+
+/**
+ * Sets a constraint on the category and field.
+ *
+ * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
+ * positions are skipped unless they have the given category and field.
+ *
+ * Any previously set constraints are cleared.
+ *
+ * For example, to loop over all grouping separators:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the grouping separator position
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * Changing the constraint while in the middle of iterating over a FormattedValue
+ * does not generally have well-defined behavior.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The field category to fix when iterating.
+ * @param field The field to fix when iterating.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_constrainField(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the field category for the current position.
+ *
+ * If a category or field constraint was set, this function returns the constrained
+ * category. Otherwise, the return value is well-defined only after
+ * ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The field category saved in the instance.
+ * @draft ICU 64
+ */
+U_DRAFT int32_t U_EXPORT2
+ucfpos_getCategory(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the field for the current position.
+ *
+ * If a field constraint was set, this function returns the constrained
+ * field. Otherwise, the return value is well-defined only after
+ * ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The field saved in the instance.
+ * @draft ICU 64
+ */
+U_DRAFT int32_t U_EXPORT2
+ucfpos_getField(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position.
+ *
+ * The output values are well-defined only after ufmtval_nextPosition returns TRUE.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param pStart Set to the start index saved in the instance. Ignored if nullptr.
+ * @param pLimit Set to the end index saved in the instance. Ignored if nullptr.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_getIndexes(
+ const UConstrainedFieldPosition* ucfpos,
+ int32_t* pStart,
+ int32_t* pLimit,
+ UErrorCode* ec);
+
+
+/**
+ * Gets an int64 that FormattedValue implementations may use for storage.
+ *
+ * The initial value is zero.
+ *
+ * Users of FormattedValue should not need to call this method.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param ec Set if an error occurs.
+ * @return The current iteration context from ucfpos_setInt64IterationContext.
+ * @draft ICU 64
+ */
+U_DRAFT int64_t U_EXPORT2
+ucfpos_getInt64IterationContext(
+ const UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+/**
+ * Sets an int64 that FormattedValue implementations may use for storage.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param context The new iteration context.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_setInt64IterationContext(
+ UConstrainedFieldPosition* ucfpos,
+ int64_t context,
+ UErrorCode* ec);
+
+
+/**
+ * Determines whether a given field should be included given the
+ * constraints.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The category to test.
+ * @param field The field to test.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT UBool U_EXPORT2
+ucfpos_matchesField(
+ const UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ UErrorCode* ec);
+
+
+/**
+ * Sets new values for the primary public getters.
+ *
+ * Intended to be used by FormattedValue implementations.
+ *
+ * It is up to the implementation to ensure that the user-requested
+ * constraints are satisfied. This method does not check!
+ *
+ * @param ucfpos The instance of UConstrainedFieldPosition.
+ * @param category The new field category.
+ * @param field The new field.
+ * @param start The new inclusive start index.
+ * @param limit The new exclusive end index.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ucfpos_setState(
+ UConstrainedFieldPosition* ucfpos,
+ int32_t category,
+ int32_t field,
+ int32_t start,
+ int32_t limit,
+ UErrorCode* ec);
+
+
+struct UFormattedValue;
+/**
+ * An abstract formatted value: a string with associated field attributes.
+ * Many formatters format to types compatible with UFormattedValue.
+ *
+ * @draft ICU 64
+ */
+typedef struct UFormattedValue UFormattedValue;
+
+
+/**
+ * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The
+ * return value is valid only as long as the UFormattedValue is present and unchanged in memory.
+ *
+ * The return value is NUL-terminated but could contain internal NULs.
+ *
+ * @param ufmtval
+ * The object containing the formatted string and attributes.
+ * @param pLength Output variable for the length of the string. Ignored if NULL.
+ * @param ec Set if an error occurs.
+ * @return A NUL-terminated char16 string owned by the UFormattedValue.
+ * @draft ICU 64
+ */
+U_DRAFT const UChar* U_EXPORT2
+ufmtval_getString(
+ const UFormattedValue* ufmtval,
+ int32_t* pLength,
+ UErrorCode* ec);
+
+
+/**
+ * Iterates over field positions in the UFormattedValue. This lets you determine the position
+ * of specific types of substrings, like a month or a decimal separator.
+ *
+ * To loop over all field positions:
+ *
+ * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
+ * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
+ * // handle the field position; get information from ucfpos
+ * }
+ * ucfpos_close(ucfpos);
+ *
+ * @param ufmtval
+ * The object containing the formatted string and attributes.
+ * @param ucfpos
+ * The object used for iteration state; can provide constraints to iterate over only
+ * one specific category or field;
+ * see ucfpos_constrainCategory
+ * and ucfpos_constrainField.
+ * @param ec Set if an error occurs.
+ * @return TRUE if another position was found; FALSE otherwise.
+ * @draft ICU 64
+ */
+U_DRAFT UBool U_EXPORT2
+ufmtval_nextPosition(
+ const UFormattedValue* ufmtval,
+ UConstrainedFieldPosition* ucfpos,
+ UErrorCode* ec);
+
+
+#if U_SHOW_CPLUSPLUS_API
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUConstrainedFieldPositionPointer
+ * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * Usage:
+ *
+ * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec));
+ * // no need to explicitly call ucfpos_close()
+ *
+ * @draft ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer,
+ UConstrainedFieldPosition,
+ ucfpos_close);
+
+U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
+
+
+#endif /* U_HIDE_DRAFT_API */
+#endif /* #if !UCONFIG_NO_FORMATTING */
+#endif // __UFORMATTEDVALUE_H__
diff --git a/deps/icu-small/source/i18n/unicode/ulistformatter.h b/deps/icu-small/source/i18n/unicode/ulistformatter.h
index 242d7d2164..4327fd5ec1 100644
--- a/deps/icu-small/source/i18n/unicode/ulistformatter.h
+++ b/deps/icu-small/source/i18n/unicode/ulistformatter.h
@@ -15,6 +15,7 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/localpointer.h"
+#include "unicode/uformattedvalue.h"
/**
* \file
@@ -34,6 +35,15 @@ struct UListFormatter;
typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */
#ifndef U_HIDE_DRAFT_API
+struct UFormattedList;
+/**
+ * Opaque struct to contain the results of a UListFormatter operation.
+ * @draft ICU 64
+ */
+typedef struct UFormattedList UFormattedList;
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_DRAFT_API
/**
* FieldPosition and UFieldPosition selectors for format fields
* defined by ListFormatter.
@@ -82,6 +92,53 @@ ulistfmt_open(const char* locale,
U_CAPI void U_EXPORT2
ulistfmt_close(UListFormatter *listfmt);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Creates an object to hold the result of a UListFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @draft ICU 64
+ */
+U_CAPI UFormattedList* U_EXPORT2
+ulistfmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedList as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedList and is valid
+ * only as long as the UFormattedList is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * When calling ufmtval_nextPosition():
+ * The fields are returned from start to end. The special field category
+ * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument
+ * was inserted at the given position. The span category will
+ * always occur before the corresponding instance of UFIELD_CATEGORY_LIST
+ * in the ufmtval_nextPosition() iterator.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @draft ICU 64
+ */
+U_CAPI const UFormattedValue* U_EXPORT2
+ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedList created by ulistfmt_openResult().
+ *
+ * @param uresult The object to release.
+ * @draft ICU 64
+ */
+U_CAPI void U_EXPORT2
+ulistfmt_closeResult(UFormattedList* uresult);
+#endif /* U_HIDE_DRAFT_API */
+
#if U_SHOW_CPLUSPLUS_API
@@ -98,6 +155,19 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * \class LocalUFormattedListPointer
+ * "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @draft ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult);
+#endif /* U_HIDE_DRAFT_API */
+
U_NAMESPACE_END
#endif
@@ -145,6 +215,43 @@ ulistfmt_format(const UListFormatter* listfmt,
int32_t resultCapacity,
UErrorCode* status);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Formats a list of strings to a UFormattedList, which exposes more
+ * information than the string exported by ulistfmt_format().
+ *
+ * @param listfmt
+ * The UListFormatter object specifying the list conventions.
+ * @param strings
+ * An array of pointers to UChar strings; the array length is
+ * specified by stringCount. Must be non-NULL if stringCount > 0.
+ * @param stringLengths
+ * An array of string lengths corresponding to the strings[]
+ * parameter; any individual length value may be negative to indicate
+ * that the corresponding strings[] entry is 0-terminated, or
+ * stringLengths itself may be NULL if all of the strings are
+ * 0-terminated. If non-NULL, the stringLengths array must have
+ * stringCount entries.
+ * @param stringCount
+ * the number of entries in strings[], and the number of entries
+ * in the stringLengths array if it is not NULL. Must be >= 0.
+ * @param uresult
+ * The object in which to store the result of the list formatting
+ * operation. See ulistfmt_openResult().
+ * @param status
+ * Error code set if an error occurred during formatting.
+ * @draft ICU 64
+ */
+U_CAPI void U_EXPORT2
+ulistfmt_formatStringsToResult(
+ const UListFormatter* listfmt,
+ const UChar* const strings[],
+ const int32_t * stringLengths,
+ int32_t stringCount,
+ UFormattedList* uresult,
+ UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
diff --git a/deps/icu-small/source/i18n/unicode/unum.h b/deps/icu-small/source/i18n/unicode/unum.h
index 8b76014b16..c03131f372 100644
--- a/deps/icu-small/source/i18n/unicode/unum.h
+++ b/deps/icu-small/source/i18n/unicode/unum.h
@@ -375,12 +375,19 @@ typedef enum UNumberFormatFields {
UNUM_PERMILL_FIELD,
/** @stable ICU 49 */
UNUM_SIGN_FIELD,
+#ifndef U_HIDE_DRAFT_API
+ /** @draft ICU 64 */
+ UNUM_MEASURE_UNIT_FIELD,
+ /** @draft ICU 64 */
+ UNUM_COMPACT_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_FIELD_COUNT = UNUM_SIGN_FIELD + 3
#endif /* U_HIDE_DEPRECATED_API */
} UNumberFormatFields;
@@ -1022,16 +1029,18 @@ typedef enum UNumberFormatAttribute {
*
* @stable ICU 51 */
UNUM_SCALE = 21,
-#ifndef U_HIDE_INTERNAL_API
+
+#ifndef U_HIDE_DRAFT_API
/**
- * Minimum grouping digits, technology preview.
+ * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
* See DecimalFormat::getMinimumGroupingDigits().
*
- * @internal technology preview
+ * For better control over grouping strategies, use UNumberFormatter.
+ *
+ * @draft ICU 64
*/
UNUM_MINIMUM_GROUPING_DIGITS = 22,
- /* TODO: test C API when it becomes @draft */
-#endif /* U_HIDE_INTERNAL_API */
+#endif /* U_HIDE_DRAFT_API */
/**
* if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose,
@@ -1041,11 +1050,12 @@ typedef enum UNumberFormatAttribute {
*/
UNUM_CURRENCY_USAGE = 23,
- /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
+#ifndef U_HIDE_INTERNAL_API
/** One below the first bitfield-boolean item.
* All items after this one are stored in boolean form.
* @internal */
UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
+#endif /* U_HIDE_INTERNAL_API */
/** If 1, specifies that if setting the "max integer digits" attribute would truncate a value, set an error status rather than silently truncating.
* For example, formatting the value 1234 with 4 max int digits would succeed, but formatting 12345 would fail. There is no effect on parsing.
@@ -1071,24 +1081,33 @@ typedef enum UNumberFormatAttribute {
*/
UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
- /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */
- /** Limit of boolean attributes.
- * @internal */
- UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003,
+#ifndef U_HIDE_DRAFT_API
/**
- * Whether parsing is sensitive to case (lowercase/uppercase).
- * TODO: Add to the test suite.
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
+ *
+ * @draft ICU 64
*/
- UNUM_PARSE_CASE_SENSITIVE = 0x1004,
+ UNUM_PARSE_CASE_SENSITIVE = 0x1003,
/**
- * Formatting: whether to show the plus sign on non-negative numbers.
- * TODO: Add to the test suite.
- * @internal This API is a technical preview. It may change in an upcoming release.
+ * Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
+ *
+ * For better control over sign display, use UNumberFormatter.
+ *
+ * @draft ICU 64
*/
- UNUM_SIGN_ALWAYS_SHOWN = 0x1005,
+ UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
+
+#endif /* U_HIDE_DRAFT_API */
+
+#ifndef U_HIDE_INTERNAL_API
+ /** Limit of boolean attributes. (value should
+ * not depend on U_HIDE conditionals)
+ * @internal */
+ UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
+#endif /* U_HIDE_INTERNAL_API */
+
} UNumberFormatAttribute;
/**
diff --git a/deps/icu-small/source/i18n/unicode/unumberformatter.h b/deps/icu-small/source/i18n/unicode/unumberformatter.h
index d05b15cdec..e4c21a4e4a 100644
--- a/deps/icu-small/source/i18n/unicode/unumberformatter.h
+++ b/deps/icu-small/source/i18n/unicode/unumberformatter.h
@@ -7,8 +7,10 @@
#ifndef __UNUMBERFORMATTER_H__
#define __UNUMBERFORMATTER_H__
+#include "unicode/parseerr.h"
#include "unicode/ufieldpositer.h"
#include "unicode/umisc.h"
+#include "unicode/uformattedvalue.h"
/**
@@ -267,13 +269,6 @@ typedef enum UNumberGroupingStrategy {
} UNumberGroupingStrategy;
-#ifndef U_HIDE_DEPRECATED_API
-/**
- * Old name for compatibility: will be removed in ICU 64.
- * @deprecated ICU 63
- */
-typedef UNumberGroupingStrategy UGroupingStrategy;
-#endif /* U_HIDE_DEPRECATED_API */
#endif /* U_HIDE_DRAFT_API */
@@ -382,6 +377,8 @@ typedef enum UNumberSignDisplay {
* <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1"
* <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1"
* </ul>
+ *
+ * @draft ICU 60
*/
typedef enum UNumberDecimalSeparatorDisplay {
/**
@@ -408,15 +405,13 @@ typedef enum UNumberDecimalSeparatorDisplay {
} UNumberDecimalSeparatorDisplay;
#endif /* U_HIDE_DRAFT_API */
-#ifndef U_HIDE_DRAFT_API
-
struct UNumberFormatter;
/**
* C-compatible version of icu::number::LocalizedNumberFormatter.
*
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
*
- * @draft ICU 62
+ * @stable ICU 62
*/
typedef struct UNumberFormatter UNumberFormatter;
@@ -426,7 +421,7 @@ struct UFormattedNumber;
*
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
*
- * @draft ICU 62
+ * @stable ICU 62
*/
typedef struct UFormattedNumber UFormattedNumber;
@@ -446,24 +441,41 @@ typedef struct UFormattedNumber UFormattedNumber;
* @param skeletonLen The number of UChars in the skeleton string, or -1 it it is NUL-terminated.
* @param locale The NUL-terminated locale ID.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT UNumberFormatter* U_EXPORT2
+U_STABLE UNumberFormatter* U_EXPORT2
unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
UErrorCode* ec);
+#ifndef U_HIDE_DRAFT_API
/**
- * Creates a new UFormattedNumber for holding the result of a number formatting operation.
+ * Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the
+ * location of a skeleton syntax error if such a syntax error exists.
*
- * Objects of type UFormattedNumber are not guaranteed to be threadsafe.
- *
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
+ * @param skeleton The skeleton string, like u"percent precision-integer"
+ * @param skeletonLen The number of UChars in the skeleton string, or -1 it it is NUL-terminated.
+ * @param locale The NUL-terminated locale ID.
+ * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL.
+ * If no error occurs, perror->offset will be set to -1.
+ * @param ec Set if an error occurs.
+ * @draft ICU 64
+ */
+U_DRAFT UNumberFormatter* U_EXPORT2
+unumf_openForSkeletonAndLocaleWithError(
+ const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec);
+#endif // U_HIDE_DRAFT_API
+
+
+/**
+ * Creates an object to hold the result of a UNumberFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
*
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT UFormattedNumber* U_EXPORT2
+U_STABLE UFormattedNumber* U_EXPORT2
unumf_openResult(UErrorCode* ec);
@@ -480,9 +492,9 @@ unumf_openResult(UErrorCode* ec);
* @param value The number to be formatted.
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
UErrorCode* ec);
@@ -500,9 +512,9 @@ unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNum
* @param value The number to be formatted.
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
UErrorCode* ec);
@@ -524,18 +536,42 @@ unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedN
* @param valueLen The length of the numeric string, or -1 if it is NUL-terminated.
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
UFormattedNumber* uresult, UErrorCode* ec);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Returns a representation of a UFormattedNumber as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedNumber and is valid
+ * only as long as the UFormattedNumber is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * @param uresult The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @draft ICU 64
+ */
+U_DRAFT const UFormattedValue* U_EXPORT2
+unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec);
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible.
* If bufferCapacity is greater than the required length, a terminating NUL is written.
* If bufferCapacity is less than the required length, an error code is set.
*
+ * Also see ufmtval_getString, which returns a NUL-terminated string:
+ *
+ * int32_t len;
+ * const UChar* str = ufmtval_getString(unumf_resultAsValue(uresult, &ec), &len, &ec);
+ *
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
*
* @param uresult The object containing the formatted number.
@@ -543,9 +579,9 @@ unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32
* @param bufferCapacity The number of UChars available in the buffer.
* @param ec Set if an error occurs.
* @return The required length.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
UErrorCode* ec);
@@ -555,6 +591,8 @@ unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t buf
* output string. This allows you to determine the locations of, for example, the integer part,
* fraction part, or symbols.
*
+ * This is a simpler but less powerful alternative to {@link ufmtval_nextPosition}.
+ *
* If a field occurs just once, calling this method will find that occurrence and return it. If a
* field occurs multiple times, this method may be called repeatedly with the following pattern:
*
@@ -579,9 +617,9 @@ unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t buf
* (exclusive index). If a field position is not found, the FieldPosition is not changed and
* the method returns FALSE.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT UBool U_EXPORT2
+U_STABLE UBool U_EXPORT2
unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec);
@@ -589,7 +627,10 @@ unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* u
* Populates the given iterator with all fields in the formatted output string. This allows you to
* determine the locations of the integer part, fraction part, and sign.
*
- * If you need information on only one field, use unumf_resultNextFieldPosition().
+ * This is an alternative to the more powerful {@link ufmtval_nextPosition} API.
+ *
+ * If you need information on only one field, use {@link ufmtval_nextPosition} or
+ * {@link unumf_resultNextFieldPosition}.
*
* @param uresult The object containing the formatted number.
* @param ufpositer
@@ -601,9 +642,9 @@ unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* u
* overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a
* grouping separator field for ',' and an integer field encompassing the entire string.
* @param ec Set if an error occurs.
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer,
UErrorCode* ec);
@@ -611,24 +652,20 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition
/**
* Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
*
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
* @param uformatter An object created by unumf_openForSkeletonAndLocale().
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_close(UNumberFormatter* uformatter);
/**
* Releases the UFormattedNumber created by unumf_openResult().
*
- * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
- *
* @param uresult An object created by unumf_openResult().
- * @draft ICU 62
+ * @stable ICU 62
*/
-U_DRAFT void U_EXPORT2
+U_STABLE void U_EXPORT2
unumf_closeResult(UFormattedNumber* uresult);
@@ -648,12 +685,12 @@ U_NAMESPACE_BEGIN
*
* @see LocalPointerBase
* @see LocalPointer
- * @draft ICU 62
+ * @stable ICU 62
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close);
/**
- * \class LocalUNumberFormatterPointer
+ * \class LocalUFormattedNumberPointer
* "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult().
* For most methods see the LocalPointerBase base class.
*
@@ -665,14 +702,12 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unum
*
* @see LocalPointerBase
* @see LocalPointer
- * @draft ICU 62
+ * @stable ICU 62
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult);
U_NAMESPACE_END
#endif // U_SHOW_CPLUSPLUS_API
-#endif /* U_HIDE_DRAFT_API */
-
#endif //__UNUMBERFORMATTER_H__
#endif /* #if !UCONFIG_NO_FORMATTING */
diff --git a/deps/icu-small/source/i18n/unicode/unumsys.h b/deps/icu-small/source/i18n/unicode/unumsys.h
index 2c794c23d3..84ceddf84f 100644
--- a/deps/icu-small/source/i18n/unicode/unumsys.h
+++ b/deps/icu-small/source/i18n/unicode/unumsys.h
@@ -105,6 +105,7 @@ U_NAMESPACE_END
/**
* Returns an enumeration over the names of all of the predefined numbering systems known
* to ICU.
+ * The numbering system names will be in alphabetical (invariant) order.
* @param status A pointer to a UErrorCode to receive any errors.
* @return A pointer to a UEnumeration that must be closed with uenum_close(),
* or NULL if an error occurred.
diff --git a/deps/icu-small/source/i18n/unicode/upluralrules.h b/deps/icu-small/source/i18n/unicode/upluralrules.h
index 690846bc89..fc1b2fb571 100644
--- a/deps/icu-small/source/i18n/unicode/upluralrules.h
+++ b/deps/icu-small/source/i18n/unicode/upluralrules.h
@@ -20,6 +20,9 @@
#include "unicode/unum.h"
#endif /* U_HIDE_INTERNAL_API */
+// Forward-declaration
+struct UFormattedNumber;
+
/**
* \file
* \brief C API: Plural rules, select plural keywords for numeric values.
@@ -132,14 +135,15 @@ U_NAMESPACE_END
/**
- * Given a number, returns the keyword of the first rule that
+ * Given a floating-point number, returns the keyword of the first rule that
* applies to the number, according to the supplied UPluralRules object.
* @param uplrules The UPluralRules object specifying the rules.
* @param number The number for which the rule has to be determined.
- * @param keyword The keyword of the rule that applies to number.
- * @param capacity The capacity of keyword.
+ * @param keyword An output buffer to write the keyword of the rule that
+ * applies to number.
+ * @param capacity The capacity of the keyword buffer.
* @param status A pointer to a UErrorCode to receive any errors.
- * @return The length of keyword.
+ * @return The length of the keyword.
* @stable ICU 4.8
*/
U_CAPI int32_t U_EXPORT2
@@ -148,6 +152,31 @@ uplrules_select(const UPluralRules *uplrules,
UChar *keyword, int32_t capacity,
UErrorCode *status);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Given a formatted number, returns the keyword of the first rule
+ * that applies to the number, according to the supplied UPluralRules object.
+ *
+ * A UFormattedNumber allows you to specify an exponent or trailing zeros,
+ * which can affect the plural category. To get a UFormattedNumber, see
+ * {@link UNumberFormatter}.
+ *
+ * @param uplrules The UPluralRules object specifying the rules.
+ * @param number The formatted number for which the rule has to be determined.
+ * @param keyword The destination buffer for the keyword of the rule that
+ * applies to number.
+ * @param capacity The capacity of the keyword buffer.
+ * @param status A pointer to a UErrorCode to receive any errors.
+ * @return The length of the keyword.
+ * @draft ICU 64
+ */
+U_CAPI int32_t U_EXPORT2
+uplrules_selectFormatted(const UPluralRules *uplrules,
+ const struct UFormattedNumber* number,
+ UChar *keyword, int32_t capacity,
+ UErrorCode *status);
+#endif /* U_HIDE_DRAFT_API */
+
#ifndef U_HIDE_INTERNAL_API
/**
* Given a number, returns the keyword of the first rule that applies to the
@@ -160,7 +189,8 @@ uplrules_select(const UPluralRules *uplrules,
* @param fmt The UNumberFormat specifying how the number will be formatted
* (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars").
* If this is NULL, the function behaves like uplrules_select.
- * @param keyword The keyword of the rule that applies to number.
+ * @param keyword An output buffer to write the keyword of the rule that
+ * applies to number.
* @param capacity The capacity of the keyword buffer.
* @param status A pointer to a UErrorCode to receive any errors.
* @return The length of keyword.
diff --git a/deps/icu-small/source/i18n/unicode/uregex.h b/deps/icu-small/source/i18n/unicode/uregex.h
index 69c0eead95..cb5e51ef01 100644
--- a/deps/icu-small/source/i18n/unicode/uregex.h
+++ b/deps/icu-small/source/i18n/unicode/uregex.h
@@ -167,6 +167,7 @@ uregex_openUText(UText *pattern,
UParseError *pe,
UErrorCode *status);
+#if !UCONFIG_NO_CONVERSION
/**
* Open (compile) an ICU regular expression. The resulting regular expression
* handle can then be used to perform various matching operations.
@@ -190,7 +191,6 @@ uregex_openUText(UText *pattern,
*
* @stable ICU 3.0
*/
-#if !UCONFIG_NO_CONVERSION
U_STABLE URegularExpression * U_EXPORT2
uregex_openC( const char *pattern,
uint32_t flags,
diff --git a/deps/icu-small/source/i18n/unicode/ureldatefmt.h b/deps/icu-small/source/i18n/unicode/ureldatefmt.h
index 0eff80a16b..1aa554dc7c 100644
--- a/deps/icu-small/source/i18n/unicode/ureldatefmt.h
+++ b/deps/icu-small/source/i18n/unicode/ureldatefmt.h
@@ -17,6 +17,7 @@
#include "unicode/unum.h"
#include "unicode/udisplaycontext.h"
#include "unicode/localpointer.h"
+#include "unicode/uformattedvalue.h"
/**
* \file
@@ -174,6 +175,27 @@ typedef enum URelativeDateTimeUnit {
#endif /* U_HIDE_DEPRECATED_API */
} URelativeDateTimeUnit;
+#ifndef U_HIDE_DRAFT_API
+/**
+ * FieldPosition and UFieldPosition selectors for format fields
+ * defined by RelativeDateTimeFormatter.
+ * @draft ICU 64
+ */
+typedef enum URelativeDateTimeFormatterField {
+ /**
+ * Represents a literal text string, like "tomorrow" or "days ago".
+ * @draft ICU 64
+ */
+ UDAT_REL_LITERAL_FIELD,
+ /**
+ * Represents a number quantity, like "3" in "3 days ago".
+ * @draft ICU 64
+ */
+ UDAT_REL_NUMERIC_FIELD,
+} URelativeDateTimeFormatterField;
+#endif // U_HIDE_DRAFT_API
+
+
/**
* Opaque URelativeDateTimeFormatter object for use in C programs.
* @stable ICU 57
@@ -230,6 +252,54 @@ ureldatefmt_open( const char* locale,
U_STABLE void U_EXPORT2
ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
+#ifndef U_HIDE_DRAFT_API
+struct UFormattedRelativeDateTime;
+/**
+ * Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
+ * @draft ICU 64
+ */
+typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime;
+
+/**
+ * Creates an object to hold the result of a URelativeDateTimeFormatter
+ * operation. The object can be used repeatedly; it is cleared whenever
+ * passed to a format function.
+ *
+ * @param ec Set if an error occurs.
+ * @return A pointer needing ownership.
+ * @draft ICU 64
+ */
+U_DRAFT UFormattedRelativeDateTime* U_EXPORT2
+ureldatefmt_openResult(UErrorCode* ec);
+
+/**
+ * Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue,
+ * which can be subsequently passed to any API requiring that type.
+ *
+ * The returned object is owned by the UFormattedRelativeDateTime and is valid
+ * only as long as the UFormattedRelativeDateTime is present and unchanged in memory.
+ *
+ * You can think of this method as a cast between types.
+ *
+ * @param ufrdt The object containing the formatted string.
+ * @param ec Set if an error occurs.
+ * @return A UFormattedValue owned by the input object.
+ * @draft ICU 64
+ */
+U_DRAFT const UFormattedValue* U_EXPORT2
+ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec);
+
+/**
+ * Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
+ *
+ * @param ufrdt The object to release.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt);
+#endif /* U_HIDE_DRAFT_API */
+
+
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -245,6 +315,19 @@ U_NAMESPACE_BEGIN
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * \class LocalUFormattedRelativeDateTimePointer
+ * "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @draft ICU 64
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult);
+#endif /* U_HIDE_DRAFT_API */
+
U_NAMESPACE_END
#endif
@@ -285,6 +368,39 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Format a combination of URelativeDateTimeUnit and numeric
+ * offset using a numeric style, e.g. "1 week ago", "in 1 week",
+ * "5 weeks ago", "in 5 weeks".
+ *
+ * @param reldatefmt
+ * The URelativeDateTimeFormatter object specifying the
+ * format conventions.
+ * @param offset
+ * The signed offset for the specified unit. This will
+ * be formatted according to this object's UNumberFormat
+ * object.
+ * @param unit
+ * The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
+ * @param result
+ * A pointer to a UFormattedRelativeDateTime to populate.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors. In
+ * case of error status, the contents of result are
+ * undefined.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ureldatefmt_formatNumericToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a text style if possible, e.g. "last week", "this week",
@@ -321,6 +437,42 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status);
+#ifndef U_HIDE_DRAFT_API
+/**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a text style if possible, e.g. "last week", "this week",
+ * "next week", "yesterday", "tomorrow". Falls back to numeric
+ * style if no appropriate text term is available for the specified
+ * offset in the object's locale.
+ *
+ * This method populates a UFormattedRelativeDateTime, which exposes more
+ * information than the string populated by format().
+ *
+ * @param reldatefmt
+ * The URelativeDateTimeFormatter object specifying the
+ * format conventions.
+ * @param offset
+ * The signed offset for the specified unit.
+ * @param unit
+ * The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY.
+ * @param result
+ * A pointer to a UFormattedRelativeDateTime to populate.
+ * @param status
+ * A pointer to a UErrorCode to receive any errors. In
+ * case of error status, the contents of result are
+ * undefined.
+ * @draft ICU 64
+ */
+U_DRAFT void U_EXPORT2
+ureldatefmt_formatToResult(
+ const URelativeDateTimeFormatter* reldatefmt,
+ double offset,
+ URelativeDateTimeUnit unit,
+ UFormattedRelativeDateTime* result,
+ UErrorCode* status);
+#endif /* U_HIDE_DRAFT_API */
+
/**
* Combines a relative date string and a time string in this object's
* locale. This is done with the same date-time separator used for the