/*
*******************************************************************************
-* Copyright (C) 1997-2004, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2008, International Business Machines Corporation and others.
+* All Rights Reserved.
* Modification History:
*
* Date Name Description
* num = unum_parse(nf, str, u_strlen(str), &pos, &status);
* \endcode
* </pre>
- * Use UCAL_DECIMAL to get the normal number format for that country.
- * There are other static options available. Use UCAL_CURRENCY
- * to get the currency number format for that country. Use UCAL_PERCENT
+ * Use UNUM_DECIMAL to get the normal number format for that country.
+ * There are other static options available. Use UNUM_CURRENCY
+ * to get the currency number format for that country. Use UNUM_PERCENT
* to get a format for displaying percentages. With this format, a
* fraction from 0.53 is displayed as 53%.
* <P>
typedef enum UNumberFormatStyle {
/**
* Decimal format defined by pattern
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PATTERN_DECIMAL=0,
/** Decimal format */
UNUM_SPELLOUT,
/**
* Ordinal rule-based format
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_ORDINAL,
/**
* Duration rule-based format
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_DURATION,
/**
* Rule-based format defined by pattern
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PATTERN_RULEBASED,
/** Default format */
UNUM_ROUND_FLOOR,
UNUM_ROUND_DOWN,
UNUM_ROUND_UP,
+ /**
+ * Half-even rounding, misspelled name
+ * @deprecated, ICU 3.8
+ */
UNUM_FOUND_HALFEVEN,
UNUM_ROUND_HALFDOWN,
- UNUM_ROUND_HALFUP
+ UNUM_ROUND_HALFUP,
+ /**
+ * Half-even rounding
+ * @stable, ICU 3.8
+ */
+ UNUM_ROUND_HALFEVEN = UNUM_FOUND_HALFEVEN
} UNumberFormatRoundingMode;
/** The possible number format pad positions.
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI UNumberFormat* U_EXPORT2
+U_STABLE UNumberFormat* U_EXPORT2
unum_open( UNumberFormatStyle style,
const UChar* pattern,
int32_t patternLength,
* @param fmt The formatter to close.
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_close(UNumberFormat* fmt);
/**
* @return A pointer to a UNumberFormat identical to fmt.
* @stable ICU 2.0
*/
-U_CAPI UNumberFormat* U_EXPORT2
+U_STABLE UNumberFormat* U_EXPORT2
unum_clone(const UNumberFormat *fmt,
UErrorCode *status);
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_format( const UNumberFormat* fmt,
int32_t number,
UChar* result,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatInt64(const UNumberFormat *fmt,
int64_t number,
UChar* result,
* @see UFieldPosition
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatDouble( const UNumberFormat* fmt,
double number,
UChar* result,
* @see unum_formatDouble
* @see unum_parseDoubleCurrency
* @see UFieldPosition
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_formatDoubleCurrency(const UNumberFormat* fmt,
double number,
UChar* currency,
* @see unum_formatDouble
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_parse( const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
* @see unum_format
* @see unum_formatInt64
* @see unum_formatDouble
-* @draft ICU 2.8
+* @stable ICU 2.8
*/
-U_CAPI int64_t U_EXPORT2
+U_STABLE int64_t U_EXPORT2
unum_parseInt64(const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
* @see unum_formatDouble
* @stable ICU 2.0
*/
-U_CAPI double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_parseDouble( const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
* @return the parsed double
* @see unum_parseDouble
* @see unum_formatDoubleCurrency
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
-U_DRAFT double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_parseDoubleCurrency(const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_applyPattern( UNumberFormat *format,
UBool localized,
const UChar *pattern,
* @see unum_countAvailable
* @stable ICU 2.0
*/
-U_CAPI const char* U_EXPORT2
+U_STABLE const char* U_EXPORT2
unum_getAvailable(int32_t index);
/**
* @see unum_getAvailable
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_countAvailable(void);
/** The possible UNumberFormat numeric attributes @stable ICU 2.0 */
/** Secondary grouping size */
UNUM_SECONDARY_GROUPING_SIZE,
/** Use significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_SIGNIFICANT_DIGITS_USED,
/** Minimum significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_MIN_SIGNIFICANT_DIGITS,
/** Maximum significant digits
- * @draft ICU 3.0 */
+ * @stable ICU 3.0 */
UNUM_MAX_SIGNIFICANT_DIGITS,
/** Lenient parse mode used by rule-based formats.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_LENIENT_PARSE
} UNumberFormatAttribute;
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr);
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
int32_t newValue);
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI double U_EXPORT2
+U_STABLE double U_EXPORT2
unum_getDoubleAttribute(const UNumberFormat* fmt,
UNumberFormatAttribute attr);
* @see unum_setTextAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setDoubleAttribute( UNumberFormat* fmt,
UNumberFormatAttribute attr,
double newValue);
UNUM_CURRENCY_CODE,
/**
* The default rule set. This is only available with rule-based formatters.
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_DEFAULT_RULESET,
/**
* The public rule sets. This is only available with rule-based formatters.
* This is a read-only attribute. The public rulesets are returned as a
* single string, with each ruleset name delimited by ';' (semicolon).
- * @draft ICU 3.0
+ * @stable ICU 3.0
*/
UNUM_PUBLIC_RULESETS
} UNumberFormatTextAttribute;
* @see unum_setAttribute
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getTextAttribute( const UNumberFormat* fmt,
UNumberFormatTextAttribute tag,
UChar* result,
* @see unum_setAttribute
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setTextAttribute( UNumberFormat* fmt,
UNumberFormatTextAttribute tag,
const UChar* newValue,
* @see DecimalFormat
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_toPattern( const UNumberFormat* fmt,
UBool isPatternLocalized,
UChar* result,
int32_t resultLength,
UErrorCode* status);
-/** The maximum size for a textual number format symbol. @internal*/
-#define UNFSYMBOLSMAXSIZE 10
/**
* Constants for specifying a number format symbol.
*/
typedef enum UNumberFormatSymbol {
/** The decimal separator */
- UNUM_DECIMAL_SEPARATOR_SYMBOL,
+ UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
/** The grouping separator */
- UNUM_GROUPING_SEPARATOR_SYMBOL,
+ UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
/** The pattern separator */
- UNUM_PATTERN_SEPARATOR_SYMBOL,
+ UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
/** The percent sign */
- UNUM_PERCENT_SYMBOL,
+ UNUM_PERCENT_SYMBOL = 3,
/** Zero*/
- UNUM_ZERO_DIGIT_SYMBOL,
+ UNUM_ZERO_DIGIT_SYMBOL = 4,
/** Character representing a digit in the pattern */
- UNUM_DIGIT_SYMBOL,
+ UNUM_DIGIT_SYMBOL = 5,
/** The minus sign */
- UNUM_MINUS_SIGN_SYMBOL,
+ UNUM_MINUS_SIGN_SYMBOL = 6,
/** The plus sign */
- UNUM_PLUS_SIGN_SYMBOL,
+ UNUM_PLUS_SIGN_SYMBOL = 7,
/** The currency symbol */
- UNUM_CURRENCY_SYMBOL,
+ UNUM_CURRENCY_SYMBOL = 8,
/** The international currency symbol */
- UNUM_INTL_CURRENCY_SYMBOL,
+ UNUM_INTL_CURRENCY_SYMBOL = 9,
/** The monetary separator */
- UNUM_MONETARY_SEPARATOR_SYMBOL,
+ UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
/** The exponential symbol */
- UNUM_EXPONENTIAL_SYMBOL,
+ UNUM_EXPONENTIAL_SYMBOL = 11,
/** Per mill symbol */
- UNUM_PERMILL_SYMBOL,
+ UNUM_PERMILL_SYMBOL = 12,
/** Escape padding character */
- UNUM_PAD_ESCAPE_SYMBOL,
+ UNUM_PAD_ESCAPE_SYMBOL = 13,
/** Infinity symbol */
- UNUM_INFINITY_SYMBOL,
+ UNUM_INFINITY_SYMBOL = 14,
/** Nan symbol */
- UNUM_NAN_SYMBOL,
+ UNUM_NAN_SYMBOL = 15,
/** Significant digit symbol
- * @draft ICU 3.0 */
- UNUM_SIGNIFICANT_DIGIT_SYMBOL,
+ * @stable ICU 3.0 */
+ UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
+ /** The monetary grouping separator
+ * @stable ICU 3.6
+ */
+ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
/** count symbol constants */
- UNUM_FORMAT_SYMBOL_COUNT
+ UNUM_FORMAT_SYMBOL_COUNT = 18
} UNumberFormatSymbol;
/**
* @see unum_setSymbol
* @stable ICU 2.0
*/
-U_CAPI int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
unum_getSymbol(const UNumberFormat *fmt,
UNumberFormatSymbol symbol,
UChar *buffer,
* @see unum_getSymbol
* @stable ICU 2.0
*/
-U_CAPI void U_EXPORT2
+U_STABLE void U_EXPORT2
unum_setSymbol(UNumberFormat *fmt,
UNumberFormatSymbol symbol,
const UChar *value,
* @param type type of the locale we're looking for (valid or actual)
* @param status error code for the operation
* @return the locale name
- * @draft ICU 2.8 likely to change in ICU 3.0, based on feedback
+ * @stable ICU 2.8
*/
-U_CAPI const char* U_EXPORT2
+U_STABLE const char* U_EXPORT2
unum_getLocaleByType(const UNumberFormat *fmt,
ULocDataLocaleType type,
UErrorCode* status);