Index: source/i18n/unicode/unum.h |
diff --git a/source/i18n/unicode/unum.h b/source/i18n/unicode/unum.h |
index c382cc86f9e199cbc4a91b206f902f079966ddb4..015fd635fcd0857a1ac43d0ca197293f248920e7 100644 |
--- a/source/i18n/unicode/unum.h |
+++ b/source/i18n/unicode/unum.h |
@@ -1,6 +1,6 @@ |
/* |
******************************************************************************* |
-* Copyright (C) 1997-2014, International Business Machines Corporation and others. |
+* Copyright (C) 1997-2015, International Business Machines Corporation and others. |
* All Rights Reserved. |
* Modification History: |
* |
@@ -148,7 +148,11 @@ typedef enum UNumberFormatStyle { |
*/ |
UNUM_DECIMAL=1, |
/** |
- * Currency format with a currency symbol, e.g., "$1.00". |
+ * Currency format (generic). |
+ * Defaults to UNUM_CURRENCY_STANDARD style |
+ * (using currency symbol, e.g., "$1.00", with non-accounting |
+ * style for negative values e.g. using minus sign). |
+ * The specific style may be specified using the -cf- locale key. |
* @stable ICU 2.0 |
*/ |
UNUM_CURRENCY=2, |
@@ -202,26 +206,48 @@ typedef enum UNumberFormatStyle { |
* @stable ICU 4.8 |
*/ |
UNUM_CURRENCY_PLURAL=11, |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Currency format for accounting, e.g., "($3.00)" for |
* negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}). |
- * @draft ICU 53 |
+ * Overrides any style specified using -cf- key in locale. |
+ * @stable ICU 53 |
*/ |
UNUM_CURRENCY_ACCOUNTING=12, |
/** |
* Currency format with a currency symbol given CASH usage, e.g., |
* "NT$3" instead of "NT$3.23". |
- * @draft ICU 54 |
+ * @stable ICU 54 |
*/ |
UNUM_CASH_CURRENCY=13, |
+#ifndef U_HIDE_DRAFT_API |
+ /** |
+ * Decimal format expressed using compact notation |
+ * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT) |
+ * e.g. "23K", "45B" |
+ * @draft ICU 56 |
+ */ |
+ UNUM_DECIMAL_COMPACT_SHORT=14, |
+ /** |
+ * Decimal format expressed using compact notation |
+ * (long form, corresponds to UNumberCompactStyle=UNUM_LONG) |
+ * e.g. "23 thousand", "45 billion" |
+ * @draft ICU 56 |
+ */ |
+ UNUM_DECIMAL_COMPACT_LONG=15, |
+ /** |
+ * Currency format with a currency symbol, e.g., "$1.00", |
+ * using non-accounting style for negative values (e.g. minus sign). |
+ * Overrides any style specified using -cf- key in locale. |
+ * @draft ICU 56 |
+ */ |
+ UNUM_CURRENCY_STANDARD=16, |
#endif /* U_HIDE_DRAFT_API */ |
/** |
* One more than the highest number format style constant. |
* @stable ICU 4.8 |
*/ |
- UNUM_FORMAT_STYLE_COUNT=14, |
+ UNUM_FORMAT_STYLE_COUNT=17, |
/** |
* Default format |
@@ -615,6 +641,8 @@ unum_formatUFormattable(const UNumberFormat* fmt, |
/** |
* Parse a string into an integer using a UNumberFormat. |
* The string will be parsed according to the UNumberFormat's locale. |
+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
+* and UNUM_DECIMAL_COMPACT_LONG. |
* @param fmt The formatter to use. |
* @param text The text to parse. |
* @param textLength The length of text, or -1 if null-terminated. |
@@ -639,6 +667,8 @@ unum_parse( const UNumberFormat* fmt, |
/** |
* Parse a string into an int64 using a UNumberFormat. |
* The string will be parsed according to the UNumberFormat's locale. |
+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
+* and UNUM_DECIMAL_COMPACT_LONG. |
* @param fmt The formatter to use. |
* @param text The text to parse. |
* @param textLength The length of text, or -1 if null-terminated. |
@@ -663,6 +693,8 @@ unum_parseInt64(const UNumberFormat* fmt, |
/** |
* Parse a string into a double using a UNumberFormat. |
* The string will be parsed according to the UNumberFormat's locale. |
+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
+* and UNUM_DECIMAL_COMPACT_LONG. |
* @param fmt The formatter to use. |
* @param text The text to parse. |
* @param textLength The length of text, or -1 if null-terminated. |
@@ -691,6 +723,8 @@ unum_parseDouble( const UNumberFormat* fmt, |
* The syntax of the output is a "numeric string" |
* as defined in the Decimal Arithmetic Specification, available at |
* http://speleotrove.com/decimal |
+* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
+* and UNUM_DECIMAL_COMPACT_LONG. |
* @param fmt The formatter to use. |
* @param text The text to parse. |
* @param textLength The length of text, or -1 if null-terminated. |
@@ -750,6 +784,8 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt, |
* Parse a UChar string into a UFormattable. |
* Example code: |
* \snippet test/cintltst/cnumtst.c unum_parseToUFormattable |
+ * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT |
+ * and UNUM_DECIMAL_COMPACT_LONG. |
* @param fmt the formatter to use |
* @param result the UFormattable to hold the result. If NULL, a new UFormattable will be allocated (which the caller must close with ufmt_close). |
* @param text the text to parse |
@@ -835,6 +871,9 @@ typedef enum UNumberFormatAttributeValue { |
UNUM_YES = 1, |
/** @internal */ |
UNUM_MAYBE = 2 |
+#else |
+ /** @internal */ |
+ UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN |
#endif /* U_HIDE_INTERNAL_API */ |
} UNumberFormatAttributeValue; |
#endif |
@@ -891,7 +930,7 @@ typedef enum UNumberFormatAttribute { |
* This is an internal ICU API. Do not use. |
* @internal |
*/ |
- UNUM_PARSE_ALL_INPUT = UNUM_LENIENT_PARSE + 1, |
+ UNUM_PARSE_ALL_INPUT = 20, |
#endif |
/** |
* Scale, which adjusts the position of the |
@@ -902,23 +941,25 @@ typedef enum UNumberFormatAttribute { |
* <p>Example: setting the scale to -4, 123 formats as "0.0123" |
* |
* @stable ICU 51 */ |
- UNUM_SCALE = UNUM_LENIENT_PARSE + 2, |
- |
+ UNUM_SCALE = 21, |
#ifndef U_HIDE_INTERNAL_API |
- /** Count of "regular" numeric attributes. |
- * @internal */ |
- UNUM_NUMERIC_ATTRIBUTE_COUNT = UNUM_LENIENT_PARSE + 3, |
+ /** |
+ * Minimum grouping digits, technology preview. |
+ * See DecimalFormat::getMinimumGroupingDigits(). |
+ * |
+ * @internal technology preview |
+ */ |
+ UNUM_MINIMUM_GROUPING_DIGITS = 22, |
+ /* TODO: test C API when it becomes @draft */ |
#endif /* U_HIDE_INTERNAL_API */ |
-#ifndef U_HIDE_DRAFT_API |
/** |
* if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, |
* otherwise it is UNUM_CURRENCY_CASH purpose |
* Default: 0 (UNUM_CURRENCY_STANDARD purpose) |
- * @draft ICU 54 |
+ * @stable ICU 54 |
*/ |
- UNUM_CURRENCY_USAGE = UNUM_LENIENT_PARSE + 4, |
-#endif /* U_HIDE_DRAFT_API */ |
+ UNUM_CURRENCY_USAGE = 23, |
/* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ |
/** One below the first bitfield-boolean item. |
@@ -940,22 +981,20 @@ typedef enum UNumberFormatAttribute { |
*/ |
UNUM_PARSE_NO_EXPONENT, |
-#ifndef U_HIDE_DRAFT_API |
/** |
* if this attribute is set to 1, specifies that, if the pattern contains a |
* decimal mark the input is required to have one. If this attribute is set to 0, |
* specifies that input does not have to contain a decimal mark. |
* Has no effect on formatting. |
* Default: 0 (unset) |
- * @draft ICU 54 |
+ * @stable ICU 54 |
*/ |
- UNUM_PARSE_DECIMAL_MARK_REQUIRED = UNUM_PARSE_NO_EXPONENT+1, |
-#endif /* U_HIDE_DRAFT_API */ |
+ UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002, |
/* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ |
/** Limit of boolean attributes. |
* @internal */ |
- UNUM_LIMIT_BOOLEAN_ATTRIBUTE = UNUM_PARSE_NO_EXPONENT+2 |
+ UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003 |
} UNumberFormatAttribute; |
/** |
@@ -966,7 +1005,7 @@ typedef enum UNumberFormatAttribute { |
* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, |
* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, |
* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, |
-* UNUM_SCALE. |
+* UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. |
* @return The value of attr. |
* @see unum_setAttribute |
* @see unum_getDoubleAttribute |
@@ -989,7 +1028,7 @@ unum_getAttribute(const UNumberFormat* fmt, |
* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, |
* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, |
* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, |
-* UNUM_LENIENT_PARSE, or UNUM_SCALE. |
+* UNUM_LENIENT_PARSE, UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. |
* @param newValue The new value of attr. |
* @see unum_getAttribute |
* @see unum_getDoubleAttribute |
@@ -1228,12 +1267,10 @@ typedef enum UNumberFormatSymbol { |
*/ |
UNUM_NINE_DIGIT_SYMBOL = 26, |
-#ifndef U_HIDE_DRAFT_API |
/** Multiplication sign |
- * @draft ICU 54 |
+ * @stable ICU 54 |
*/ |
UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, |
-#endif /* U_HIDE_DRAFT_API */ |
/** count symbol constants */ |
UNUM_FORMAT_SYMBOL_COUNT = 28 |
@@ -1297,16 +1334,15 @@ unum_getLocaleByType(const UNumberFormat *fmt, |
ULocDataLocaleType type, |
UErrorCode* status); |
-#ifndef U_HIDE_DRAFT_API |
/** |
* Set a particular UDisplayContext value in the formatter, such as |
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE. |
* @param fmt The formatter for which to set a UDisplayContext value. |
* @param value The UDisplayContext value to set. |
* @param status A pointer to an UErrorCode to receive any errors |
- * @draft ICU 53 |
+ * @stable ICU 53 |
*/ |
-U_DRAFT void U_EXPORT2 |
+U_STABLE void U_EXPORT2 |
unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); |
/** |
@@ -1316,13 +1352,11 @@ unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); |
* @param type The UDisplayContextType whose value to return |
* @param status A pointer to an UErrorCode to receive any errors |
* @return The UDisplayContextValue for the specified type. |
- * @draft ICU 53 |
+ * @stable ICU 53 |
*/ |
-U_DRAFT UDisplayContext U_EXPORT2 |
+U_STABLE UDisplayContext U_EXPORT2 |
unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status); |
-#endif /* U_HIDE_DRAFT_API */ |
- |
#endif /* #if !UCONFIG_NO_FORMATTING */ |
#endif |