X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..46f4442e9a5a4f3b98b7c1083586332f6a8a99a4:/icuSources/i18n/unicode/unum.h diff --git a/icuSources/i18n/unicode/unum.h b/icuSources/i18n/unicode/unum.h index 387ed951..c5df2bbf 100644 --- a/icuSources/i18n/unicode/unum.h +++ b/icuSources/i18n/unicode/unum.h @@ -1,6 +1,7 @@ /* ******************************************************************************* -* 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 @@ -94,9 +95,9 @@ * num = unum_parse(nf, str, u_strlen(str), &pos, &status); * \endcode * - * 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%. *

@@ -133,7 +134,7 @@ typedef void* UNumberFormat; typedef enum UNumberFormatStyle { /** * Decimal format defined by pattern - * @draft ICU 3.0 + * @stable ICU 3.0 */ UNUM_PATTERN_DECIMAL=0, /** Decimal format */ @@ -148,17 +149,17 @@ typedef enum UNumberFormatStyle { 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 */ @@ -175,9 +176,18 @@ typedef enum UNumberFormatRoundingMode { 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. @@ -221,7 +231,7 @@ typedef enum UNumberFormatPadPosition { * @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, @@ -236,7 +246,7 @@ unum_open( UNumberFormatStyle style, * @param fmt The formatter to close. * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_STABLE void U_EXPORT2 unum_close(UNumberFormat* fmt); /** @@ -247,7 +257,7 @@ 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); @@ -272,7 +282,7 @@ unum_clone(const UNumberFormat *fmt, * @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, @@ -301,7 +311,7 @@ unum_format( const UNumberFormat* fmt, * @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, @@ -330,7 +340,7 @@ unum_formatInt64(const UNumberFormat *fmt, * @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, @@ -357,9 +367,9 @@ unum_formatDouble( const UNumberFormat* fmt, * @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, @@ -385,7 +395,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt, * @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, @@ -407,9 +417,9 @@ unum_parse( const UNumberFormat* fmt, * @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, @@ -433,7 +443,7 @@ unum_parseInt64(const UNumberFormat* fmt, * @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, @@ -457,9 +467,9 @@ unum_parseDouble( const UNumberFormat* fmt, * @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, @@ -483,7 +493,7 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt, * @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, @@ -502,7 +512,7 @@ unum_applyPattern( UNumberFormat *format, * @see unum_countAvailable * @stable ICU 2.0 */ -U_CAPI const char* U_EXPORT2 +U_STABLE const char* U_EXPORT2 unum_getAvailable(int32_t index); /** @@ -514,7 +524,7 @@ 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 */ @@ -552,16 +562,16 @@ typedef enum UNumberFormatAttribute { /** 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; @@ -582,7 +592,7 @@ typedef enum 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); @@ -605,7 +615,7 @@ unum_getAttribute(const UNumberFormat* fmt, * @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); @@ -625,7 +635,7 @@ unum_setAttribute( UNumberFormat* fmt, * @see unum_setTextAttribute * @stable ICU 2.0 */ -U_CAPI double U_EXPORT2 +U_STABLE double U_EXPORT2 unum_getDoubleAttribute(const UNumberFormat* fmt, UNumberFormatAttribute attr); @@ -643,7 +653,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt, * @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); @@ -664,14 +674,14 @@ typedef enum UNumberFormatTextAttribute { 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; @@ -694,7 +704,7 @@ typedef enum 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, @@ -717,7 +727,7 @@ unum_getTextAttribute( const UNumberFormat* fmt, * @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, @@ -740,15 +750,13 @@ unum_setTextAttribute( UNumberFormat* fmt, * @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. @@ -756,42 +764,46 @@ unum_toPattern( const UNumberFormat* fmt, */ 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; /** @@ -810,7 +822,7 @@ typedef enum 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, @@ -830,7 +842,7 @@ unum_getSymbol(const UNumberFormat *fmt, * @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, @@ -845,9 +857,9 @@ unum_setSymbol(UNumberFormat *fmt, * @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);