17777dab0Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
27777dab0Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
37777dab0Sopenharmony_ci/*
47777dab0Sopenharmony_ci*******************************************************************************
57777dab0Sopenharmony_ci* Copyright (C) 1997-2015, International Business Machines Corporation and others.
67777dab0Sopenharmony_ci* All Rights Reserved.
77777dab0Sopenharmony_ci* Modification History:
87777dab0Sopenharmony_ci*
97777dab0Sopenharmony_ci*   Date        Name        Description
107777dab0Sopenharmony_ci*   06/24/99    helena      Integrated Alan's NF enhancements and Java2 bug fixes
117777dab0Sopenharmony_ci*******************************************************************************
127777dab0Sopenharmony_ci*/
137777dab0Sopenharmony_ci
147777dab0Sopenharmony_ci#ifndef _UNUM
157777dab0Sopenharmony_ci#define _UNUM
167777dab0Sopenharmony_ci
177777dab0Sopenharmony_ci#include "unicode/utypes.h"
187777dab0Sopenharmony_ci
197777dab0Sopenharmony_ci#if !UCONFIG_NO_FORMATTING
207777dab0Sopenharmony_ci
217777dab0Sopenharmony_ci#include "unicode/uloc.h"
227777dab0Sopenharmony_ci#include "unicode/umisc.h"
237777dab0Sopenharmony_ci#include "unicode/parseerr.h"
247777dab0Sopenharmony_ci#include "unicode/udisplaycontext.h"
257777dab0Sopenharmony_ci#include "unicode/ufieldpositer.h"
267777dab0Sopenharmony_ci
277777dab0Sopenharmony_ci#if U_SHOW_CPLUSPLUS_API
287777dab0Sopenharmony_ci#include "unicode/localpointer.h"
297777dab0Sopenharmony_ci#endif   // U_SHOW_CPLUSPLUS_API
307777dab0Sopenharmony_ci
317777dab0Sopenharmony_ci/**
327777dab0Sopenharmony_ci * \file
337777dab0Sopenharmony_ci * \brief C API: Compatibility APIs for number formatting.
347777dab0Sopenharmony_ci *
357777dab0Sopenharmony_ci * <h2> Number Format C API </h2>
367777dab0Sopenharmony_ci *
377777dab0Sopenharmony_ci * <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to
387777dab0Sopenharmony_ci * see if unumberformatter.h fits their use case.  Although not deprecated,
397777dab0Sopenharmony_ci * this header is provided for backwards compatibility only.
407777dab0Sopenharmony_ci *
417777dab0Sopenharmony_ci * Number Format C API  Provides functions for
427777dab0Sopenharmony_ci * formatting and parsing a number.  Also provides methods for
437777dab0Sopenharmony_ci * determining which locales have number formats, and what their names
447777dab0Sopenharmony_ci * are.
457777dab0Sopenharmony_ci * <P>
467777dab0Sopenharmony_ci * UNumberFormat helps you to format and parse numbers for any locale.
477777dab0Sopenharmony_ci * Your code can be completely independent of the locale conventions
487777dab0Sopenharmony_ci * for decimal points, thousands-separators, or even the particular
497777dab0Sopenharmony_ci * decimal digits used, or whether the number format is even decimal.
507777dab0Sopenharmony_ci * There are different number format styles like decimal, currency,
517777dab0Sopenharmony_ci * percent and spellout.
527777dab0Sopenharmony_ci * <P>
537777dab0Sopenharmony_ci * To format a number for the current Locale, use one of the static
547777dab0Sopenharmony_ci * factory methods:
557777dab0Sopenharmony_ci * <pre>
567777dab0Sopenharmony_ci * \code
577777dab0Sopenharmony_ci *    UChar myString[20];
587777dab0Sopenharmony_ci *    double myNumber = 7.0;
597777dab0Sopenharmony_ci *    UErrorCode status = U_ZERO_ERROR;
607777dab0Sopenharmony_ci *    UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
617777dab0Sopenharmony_ci *    unum_formatDouble(nf, myNumber, myString, 20, NULL, &status);
627777dab0Sopenharmony_ci *    printf(" Example 1: %s\n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
637777dab0Sopenharmony_ci * \endcode
647777dab0Sopenharmony_ci * </pre>
657777dab0Sopenharmony_ci * If you are formatting multiple numbers, it is more efficient to get
667777dab0Sopenharmony_ci * the format and use it multiple times so that the system doesn't
677777dab0Sopenharmony_ci * have to fetch the information about the local language and country
687777dab0Sopenharmony_ci * conventions multiple times.
697777dab0Sopenharmony_ci * <pre>
707777dab0Sopenharmony_ci * \code
717777dab0Sopenharmony_ci * uint32_t i, resultlength, reslenneeded;
727777dab0Sopenharmony_ci * UErrorCode status = U_ZERO_ERROR;
737777dab0Sopenharmony_ci * UFieldPosition pos;
747777dab0Sopenharmony_ci * uint32_t a[] = { 123, 3333, -1234567 };
757777dab0Sopenharmony_ci * const uint32_t a_len = sizeof(a) / sizeof(a[0]);
767777dab0Sopenharmony_ci * UNumberFormat* nf;
777777dab0Sopenharmony_ci * UChar* result = NULL;
787777dab0Sopenharmony_ci *
797777dab0Sopenharmony_ci * nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
807777dab0Sopenharmony_ci * for (i = 0; i < a_len; i++) {
817777dab0Sopenharmony_ci *    resultlength=0;
827777dab0Sopenharmony_ci *    reslenneeded=unum_format(nf, a[i], NULL, resultlength, &pos, &status);
837777dab0Sopenharmony_ci *    result = NULL;
847777dab0Sopenharmony_ci *    if(status==U_BUFFER_OVERFLOW_ERROR){
857777dab0Sopenharmony_ci *       status=U_ZERO_ERROR;
867777dab0Sopenharmony_ci *       resultlength=reslenneeded+1;
877777dab0Sopenharmony_ci *       result=(UChar*)malloc(sizeof(UChar) * resultlength);
887777dab0Sopenharmony_ci *       unum_format(nf, a[i], result, resultlength, &pos, &status);
897777dab0Sopenharmony_ci *    }
907777dab0Sopenharmony_ci *    printf( " Example 2: %s\n", austrdup(result));
917777dab0Sopenharmony_ci *    free(result);
927777dab0Sopenharmony_ci * }
937777dab0Sopenharmony_ci * \endcode
947777dab0Sopenharmony_ci * </pre>
957777dab0Sopenharmony_ci * To format a number for a different Locale, specify it in the
967777dab0Sopenharmony_ci * call to unum_open().
977777dab0Sopenharmony_ci * <pre>
987777dab0Sopenharmony_ci * \code
997777dab0Sopenharmony_ci *     UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, "fr_FR", NULL, &success)
1007777dab0Sopenharmony_ci * \endcode
1017777dab0Sopenharmony_ci * </pre>
1027777dab0Sopenharmony_ci * You can use a NumberFormat API unum_parse() to parse.
1037777dab0Sopenharmony_ci * <pre>
1047777dab0Sopenharmony_ci * \code
1057777dab0Sopenharmony_ci *    UErrorCode status = U_ZERO_ERROR;
1067777dab0Sopenharmony_ci *    int32_t pos=0;
1077777dab0Sopenharmony_ci *    int32_t num;
1087777dab0Sopenharmony_ci *    num = unum_parse(nf, str, u_strlen(str), &pos, &status);
1097777dab0Sopenharmony_ci * \endcode
1107777dab0Sopenharmony_ci * </pre>
1117777dab0Sopenharmony_ci * Use UNUM_DECIMAL to get the normal number format for that country.
1127777dab0Sopenharmony_ci * There are other static options available.  Use UNUM_CURRENCY
1137777dab0Sopenharmony_ci * to get the currency number format for that country.  Use UNUM_PERCENT
1147777dab0Sopenharmony_ci * to get a format for displaying percentages. With this format, a
1157777dab0Sopenharmony_ci * fraction from 0.53 is displayed as 53%.
1167777dab0Sopenharmony_ci * <P>
1177777dab0Sopenharmony_ci * Use a pattern to create either a DecimalFormat or a RuleBasedNumberFormat
1187777dab0Sopenharmony_ci * formatter.  The pattern must conform to the syntax defined for those
1197777dab0Sopenharmony_ci * formatters.
1207777dab0Sopenharmony_ci * <P>
1217777dab0Sopenharmony_ci * You can also control the display of numbers with such function as
1227777dab0Sopenharmony_ci * unum_getAttributes() and unum_setAttributes(), which let you set the
1237777dab0Sopenharmony_ci * minimum fraction digits, grouping, etc.
1247777dab0Sopenharmony_ci * @see UNumberFormatAttributes for more details
1257777dab0Sopenharmony_ci * <P>
1267777dab0Sopenharmony_ci * You can also use forms of the parse and format methods with
1277777dab0Sopenharmony_ci * ParsePosition and UFieldPosition to allow you to:
1287777dab0Sopenharmony_ci * <ul type=round>
1297777dab0Sopenharmony_ci *   <li>(a) progressively parse through pieces of a string.
1307777dab0Sopenharmony_ci *   <li>(b) align the decimal point and other areas.
1317777dab0Sopenharmony_ci * </ul>
1327777dab0Sopenharmony_ci * <p>
1337777dab0Sopenharmony_ci * It is also possible to change or set the symbols used for a particular
1347777dab0Sopenharmony_ci * locale like the currency symbol, the grouping separator , monetary separator
1357777dab0Sopenharmony_ci * etc by making use of functions unum_setSymbols() and unum_getSymbols().
1367777dab0Sopenharmony_ci */
1377777dab0Sopenharmony_ci
1387777dab0Sopenharmony_ci/** A number formatter.
1397777dab0Sopenharmony_ci *  For usage in C programs.
1407777dab0Sopenharmony_ci *  @stable ICU 2.0
1417777dab0Sopenharmony_ci */
1427777dab0Sopenharmony_citypedef void* UNumberFormat;
1437777dab0Sopenharmony_ci
1447777dab0Sopenharmony_ci/** The possible number format styles.
1457777dab0Sopenharmony_ci *  @stable ICU 2.0
1467777dab0Sopenharmony_ci */
1477777dab0Sopenharmony_citypedef enum UNumberFormatStyle {
1487777dab0Sopenharmony_ci    /**
1497777dab0Sopenharmony_ci     * Decimal format defined by a pattern string.
1507777dab0Sopenharmony_ci     * @stable ICU 3.0
1517777dab0Sopenharmony_ci     */
1527777dab0Sopenharmony_ci    UNUM_PATTERN_DECIMAL=0,
1537777dab0Sopenharmony_ci    /**
1547777dab0Sopenharmony_ci     * Decimal format ("normal" style).
1557777dab0Sopenharmony_ci     * @stable ICU 2.0
1567777dab0Sopenharmony_ci     */
1577777dab0Sopenharmony_ci    UNUM_DECIMAL=1,
1587777dab0Sopenharmony_ci    /**
1597777dab0Sopenharmony_ci     * Currency format (generic).
1607777dab0Sopenharmony_ci     * Defaults to UNUM_CURRENCY_STANDARD style
1617777dab0Sopenharmony_ci     * (using currency symbol, e.g., "$1.00", with non-accounting
1627777dab0Sopenharmony_ci     * style for negative values e.g. using minus sign).
1637777dab0Sopenharmony_ci     * The specific style may be specified using the -cf- locale key.
1647777dab0Sopenharmony_ci     * @stable ICU 2.0
1657777dab0Sopenharmony_ci     */
1667777dab0Sopenharmony_ci    UNUM_CURRENCY=2,
1677777dab0Sopenharmony_ci    /**
1687777dab0Sopenharmony_ci     * Percent format
1697777dab0Sopenharmony_ci     * @stable ICU 2.0
1707777dab0Sopenharmony_ci     */
1717777dab0Sopenharmony_ci    UNUM_PERCENT=3,
1727777dab0Sopenharmony_ci    /**
1737777dab0Sopenharmony_ci     * Scientific format
1747777dab0Sopenharmony_ci     * @stable ICU 2.1
1757777dab0Sopenharmony_ci     */
1767777dab0Sopenharmony_ci    UNUM_SCIENTIFIC=4,
1777777dab0Sopenharmony_ci    /**
1787777dab0Sopenharmony_ci     * Spellout rule-based format. The default ruleset can be specified/changed using
1797777dab0Sopenharmony_ci     * unum_setTextAttribute with UNUM_DEFAULT_RULESET; the available public rulesets
1807777dab0Sopenharmony_ci     * can be listed using unum_getTextAttribute with UNUM_PUBLIC_RULESETS.
1817777dab0Sopenharmony_ci     * @stable ICU 2.0
1827777dab0Sopenharmony_ci     */
1837777dab0Sopenharmony_ci    UNUM_SPELLOUT=5,
1847777dab0Sopenharmony_ci    /**
1857777dab0Sopenharmony_ci     * Ordinal rule-based format . The default ruleset can be specified/changed using
1867777dab0Sopenharmony_ci     * unum_setTextAttribute with UNUM_DEFAULT_RULESET; the available public rulesets
1877777dab0Sopenharmony_ci     * can be listed using unum_getTextAttribute with UNUM_PUBLIC_RULESETS.
1887777dab0Sopenharmony_ci     * @stable ICU 3.0
1897777dab0Sopenharmony_ci     */
1907777dab0Sopenharmony_ci    UNUM_ORDINAL=6,
1917777dab0Sopenharmony_ci    /**
1927777dab0Sopenharmony_ci     * Duration rule-based format
1937777dab0Sopenharmony_ci     * @stable ICU 3.0
1947777dab0Sopenharmony_ci     */
1957777dab0Sopenharmony_ci    UNUM_DURATION=7,
1967777dab0Sopenharmony_ci    /**
1977777dab0Sopenharmony_ci     * Numbering system rule-based format
1987777dab0Sopenharmony_ci     * @stable ICU 4.2
1997777dab0Sopenharmony_ci     */
2007777dab0Sopenharmony_ci    UNUM_NUMBERING_SYSTEM=8,
2017777dab0Sopenharmony_ci    /**
2027777dab0Sopenharmony_ci     * Rule-based format defined by a pattern string.
2037777dab0Sopenharmony_ci     * @stable ICU 3.0
2047777dab0Sopenharmony_ci     */
2057777dab0Sopenharmony_ci    UNUM_PATTERN_RULEBASED=9,
2067777dab0Sopenharmony_ci    /**
2077777dab0Sopenharmony_ci     * Currency format with an ISO currency code, e.g., "USD1.00".
2087777dab0Sopenharmony_ci     * @stable ICU 4.8
2097777dab0Sopenharmony_ci     */
2107777dab0Sopenharmony_ci    UNUM_CURRENCY_ISO=10,
2117777dab0Sopenharmony_ci    /**
2127777dab0Sopenharmony_ci     * Currency format with a pluralized currency name,
2137777dab0Sopenharmony_ci     * e.g., "1.00 US dollar" and "3.00 US dollars".
2147777dab0Sopenharmony_ci     * @stable ICU 4.8
2157777dab0Sopenharmony_ci     */
2167777dab0Sopenharmony_ci    UNUM_CURRENCY_PLURAL=11,
2177777dab0Sopenharmony_ci    /**
2187777dab0Sopenharmony_ci     * Currency format for accounting, e.g., "($3.00)" for
2197777dab0Sopenharmony_ci     * negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}).
2207777dab0Sopenharmony_ci     * Overrides any style specified using -cf- key in locale.
2217777dab0Sopenharmony_ci     * @stable ICU 53
2227777dab0Sopenharmony_ci     */
2237777dab0Sopenharmony_ci    UNUM_CURRENCY_ACCOUNTING=12,
2247777dab0Sopenharmony_ci    /**
2257777dab0Sopenharmony_ci     * Currency format with a currency symbol given CASH usage, e.g.,
2267777dab0Sopenharmony_ci     * "NT$3" instead of "NT$3.23".
2277777dab0Sopenharmony_ci     * @stable ICU 54
2287777dab0Sopenharmony_ci     */
2297777dab0Sopenharmony_ci    UNUM_CASH_CURRENCY=13,
2307777dab0Sopenharmony_ci    /**
2317777dab0Sopenharmony_ci     * Decimal format expressed using compact notation
2327777dab0Sopenharmony_ci     * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT)
2337777dab0Sopenharmony_ci     * e.g. "23K", "45B"
2347777dab0Sopenharmony_ci     * @stable ICU 56
2357777dab0Sopenharmony_ci     */
2367777dab0Sopenharmony_ci    UNUM_DECIMAL_COMPACT_SHORT=14,
2377777dab0Sopenharmony_ci    /**
2387777dab0Sopenharmony_ci     * Decimal format expressed using compact notation
2397777dab0Sopenharmony_ci     * (long form, corresponds to UNumberCompactStyle=UNUM_LONG)
2407777dab0Sopenharmony_ci     * e.g. "23 thousand", "45 billion"
2417777dab0Sopenharmony_ci     * @stable ICU 56
2427777dab0Sopenharmony_ci     */
2437777dab0Sopenharmony_ci    UNUM_DECIMAL_COMPACT_LONG=15,
2447777dab0Sopenharmony_ci    /**
2457777dab0Sopenharmony_ci     * Currency format with a currency symbol, e.g., "$1.00",
2467777dab0Sopenharmony_ci     * using non-accounting style for negative values (e.g. minus sign).
2477777dab0Sopenharmony_ci     * Overrides any style specified using -cf- key in locale.
2487777dab0Sopenharmony_ci     * @stable ICU 56
2497777dab0Sopenharmony_ci     */
2507777dab0Sopenharmony_ci    UNUM_CURRENCY_STANDARD=16,
2517777dab0Sopenharmony_ci    /**
2527777dab0Sopenharmony_ci     * Default format
2537777dab0Sopenharmony_ci     * @stable ICU 2.0
2547777dab0Sopenharmony_ci     */
2557777dab0Sopenharmony_ci    UNUM_DEFAULT = UNUM_DECIMAL,
2567777dab0Sopenharmony_ci    /**
2577777dab0Sopenharmony_ci     * Alias for UNUM_PATTERN_DECIMAL
2587777dab0Sopenharmony_ci     * @stable ICU 3.0
2597777dab0Sopenharmony_ci     */
2607777dab0Sopenharmony_ci    UNUM_IGNORE = UNUM_PATTERN_DECIMAL
2617777dab0Sopenharmony_ci} UNumberFormatStyle;
2627777dab0Sopenharmony_ci
2637777dab0Sopenharmony_ci/** The possible number format rounding modes.
2647777dab0Sopenharmony_ci *
2657777dab0Sopenharmony_ci * <p>
2667777dab0Sopenharmony_ci * For more detail on rounding modes, see:
2677777dab0Sopenharmony_ci * https://unicode-org.github.io/icu/userguide/format_parse/numbers/rounding-modes
2687777dab0Sopenharmony_ci *
2697777dab0Sopenharmony_ci * @stable ICU 2.0
2707777dab0Sopenharmony_ci */
2717777dab0Sopenharmony_citypedef enum UNumberFormatRoundingMode {
2727777dab0Sopenharmony_ci    UNUM_ROUND_CEILING,
2737777dab0Sopenharmony_ci    UNUM_ROUND_FLOOR,
2747777dab0Sopenharmony_ci    UNUM_ROUND_DOWN,
2757777dab0Sopenharmony_ci    UNUM_ROUND_UP,
2767777dab0Sopenharmony_ci    /**
2777777dab0Sopenharmony_ci     * Half-even rounding
2787777dab0Sopenharmony_ci     * @stable, ICU 3.8
2797777dab0Sopenharmony_ci     */
2807777dab0Sopenharmony_ci    UNUM_ROUND_HALFEVEN,
2817777dab0Sopenharmony_ci    UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1,
2827777dab0Sopenharmony_ci    UNUM_ROUND_HALFUP,
2837777dab0Sopenharmony_ci    /**
2847777dab0Sopenharmony_ci      * ROUND_UNNECESSARY reports an error if formatted result is not exact.
2857777dab0Sopenharmony_ci      * @stable ICU 4.8
2867777dab0Sopenharmony_ci      */
2877777dab0Sopenharmony_ci    UNUM_ROUND_UNNECESSARY,
2887777dab0Sopenharmony_ci    /**
2897777dab0Sopenharmony_ci     * Rounds ties toward the odd number.
2907777dab0Sopenharmony_ci     * @stable ICU 69
2917777dab0Sopenharmony_ci     */
2927777dab0Sopenharmony_ci    UNUM_ROUND_HALF_ODD,
2937777dab0Sopenharmony_ci    /**
2947777dab0Sopenharmony_ci     * Rounds ties toward +∞.
2957777dab0Sopenharmony_ci     * @stable ICU 69
2967777dab0Sopenharmony_ci     */
2977777dab0Sopenharmony_ci    UNUM_ROUND_HALF_CEILING,
2987777dab0Sopenharmony_ci    /**
2997777dab0Sopenharmony_ci     * Rounds ties toward -∞.
3007777dab0Sopenharmony_ci     * @stable ICU 69
3017777dab0Sopenharmony_ci     */
3027777dab0Sopenharmony_ci    UNUM_ROUND_HALF_FLOOR,
3037777dab0Sopenharmony_ci} UNumberFormatRoundingMode;
3047777dab0Sopenharmony_ci
3057777dab0Sopenharmony_ci/** The possible number format pad positions.
3067777dab0Sopenharmony_ci *  @stable ICU 2.0
3077777dab0Sopenharmony_ci */
3087777dab0Sopenharmony_citypedef enum UNumberFormatPadPosition {
3097777dab0Sopenharmony_ci    UNUM_PAD_BEFORE_PREFIX,
3107777dab0Sopenharmony_ci    UNUM_PAD_AFTER_PREFIX,
3117777dab0Sopenharmony_ci    UNUM_PAD_BEFORE_SUFFIX,
3127777dab0Sopenharmony_ci    UNUM_PAD_AFTER_SUFFIX
3137777dab0Sopenharmony_ci} UNumberFormatPadPosition;
3147777dab0Sopenharmony_ci
3157777dab0Sopenharmony_ci/**
3167777dab0Sopenharmony_ci * Constants for specifying short or long format.
3177777dab0Sopenharmony_ci * @stable ICU 51
3187777dab0Sopenharmony_ci */
3197777dab0Sopenharmony_citypedef enum UNumberCompactStyle {
3207777dab0Sopenharmony_ci  /** @stable ICU 51 */
3217777dab0Sopenharmony_ci  UNUM_SHORT,
3227777dab0Sopenharmony_ci  /** @stable ICU 51 */
3237777dab0Sopenharmony_ci  UNUM_LONG
3247777dab0Sopenharmony_ci  /** @stable ICU 51 */
3257777dab0Sopenharmony_ci} UNumberCompactStyle;
3267777dab0Sopenharmony_ci
3277777dab0Sopenharmony_ci/**
3287777dab0Sopenharmony_ci * Constants for specifying currency spacing
3297777dab0Sopenharmony_ci * @stable ICU 4.8
3307777dab0Sopenharmony_ci */
3317777dab0Sopenharmony_cienum UCurrencySpacing {
3327777dab0Sopenharmony_ci    /** @stable ICU 4.8 */
3337777dab0Sopenharmony_ci    UNUM_CURRENCY_MATCH,
3347777dab0Sopenharmony_ci    /** @stable ICU 4.8 */
3357777dab0Sopenharmony_ci    UNUM_CURRENCY_SURROUNDING_MATCH,
3367777dab0Sopenharmony_ci    /** @stable ICU 4.8 */
3377777dab0Sopenharmony_ci    UNUM_CURRENCY_INSERT
3387777dab0Sopenharmony_ci};
3397777dab0Sopenharmony_citypedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */
3407777dab0Sopenharmony_ci
3417777dab0Sopenharmony_ci
3427777dab0Sopenharmony_ci/**
3437777dab0Sopenharmony_ci * FieldPosition and UFieldPosition selectors for format fields
3447777dab0Sopenharmony_ci * defined by NumberFormat and UNumberFormat.
3457777dab0Sopenharmony_ci * @stable ICU 49
3467777dab0Sopenharmony_ci */
3477777dab0Sopenharmony_citypedef enum UNumberFormatFields {
3487777dab0Sopenharmony_ci    /** @stable ICU 49 */
3497777dab0Sopenharmony_ci    UNUM_INTEGER_FIELD,
3507777dab0Sopenharmony_ci    /** @stable ICU 49 */
3517777dab0Sopenharmony_ci    UNUM_FRACTION_FIELD,
3527777dab0Sopenharmony_ci    /** @stable ICU 49 */
3537777dab0Sopenharmony_ci    UNUM_DECIMAL_SEPARATOR_FIELD,
3547777dab0Sopenharmony_ci    /** @stable ICU 49 */
3557777dab0Sopenharmony_ci    UNUM_EXPONENT_SYMBOL_FIELD,
3567777dab0Sopenharmony_ci    /** @stable ICU 49 */
3577777dab0Sopenharmony_ci    UNUM_EXPONENT_SIGN_FIELD,
3587777dab0Sopenharmony_ci    /** @stable ICU 49 */
3597777dab0Sopenharmony_ci    UNUM_EXPONENT_FIELD,
3607777dab0Sopenharmony_ci    /** @stable ICU 49 */
3617777dab0Sopenharmony_ci    UNUM_GROUPING_SEPARATOR_FIELD,
3627777dab0Sopenharmony_ci    /** @stable ICU 49 */
3637777dab0Sopenharmony_ci    UNUM_CURRENCY_FIELD,
3647777dab0Sopenharmony_ci    /** @stable ICU 49 */
3657777dab0Sopenharmony_ci    UNUM_PERCENT_FIELD,
3667777dab0Sopenharmony_ci    /** @stable ICU 49 */
3677777dab0Sopenharmony_ci    UNUM_PERMILL_FIELD,
3687777dab0Sopenharmony_ci    /** @stable ICU 49 */
3697777dab0Sopenharmony_ci    UNUM_SIGN_FIELD,
3707777dab0Sopenharmony_ci    /** @stable ICU 64 */
3717777dab0Sopenharmony_ci    UNUM_MEASURE_UNIT_FIELD,
3727777dab0Sopenharmony_ci    /** @stable ICU 64 */
3737777dab0Sopenharmony_ci    UNUM_COMPACT_FIELD
3747777dab0Sopenharmony_ci} UNumberFormatFields;
3757777dab0Sopenharmony_ci
3767777dab0Sopenharmony_ci
3777777dab0Sopenharmony_ci/**
3787777dab0Sopenharmony_ci * Selectors with special numeric values to use locale default minimum grouping
3797777dab0Sopenharmony_ci * digits for the DecimalFormat/UNumberFormat setMinimumGroupingDigits method.
3807777dab0Sopenharmony_ci * Do not use these constants with the [U]NumberFormatter API.
3817777dab0Sopenharmony_ci *
3827777dab0Sopenharmony_ci * @stable ICU 68
3837777dab0Sopenharmony_ci */
3847777dab0Sopenharmony_citypedef enum UNumberFormatMinimumGroupingDigits {
3857777dab0Sopenharmony_ci    /**
3867777dab0Sopenharmony_ci     * Display grouping using the default strategy for all locales.
3877777dab0Sopenharmony_ci     * @stable ICU 68
3887777dab0Sopenharmony_ci     */
3897777dab0Sopenharmony_ci    UNUM_MINIMUM_GROUPING_DIGITS_AUTO = -2,
3907777dab0Sopenharmony_ci    /**
3917777dab0Sopenharmony_ci     * Display grouping using locale defaults, except do not show grouping on
3927777dab0Sopenharmony_ci     * values smaller than 10000 (such that there is a minimum of two digits
3937777dab0Sopenharmony_ci     * before the first separator).
3947777dab0Sopenharmony_ci     * @stable ICU 68
3957777dab0Sopenharmony_ci     */
3967777dab0Sopenharmony_ci    UNUM_MINIMUM_GROUPING_DIGITS_MIN2 = -3,
3977777dab0Sopenharmony_ci} UNumberFormatMinimumGroupingDigits;
3987777dab0Sopenharmony_ci
3997777dab0Sopenharmony_ci/**
4007777dab0Sopenharmony_ci * Create and return a new UNumberFormat for formatting and parsing
4017777dab0Sopenharmony_ci * numbers.  A UNumberFormat may be used to format numbers by calling
4027777dab0Sopenharmony_ci * {@link #unum_format }, and to parse numbers by calling {@link #unum_parse }.
4037777dab0Sopenharmony_ci * The caller must call {@link #unum_close } when done to release resources
4047777dab0Sopenharmony_ci * used by this object.
4057777dab0Sopenharmony_ci * @param style The type of number format to open: one of
4067777dab0Sopenharmony_ci * UNUM_DECIMAL, UNUM_CURRENCY, UNUM_PERCENT, UNUM_SCIENTIFIC,
4077777dab0Sopenharmony_ci * UNUM_CURRENCY_ISO, UNUM_CURRENCY_PLURAL, UNUM_SPELLOUT,
4087777dab0Sopenharmony_ci * UNUM_ORDINAL, UNUM_DURATION, UNUM_NUMBERING_SYSTEM,
4097777dab0Sopenharmony_ci * UNUM_PATTERN_DECIMAL, UNUM_PATTERN_RULEBASED, or UNUM_DEFAULT.
4107777dab0Sopenharmony_ci * If UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED is passed then the
4117777dab0Sopenharmony_ci * number format is opened using the given pattern, which must conform
4127777dab0Sopenharmony_ci * to the syntax described in DecimalFormat or RuleBasedNumberFormat,
4137777dab0Sopenharmony_ci * respectively.
4147777dab0Sopenharmony_ci *
4157777dab0Sopenharmony_ci * <p><strong>NOTE::</strong> New users with are strongly encouraged to
4167777dab0Sopenharmony_ci * use unumf_openForSkeletonAndLocale instead of unum_open.
4177777dab0Sopenharmony_ci *
4187777dab0Sopenharmony_ci * @param pattern A pattern specifying the format to use.
4197777dab0Sopenharmony_ci * This parameter is ignored unless the style is
4207777dab0Sopenharmony_ci * UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED.
4217777dab0Sopenharmony_ci * @param patternLength The number of characters in the pattern, or -1
4227777dab0Sopenharmony_ci * if null-terminated. This parameter is ignored unless the style is
4237777dab0Sopenharmony_ci * UNUM_PATTERN.
4247777dab0Sopenharmony_ci * @param locale A locale identifier to use to determine formatting
4257777dab0Sopenharmony_ci * and parsing conventions, or NULL to use the default locale.
4267777dab0Sopenharmony_ci * @param parseErr A pointer to a UParseError struct to receive the
4277777dab0Sopenharmony_ci * details of any parsing errors, or NULL if no parsing error details
4287777dab0Sopenharmony_ci * are desired.
4297777dab0Sopenharmony_ci * @param status A pointer to an input-output UErrorCode.
4307777dab0Sopenharmony_ci * @return A pointer to a newly created UNumberFormat, or NULL if an
4317777dab0Sopenharmony_ci * error occurred.
4327777dab0Sopenharmony_ci * @see unum_close
4337777dab0Sopenharmony_ci * @see DecimalFormat
4347777dab0Sopenharmony_ci * @stable ICU 2.0
4357777dab0Sopenharmony_ci */
4367777dab0Sopenharmony_ciU_CAPI UNumberFormat* U_EXPORT2
4377777dab0Sopenharmony_ciunum_open(  UNumberFormatStyle    style,
4387777dab0Sopenharmony_ci            const    UChar*    pattern,
4397777dab0Sopenharmony_ci            int32_t            patternLength,
4407777dab0Sopenharmony_ci            const    char*     locale,
4417777dab0Sopenharmony_ci            UParseError*       parseErr,
4427777dab0Sopenharmony_ci            UErrorCode*        status);
4437777dab0Sopenharmony_ci
4447777dab0Sopenharmony_ci
4457777dab0Sopenharmony_ci/**
4467777dab0Sopenharmony_ci* Close a UNumberFormat.
4477777dab0Sopenharmony_ci* Once closed, a UNumberFormat may no longer be used.
4487777dab0Sopenharmony_ci* @param fmt The formatter to close.
4497777dab0Sopenharmony_ci* @stable ICU 2.0
4507777dab0Sopenharmony_ci*/
4517777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
4527777dab0Sopenharmony_ciunum_close(UNumberFormat* fmt);
4537777dab0Sopenharmony_ci
4547777dab0Sopenharmony_ci#if U_SHOW_CPLUSPLUS_API
4557777dab0Sopenharmony_ci
4567777dab0Sopenharmony_ciU_NAMESPACE_BEGIN
4577777dab0Sopenharmony_ci
4587777dab0Sopenharmony_ci/**
4597777dab0Sopenharmony_ci * \class LocalUNumberFormatPointer
4607777dab0Sopenharmony_ci * "Smart pointer" class, closes a UNumberFormat via unum_close().
4617777dab0Sopenharmony_ci * For most methods see the LocalPointerBase base class.
4627777dab0Sopenharmony_ci *
4637777dab0Sopenharmony_ci * @see LocalPointerBase
4647777dab0Sopenharmony_ci * @see LocalPointer
4657777dab0Sopenharmony_ci * @stable ICU 4.4
4667777dab0Sopenharmony_ci */
4677777dab0Sopenharmony_ciU_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
4687777dab0Sopenharmony_ci
4697777dab0Sopenharmony_ciU_NAMESPACE_END
4707777dab0Sopenharmony_ci
4717777dab0Sopenharmony_ci#endif
4727777dab0Sopenharmony_ci
4737777dab0Sopenharmony_ci/**
4747777dab0Sopenharmony_ci * Open a copy of a UNumberFormat.
4757777dab0Sopenharmony_ci * This function performs a deep copy.
4767777dab0Sopenharmony_ci * @param fmt The format to copy
4777777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors.
4787777dab0Sopenharmony_ci * @return A pointer to a UNumberFormat identical to fmt.
4797777dab0Sopenharmony_ci * @stable ICU 2.0
4807777dab0Sopenharmony_ci */
4817777dab0Sopenharmony_ciU_CAPI UNumberFormat* U_EXPORT2
4827777dab0Sopenharmony_ciunum_clone(const UNumberFormat *fmt,
4837777dab0Sopenharmony_ci       UErrorCode *status);
4847777dab0Sopenharmony_ci
4857777dab0Sopenharmony_ci/**
4867777dab0Sopenharmony_ci* Format an integer using a UNumberFormat.
4877777dab0Sopenharmony_ci* The integer will be formatted according to the UNumberFormat's locale.
4887777dab0Sopenharmony_ci* @param fmt The formatter to use.
4897777dab0Sopenharmony_ci* @param number The number to format.
4907777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If
4917777dab0Sopenharmony_ci* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength)
4927777dab0Sopenharmony_ci* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number
4937777dab0Sopenharmony_ci* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR.
4947777dab0Sopenharmony_ci* @param resultLength The maximum size of result.
4957777dab0Sopenharmony_ci* @param pos    A pointer to a UFieldPosition.  On input, position->field
4967777dab0Sopenharmony_ci* is read.  On output, position->beginIndex and position->endIndex indicate
4977777dab0Sopenharmony_ci* the beginning and ending indices of field number position->field, if such
4987777dab0Sopenharmony_ci* a field exists.  This parameter may be NULL, in which case no field
4997777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
5007777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated.
5017777dab0Sopenharmony_ci* @see unum_formatInt64
5027777dab0Sopenharmony_ci* @see unum_formatDouble
5037777dab0Sopenharmony_ci* @see unum_parse
5047777dab0Sopenharmony_ci* @see unum_parseInt64
5057777dab0Sopenharmony_ci* @see unum_parseDouble
5067777dab0Sopenharmony_ci* @see UFieldPosition
5077777dab0Sopenharmony_ci* @stable ICU 2.0
5087777dab0Sopenharmony_ci*/
5097777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
5107777dab0Sopenharmony_ciunum_format(    const    UNumberFormat*    fmt,
5117777dab0Sopenharmony_ci        int32_t            number,
5127777dab0Sopenharmony_ci        UChar*            result,
5137777dab0Sopenharmony_ci        int32_t            resultLength,
5147777dab0Sopenharmony_ci        UFieldPosition    *pos,
5157777dab0Sopenharmony_ci        UErrorCode*        status);
5167777dab0Sopenharmony_ci
5177777dab0Sopenharmony_ci/**
5187777dab0Sopenharmony_ci* Format an int64 using a UNumberFormat.
5197777dab0Sopenharmony_ci* The int64 will be formatted according to the UNumberFormat's locale.
5207777dab0Sopenharmony_ci* @param fmt The formatter to use.
5217777dab0Sopenharmony_ci* @param number The number to format.
5227777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If
5237777dab0Sopenharmony_ci* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength)
5247777dab0Sopenharmony_ci* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number
5257777dab0Sopenharmony_ci* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR.
5267777dab0Sopenharmony_ci* @param resultLength The maximum size of result.
5277777dab0Sopenharmony_ci* @param pos    A pointer to a UFieldPosition.  On input, position->field
5287777dab0Sopenharmony_ci* is read.  On output, position->beginIndex and position->endIndex indicate
5297777dab0Sopenharmony_ci* the beginning and ending indices of field number position->field, if such
5307777dab0Sopenharmony_ci* a field exists.  This parameter may be NULL, in which case no field
5317777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
5327777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated.
5337777dab0Sopenharmony_ci* @see unum_format
5347777dab0Sopenharmony_ci* @see unum_formatDouble
5357777dab0Sopenharmony_ci* @see unum_parse
5367777dab0Sopenharmony_ci* @see unum_parseInt64
5377777dab0Sopenharmony_ci* @see unum_parseDouble
5387777dab0Sopenharmony_ci* @see UFieldPosition
5397777dab0Sopenharmony_ci* @stable ICU 2.0
5407777dab0Sopenharmony_ci*/
5417777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
5427777dab0Sopenharmony_ciunum_formatInt64(const UNumberFormat *fmt,
5437777dab0Sopenharmony_ci        int64_t         number,
5447777dab0Sopenharmony_ci        UChar*          result,
5457777dab0Sopenharmony_ci        int32_t         resultLength,
5467777dab0Sopenharmony_ci        UFieldPosition *pos,
5477777dab0Sopenharmony_ci        UErrorCode*     status);
5487777dab0Sopenharmony_ci
5497777dab0Sopenharmony_ci/**
5507777dab0Sopenharmony_ci* Format a double using a UNumberFormat.
5517777dab0Sopenharmony_ci* The double will be formatted according to the UNumberFormat's locale.
5527777dab0Sopenharmony_ci* @param fmt The formatter to use.
5537777dab0Sopenharmony_ci* @param number The number to format.
5547777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If
5557777dab0Sopenharmony_ci* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength)
5567777dab0Sopenharmony_ci* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number
5577777dab0Sopenharmony_ci* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR.
5587777dab0Sopenharmony_ci* @param resultLength The maximum size of result.
5597777dab0Sopenharmony_ci* @param pos    A pointer to a UFieldPosition.  On input, position->field
5607777dab0Sopenharmony_ci* is read.  On output, position->beginIndex and position->endIndex indicate
5617777dab0Sopenharmony_ci* the beginning and ending indices of field number position->field, if such
5627777dab0Sopenharmony_ci* a field exists.  This parameter may be NULL, in which case no field
5637777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
5647777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated.
5657777dab0Sopenharmony_ci* @see unum_format
5667777dab0Sopenharmony_ci* @see unum_formatInt64
5677777dab0Sopenharmony_ci* @see unum_parse
5687777dab0Sopenharmony_ci* @see unum_parseInt64
5697777dab0Sopenharmony_ci* @see unum_parseDouble
5707777dab0Sopenharmony_ci* @see UFieldPosition
5717777dab0Sopenharmony_ci* @stable ICU 2.0
5727777dab0Sopenharmony_ci*/
5737777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
5747777dab0Sopenharmony_ciunum_formatDouble(    const    UNumberFormat*  fmt,
5757777dab0Sopenharmony_ci            double          number,
5767777dab0Sopenharmony_ci            UChar*          result,
5777777dab0Sopenharmony_ci            int32_t         resultLength,
5787777dab0Sopenharmony_ci            UFieldPosition  *pos, /* 0 if ignore */
5797777dab0Sopenharmony_ci            UErrorCode*     status);
5807777dab0Sopenharmony_ci
5817777dab0Sopenharmony_ci/**
5827777dab0Sopenharmony_ci* Format a double using a UNumberFormat according to the UNumberFormat's locale,
5837777dab0Sopenharmony_ci* and initialize a UFieldPositionIterator that enumerates the subcomponents of
5847777dab0Sopenharmony_ci* the resulting string.
5857777dab0Sopenharmony_ci*
5867777dab0Sopenharmony_ci* @param format
5877777dab0Sopenharmony_ci*          The formatter to use.
5887777dab0Sopenharmony_ci* @param number
5897777dab0Sopenharmony_ci*          The number to format.
5907777dab0Sopenharmony_ci* @param result
5917777dab0Sopenharmony_ci*          A pointer to a buffer to receive the NULL-terminated formatted
5927777dab0Sopenharmony_ci*          number. If the formatted number fits into dest but cannot be
5937777dab0Sopenharmony_ci*          NULL-terminated (length == resultLength) then the error code is set
5947777dab0Sopenharmony_ci*          to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't
5957777dab0Sopenharmony_ci*          fit into result then the error code is set to
5967777dab0Sopenharmony_ci*          U_BUFFER_OVERFLOW_ERROR.
5977777dab0Sopenharmony_ci* @param resultLength
5987777dab0Sopenharmony_ci*          The maximum size of result.
5997777dab0Sopenharmony_ci* @param fpositer
6007777dab0Sopenharmony_ci*          A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
6017777dab0Sopenharmony_ci*          (may be NULL if field position information is not needed, but in this
6027777dab0Sopenharmony_ci*          case it's preferable to use {@link #unum_formatDouble}). Iteration
6037777dab0Sopenharmony_ci*          information already present in the UFieldPositionIterator is deleted,
6047777dab0Sopenharmony_ci*          and the iterator is reset to apply to the fields in the formatted
6057777dab0Sopenharmony_ci*          string created by this function call. The field values and indexes
6067777dab0Sopenharmony_ci*          returned by {@link #ufieldpositer_next} represent fields denoted by
6077777dab0Sopenharmony_ci*          the UNumberFormatFields enum. Fields are not returned in a guaranteed
6087777dab0Sopenharmony_ci*          order. Fields cannot overlap, but they may nest. For example, 1234
6097777dab0Sopenharmony_ci*          could format as "1,234" which might consist of a grouping separator
6107777dab0Sopenharmony_ci*          field for ',' and an integer field encompassing the entire string.
6117777dab0Sopenharmony_ci* @param status
6127777dab0Sopenharmony_ci*          A pointer to an UErrorCode to receive any errors
6137777dab0Sopenharmony_ci* @return
6147777dab0Sopenharmony_ci*          The total buffer size needed; if greater than resultLength, the
6157777dab0Sopenharmony_ci*          output was truncated.
6167777dab0Sopenharmony_ci* @see unum_formatDouble
6177777dab0Sopenharmony_ci* @see unum_parse
6187777dab0Sopenharmony_ci* @see unum_parseDouble
6197777dab0Sopenharmony_ci* @see UFieldPositionIterator
6207777dab0Sopenharmony_ci* @see UNumberFormatFields
6217777dab0Sopenharmony_ci* @stable ICU 59
6227777dab0Sopenharmony_ci*/
6237777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
6247777dab0Sopenharmony_ciunum_formatDoubleForFields(const UNumberFormat* format,
6257777dab0Sopenharmony_ci                           double number,
6267777dab0Sopenharmony_ci                           UChar* result,
6277777dab0Sopenharmony_ci                           int32_t resultLength,
6287777dab0Sopenharmony_ci                           UFieldPositionIterator* fpositer,
6297777dab0Sopenharmony_ci                           UErrorCode* status);
6307777dab0Sopenharmony_ci
6317777dab0Sopenharmony_ci
6327777dab0Sopenharmony_ci/**
6337777dab0Sopenharmony_ci* Format a decimal number using a UNumberFormat.
6347777dab0Sopenharmony_ci* The number will be formatted according to the UNumberFormat's locale.
6357777dab0Sopenharmony_ci* The syntax of the input number is a "numeric string"
6367777dab0Sopenharmony_ci* as defined in the Decimal Arithmetic Specification, available at
6377777dab0Sopenharmony_ci* http://speleotrove.com/decimal
6387777dab0Sopenharmony_ci* @param fmt The formatter to use.
6397777dab0Sopenharmony_ci* @param number The number to format.
6407777dab0Sopenharmony_ci* @param length The length of the input number, or -1 if the input is nul-terminated.
6417777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If
6427777dab0Sopenharmony_ci* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength)
6437777dab0Sopenharmony_ci* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number
6447777dab0Sopenharmony_ci* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR.
6457777dab0Sopenharmony_ci* @param resultLength The maximum size of result.
6467777dab0Sopenharmony_ci* @param pos    A pointer to a UFieldPosition.  On input, position->field
6477777dab0Sopenharmony_ci*               is read.  On output, position->beginIndex and position->endIndex indicate
6487777dab0Sopenharmony_ci*               the beginning and ending indices of field number position->field, if such
6497777dab0Sopenharmony_ci*               a field exists.  This parameter may be NULL, in which case it is ignored.
6507777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
6517777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated.
6527777dab0Sopenharmony_ci* @see unum_format
6537777dab0Sopenharmony_ci* @see unum_formatInt64
6547777dab0Sopenharmony_ci* @see unum_parse
6557777dab0Sopenharmony_ci* @see unum_parseInt64
6567777dab0Sopenharmony_ci* @see unum_parseDouble
6577777dab0Sopenharmony_ci* @see UFieldPosition
6587777dab0Sopenharmony_ci* @stable ICU 4.4
6597777dab0Sopenharmony_ci*/
6607777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
6617777dab0Sopenharmony_ciunum_formatDecimal(    const    UNumberFormat*  fmt,
6627777dab0Sopenharmony_ci            const char *    number,
6637777dab0Sopenharmony_ci            int32_t         length,
6647777dab0Sopenharmony_ci            UChar*          result,
6657777dab0Sopenharmony_ci            int32_t         resultLength,
6667777dab0Sopenharmony_ci            UFieldPosition  *pos, /* 0 if ignore */
6677777dab0Sopenharmony_ci            UErrorCode*     status);
6687777dab0Sopenharmony_ci
6697777dab0Sopenharmony_ci/**
6707777dab0Sopenharmony_ci * Format a double currency amount using a UNumberFormat.
6717777dab0Sopenharmony_ci * The double will be formatted according to the UNumberFormat's locale.
6727777dab0Sopenharmony_ci *
6737777dab0Sopenharmony_ci * To format an exact decimal value with a currency, use
6747777dab0Sopenharmony_ci * `unum_setTextAttribute(UNUM_CURRENCY_CODE, ...)` followed by unum_formatDecimal.
6757777dab0Sopenharmony_ci * Your UNumberFormat must be created with the UNUM_CURRENCY style. Alternatively,
6767777dab0Sopenharmony_ci * consider using unumf_openForSkeletonAndLocale.
6777777dab0Sopenharmony_ci *
6787777dab0Sopenharmony_ci * @param fmt the formatter to use
6797777dab0Sopenharmony_ci * @param number the number to format
6807777dab0Sopenharmony_ci * @param currency the 3-letter null-terminated ISO 4217 currency code
6817777dab0Sopenharmony_ci * @param result A pointer to a buffer to receive the NULL-terminated formatted number. If
6827777dab0Sopenharmony_ci * the formatted number fits into dest but cannot be NULL-terminated (length == resultLength)
6837777dab0Sopenharmony_ci * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number
6847777dab0Sopenharmony_ci * doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR.
6857777dab0Sopenharmony_ci * @param resultLength the maximum number of UChars to write to result
6867777dab0Sopenharmony_ci * @param pos a pointer to a UFieldPosition.  On input,
6877777dab0Sopenharmony_ci * position->field is read.  On output, position->beginIndex and
6887777dab0Sopenharmony_ci * position->endIndex indicate the beginning and ending indices of
6897777dab0Sopenharmony_ci * field number position->field, if such a field exists.  This
6907777dab0Sopenharmony_ci * parameter may be NULL, in which case it is ignored.
6917777dab0Sopenharmony_ci * @param status a pointer to an input-output UErrorCode
6927777dab0Sopenharmony_ci * @return the total buffer size needed; if greater than resultLength,
6937777dab0Sopenharmony_ci * the output was truncated.
6947777dab0Sopenharmony_ci * @see unum_formatDouble
6957777dab0Sopenharmony_ci * @see unum_parseDoubleCurrency
6967777dab0Sopenharmony_ci * @see UFieldPosition
6977777dab0Sopenharmony_ci * @stable ICU 3.0
6987777dab0Sopenharmony_ci */
6997777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
7007777dab0Sopenharmony_ciunum_formatDoubleCurrency(const UNumberFormat* fmt,
7017777dab0Sopenharmony_ci                          double number,
7027777dab0Sopenharmony_ci                          UChar* currency,
7037777dab0Sopenharmony_ci                          UChar* result,
7047777dab0Sopenharmony_ci                          int32_t resultLength,
7057777dab0Sopenharmony_ci                          UFieldPosition* pos,
7067777dab0Sopenharmony_ci                          UErrorCode* status);
7077777dab0Sopenharmony_ci
7087777dab0Sopenharmony_ci/**
7097777dab0Sopenharmony_ci* Parse a string into an integer using a UNumberFormat.
7107777dab0Sopenharmony_ci* The string will be parsed according to the UNumberFormat's locale.
7117777dab0Sopenharmony_ci* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT
7127777dab0Sopenharmony_ci* and UNUM_DECIMAL_COMPACT_LONG.
7137777dab0Sopenharmony_ci* @param fmt The formatter to use.
7147777dab0Sopenharmony_ci* @param text The text to parse.
7157777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated.
7167777dab0Sopenharmony_ci* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
7177777dab0Sopenharmony_ci* to begin parsing.  If not NULL, on output the offset at which parsing ended.
7187777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
7197777dab0Sopenharmony_ci* @return The value of the parsed integer
7207777dab0Sopenharmony_ci* @see unum_parseInt64
7217777dab0Sopenharmony_ci* @see unum_parseDouble
7227777dab0Sopenharmony_ci* @see unum_format
7237777dab0Sopenharmony_ci* @see unum_formatInt64
7247777dab0Sopenharmony_ci* @see unum_formatDouble
7257777dab0Sopenharmony_ci* @stable ICU 2.0
7267777dab0Sopenharmony_ci*/
7277777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
7287777dab0Sopenharmony_ciunum_parse(    const   UNumberFormat*  fmt,
7297777dab0Sopenharmony_ci        const   UChar*          text,
7307777dab0Sopenharmony_ci        int32_t         textLength,
7317777dab0Sopenharmony_ci        int32_t         *parsePos /* 0 = start */,
7327777dab0Sopenharmony_ci        UErrorCode      *status);
7337777dab0Sopenharmony_ci
7347777dab0Sopenharmony_ci/**
7357777dab0Sopenharmony_ci* Parse a string into an int64 using a UNumberFormat.
7367777dab0Sopenharmony_ci* The string will be parsed according to the UNumberFormat's locale.
7377777dab0Sopenharmony_ci* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT
7387777dab0Sopenharmony_ci* and UNUM_DECIMAL_COMPACT_LONG.
7397777dab0Sopenharmony_ci* @param fmt The formatter to use.
7407777dab0Sopenharmony_ci* @param text The text to parse.
7417777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated.
7427777dab0Sopenharmony_ci* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
7437777dab0Sopenharmony_ci* to begin parsing.  If not NULL, on output the offset at which parsing ended.
7447777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
7457777dab0Sopenharmony_ci* @return The value of the parsed integer
7467777dab0Sopenharmony_ci* @see unum_parse
7477777dab0Sopenharmony_ci* @see unum_parseDouble
7487777dab0Sopenharmony_ci* @see unum_format
7497777dab0Sopenharmony_ci* @see unum_formatInt64
7507777dab0Sopenharmony_ci* @see unum_formatDouble
7517777dab0Sopenharmony_ci* @stable ICU 2.8
7527777dab0Sopenharmony_ci*/
7537777dab0Sopenharmony_ciU_CAPI int64_t U_EXPORT2
7547777dab0Sopenharmony_ciunum_parseInt64(const UNumberFormat*  fmt,
7557777dab0Sopenharmony_ci        const UChar*  text,
7567777dab0Sopenharmony_ci        int32_t       textLength,
7577777dab0Sopenharmony_ci        int32_t       *parsePos /* 0 = start */,
7587777dab0Sopenharmony_ci        UErrorCode    *status);
7597777dab0Sopenharmony_ci
7607777dab0Sopenharmony_ci/**
7617777dab0Sopenharmony_ci* Parse a string into a double using a UNumberFormat.
7627777dab0Sopenharmony_ci* The string will be parsed according to the UNumberFormat's locale.
7637777dab0Sopenharmony_ci* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT
7647777dab0Sopenharmony_ci* and UNUM_DECIMAL_COMPACT_LONG.
7657777dab0Sopenharmony_ci* @param fmt The formatter to use.
7667777dab0Sopenharmony_ci* @param text The text to parse.
7677777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated.
7687777dab0Sopenharmony_ci* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
7697777dab0Sopenharmony_ci* to begin parsing.  If not NULL, on output the offset at which parsing ended.
7707777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
7717777dab0Sopenharmony_ci* @return The value of the parsed double
7727777dab0Sopenharmony_ci* @see unum_parse
7737777dab0Sopenharmony_ci* @see unum_parseInt64
7747777dab0Sopenharmony_ci* @see unum_format
7757777dab0Sopenharmony_ci* @see unum_formatInt64
7767777dab0Sopenharmony_ci* @see unum_formatDouble
7777777dab0Sopenharmony_ci* @stable ICU 2.0
7787777dab0Sopenharmony_ci*/
7797777dab0Sopenharmony_ciU_CAPI double U_EXPORT2
7807777dab0Sopenharmony_ciunum_parseDouble(    const   UNumberFormat*  fmt,
7817777dab0Sopenharmony_ci            const   UChar*          text,
7827777dab0Sopenharmony_ci            int32_t         textLength,
7837777dab0Sopenharmony_ci            int32_t         *parsePos /* 0 = start */,
7847777dab0Sopenharmony_ci            UErrorCode      *status);
7857777dab0Sopenharmony_ci
7867777dab0Sopenharmony_ci
7877777dab0Sopenharmony_ci/**
7887777dab0Sopenharmony_ci* Parse a number from a string into an unformatted numeric string using a UNumberFormat.
7897777dab0Sopenharmony_ci* The input string will be parsed according to the UNumberFormat's locale.
7907777dab0Sopenharmony_ci* The syntax of the output is a "numeric string"
7917777dab0Sopenharmony_ci* as defined in the Decimal Arithmetic Specification, available at
7927777dab0Sopenharmony_ci* http://speleotrove.com/decimal
7937777dab0Sopenharmony_ci* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT
7947777dab0Sopenharmony_ci* and UNUM_DECIMAL_COMPACT_LONG.
7957777dab0Sopenharmony_ci* @param fmt The formatter to use.
7967777dab0Sopenharmony_ci* @param text The text to parse.
7977777dab0Sopenharmony_ci* @param textLength The length of text, or -1 if null-terminated.
7987777dab0Sopenharmony_ci* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which
7997777dab0Sopenharmony_ci*                 to begin parsing.  If not NULL, on output the offset at which parsing ended.
8007777dab0Sopenharmony_ci* @param outBuf A (char *) buffer to receive the parsed number as a string.  The output string
8017777dab0Sopenharmony_ci*               will be nul-terminated if there is sufficient space.
8027777dab0Sopenharmony_ci* @param outBufLength The size of the output buffer.  May be zero, in which case
8037777dab0Sopenharmony_ci*               the outBuf pointer may be NULL, and the function will return the
8047777dab0Sopenharmony_ci*               size of the output string.
8057777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
8067777dab0Sopenharmony_ci* @return the length of the output string, not including any terminating nul.
8077777dab0Sopenharmony_ci* @see unum_parse
8087777dab0Sopenharmony_ci* @see unum_parseInt64
8097777dab0Sopenharmony_ci* @see unum_format
8107777dab0Sopenharmony_ci* @see unum_formatInt64
8117777dab0Sopenharmony_ci* @see unum_formatDouble
8127777dab0Sopenharmony_ci* @stable ICU 4.4
8137777dab0Sopenharmony_ci*/
8147777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
8157777dab0Sopenharmony_ciunum_parseDecimal(const   UNumberFormat*  fmt,
8167777dab0Sopenharmony_ci                 const   UChar*          text,
8177777dab0Sopenharmony_ci                         int32_t         textLength,
8187777dab0Sopenharmony_ci                         int32_t         *parsePos /* 0 = start */,
8197777dab0Sopenharmony_ci                         char            *outBuf,
8207777dab0Sopenharmony_ci                         int32_t         outBufLength,
8217777dab0Sopenharmony_ci                         UErrorCode      *status);
8227777dab0Sopenharmony_ci
8237777dab0Sopenharmony_ci/**
8247777dab0Sopenharmony_ci * Parse a string into a double and a currency using a UNumberFormat.
8257777dab0Sopenharmony_ci * The string will be parsed according to the UNumberFormat's locale.
8267777dab0Sopenharmony_ci * @param fmt the formatter to use
8277777dab0Sopenharmony_ci * @param text the text to parse
8287777dab0Sopenharmony_ci * @param textLength the length of text, or -1 if null-terminated
8297777dab0Sopenharmony_ci * @param parsePos a pointer to an offset index into text at which to
8307777dab0Sopenharmony_ci * begin parsing. On output, *parsePos will point after the last
8317777dab0Sopenharmony_ci * parsed character.  This parameter may be NULL, in which case parsing
8327777dab0Sopenharmony_ci * begins at offset 0.
8337777dab0Sopenharmony_ci * @param currency a pointer to the buffer to receive the parsed null-
8347777dab0Sopenharmony_ci * terminated currency.  This buffer must have a capacity of at least
8357777dab0Sopenharmony_ci * 4 UChars.
8367777dab0Sopenharmony_ci * @param status a pointer to an input-output UErrorCode
8377777dab0Sopenharmony_ci * @return the parsed double
8387777dab0Sopenharmony_ci * @see unum_parseDouble
8397777dab0Sopenharmony_ci * @see unum_formatDoubleCurrency
8407777dab0Sopenharmony_ci * @stable ICU 3.0
8417777dab0Sopenharmony_ci */
8427777dab0Sopenharmony_ciU_CAPI double U_EXPORT2
8437777dab0Sopenharmony_ciunum_parseDoubleCurrency(const UNumberFormat* fmt,
8447777dab0Sopenharmony_ci                         const UChar* text,
8457777dab0Sopenharmony_ci                         int32_t textLength,
8467777dab0Sopenharmony_ci                         int32_t* parsePos, /* 0 = start */
8477777dab0Sopenharmony_ci                         UChar* currency,
8487777dab0Sopenharmony_ci                         UErrorCode* status);
8497777dab0Sopenharmony_ci
8507777dab0Sopenharmony_ci/**
8517777dab0Sopenharmony_ci * Set the pattern used by a UNumberFormat.  This can only be used
8527777dab0Sopenharmony_ci * on a DecimalFormat, other formats return U_UNSUPPORTED_ERROR
8537777dab0Sopenharmony_ci * in the status.
8547777dab0Sopenharmony_ci * @param format The formatter to set.
8557777dab0Sopenharmony_ci * @param localized true if the pattern is localized, false otherwise.
8567777dab0Sopenharmony_ci * @param pattern The new pattern
8577777dab0Sopenharmony_ci * @param patternLength The length of pattern, or -1 if null-terminated.
8587777dab0Sopenharmony_ci * @param parseError A pointer to UParseError to receive information
8597777dab0Sopenharmony_ci * about errors occurred during parsing, or NULL if no parse error
8607777dab0Sopenharmony_ci * information is desired.
8617777dab0Sopenharmony_ci * @param status A pointer to an input-output UErrorCode.
8627777dab0Sopenharmony_ci * @see unum_toPattern
8637777dab0Sopenharmony_ci * @see DecimalFormat
8647777dab0Sopenharmony_ci * @stable ICU 2.0
8657777dab0Sopenharmony_ci */
8667777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
8677777dab0Sopenharmony_ciunum_applyPattern(          UNumberFormat  *format,
8687777dab0Sopenharmony_ci                            UBool          localized,
8697777dab0Sopenharmony_ci                    const   UChar          *pattern,
8707777dab0Sopenharmony_ci                            int32_t         patternLength,
8717777dab0Sopenharmony_ci                            UParseError    *parseError,
8727777dab0Sopenharmony_ci                            UErrorCode     *status
8737777dab0Sopenharmony_ci                                    );
8747777dab0Sopenharmony_ci
8757777dab0Sopenharmony_ci/**
8767777dab0Sopenharmony_ci* Get a locale for which decimal formatting patterns are available.
8777777dab0Sopenharmony_ci* A UNumberFormat in a locale returned by this function will perform the correct
8787777dab0Sopenharmony_ci* formatting and parsing for the locale.  The results of this call are not
8797777dab0Sopenharmony_ci* valid for rule-based number formats.
8807777dab0Sopenharmony_ci* @param localeIndex The index of the desired locale.
8817777dab0Sopenharmony_ci* @return A locale for which number formatting patterns are available, or 0 if none.
8827777dab0Sopenharmony_ci* @see unum_countAvailable
8837777dab0Sopenharmony_ci* @stable ICU 2.0
8847777dab0Sopenharmony_ci*/
8857777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
8867777dab0Sopenharmony_ciunum_getAvailable(int32_t localeIndex);
8877777dab0Sopenharmony_ci
8887777dab0Sopenharmony_ci/**
8897777dab0Sopenharmony_ci* Determine how many locales have decimal formatting patterns available.  The
8907777dab0Sopenharmony_ci* results of this call are not valid for rule-based number formats.
8917777dab0Sopenharmony_ci* This function is useful for determining the loop ending condition for
8927777dab0Sopenharmony_ci* calls to {@link #unum_getAvailable }.
8937777dab0Sopenharmony_ci* @return The number of locales for which decimal formatting patterns are available.
8947777dab0Sopenharmony_ci* @see unum_getAvailable
8957777dab0Sopenharmony_ci* @stable ICU 2.0
8967777dab0Sopenharmony_ci*/
8977777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
8987777dab0Sopenharmony_ciunum_countAvailable(void);
8997777dab0Sopenharmony_ci
9007777dab0Sopenharmony_ci#if UCONFIG_HAVE_PARSEALLINPUT
9017777dab0Sopenharmony_ci/* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */
9027777dab0Sopenharmony_ci/**
9037777dab0Sopenharmony_ci * @internal
9047777dab0Sopenharmony_ci */
9057777dab0Sopenharmony_citypedef enum UNumberFormatAttributeValue {
9067777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API
9077777dab0Sopenharmony_ci  /** @internal */
9087777dab0Sopenharmony_ci  UNUM_NO = 0,
9097777dab0Sopenharmony_ci  /** @internal */
9107777dab0Sopenharmony_ci  UNUM_YES = 1,
9117777dab0Sopenharmony_ci  /** @internal */
9127777dab0Sopenharmony_ci  UNUM_MAYBE = 2
9137777dab0Sopenharmony_ci#else
9147777dab0Sopenharmony_ci  /** @internal */
9157777dab0Sopenharmony_ci  UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN
9167777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */
9177777dab0Sopenharmony_ci} UNumberFormatAttributeValue;
9187777dab0Sopenharmony_ci#endif
9197777dab0Sopenharmony_ci
9207777dab0Sopenharmony_ci/** The possible UNumberFormat numeric attributes @stable ICU 2.0 */
9217777dab0Sopenharmony_citypedef enum UNumberFormatAttribute {
9227777dab0Sopenharmony_ci  /** Parse integers only */
9237777dab0Sopenharmony_ci  UNUM_PARSE_INT_ONLY,
9247777dab0Sopenharmony_ci  /** Use grouping separator */
9257777dab0Sopenharmony_ci  UNUM_GROUPING_USED,
9267777dab0Sopenharmony_ci  /** Always show decimal point */
9277777dab0Sopenharmony_ci  UNUM_DECIMAL_ALWAYS_SHOWN,
9287777dab0Sopenharmony_ci  /** Maximum integer digits */
9297777dab0Sopenharmony_ci  UNUM_MAX_INTEGER_DIGITS,
9307777dab0Sopenharmony_ci  /** Minimum integer digits */
9317777dab0Sopenharmony_ci  UNUM_MIN_INTEGER_DIGITS,
9327777dab0Sopenharmony_ci  /** Integer digits */
9337777dab0Sopenharmony_ci  UNUM_INTEGER_DIGITS,
9347777dab0Sopenharmony_ci  /** Maximum fraction digits */
9357777dab0Sopenharmony_ci  UNUM_MAX_FRACTION_DIGITS,
9367777dab0Sopenharmony_ci  /** Minimum fraction digits */
9377777dab0Sopenharmony_ci  UNUM_MIN_FRACTION_DIGITS,
9387777dab0Sopenharmony_ci  /** Fraction digits */
9397777dab0Sopenharmony_ci  UNUM_FRACTION_DIGITS,
9407777dab0Sopenharmony_ci  /** Multiplier */
9417777dab0Sopenharmony_ci  UNUM_MULTIPLIER,
9427777dab0Sopenharmony_ci  /** Grouping size */
9437777dab0Sopenharmony_ci  UNUM_GROUPING_SIZE,
9447777dab0Sopenharmony_ci  /** Rounding Mode */
9457777dab0Sopenharmony_ci  UNUM_ROUNDING_MODE,
9467777dab0Sopenharmony_ci  /** Rounding increment */
9477777dab0Sopenharmony_ci  UNUM_ROUNDING_INCREMENT,
9487777dab0Sopenharmony_ci  /** The width to which the output of <code>format()</code> is padded. */
9497777dab0Sopenharmony_ci  UNUM_FORMAT_WIDTH,
9507777dab0Sopenharmony_ci  /** The position at which padding will take place. */
9517777dab0Sopenharmony_ci  UNUM_PADDING_POSITION,
9527777dab0Sopenharmony_ci  /** Secondary grouping size */
9537777dab0Sopenharmony_ci  UNUM_SECONDARY_GROUPING_SIZE,
9547777dab0Sopenharmony_ci  /** Use significant digits
9557777dab0Sopenharmony_ci   * @stable ICU 3.0 */
9567777dab0Sopenharmony_ci  UNUM_SIGNIFICANT_DIGITS_USED,
9577777dab0Sopenharmony_ci  /** Minimum significant digits
9587777dab0Sopenharmony_ci   * @stable ICU 3.0 */
9597777dab0Sopenharmony_ci  UNUM_MIN_SIGNIFICANT_DIGITS,
9607777dab0Sopenharmony_ci  /** Maximum significant digits
9617777dab0Sopenharmony_ci   * @stable ICU 3.0 */
9627777dab0Sopenharmony_ci  UNUM_MAX_SIGNIFICANT_DIGITS,
9637777dab0Sopenharmony_ci  /** Lenient parse mode used by rule-based formats.
9647777dab0Sopenharmony_ci   * @stable ICU 3.0
9657777dab0Sopenharmony_ci   */
9667777dab0Sopenharmony_ci  UNUM_LENIENT_PARSE,
9677777dab0Sopenharmony_ci#if UCONFIG_HAVE_PARSEALLINPUT
9687777dab0Sopenharmony_ci  /** Consume all input. (may use fastpath). Set to UNUM_YES (require fastpath), UNUM_NO (skip fastpath), or UNUM_MAYBE (heuristic).
9697777dab0Sopenharmony_ci   * This is an internal ICU API. Do not use.
9707777dab0Sopenharmony_ci   * @internal
9717777dab0Sopenharmony_ci   */
9727777dab0Sopenharmony_ci  UNUM_PARSE_ALL_INPUT = 20,
9737777dab0Sopenharmony_ci#endif
9747777dab0Sopenharmony_ci  /**
9757777dab0Sopenharmony_ci    * Scale, which adjusts the position of the
9767777dab0Sopenharmony_ci    * decimal point when formatting.  Amounts will be multiplied by 10 ^ (scale)
9777777dab0Sopenharmony_ci    * before they are formatted.  The default value for the scale is 0 ( no adjustment ).
9787777dab0Sopenharmony_ci    *
9797777dab0Sopenharmony_ci    * <p>Example: setting the scale to 3, 123 formats as "123,000"
9807777dab0Sopenharmony_ci    * <p>Example: setting the scale to -4, 123 formats as "0.0123"
9817777dab0Sopenharmony_ci    *
9827777dab0Sopenharmony_ci    * This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h.
9837777dab0Sopenharmony_ci    *
9847777dab0Sopenharmony_ci   * @stable ICU 51 */
9857777dab0Sopenharmony_ci  UNUM_SCALE = 21,
9867777dab0Sopenharmony_ci
9877777dab0Sopenharmony_ci  /**
9887777dab0Sopenharmony_ci   * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000".
9897777dab0Sopenharmony_ci   * See DecimalFormat::getMinimumGroupingDigits().
9907777dab0Sopenharmony_ci   *
9917777dab0Sopenharmony_ci   * For better control over grouping strategies, use UNumberFormatter.
9927777dab0Sopenharmony_ci   *
9937777dab0Sopenharmony_ci   * @stable ICU 64
9947777dab0Sopenharmony_ci   */
9957777dab0Sopenharmony_ci  UNUM_MINIMUM_GROUPING_DIGITS = 22,
9967777dab0Sopenharmony_ci
9977777dab0Sopenharmony_ci  /**
9987777dab0Sopenharmony_ci   * if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose,
9997777dab0Sopenharmony_ci   * otherwise it is UNUM_CASH_CURRENCY purpose
10007777dab0Sopenharmony_ci   * Default: 0 (UNUM_CURRENCY_STANDARD purpose)
10017777dab0Sopenharmony_ci   * @stable ICU 54
10027777dab0Sopenharmony_ci   */
10037777dab0Sopenharmony_ci  UNUM_CURRENCY_USAGE = 23,
10047777dab0Sopenharmony_ci
10057777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API
10067777dab0Sopenharmony_ci  /** One below the first bitfield-boolean item.
10077777dab0Sopenharmony_ci   * All items after this one are stored in boolean form.
10087777dab0Sopenharmony_ci   * @internal */
10097777dab0Sopenharmony_ci  UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF,
10107777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */
10117777dab0Sopenharmony_ci
10127777dab0Sopenharmony_ci  /** If 1, specifies that if setting the "max integer digits" attribute would truncate a value, set an error status rather than silently truncating.
10137777dab0Sopenharmony_ci   * For example,  formatting the value 1234 with 4 max int digits would succeed, but formatting 12345 would fail. There is no effect on parsing.
10147777dab0Sopenharmony_ci   * Default: 0 (not set)
10157777dab0Sopenharmony_ci   * @stable ICU 50
10167777dab0Sopenharmony_ci   */
10177777dab0Sopenharmony_ci  UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000,
10187777dab0Sopenharmony_ci  /**
10197777dab0Sopenharmony_ci   * if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent, the exponent will not be parsed. If the pattern does contain an exponent, this attribute has no effect.
10207777dab0Sopenharmony_ci   * Has no effect on formatting.
10217777dab0Sopenharmony_ci   * Default: 0 (unset)
10227777dab0Sopenharmony_ci   * @stable ICU 50
10237777dab0Sopenharmony_ci   */
10247777dab0Sopenharmony_ci  UNUM_PARSE_NO_EXPONENT = 0x1001,
10257777dab0Sopenharmony_ci
10267777dab0Sopenharmony_ci  /**
10277777dab0Sopenharmony_ci   * if this attribute is set to 1, specifies that, if the pattern contains a
10287777dab0Sopenharmony_ci   * decimal mark the input is required to have one. If this attribute is set to 0,
10297777dab0Sopenharmony_ci   * specifies that input does not have to contain a decimal mark.
10307777dab0Sopenharmony_ci   * Has no effect on formatting.
10317777dab0Sopenharmony_ci   * Default: 0 (unset)
10327777dab0Sopenharmony_ci   * @stable ICU 54
10337777dab0Sopenharmony_ci   */
10347777dab0Sopenharmony_ci  UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002,
10357777dab0Sopenharmony_ci
10367777dab0Sopenharmony_ci  /**
10377777dab0Sopenharmony_ci   * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase).
10387777dab0Sopenharmony_ci   *
10397777dab0Sopenharmony_ci   * @stable ICU 64
10407777dab0Sopenharmony_ci   */
10417777dab0Sopenharmony_ci  UNUM_PARSE_CASE_SENSITIVE = 0x1003,
10427777dab0Sopenharmony_ci
10437777dab0Sopenharmony_ci  /**
10447777dab0Sopenharmony_ci   * Formatting: if set to 1, whether to show the plus sign on non-negative numbers.
10457777dab0Sopenharmony_ci   *
10467777dab0Sopenharmony_ci   * For better control over sign display, use UNumberFormatter.
10477777dab0Sopenharmony_ci   *
10487777dab0Sopenharmony_ci   * @stable ICU 64
10497777dab0Sopenharmony_ci   */
10507777dab0Sopenharmony_ci  UNUM_SIGN_ALWAYS_SHOWN = 0x1004,
10517777dab0Sopenharmony_ci
10527777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API
10537777dab0Sopenharmony_ci  /** Limit of boolean attributes. (value should
10547777dab0Sopenharmony_ci   * not depend on U_HIDE conditionals)
10557777dab0Sopenharmony_ci   * @internal */
10567777dab0Sopenharmony_ci  UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005,
10577777dab0Sopenharmony_ci#endif /* U_HIDE_INTERNAL_API */
10587777dab0Sopenharmony_ci
10597777dab0Sopenharmony_ci} UNumberFormatAttribute;
10607777dab0Sopenharmony_ci
10617777dab0Sopenharmony_ci/**
10627777dab0Sopenharmony_ci* Get a numeric attribute associated with a UNumberFormat.
10637777dab0Sopenharmony_ci* An example of a numeric attribute is the number of integer digits a formatter will produce.
10647777dab0Sopenharmony_ci* @param fmt The formatter to query.
10657777dab0Sopenharmony_ci* @param attr The attribute to query; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED,
10667777dab0Sopenharmony_ci* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS,
10677777dab0Sopenharmony_ci* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER,
10687777dab0Sopenharmony_ci* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE,
10697777dab0Sopenharmony_ci* UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS.
10707777dab0Sopenharmony_ci* @return The value of attr, or -1 if the formatter doesn't have the requested attribute.  The caller should use unum_hasAttribute() to tell if the attribute
10717777dab0Sopenharmony_ci* is available, rather than relaying on this function returning -1.
10727777dab0Sopenharmony_ci* @see unum_hasAttribute
10737777dab0Sopenharmony_ci* @see unum_setAttribute
10747777dab0Sopenharmony_ci* @see unum_getDoubleAttribute
10757777dab0Sopenharmony_ci* @see unum_setDoubleAttribute
10767777dab0Sopenharmony_ci* @stable ICU 2.0
10777777dab0Sopenharmony_ci*/
10787777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
10797777dab0Sopenharmony_ciunum_getAttribute(const UNumberFormat*          fmt,
10807777dab0Sopenharmony_ci          UNumberFormatAttribute  attr);
10817777dab0Sopenharmony_ci
10827777dab0Sopenharmony_ci/**
10837777dab0Sopenharmony_ci* Set a numeric attribute associated with a UNumberFormat.
10847777dab0Sopenharmony_ci* An example of a numeric attribute is the number of integer digits a formatter will produce.  If the
10857777dab0Sopenharmony_ci* formatter does not understand the attribute, the call is ignored.  Rule-based formatters only understand
10867777dab0Sopenharmony_ci* the lenient-parse attribute.  The caller can use unum_hasAttribute() to find out if the formatter supports the attribute.
10877777dab0Sopenharmony_ci* @param fmt The formatter to set.
10887777dab0Sopenharmony_ci* @param attr The attribute to set; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED,
10897777dab0Sopenharmony_ci* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS,
10907777dab0Sopenharmony_ci* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER,
10917777dab0Sopenharmony_ci* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE,
10927777dab0Sopenharmony_ci* UNUM_LENIENT_PARSE, UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS.
10937777dab0Sopenharmony_ci* @param newValue The new value of attr.
10947777dab0Sopenharmony_ci* @see unum_hasAttribute
10957777dab0Sopenharmony_ci* @see unum_getAttribute
10967777dab0Sopenharmony_ci* @see unum_getDoubleAttribute
10977777dab0Sopenharmony_ci* @see unum_setDoubleAttribute
10987777dab0Sopenharmony_ci* @see unum_getTextAttribute
10997777dab0Sopenharmony_ci* @see unum_setTextAttribute
11007777dab0Sopenharmony_ci* @stable ICU 2.0
11017777dab0Sopenharmony_ci*/
11027777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
11037777dab0Sopenharmony_ciunum_setAttribute(    UNumberFormat*          fmt,
11047777dab0Sopenharmony_ci            UNumberFormatAttribute  attr,
11057777dab0Sopenharmony_ci            int32_t                 newValue);
11067777dab0Sopenharmony_ci
11077777dab0Sopenharmony_ci
11087777dab0Sopenharmony_ci/**
11097777dab0Sopenharmony_ci* Get a numeric attribute associated with a UNumberFormat.
11107777dab0Sopenharmony_ci* An example of a numeric attribute is the number of integer digits a formatter will produce.
11117777dab0Sopenharmony_ci* If the formatter does not understand the attribute, -1 is returned.  The caller should use unum_hasAttribute()
11127777dab0Sopenharmony_ci* to determine if the attribute is supported, rather than relying on this function returning -1.
11137777dab0Sopenharmony_ci* @param fmt The formatter to query.
11147777dab0Sopenharmony_ci* @param attr The attribute to query; e.g. UNUM_ROUNDING_INCREMENT.
11157777dab0Sopenharmony_ci* @return The value of attr, or -1 if the formatter doesn't understand the attribute.
11167777dab0Sopenharmony_ci* @see unum_hasAttribute
11177777dab0Sopenharmony_ci* @see unum_getAttribute
11187777dab0Sopenharmony_ci* @see unum_setAttribute
11197777dab0Sopenharmony_ci* @see unum_setDoubleAttribute
11207777dab0Sopenharmony_ci* @see unum_getTextAttribute
11217777dab0Sopenharmony_ci* @see unum_setTextAttribute
11227777dab0Sopenharmony_ci* @stable ICU 2.0
11237777dab0Sopenharmony_ci*/
11247777dab0Sopenharmony_ciU_CAPI double U_EXPORT2
11257777dab0Sopenharmony_ciunum_getDoubleAttribute(const UNumberFormat*          fmt,
11267777dab0Sopenharmony_ci          UNumberFormatAttribute  attr);
11277777dab0Sopenharmony_ci
11287777dab0Sopenharmony_ci/**
11297777dab0Sopenharmony_ci* Set a numeric attribute associated with a UNumberFormat.
11307777dab0Sopenharmony_ci* An example of a numeric attribute is the number of integer digits a formatter will produce.
11317777dab0Sopenharmony_ci* If the formatter does not understand the attribute, this call is ignored.  The caller can use
11327777dab0Sopenharmony_ci* unum_hasAttribute() to tell in advance whether the formatter understands the attribute.
11337777dab0Sopenharmony_ci* @param fmt The formatter to set.
11347777dab0Sopenharmony_ci* @param attr The attribute to set; e.g. UNUM_ROUNDING_INCREMENT.
11357777dab0Sopenharmony_ci* @param newValue The new value of attr.
11367777dab0Sopenharmony_ci* @see unum_hasAttribute
11377777dab0Sopenharmony_ci* @see unum_getAttribute
11387777dab0Sopenharmony_ci* @see unum_setAttribute
11397777dab0Sopenharmony_ci* @see unum_getDoubleAttribute
11407777dab0Sopenharmony_ci* @see unum_getTextAttribute
11417777dab0Sopenharmony_ci* @see unum_setTextAttribute
11427777dab0Sopenharmony_ci* @stable ICU 2.0
11437777dab0Sopenharmony_ci*/
11447777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
11457777dab0Sopenharmony_ciunum_setDoubleAttribute(    UNumberFormat*          fmt,
11467777dab0Sopenharmony_ci            UNumberFormatAttribute  attr,
11477777dab0Sopenharmony_ci            double                 newValue);
11487777dab0Sopenharmony_ci
11497777dab0Sopenharmony_ci/** The possible UNumberFormat text attributes @stable ICU 2.0*/
11507777dab0Sopenharmony_citypedef enum UNumberFormatTextAttribute {
11517777dab0Sopenharmony_ci  /** Positive prefix */
11527777dab0Sopenharmony_ci  UNUM_POSITIVE_PREFIX,
11537777dab0Sopenharmony_ci  /** Positive suffix */
11547777dab0Sopenharmony_ci  UNUM_POSITIVE_SUFFIX,
11557777dab0Sopenharmony_ci  /** Negative prefix */
11567777dab0Sopenharmony_ci  UNUM_NEGATIVE_PREFIX,
11577777dab0Sopenharmony_ci  /** Negative suffix */
11587777dab0Sopenharmony_ci  UNUM_NEGATIVE_SUFFIX,
11597777dab0Sopenharmony_ci  /** The character used to pad to the format width. */
11607777dab0Sopenharmony_ci  UNUM_PADDING_CHARACTER,
11617777dab0Sopenharmony_ci  /** The ISO currency code */
11627777dab0Sopenharmony_ci  UNUM_CURRENCY_CODE,
11637777dab0Sopenharmony_ci  /**
11647777dab0Sopenharmony_ci   * The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:",
11657777dab0Sopenharmony_ci   * "%spellout-ordinal-masculine-plural:", "%spellout-ordinal-feminine:", or
11667777dab0Sopenharmony_ci   * "%spellout-ordinal-neuter:". The available public rulesets can be listed using
11677777dab0Sopenharmony_ci   * unum_getTextAttribute with UNUM_PUBLIC_RULESETS. This is only available with
11687777dab0Sopenharmony_ci   * rule-based formatters.
11697777dab0Sopenharmony_ci   * @stable ICU 3.0
11707777dab0Sopenharmony_ci   */
11717777dab0Sopenharmony_ci  UNUM_DEFAULT_RULESET,
11727777dab0Sopenharmony_ci  /**
11737777dab0Sopenharmony_ci   * The public rule sets.  This is only available with rule-based formatters.
11747777dab0Sopenharmony_ci   * This is a read-only attribute.  The public rulesets are returned as a
11757777dab0Sopenharmony_ci   * single string, with each ruleset name delimited by ';' (semicolon). See the
11767777dab0Sopenharmony_ci   * CLDR LDML spec for more information about RBNF rulesets:
11777777dab0Sopenharmony_ci   * http://www.unicode.org/reports/tr35/tr35-numbers.html#Rule-Based_Number_Formatting
11787777dab0Sopenharmony_ci   * @stable ICU 3.0
11797777dab0Sopenharmony_ci   */
11807777dab0Sopenharmony_ci  UNUM_PUBLIC_RULESETS
11817777dab0Sopenharmony_ci} UNumberFormatTextAttribute;
11827777dab0Sopenharmony_ci
11837777dab0Sopenharmony_ci/**
11847777dab0Sopenharmony_ci* Get a text attribute associated with a UNumberFormat.
11857777dab0Sopenharmony_ci* An example of a text attribute is the suffix for positive numbers.  If the formatter
11867777dab0Sopenharmony_ci* does not understand the attribute, U_UNSUPPORTED_ERROR is returned as the status.
11877777dab0Sopenharmony_ci* Rule-based formatters only understand UNUM_DEFAULT_RULESET and UNUM_PUBLIC_RULESETS.
11887777dab0Sopenharmony_ci* @param fmt The formatter to query.
11897777dab0Sopenharmony_ci* @param tag The attribute to query; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX,
11907777dab0Sopenharmony_ci* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE,
11917777dab0Sopenharmony_ci* UNUM_DEFAULT_RULESET, or UNUM_PUBLIC_RULESETS.
11927777dab0Sopenharmony_ci* @param result A pointer to a buffer to receive the attribute.
11937777dab0Sopenharmony_ci* @param resultLength The maximum size of result.
11947777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
11957777dab0Sopenharmony_ci* @return The total buffer size needed; if greater than resultLength, the output was truncated.
11967777dab0Sopenharmony_ci* @see unum_setTextAttribute
11977777dab0Sopenharmony_ci* @see unum_getAttribute
11987777dab0Sopenharmony_ci* @see unum_setAttribute
11997777dab0Sopenharmony_ci* @stable ICU 2.0
12007777dab0Sopenharmony_ci*/
12017777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
12027777dab0Sopenharmony_ciunum_getTextAttribute(    const    UNumberFormat*                    fmt,
12037777dab0Sopenharmony_ci            UNumberFormatTextAttribute      tag,
12047777dab0Sopenharmony_ci            UChar*                            result,
12057777dab0Sopenharmony_ci            int32_t                            resultLength,
12067777dab0Sopenharmony_ci            UErrorCode*                        status);
12077777dab0Sopenharmony_ci
12087777dab0Sopenharmony_ci/**
12097777dab0Sopenharmony_ci* Set a text attribute associated with a UNumberFormat.
12107777dab0Sopenharmony_ci* An example of a text attribute is the suffix for positive numbers.  Rule-based formatters
12117777dab0Sopenharmony_ci* only understand UNUM_DEFAULT_RULESET.
12127777dab0Sopenharmony_ci* @param fmt The formatter to set.
12137777dab0Sopenharmony_ci* @param tag The attribute to set; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX,
12147777dab0Sopenharmony_ci* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE,
12157777dab0Sopenharmony_ci* or UNUM_DEFAULT_RULESET.
12167777dab0Sopenharmony_ci* @param newValue The new value of attr.
12177777dab0Sopenharmony_ci* @param newValueLength The length of newValue, or -1 if null-terminated.
12187777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
12197777dab0Sopenharmony_ci* @see unum_getTextAttribute
12207777dab0Sopenharmony_ci* @see unum_getAttribute
12217777dab0Sopenharmony_ci* @see unum_setAttribute
12227777dab0Sopenharmony_ci* @stable ICU 2.0
12237777dab0Sopenharmony_ci*/
12247777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
12257777dab0Sopenharmony_ciunum_setTextAttribute(    UNumberFormat*                    fmt,
12267777dab0Sopenharmony_ci            UNumberFormatTextAttribute      tag,
12277777dab0Sopenharmony_ci            const    UChar*                            newValue,
12287777dab0Sopenharmony_ci            int32_t                            newValueLength,
12297777dab0Sopenharmony_ci            UErrorCode                        *status);
12307777dab0Sopenharmony_ci
12317777dab0Sopenharmony_ci/**
12327777dab0Sopenharmony_ci * Extract the pattern from a UNumberFormat.  The pattern will follow
12337777dab0Sopenharmony_ci * the DecimalFormat pattern syntax.
12347777dab0Sopenharmony_ci * @param fmt The formatter to query.
12357777dab0Sopenharmony_ci * @param isPatternLocalized true if the pattern should be localized,
12367777dab0Sopenharmony_ci * false otherwise.  This is ignored if the formatter is a rule-based
12377777dab0Sopenharmony_ci * formatter.
12387777dab0Sopenharmony_ci * @param result A pointer to a buffer to receive the pattern.
12397777dab0Sopenharmony_ci * @param resultLength The maximum size of result.
12407777dab0Sopenharmony_ci * @param status A pointer to an input-output UErrorCode.
12417777dab0Sopenharmony_ci * @return The total buffer size needed; if greater than resultLength,
12427777dab0Sopenharmony_ci * the output was truncated.
12437777dab0Sopenharmony_ci * @see unum_applyPattern
12447777dab0Sopenharmony_ci * @see DecimalFormat
12457777dab0Sopenharmony_ci * @stable ICU 2.0
12467777dab0Sopenharmony_ci */
12477777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
12487777dab0Sopenharmony_ciunum_toPattern(    const    UNumberFormat*          fmt,
12497777dab0Sopenharmony_ci        UBool                  isPatternLocalized,
12507777dab0Sopenharmony_ci        UChar*                  result,
12517777dab0Sopenharmony_ci        int32_t                 resultLength,
12527777dab0Sopenharmony_ci        UErrorCode*             status);
12537777dab0Sopenharmony_ci
12547777dab0Sopenharmony_ci
12557777dab0Sopenharmony_ci/**
12567777dab0Sopenharmony_ci * Constants for specifying a number format symbol.
12577777dab0Sopenharmony_ci * @stable ICU 2.0
12587777dab0Sopenharmony_ci */
12597777dab0Sopenharmony_citypedef enum UNumberFormatSymbol {
12607777dab0Sopenharmony_ci  /** The decimal separator */
12617777dab0Sopenharmony_ci  UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
12627777dab0Sopenharmony_ci  /** The grouping separator */
12637777dab0Sopenharmony_ci  UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
12647777dab0Sopenharmony_ci  /** The pattern separator */
12657777dab0Sopenharmony_ci  UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
12667777dab0Sopenharmony_ci  /** The percent sign */
12677777dab0Sopenharmony_ci  UNUM_PERCENT_SYMBOL = 3,
12687777dab0Sopenharmony_ci  /** Zero*/
12697777dab0Sopenharmony_ci  UNUM_ZERO_DIGIT_SYMBOL = 4,
12707777dab0Sopenharmony_ci  /** Character representing a digit in the pattern */
12717777dab0Sopenharmony_ci  UNUM_DIGIT_SYMBOL = 5,
12727777dab0Sopenharmony_ci  /** The minus sign */
12737777dab0Sopenharmony_ci  UNUM_MINUS_SIGN_SYMBOL = 6,
12747777dab0Sopenharmony_ci  /** The plus sign */
12757777dab0Sopenharmony_ci  UNUM_PLUS_SIGN_SYMBOL = 7,
12767777dab0Sopenharmony_ci  /** The currency symbol */
12777777dab0Sopenharmony_ci  UNUM_CURRENCY_SYMBOL = 8,
12787777dab0Sopenharmony_ci  /** The international currency symbol */
12797777dab0Sopenharmony_ci  UNUM_INTL_CURRENCY_SYMBOL = 9,
12807777dab0Sopenharmony_ci  /** The monetary separator */
12817777dab0Sopenharmony_ci  UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
12827777dab0Sopenharmony_ci  /** The exponential symbol */
12837777dab0Sopenharmony_ci  UNUM_EXPONENTIAL_SYMBOL = 11,
12847777dab0Sopenharmony_ci  /** Per mill symbol */
12857777dab0Sopenharmony_ci  UNUM_PERMILL_SYMBOL = 12,
12867777dab0Sopenharmony_ci  /** Escape padding character */
12877777dab0Sopenharmony_ci  UNUM_PAD_ESCAPE_SYMBOL = 13,
12887777dab0Sopenharmony_ci  /** Infinity symbol */
12897777dab0Sopenharmony_ci  UNUM_INFINITY_SYMBOL = 14,
12907777dab0Sopenharmony_ci  /** Nan symbol */
12917777dab0Sopenharmony_ci  UNUM_NAN_SYMBOL = 15,
12927777dab0Sopenharmony_ci  /** Significant digit symbol
12937777dab0Sopenharmony_ci   * @stable ICU 3.0 */
12947777dab0Sopenharmony_ci  UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
12957777dab0Sopenharmony_ci  /** The monetary grouping separator
12967777dab0Sopenharmony_ci   * @stable ICU 3.6
12977777dab0Sopenharmony_ci   */
12987777dab0Sopenharmony_ci  UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
12997777dab0Sopenharmony_ci  /** One
13007777dab0Sopenharmony_ci   * @stable ICU 4.6
13017777dab0Sopenharmony_ci   */
13027777dab0Sopenharmony_ci  UNUM_ONE_DIGIT_SYMBOL = 18,
13037777dab0Sopenharmony_ci  /** Two
13047777dab0Sopenharmony_ci   * @stable ICU 4.6
13057777dab0Sopenharmony_ci   */
13067777dab0Sopenharmony_ci  UNUM_TWO_DIGIT_SYMBOL = 19,
13077777dab0Sopenharmony_ci  /** Three
13087777dab0Sopenharmony_ci   * @stable ICU 4.6
13097777dab0Sopenharmony_ci   */
13107777dab0Sopenharmony_ci  UNUM_THREE_DIGIT_SYMBOL = 20,
13117777dab0Sopenharmony_ci  /** Four
13127777dab0Sopenharmony_ci   * @stable ICU 4.6
13137777dab0Sopenharmony_ci   */
13147777dab0Sopenharmony_ci  UNUM_FOUR_DIGIT_SYMBOL = 21,
13157777dab0Sopenharmony_ci  /** Five
13167777dab0Sopenharmony_ci   * @stable ICU 4.6
13177777dab0Sopenharmony_ci   */
13187777dab0Sopenharmony_ci  UNUM_FIVE_DIGIT_SYMBOL = 22,
13197777dab0Sopenharmony_ci  /** Six
13207777dab0Sopenharmony_ci   * @stable ICU 4.6
13217777dab0Sopenharmony_ci   */
13227777dab0Sopenharmony_ci  UNUM_SIX_DIGIT_SYMBOL = 23,
13237777dab0Sopenharmony_ci  /** Seven
13247777dab0Sopenharmony_ci    * @stable ICU 4.6
13257777dab0Sopenharmony_ci   */
13267777dab0Sopenharmony_ci  UNUM_SEVEN_DIGIT_SYMBOL = 24,
13277777dab0Sopenharmony_ci  /** Eight
13287777dab0Sopenharmony_ci   * @stable ICU 4.6
13297777dab0Sopenharmony_ci   */
13307777dab0Sopenharmony_ci  UNUM_EIGHT_DIGIT_SYMBOL = 25,
13317777dab0Sopenharmony_ci  /** Nine
13327777dab0Sopenharmony_ci   * @stable ICU 4.6
13337777dab0Sopenharmony_ci   */
13347777dab0Sopenharmony_ci  UNUM_NINE_DIGIT_SYMBOL = 26,
13357777dab0Sopenharmony_ci
13367777dab0Sopenharmony_ci  /** Multiplication sign
13377777dab0Sopenharmony_ci   * @stable ICU 54
13387777dab0Sopenharmony_ci   */
13397777dab0Sopenharmony_ci  UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27
13407777dab0Sopenharmony_ci} UNumberFormatSymbol;
13417777dab0Sopenharmony_ci
13427777dab0Sopenharmony_ci/**
13437777dab0Sopenharmony_ci* Get a symbol associated with a UNumberFormat.
13447777dab0Sopenharmony_ci* A UNumberFormat uses symbols to represent the special locale-dependent
13457777dab0Sopenharmony_ci* characters in a number, for example the percent sign. This API is not
13467777dab0Sopenharmony_ci* supported for rule-based formatters.
13477777dab0Sopenharmony_ci* @param fmt The formatter to query.
13487777dab0Sopenharmony_ci* @param symbol The UNumberFormatSymbol constant for the symbol to get
13497777dab0Sopenharmony_ci* @param buffer The string buffer that will receive the symbol string;
13507777dab0Sopenharmony_ci*               if it is NULL, then only the length of the symbol is returned
13517777dab0Sopenharmony_ci* @param size The size of the string buffer
13527777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors
13537777dab0Sopenharmony_ci* @return The length of the symbol; the buffer is not modified if
13547777dab0Sopenharmony_ci*         <code>length&gt;=size</code>
13557777dab0Sopenharmony_ci* @see unum_setSymbol
13567777dab0Sopenharmony_ci* @stable ICU 2.0
13577777dab0Sopenharmony_ci*/
13587777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
13597777dab0Sopenharmony_ciunum_getSymbol(const UNumberFormat *fmt,
13607777dab0Sopenharmony_ci               UNumberFormatSymbol symbol,
13617777dab0Sopenharmony_ci               UChar *buffer,
13627777dab0Sopenharmony_ci               int32_t size,
13637777dab0Sopenharmony_ci               UErrorCode *status);
13647777dab0Sopenharmony_ci
13657777dab0Sopenharmony_ci/**
13667777dab0Sopenharmony_ci* Set a symbol associated with a UNumberFormat.
13677777dab0Sopenharmony_ci* A UNumberFormat uses symbols to represent the special locale-dependent
13687777dab0Sopenharmony_ci* characters in a number, for example the percent sign.  This API is not
13697777dab0Sopenharmony_ci* supported for rule-based formatters.
13707777dab0Sopenharmony_ci* @param fmt The formatter to set.
13717777dab0Sopenharmony_ci* @param symbol The UNumberFormatSymbol constant for the symbol to set
13727777dab0Sopenharmony_ci* @param value The string to set the symbol to
13737777dab0Sopenharmony_ci* @param length The length of the string, or -1 for a zero-terminated string
13747777dab0Sopenharmony_ci* @param status A pointer to an UErrorCode to receive any errors.
13757777dab0Sopenharmony_ci* @see unum_getSymbol
13767777dab0Sopenharmony_ci* @stable ICU 2.0
13777777dab0Sopenharmony_ci*/
13787777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
13797777dab0Sopenharmony_ciunum_setSymbol(UNumberFormat *fmt,
13807777dab0Sopenharmony_ci               UNumberFormatSymbol symbol,
13817777dab0Sopenharmony_ci               const UChar *value,
13827777dab0Sopenharmony_ci               int32_t length,
13837777dab0Sopenharmony_ci               UErrorCode *status);
13847777dab0Sopenharmony_ci
13857777dab0Sopenharmony_ci
13867777dab0Sopenharmony_ci/**
13877777dab0Sopenharmony_ci * Get the locale for this number format object.
13887777dab0Sopenharmony_ci * You can choose between valid and actual locale.
13897777dab0Sopenharmony_ci * @param fmt The formatter to get the locale from
13907777dab0Sopenharmony_ci * @param type type of the locale we're looking for (valid or actual)
13917777dab0Sopenharmony_ci * @param status error code for the operation
13927777dab0Sopenharmony_ci * @return the locale name
13937777dab0Sopenharmony_ci * @stable ICU 2.8
13947777dab0Sopenharmony_ci */
13957777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
13967777dab0Sopenharmony_ciunum_getLocaleByType(const UNumberFormat *fmt,
13977777dab0Sopenharmony_ci                     ULocDataLocaleType type,
13987777dab0Sopenharmony_ci                     UErrorCode* status);
13997777dab0Sopenharmony_ci
14007777dab0Sopenharmony_ci/**
14017777dab0Sopenharmony_ci * Set a particular UDisplayContext value in the formatter, such as
14027777dab0Sopenharmony_ci * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
14037777dab0Sopenharmony_ci * @param fmt The formatter for which to set a UDisplayContext value.
14047777dab0Sopenharmony_ci * @param value The UDisplayContext value to set.
14057777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors
14067777dab0Sopenharmony_ci * @stable ICU 53
14077777dab0Sopenharmony_ci */
14087777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
14097777dab0Sopenharmony_ciunum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status);
14107777dab0Sopenharmony_ci
14117777dab0Sopenharmony_ci/**
14127777dab0Sopenharmony_ci * Get the formatter's UDisplayContext value for the specified UDisplayContextType,
14137777dab0Sopenharmony_ci * such as UDISPCTX_TYPE_CAPITALIZATION.
14147777dab0Sopenharmony_ci * @param fmt The formatter to query.
14157777dab0Sopenharmony_ci * @param type The UDisplayContextType whose value to return
14167777dab0Sopenharmony_ci * @param status A pointer to an UErrorCode to receive any errors
14177777dab0Sopenharmony_ci * @return The UDisplayContextValue for the specified type.
14187777dab0Sopenharmony_ci * @stable ICU 53
14197777dab0Sopenharmony_ci */
14207777dab0Sopenharmony_ciU_CAPI UDisplayContext U_EXPORT2
14217777dab0Sopenharmony_ciunum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status);
14227777dab0Sopenharmony_ci
14237777dab0Sopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */
14247777dab0Sopenharmony_ci
14257777dab0Sopenharmony_ci#endif
1426