xref: /aosp_15_r20/external/icu/libicu/cts_headers/unicode/decimfmt.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker ********************************************************************************
5*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 1997-2016, International Business Machines
6*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker ********************************************************************************
8*0e209d39SAndroid Build Coastguard Worker *
9*0e209d39SAndroid Build Coastguard Worker * File DECIMFMT.H
10*0e209d39SAndroid Build Coastguard Worker *
11*0e209d39SAndroid Build Coastguard Worker * Modification History:
12*0e209d39SAndroid Build Coastguard Worker *
13*0e209d39SAndroid Build Coastguard Worker *   Date        Name        Description
14*0e209d39SAndroid Build Coastguard Worker *   02/19/97    aliu        Converted from java.
15*0e209d39SAndroid Build Coastguard Worker *   03/20/97    clhuang     Updated per C++ implementation.
16*0e209d39SAndroid Build Coastguard Worker *   04/03/97    aliu        Rewrote parsing and formatting completely, and
17*0e209d39SAndroid Build Coastguard Worker *                           cleaned up and debugged.  Actually works now.
18*0e209d39SAndroid Build Coastguard Worker *   04/17/97    aliu        Changed DigitCount to int per code review.
19*0e209d39SAndroid Build Coastguard Worker *   07/10/97    helena      Made ParsePosition a class and get rid of the function
20*0e209d39SAndroid Build Coastguard Worker *                           hiding problems.
21*0e209d39SAndroid Build Coastguard Worker *   09/09/97    aliu        Ported over support for exponential formats.
22*0e209d39SAndroid Build Coastguard Worker *   07/20/98    stephen     Changed documentation
23*0e209d39SAndroid Build Coastguard Worker *   01/30/13    emmons      Added Scaling methods
24*0e209d39SAndroid Build Coastguard Worker ********************************************************************************
25*0e209d39SAndroid Build Coastguard Worker */
26*0e209d39SAndroid Build Coastguard Worker 
27*0e209d39SAndroid Build Coastguard Worker #ifndef DECIMFMT_H
28*0e209d39SAndroid Build Coastguard Worker #define DECIMFMT_H
29*0e209d39SAndroid Build Coastguard Worker 
30*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
31*0e209d39SAndroid Build Coastguard Worker 
32*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API
33*0e209d39SAndroid Build Coastguard Worker 
34*0e209d39SAndroid Build Coastguard Worker /**
35*0e209d39SAndroid Build Coastguard Worker  * \file
36*0e209d39SAndroid Build Coastguard Worker  * \brief C++ API: Compatibility APIs for decimal formatting.
37*0e209d39SAndroid Build Coastguard Worker  */
38*0e209d39SAndroid Build Coastguard Worker 
39*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING
40*0e209d39SAndroid Build Coastguard Worker 
41*0e209d39SAndroid Build Coastguard Worker #include "unicode/dcfmtsym.h"
42*0e209d39SAndroid Build Coastguard Worker #include "unicode/numfmt.h"
43*0e209d39SAndroid Build Coastguard Worker #include "unicode/locid.h"
44*0e209d39SAndroid Build Coastguard Worker #include "unicode/fpositer.h"
45*0e209d39SAndroid Build Coastguard Worker #include "unicode/stringpiece.h"
46*0e209d39SAndroid Build Coastguard Worker #include "unicode/curramt.h"
47*0e209d39SAndroid Build Coastguard Worker #include "unicode/enumset.h"
48*0e209d39SAndroid Build Coastguard Worker 
49*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
50*0e209d39SAndroid Build Coastguard Worker 
51*0e209d39SAndroid Build Coastguard Worker class CurrencyPluralInfo;
52*0e209d39SAndroid Build Coastguard Worker class CompactDecimalFormat;
53*0e209d39SAndroid Build Coastguard Worker 
54*0e209d39SAndroid Build Coastguard Worker namespace number {
55*0e209d39SAndroid Build Coastguard Worker class LocalizedNumberFormatter;
56*0e209d39SAndroid Build Coastguard Worker namespace impl {
57*0e209d39SAndroid Build Coastguard Worker class DecimalQuantity;
58*0e209d39SAndroid Build Coastguard Worker struct DecimalFormatFields;
59*0e209d39SAndroid Build Coastguard Worker class UFormattedNumberData;
60*0e209d39SAndroid Build Coastguard Worker }
61*0e209d39SAndroid Build Coastguard Worker }
62*0e209d39SAndroid Build Coastguard Worker 
63*0e209d39SAndroid Build Coastguard Worker namespace numparse::impl {
64*0e209d39SAndroid Build Coastguard Worker class NumberParserImpl;
65*0e209d39SAndroid Build Coastguard Worker }
66*0e209d39SAndroid Build Coastguard Worker 
67*0e209d39SAndroid Build Coastguard Worker /**
68*0e209d39SAndroid Build Coastguard Worker  * **IMPORTANT:** New users are strongly encouraged to see if
69*0e209d39SAndroid Build Coastguard Worker  * numberformatter.h fits their use case.  Although not deprecated, this header
70*0e209d39SAndroid Build Coastguard Worker  * is provided for backwards compatibility only.
71*0e209d39SAndroid Build Coastguard Worker  *
72*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat is a concrete subclass of NumberFormat that formats decimal
73*0e209d39SAndroid Build Coastguard Worker  * numbers. It has a variety of features designed to make it possible to parse
74*0e209d39SAndroid Build Coastguard Worker  * and format numbers in any locale, including support for Western, Arabic, or
75*0e209d39SAndroid Build Coastguard Worker  * Indic digits.  It also supports different flavors of numbers, including
76*0e209d39SAndroid Build Coastguard Worker  * integers ("123"), fixed-point numbers ("123.4"), scientific notation
77*0e209d39SAndroid Build Coastguard Worker  * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123",
78*0e209d39SAndroid Build Coastguard Worker  * "123 US dollars").  All of these flavors can be easily localized.
79*0e209d39SAndroid Build Coastguard Worker  *
80*0e209d39SAndroid Build Coastguard Worker  * To obtain a NumberFormat for a specific locale (including the default
81*0e209d39SAndroid Build Coastguard Worker  * locale) call one of NumberFormat's factory methods such as
82*0e209d39SAndroid Build Coastguard Worker  * createInstance(). Do not call the DecimalFormat constructors directly, unless
83*0e209d39SAndroid Build Coastguard Worker  * you know what you are doing, since the NumberFormat factory methods may
84*0e209d39SAndroid Build Coastguard Worker  * return subclasses other than DecimalFormat.
85*0e209d39SAndroid Build Coastguard Worker  *
86*0e209d39SAndroid Build Coastguard Worker  * **Example Usage**
87*0e209d39SAndroid Build Coastguard Worker  *
88*0e209d39SAndroid Build Coastguard Worker  * \code
89*0e209d39SAndroid Build Coastguard Worker  *     // Normally we would have a GUI with a menu for this
90*0e209d39SAndroid Build Coastguard Worker  *     int32_t locCount;
91*0e209d39SAndroid Build Coastguard Worker  *     const Locale* locales = NumberFormat::getAvailableLocales(locCount);
92*0e209d39SAndroid Build Coastguard Worker  *
93*0e209d39SAndroid Build Coastguard Worker  *     double myNumber = -1234.56;
94*0e209d39SAndroid Build Coastguard Worker  *     UErrorCode success = U_ZERO_ERROR;
95*0e209d39SAndroid Build Coastguard Worker  *     NumberFormat* form;
96*0e209d39SAndroid Build Coastguard Worker  *
97*0e209d39SAndroid Build Coastguard Worker  *     // Print out a number with the localized number, currency and percent
98*0e209d39SAndroid Build Coastguard Worker  *     // format for each locale.
99*0e209d39SAndroid Build Coastguard Worker  *     UnicodeString countryName;
100*0e209d39SAndroid Build Coastguard Worker  *     UnicodeString displayName;
101*0e209d39SAndroid Build Coastguard Worker  *     UnicodeString str;
102*0e209d39SAndroid Build Coastguard Worker  *     UnicodeString pattern;
103*0e209d39SAndroid Build Coastguard Worker  *     Formattable fmtable;
104*0e209d39SAndroid Build Coastguard Worker  *     for (int32_t j = 0; j < 3; ++j) {
105*0e209d39SAndroid Build Coastguard Worker  *         cout << endl << "FORMAT " << j << endl;
106*0e209d39SAndroid Build Coastguard Worker  *         for (int32_t i = 0; i < locCount; ++i) {
107*0e209d39SAndroid Build Coastguard Worker  *             if (locales[i].getCountry(countryName).size() == 0) {
108*0e209d39SAndroid Build Coastguard Worker  *                 // skip language-only
109*0e209d39SAndroid Build Coastguard Worker  *                 continue;
110*0e209d39SAndroid Build Coastguard Worker  *             }
111*0e209d39SAndroid Build Coastguard Worker  *             switch (j) {
112*0e209d39SAndroid Build Coastguard Worker  *             case 0:
113*0e209d39SAndroid Build Coastguard Worker  *                 form = NumberFormat::createInstance(locales[i], success ); break;
114*0e209d39SAndroid Build Coastguard Worker  *             case 1:
115*0e209d39SAndroid Build Coastguard Worker  *                 form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
116*0e209d39SAndroid Build Coastguard Worker  *             default:
117*0e209d39SAndroid Build Coastguard Worker  *                 form = NumberFormat::createPercentInstance(locales[i], success ); break;
118*0e209d39SAndroid Build Coastguard Worker  *             }
119*0e209d39SAndroid Build Coastguard Worker  *             if (form) {
120*0e209d39SAndroid Build Coastguard Worker  *                 str.remove();
121*0e209d39SAndroid Build Coastguard Worker  *                 pattern = ((DecimalFormat*)form)->toPattern(pattern);
122*0e209d39SAndroid Build Coastguard Worker  *                 cout << locales[i].getDisplayName(displayName) << ": " << pattern;
123*0e209d39SAndroid Build Coastguard Worker  *                 cout << "  ->  " << form->format(myNumber,str) << endl;
124*0e209d39SAndroid Build Coastguard Worker  *                 form->parse(form->format(myNumber,str), fmtable, success);
125*0e209d39SAndroid Build Coastguard Worker  *                 delete form;
126*0e209d39SAndroid Build Coastguard Worker  *             }
127*0e209d39SAndroid Build Coastguard Worker  *         }
128*0e209d39SAndroid Build Coastguard Worker  *     }
129*0e209d39SAndroid Build Coastguard Worker  * \endcode
130*0e209d39SAndroid Build Coastguard Worker  *
131*0e209d39SAndroid Build Coastguard Worker  * **Another example use createInstance(style)**
132*0e209d39SAndroid Build Coastguard Worker  *
133*0e209d39SAndroid Build Coastguard Worker  * \code
134*0e209d39SAndroid Build Coastguard Worker  * // Print out a number using the localized number, currency,
135*0e209d39SAndroid Build Coastguard Worker  * // percent, scientific, integer, iso currency, and plural currency
136*0e209d39SAndroid Build Coastguard Worker  * // format for each locale</strong>
137*0e209d39SAndroid Build Coastguard Worker  * Locale* locale = new Locale("en", "US");
138*0e209d39SAndroid Build Coastguard Worker  * double myNumber = 1234.56;
139*0e209d39SAndroid Build Coastguard Worker  * UErrorCode success = U_ZERO_ERROR;
140*0e209d39SAndroid Build Coastguard Worker  * UnicodeString str;
141*0e209d39SAndroid Build Coastguard Worker  * Formattable fmtable;
142*0e209d39SAndroid Build Coastguard Worker  * for (int j=NumberFormat::kNumberStyle;
143*0e209d39SAndroid Build Coastguard Worker  *      j<=NumberFormat::kPluralCurrencyStyle;
144*0e209d39SAndroid Build Coastguard Worker  *      ++j) {
145*0e209d39SAndroid Build Coastguard Worker  *     NumberFormat* form = NumberFormat::createInstance(locale, j, success);
146*0e209d39SAndroid Build Coastguard Worker  *     str.remove();
147*0e209d39SAndroid Build Coastguard Worker  *     cout << "format result " << form->format(myNumber, str) << endl;
148*0e209d39SAndroid Build Coastguard Worker  *     format->parse(form->format(myNumber, str), fmtable, success);
149*0e209d39SAndroid Build Coastguard Worker  *     delete form;
150*0e209d39SAndroid Build Coastguard Worker  * }
151*0e209d39SAndroid Build Coastguard Worker  * \endcode
152*0e209d39SAndroid Build Coastguard Worker  *
153*0e209d39SAndroid Build Coastguard Worker  *
154*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Patterns</strong>
155*0e209d39SAndroid Build Coastguard Worker  *
156*0e209d39SAndroid Build Coastguard Worker  * <p>A DecimalFormat consists of a <em>pattern</em> and a set of
157*0e209d39SAndroid Build Coastguard Worker  * <em>symbols</em>.  The pattern may be set directly using
158*0e209d39SAndroid Build Coastguard Worker  * applyPattern(), or indirectly using other API methods which
159*0e209d39SAndroid Build Coastguard Worker  * manipulate aspects of the pattern, such as the minimum number of integer
160*0e209d39SAndroid Build Coastguard Worker  * digits.  The symbols are stored in a DecimalFormatSymbols
161*0e209d39SAndroid Build Coastguard Worker  * object.  When using the NumberFormat factory methods, the
162*0e209d39SAndroid Build Coastguard Worker  * pattern and symbols are read from ICU's locale data.
163*0e209d39SAndroid Build Coastguard Worker  *
164*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Special Pattern Characters</strong>
165*0e209d39SAndroid Build Coastguard Worker  *
166*0e209d39SAndroid Build Coastguard Worker  * <p>Many characters in a pattern are taken literally; they are matched during
167*0e209d39SAndroid Build Coastguard Worker  * parsing and output unchanged during formatting.  Special characters, on the
168*0e209d39SAndroid Build Coastguard Worker  * other hand, stand for other characters, strings, or classes of characters.
169*0e209d39SAndroid Build Coastguard Worker  * For example, the '#' character is replaced by a localized digit.  Often the
170*0e209d39SAndroid Build Coastguard Worker  * replacement character is the same as the pattern character; in the U.S. locale,
171*0e209d39SAndroid Build Coastguard Worker  * the ',' grouping character is replaced by ','.  However, the replacement is
172*0e209d39SAndroid Build Coastguard Worker  * still happening, and if the symbols are modified, the grouping character
173*0e209d39SAndroid Build Coastguard Worker  * changes.  Some special characters affect the behavior of the formatter by
174*0e209d39SAndroid Build Coastguard Worker  * their presence; for example, if the percent character is seen, then the
175*0e209d39SAndroid Build Coastguard Worker  * value is multiplied by 100 before being displayed.
176*0e209d39SAndroid Build Coastguard Worker  *
177*0e209d39SAndroid Build Coastguard Worker  * <p>To insert a special character in a pattern as a literal, that is, without
178*0e209d39SAndroid Build Coastguard Worker  * any special meaning, the character must be quoted.  There are some exceptions to
179*0e209d39SAndroid Build Coastguard Worker  * this which are noted below.
180*0e209d39SAndroid Build Coastguard Worker  *
181*0e209d39SAndroid Build Coastguard Worker  * <p>The characters listed here are used in non-localized patterns.  Localized
182*0e209d39SAndroid Build Coastguard Worker  * patterns use the corresponding characters taken from this formatter's
183*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols object instead, and these characters lose
184*0e209d39SAndroid Build Coastguard Worker  * their special status.  Two exceptions are the currency sign and quote, which
185*0e209d39SAndroid Build Coastguard Worker  * are not localized.
186*0e209d39SAndroid Build Coastguard Worker  *
187*0e209d39SAndroid Build Coastguard Worker  * <table border=0 cellspacing=3 cellpadding=0>
188*0e209d39SAndroid Build Coastguard Worker  *   <tr bgcolor="#ccccff">
189*0e209d39SAndroid Build Coastguard Worker  *     <td align=left><strong>Symbol</strong>
190*0e209d39SAndroid Build Coastguard Worker  *     <td align=left><strong>Location</strong>
191*0e209d39SAndroid Build Coastguard Worker  *     <td align=left><strong>Localized?</strong>
192*0e209d39SAndroid Build Coastguard Worker  *     <td align=left><strong>Meaning</strong>
193*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
194*0e209d39SAndroid Build Coastguard Worker  *     <td><code>0</code>
195*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
196*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
197*0e209d39SAndroid Build Coastguard Worker  *     <td>Digit
198*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
199*0e209d39SAndroid Build Coastguard Worker  *     <td><code>1-9</code>
200*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
201*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
202*0e209d39SAndroid Build Coastguard Worker  *     <td>'1' through '9' indicate rounding.
203*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
204*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\htmlonly&#x40;\endhtmlonly</code> <!--doxygen doesn't like @-->
205*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
206*0e209d39SAndroid Build Coastguard Worker  *     <td>No
207*0e209d39SAndroid Build Coastguard Worker  *     <td>Significant digit
208*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
209*0e209d39SAndroid Build Coastguard Worker  *     <td><code>#</code>
210*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
211*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
212*0e209d39SAndroid Build Coastguard Worker  *     <td>Digit, zero shows as absent
213*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
214*0e209d39SAndroid Build Coastguard Worker  *     <td><code>.</code>
215*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
216*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
217*0e209d39SAndroid Build Coastguard Worker  *     <td>Decimal separator or monetary decimal separator
218*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
219*0e209d39SAndroid Build Coastguard Worker  *     <td><code>-</code>
220*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
221*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
222*0e209d39SAndroid Build Coastguard Worker  *     <td>Minus sign
223*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
224*0e209d39SAndroid Build Coastguard Worker  *     <td><code>,</code>
225*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
226*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
227*0e209d39SAndroid Build Coastguard Worker  *     <td>Grouping separator
228*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
229*0e209d39SAndroid Build Coastguard Worker  *     <td><code>E</code>
230*0e209d39SAndroid Build Coastguard Worker  *     <td>Number
231*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
232*0e209d39SAndroid Build Coastguard Worker  *     <td>Separates mantissa and exponent in scientific notation.
233*0e209d39SAndroid Build Coastguard Worker  *         <em>Need not be quoted in prefix or suffix.</em>
234*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
235*0e209d39SAndroid Build Coastguard Worker  *     <td><code>+</code>
236*0e209d39SAndroid Build Coastguard Worker  *     <td>Exponent
237*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
238*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix positive exponents with localized plus sign.
239*0e209d39SAndroid Build Coastguard Worker  *         <em>Need not be quoted in prefix or suffix.</em>
240*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
241*0e209d39SAndroid Build Coastguard Worker  *     <td><code>;</code>
242*0e209d39SAndroid Build Coastguard Worker  *     <td>Subpattern boundary
243*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
244*0e209d39SAndroid Build Coastguard Worker  *     <td>Separates positive and negative subpatterns
245*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
246*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\%</code>
247*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix or suffix
248*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
249*0e209d39SAndroid Build Coastguard Worker  *     <td>Multiply by 100 and show as percentage
250*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
251*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\\u2030</code>
252*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix or suffix
253*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
254*0e209d39SAndroid Build Coastguard Worker  *     <td>Multiply by 1000 and show as per mille
255*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
256*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\htmlonly&curren;\endhtmlonly</code> (<code>\\u00A4</code>)
257*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix or suffix
258*0e209d39SAndroid Build Coastguard Worker  *     <td>No
259*0e209d39SAndroid Build Coastguard Worker  *     <td>Currency sign, replaced by currency symbol.  If
260*0e209d39SAndroid Build Coastguard Worker  *         doubled, replaced by international currency symbol.
261*0e209d39SAndroid Build Coastguard Worker  *         If tripled, replaced by currency plural names, for example,
262*0e209d39SAndroid Build Coastguard Worker  *         "US dollar" or "US dollars" for America.
263*0e209d39SAndroid Build Coastguard Worker  *         If present in a pattern, the monetary decimal separator
264*0e209d39SAndroid Build Coastguard Worker  *         is used instead of the decimal separator.
265*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
266*0e209d39SAndroid Build Coastguard Worker  *     <td><code>'</code>
267*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix or suffix
268*0e209d39SAndroid Build Coastguard Worker  *     <td>No
269*0e209d39SAndroid Build Coastguard Worker  *     <td>Used to quote special characters in a prefix or suffix,
270*0e209d39SAndroid Build Coastguard Worker  *         for example, <code>"'#'#"</code> formats 123 to
271*0e209d39SAndroid Build Coastguard Worker  *         <code>"#123"</code>.  To create a single quote
272*0e209d39SAndroid Build Coastguard Worker  *         itself, use two in a row: <code>"# o''clock"</code>.
273*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
274*0e209d39SAndroid Build Coastguard Worker  *     <td><code>*</code>
275*0e209d39SAndroid Build Coastguard Worker  *     <td>Prefix or suffix boundary
276*0e209d39SAndroid Build Coastguard Worker  *     <td>Yes
277*0e209d39SAndroid Build Coastguard Worker  *     <td>Pad escape, precedes pad character
278*0e209d39SAndroid Build Coastguard Worker  * </table>
279*0e209d39SAndroid Build Coastguard Worker  *
280*0e209d39SAndroid Build Coastguard Worker  * <p>A DecimalFormat pattern contains a positive and negative
281*0e209d39SAndroid Build Coastguard Worker  * subpattern, for example, "#,##0.00;(#,##0.00)".  Each subpattern has a
282*0e209d39SAndroid Build Coastguard Worker  * prefix, a numeric part, and a suffix.  If there is no explicit negative
283*0e209d39SAndroid Build Coastguard Worker  * subpattern, the negative subpattern is the localized minus sign prefixed to the
284*0e209d39SAndroid Build Coastguard Worker  * positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00".  If there
285*0e209d39SAndroid Build Coastguard Worker  * is an explicit negative subpattern, it serves only to specify the negative
286*0e209d39SAndroid Build Coastguard Worker  * prefix and suffix; the number of digits, minimal digits, and other
287*0e209d39SAndroid Build Coastguard Worker  * characteristics are ignored in the negative subpattern. That means that
288*0e209d39SAndroid Build Coastguard Worker  * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)".
289*0e209d39SAndroid Build Coastguard Worker  *
290*0e209d39SAndroid Build Coastguard Worker  * <p>The prefixes, suffixes, and various symbols used for infinity, digits,
291*0e209d39SAndroid Build Coastguard Worker  * thousands separators, decimal separators, etc. may be set to arbitrary
292*0e209d39SAndroid Build Coastguard Worker  * values, and they will appear properly during formatting.  However, care must
293*0e209d39SAndroid Build Coastguard Worker  * be taken that the symbols and strings do not conflict, or parsing will be
294*0e209d39SAndroid Build Coastguard Worker  * unreliable.  For example, either the positive and negative prefixes or the
295*0e209d39SAndroid Build Coastguard Worker  * suffixes must be distinct for parse() to be able
296*0e209d39SAndroid Build Coastguard Worker  * to distinguish positive from negative values.  Another example is that the
297*0e209d39SAndroid Build Coastguard Worker  * decimal separator and thousands separator should be distinct characters, or
298*0e209d39SAndroid Build Coastguard Worker  * parsing will be impossible.
299*0e209d39SAndroid Build Coastguard Worker  *
300*0e209d39SAndroid Build Coastguard Worker  * <p>The <em>grouping separator</em> is a character that separates clusters of
301*0e209d39SAndroid Build Coastguard Worker  * integer digits to make large numbers more legible.  It commonly used for
302*0e209d39SAndroid Build Coastguard Worker  * thousands, but in some locales it separates ten-thousands.  The <em>grouping
303*0e209d39SAndroid Build Coastguard Worker  * size</em> is the number of digits between the grouping separators, such as 3
304*0e209d39SAndroid Build Coastguard Worker  * for "100,000,000" or 4 for "1 0000 0000". There are actually two different
305*0e209d39SAndroid Build Coastguard Worker  * grouping sizes: One used for the least significant integer digits, the
306*0e209d39SAndroid Build Coastguard Worker  * <em>primary grouping size</em>, and one used for all others, the
307*0e209d39SAndroid Build Coastguard Worker  * <em>secondary grouping size</em>.  In most locales these are the same, but
308*0e209d39SAndroid Build Coastguard Worker  * sometimes they are different. For example, if the primary grouping interval
309*0e209d39SAndroid Build Coastguard Worker  * is 3, and the secondary is 2, then this corresponds to the pattern
310*0e209d39SAndroid Build Coastguard Worker  * "#,##,##0", and the number 123456789 is formatted as "12,34,56,789".  If a
311*0e209d39SAndroid Build Coastguard Worker  * pattern contains multiple grouping separators, the interval between the last
312*0e209d39SAndroid Build Coastguard Worker  * one and the end of the integer defines the primary grouping size, and the
313*0e209d39SAndroid Build Coastguard Worker  * interval between the last two defines the secondary grouping size. All others
314*0e209d39SAndroid Build Coastguard Worker  * are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####".
315*0e209d39SAndroid Build Coastguard Worker  *
316*0e209d39SAndroid Build Coastguard Worker  * <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause
317*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat to set a failing UErrorCode.
318*0e209d39SAndroid Build Coastguard Worker  *
319*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Pattern BNF</strong>
320*0e209d39SAndroid Build Coastguard Worker  *
321*0e209d39SAndroid Build Coastguard Worker  * <pre>
322*0e209d39SAndroid Build Coastguard Worker  * pattern    := subpattern (';' subpattern)?
323*0e209d39SAndroid Build Coastguard Worker  * subpattern := prefix? number exponent? suffix?
324*0e209d39SAndroid Build Coastguard Worker  * number     := (integer ('.' fraction)?) | sigDigits
325*0e209d39SAndroid Build Coastguard Worker  * prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
326*0e209d39SAndroid Build Coastguard Worker  * suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
327*0e209d39SAndroid Build Coastguard Worker  * integer    := '#'* '0'* '0'
328*0e209d39SAndroid Build Coastguard Worker  * fraction   := '0'* '#'*
329*0e209d39SAndroid Build Coastguard Worker  * sigDigits  := '#'* '@' '@'* '#'*
330*0e209d39SAndroid Build Coastguard Worker  * exponent   := 'E' '+'? '0'* '0'
331*0e209d39SAndroid Build Coastguard Worker  * padSpec    := '*' padChar
332*0e209d39SAndroid Build Coastguard Worker  * padChar    := '\\u0000'..'\\uFFFD' - quote
333*0e209d39SAndroid Build Coastguard Worker  * &nbsp;
334*0e209d39SAndroid Build Coastguard Worker  * Notation:
335*0e209d39SAndroid Build Coastguard Worker  *   X*       0 or more instances of X
336*0e209d39SAndroid Build Coastguard Worker  *   X?       0 or 1 instances of X
337*0e209d39SAndroid Build Coastguard Worker  *   X|Y      either X or Y
338*0e209d39SAndroid Build Coastguard Worker  *   C..D     any character from C up to D, inclusive
339*0e209d39SAndroid Build Coastguard Worker  *   S-T      characters in S, except those in T
340*0e209d39SAndroid Build Coastguard Worker  * </pre>
341*0e209d39SAndroid Build Coastguard Worker  * The first subpattern is for positive numbers. The second (optional)
342*0e209d39SAndroid Build Coastguard Worker  * subpattern is for negative numbers.
343*0e209d39SAndroid Build Coastguard Worker  *
344*0e209d39SAndroid Build Coastguard Worker  * <p>Not indicated in the BNF syntax above:
345*0e209d39SAndroid Build Coastguard Worker  *
346*0e209d39SAndroid Build Coastguard Worker  * <ul><li>The grouping separator ',' can occur inside the integer and
347*0e209d39SAndroid Build Coastguard Worker  * sigDigits elements, between any two pattern characters of that
348*0e209d39SAndroid Build Coastguard Worker  * element, as long as the integer or sigDigits element is not
349*0e209d39SAndroid Build Coastguard Worker  * followed by the exponent element.
350*0e209d39SAndroid Build Coastguard Worker  *
351*0e209d39SAndroid Build Coastguard Worker  * <li>Two grouping intervals are recognized: That between the
352*0e209d39SAndroid Build Coastguard Worker  *     decimal point and the first grouping symbol, and that
353*0e209d39SAndroid Build Coastguard Worker  *     between the first and second grouping symbols. These
354*0e209d39SAndroid Build Coastguard Worker  *     intervals are identical in most locales, but in some
355*0e209d39SAndroid Build Coastguard Worker  *     locales they differ. For example, the pattern
356*0e209d39SAndroid Build Coastguard Worker  *     &quot;#,##,###&quot; formats the number 123456789 as
357*0e209d39SAndroid Build Coastguard Worker  *     &quot;12,34,56,789&quot;.</li>
358*0e209d39SAndroid Build Coastguard Worker  *
359*0e209d39SAndroid Build Coastguard Worker  * <li>The pad specifier <code>padSpec</code> may appear before the prefix,
360*0e209d39SAndroid Build Coastguard Worker  * after the prefix, before the suffix, after the suffix, or not at all.
361*0e209d39SAndroid Build Coastguard Worker  *
362*0e209d39SAndroid Build Coastguard Worker  * <li>In place of '0', the digits '1' through '9' may be used to
363*0e209d39SAndroid Build Coastguard Worker  * indicate a rounding increment.
364*0e209d39SAndroid Build Coastguard Worker  * </ul>
365*0e209d39SAndroid Build Coastguard Worker  *
366*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Parsing</strong>
367*0e209d39SAndroid Build Coastguard Worker  *
368*0e209d39SAndroid Build Coastguard Worker  * <p>DecimalFormat parses all Unicode characters that represent
369*0e209d39SAndroid Build Coastguard Worker  * decimal digits, as defined by u_charDigitValue().  In addition,
370*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat also recognizes as digits the ten consecutive
371*0e209d39SAndroid Build Coastguard Worker  * characters starting with the localized zero digit defined in the
372*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols object.  During formatting, the
373*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols-based digits are output.
374*0e209d39SAndroid Build Coastguard Worker  *
375*0e209d39SAndroid Build Coastguard Worker  * <p>During parsing, grouping separators are ignored if in lenient mode;
376*0e209d39SAndroid Build Coastguard Worker  * otherwise, if present, they must be in appropriate positions.
377*0e209d39SAndroid Build Coastguard Worker  *
378*0e209d39SAndroid Build Coastguard Worker  * <p>For currency parsing, the formatter is able to parse every currency
379*0e209d39SAndroid Build Coastguard Worker  * style formats no matter which style the formatter is constructed with.
380*0e209d39SAndroid Build Coastguard Worker  * For example, a formatter instance gotten from
381*0e209d39SAndroid Build Coastguard Worker  * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse
382*0e209d39SAndroid Build Coastguard Worker  * formats such as "USD1.00" and "3.00 US dollars".
383*0e209d39SAndroid Build Coastguard Worker  *
384*0e209d39SAndroid Build Coastguard Worker  * <p>If parse(UnicodeString&,Formattable&,ParsePosition&)
385*0e209d39SAndroid Build Coastguard Worker  * fails to parse a string, it leaves the parse position unchanged.
386*0e209d39SAndroid Build Coastguard Worker  * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&)
387*0e209d39SAndroid Build Coastguard Worker  * indicates parse failure by setting a failing
388*0e209d39SAndroid Build Coastguard Worker  * UErrorCode.
389*0e209d39SAndroid Build Coastguard Worker  *
390*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Formatting</strong>
391*0e209d39SAndroid Build Coastguard Worker  *
392*0e209d39SAndroid Build Coastguard Worker  * <p>Formatting is guided by several parameters, all of which can be
393*0e209d39SAndroid Build Coastguard Worker  * specified either using a pattern or using the API.  The following
394*0e209d39SAndroid Build Coastguard Worker  * description applies to formats that do not use <a href="#sci">scientific
395*0e209d39SAndroid Build Coastguard Worker  * notation</a> or <a href="#sigdig">significant digits</a>.
396*0e209d39SAndroid Build Coastguard Worker  *
397*0e209d39SAndroid Build Coastguard Worker  * <ul><li>If the number of actual integer digits exceeds the
398*0e209d39SAndroid Build Coastguard Worker  * <em>maximum integer digits</em>, then only the least significant
399*0e209d39SAndroid Build Coastguard Worker  * digits are shown.  For example, 1997 is formatted as "97" if the
400*0e209d39SAndroid Build Coastguard Worker  * maximum integer digits is set to 2.
401*0e209d39SAndroid Build Coastguard Worker  *
402*0e209d39SAndroid Build Coastguard Worker  * <li>If the number of actual integer digits is less than the
403*0e209d39SAndroid Build Coastguard Worker  * <em>minimum integer digits</em>, then leading zeros are added.  For
404*0e209d39SAndroid Build Coastguard Worker  * example, 1997 is formatted as "01997" if the minimum integer digits
405*0e209d39SAndroid Build Coastguard Worker  * is set to 5.
406*0e209d39SAndroid Build Coastguard Worker  *
407*0e209d39SAndroid Build Coastguard Worker  * <li>If the number of actual fraction digits exceeds the <em>maximum
408*0e209d39SAndroid Build Coastguard Worker  * fraction digits</em>, then rounding is performed to the
409*0e209d39SAndroid Build Coastguard Worker  * maximum fraction digits.  For example, 0.125 is formatted as "0.12"
410*0e209d39SAndroid Build Coastguard Worker  * if the maximum fraction digits is 2.  This behavior can be changed
411*0e209d39SAndroid Build Coastguard Worker  * by specifying a rounding increment and/or a rounding mode.
412*0e209d39SAndroid Build Coastguard Worker  *
413*0e209d39SAndroid Build Coastguard Worker  * <li>If the number of actual fraction digits is less than the
414*0e209d39SAndroid Build Coastguard Worker  * <em>minimum fraction digits</em>, then trailing zeros are added.
415*0e209d39SAndroid Build Coastguard Worker  * For example, 0.125 is formatted as "0.1250" if the minimum fraction
416*0e209d39SAndroid Build Coastguard Worker  * digits is set to 4.
417*0e209d39SAndroid Build Coastguard Worker  *
418*0e209d39SAndroid Build Coastguard Worker  * <li>Trailing fractional zeros are not displayed if they occur
419*0e209d39SAndroid Build Coastguard Worker  * <em>j</em> positions after the decimal, where <em>j</em> is less
420*0e209d39SAndroid Build Coastguard Worker  * than the maximum fraction digits. For example, 0.10004 is
421*0e209d39SAndroid Build Coastguard Worker  * formatted as "0.1" if the maximum fraction digits is four or less.
422*0e209d39SAndroid Build Coastguard Worker  * </ul>
423*0e209d39SAndroid Build Coastguard Worker  *
424*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Special Values</strong>
425*0e209d39SAndroid Build Coastguard Worker  *
426*0e209d39SAndroid Build Coastguard Worker  * <p><code>NaN</code> is represented as a single character, typically
427*0e209d39SAndroid Build Coastguard Worker  * <code>\\uFFFD</code>.  This character is determined by the
428*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols object.  This is the only value for which
429*0e209d39SAndroid Build Coastguard Worker  * the prefixes and suffixes are not used.
430*0e209d39SAndroid Build Coastguard Worker  *
431*0e209d39SAndroid Build Coastguard Worker  * <p>Infinity is represented as a single character, typically
432*0e209d39SAndroid Build Coastguard Worker  * <code>\\u221E</code>, with the positive or negative prefixes and suffixes
433*0e209d39SAndroid Build Coastguard Worker  * applied.  The infinity character is determined by the
434*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols object.
435*0e209d39SAndroid Build Coastguard Worker  *
436*0e209d39SAndroid Build Coastguard Worker  * <a name="sci"><strong>Scientific Notation</strong></a>
437*0e209d39SAndroid Build Coastguard Worker  *
438*0e209d39SAndroid Build Coastguard Worker  * <p>Numbers in scientific notation are expressed as the product of a mantissa
439*0e209d39SAndroid Build Coastguard Worker  * and a power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The
440*0e209d39SAndroid Build Coastguard Worker  * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0),
441*0e209d39SAndroid Build Coastguard Worker  * but it need not be.  DecimalFormat supports arbitrary mantissas.
442*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat can be instructed to use scientific
443*0e209d39SAndroid Build Coastguard Worker  * notation through the API or through the pattern.  In a pattern, the exponent
444*0e209d39SAndroid Build Coastguard Worker  * character immediately followed by one or more digit characters indicates
445*0e209d39SAndroid Build Coastguard Worker  * scientific notation.  Example: "0.###E0" formats the number 1234 as
446*0e209d39SAndroid Build Coastguard Worker  * "1.234E3".
447*0e209d39SAndroid Build Coastguard Worker  *
448*0e209d39SAndroid Build Coastguard Worker  * <ul>
449*0e209d39SAndroid Build Coastguard Worker  * <li>The number of digit characters after the exponent character gives the
450*0e209d39SAndroid Build Coastguard Worker  * minimum exponent digit count.  There is no maximum.  Negative exponents are
451*0e209d39SAndroid Build Coastguard Worker  * formatted using the localized minus sign, <em>not</em> the prefix and suffix
452*0e209d39SAndroid Build Coastguard Worker  * from the pattern.  This allows patterns such as "0.###E0 m/s".  To prefix
453*0e209d39SAndroid Build Coastguard Worker  * positive exponents with a localized plus sign, specify '+' between the
454*0e209d39SAndroid Build Coastguard Worker  * exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0",
455*0e209d39SAndroid Build Coastguard Worker  * "1E-1", etc.  (In localized patterns, use the localized plus sign rather than
456*0e209d39SAndroid Build Coastguard Worker  * '+'.)
457*0e209d39SAndroid Build Coastguard Worker  *
458*0e209d39SAndroid Build Coastguard Worker  * <li>The minimum number of integer digits is achieved by adjusting the
459*0e209d39SAndroid Build Coastguard Worker  * exponent.  Example: 0.00123 formatted with "00.###E0" yields "12.3E-4".  This
460*0e209d39SAndroid Build Coastguard Worker  * only happens if there is no maximum number of integer digits.  If there is a
461*0e209d39SAndroid Build Coastguard Worker  * maximum, then the minimum number of integer digits is fixed at one.
462*0e209d39SAndroid Build Coastguard Worker  *
463*0e209d39SAndroid Build Coastguard Worker  * <li>The maximum number of integer digits, if present, specifies the exponent
464*0e209d39SAndroid Build Coastguard Worker  * grouping.  The most common use of this is to generate <em>engineering
465*0e209d39SAndroid Build Coastguard Worker  * notation</em>, in which the exponent is a multiple of three, e.g.,
466*0e209d39SAndroid Build Coastguard Worker  * "##0.###E0".  The number 12345 is formatted using "##0.####E0" as "12.345E3".
467*0e209d39SAndroid Build Coastguard Worker  *
468*0e209d39SAndroid Build Coastguard Worker  * <li>When using scientific notation, the formatter controls the
469*0e209d39SAndroid Build Coastguard Worker  * digit counts using significant digits logic.  The maximum number of
470*0e209d39SAndroid Build Coastguard Worker  * significant digits limits the total number of integer and fraction
471*0e209d39SAndroid Build Coastguard Worker  * digits that will be shown in the mantissa; it does not affect
472*0e209d39SAndroid Build Coastguard Worker  * parsing.  For example, 12345 formatted with "##0.##E0" is "12.3E3".
473*0e209d39SAndroid Build Coastguard Worker  * See the section on significant digits for more details.
474*0e209d39SAndroid Build Coastguard Worker  *
475*0e209d39SAndroid Build Coastguard Worker  * <li>The number of significant digits shown is determined as
476*0e209d39SAndroid Build Coastguard Worker  * follows: If areSignificantDigitsUsed() returns false, then the
477*0e209d39SAndroid Build Coastguard Worker  * minimum number of significant digits shown is one, and the maximum
478*0e209d39SAndroid Build Coastguard Worker  * number of significant digits shown is the sum of the <em>minimum
479*0e209d39SAndroid Build Coastguard Worker  * integer</em> and <em>maximum fraction</em> digits, and is
480*0e209d39SAndroid Build Coastguard Worker  * unaffected by the maximum integer digits.  If this sum is zero,
481*0e209d39SAndroid Build Coastguard Worker  * then all significant digits are shown.  If
482*0e209d39SAndroid Build Coastguard Worker  * areSignificantDigitsUsed() returns true, then the significant digit
483*0e209d39SAndroid Build Coastguard Worker  * counts are specified by getMinimumSignificantDigits() and
484*0e209d39SAndroid Build Coastguard Worker  * getMaximumSignificantDigits().  In this case, the number of
485*0e209d39SAndroid Build Coastguard Worker  * integer digits is fixed at one, and there is no exponent grouping.
486*0e209d39SAndroid Build Coastguard Worker  *
487*0e209d39SAndroid Build Coastguard Worker  * <li>Exponential patterns may not contain grouping separators.
488*0e209d39SAndroid Build Coastguard Worker  * </ul>
489*0e209d39SAndroid Build Coastguard Worker  *
490*0e209d39SAndroid Build Coastguard Worker  * <a name="sigdig"><strong>Significant Digits</strong></a>
491*0e209d39SAndroid Build Coastguard Worker  *
492*0e209d39SAndroid Build Coastguard Worker  * <code>DecimalFormat</code> has two ways of controlling how many
493*0e209d39SAndroid Build Coastguard Worker  * digits are shows: (a) significant digits counts, or (b) integer and
494*0e209d39SAndroid Build Coastguard Worker  * fraction digit counts.  Integer and fraction digit counts are
495*0e209d39SAndroid Build Coastguard Worker  * described above.  When a formatter is using significant digits
496*0e209d39SAndroid Build Coastguard Worker  * counts, the number of integer and fraction digits is not specified
497*0e209d39SAndroid Build Coastguard Worker  * directly, and the formatter settings for these counts are ignored.
498*0e209d39SAndroid Build Coastguard Worker  * Instead, the formatter uses however many integer and fraction
499*0e209d39SAndroid Build Coastguard Worker  * digits are required to display the specified number of significant
500*0e209d39SAndroid Build Coastguard Worker  * digits.  Examples:
501*0e209d39SAndroid Build Coastguard Worker  *
502*0e209d39SAndroid Build Coastguard Worker  * <table border=0 cellspacing=3 cellpadding=0>
503*0e209d39SAndroid Build Coastguard Worker  *   <tr bgcolor="#ccccff">
504*0e209d39SAndroid Build Coastguard Worker  *     <td align=left>Pattern
505*0e209d39SAndroid Build Coastguard Worker  *     <td align=left>Minimum significant digits
506*0e209d39SAndroid Build Coastguard Worker  *     <td align=left>Maximum significant digits
507*0e209d39SAndroid Build Coastguard Worker  *     <td align=left>Number
508*0e209d39SAndroid Build Coastguard Worker  *     <td align=left>Output of format()
509*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
510*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\@\@\@</code>
511*0e209d39SAndroid Build Coastguard Worker  *     <td>3
512*0e209d39SAndroid Build Coastguard Worker  *     <td>3
513*0e209d39SAndroid Build Coastguard Worker  *     <td>12345
514*0e209d39SAndroid Build Coastguard Worker  *     <td><code>12300</code>
515*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
516*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\@\@\@</code>
517*0e209d39SAndroid Build Coastguard Worker  *     <td>3
518*0e209d39SAndroid Build Coastguard Worker  *     <td>3
519*0e209d39SAndroid Build Coastguard Worker  *     <td>0.12345
520*0e209d39SAndroid Build Coastguard Worker  *     <td><code>0.123</code>
521*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top>
522*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\@\@##</code>
523*0e209d39SAndroid Build Coastguard Worker  *     <td>2
524*0e209d39SAndroid Build Coastguard Worker  *     <td>4
525*0e209d39SAndroid Build Coastguard Worker  *     <td>3.14159
526*0e209d39SAndroid Build Coastguard Worker  *     <td><code>3.142</code>
527*0e209d39SAndroid Build Coastguard Worker  *   <tr valign=top bgcolor="#eeeeff">
528*0e209d39SAndroid Build Coastguard Worker  *     <td><code>\@\@##</code>
529*0e209d39SAndroid Build Coastguard Worker  *     <td>2
530*0e209d39SAndroid Build Coastguard Worker  *     <td>4
531*0e209d39SAndroid Build Coastguard Worker  *     <td>1.23004
532*0e209d39SAndroid Build Coastguard Worker  *     <td><code>1.23</code>
533*0e209d39SAndroid Build Coastguard Worker  * </table>
534*0e209d39SAndroid Build Coastguard Worker  *
535*0e209d39SAndroid Build Coastguard Worker  * <ul>
536*0e209d39SAndroid Build Coastguard Worker  * <li>Significant digit counts may be expressed using patterns that
537*0e209d39SAndroid Build Coastguard Worker  * specify a minimum and maximum number of significant digits.  These
538*0e209d39SAndroid Build Coastguard Worker  * are indicated by the <code>'@'</code> and <code>'#'</code>
539*0e209d39SAndroid Build Coastguard Worker  * characters.  The minimum number of significant digits is the number
540*0e209d39SAndroid Build Coastguard Worker  * of <code>'@'</code> characters.  The maximum number of significant
541*0e209d39SAndroid Build Coastguard Worker  * digits is the number of <code>'@'</code> characters plus the number
542*0e209d39SAndroid Build Coastguard Worker  * of <code>'#'</code> characters following on the right.  For
543*0e209d39SAndroid Build Coastguard Worker  * example, the pattern <code>"@@@"</code> indicates exactly 3
544*0e209d39SAndroid Build Coastguard Worker  * significant digits.  The pattern <code>"@##"</code> indicates from
545*0e209d39SAndroid Build Coastguard Worker  * 1 to 3 significant digits.  Trailing zero digits to the right of
546*0e209d39SAndroid Build Coastguard Worker  * the decimal separator are suppressed after the minimum number of
547*0e209d39SAndroid Build Coastguard Worker  * significant digits have been shown.  For example, the pattern
548*0e209d39SAndroid Build Coastguard Worker  * <code>"@##"</code> formats the number 0.1203 as
549*0e209d39SAndroid Build Coastguard Worker  * <code>"0.12"</code>.
550*0e209d39SAndroid Build Coastguard Worker  *
551*0e209d39SAndroid Build Coastguard Worker  * <li>If a pattern uses significant digits, it may not contain a
552*0e209d39SAndroid Build Coastguard Worker  * decimal separator, nor the <code>'0'</code> pattern character.
553*0e209d39SAndroid Build Coastguard Worker  * Patterns such as <code>"@00"</code> or <code>"@.###"</code> are
554*0e209d39SAndroid Build Coastguard Worker  * disallowed.
555*0e209d39SAndroid Build Coastguard Worker  *
556*0e209d39SAndroid Build Coastguard Worker  * <li>Any number of <code>'#'</code> characters may be prepended to
557*0e209d39SAndroid Build Coastguard Worker  * the left of the leftmost <code>'@'</code> character.  These have no
558*0e209d39SAndroid Build Coastguard Worker  * effect on the minimum and maximum significant digits counts, but
559*0e209d39SAndroid Build Coastguard Worker  * may be used to position grouping separators.  For example,
560*0e209d39SAndroid Build Coastguard Worker  * <code>"#,#@#"</code> indicates a minimum of one significant digits,
561*0e209d39SAndroid Build Coastguard Worker  * a maximum of two significant digits, and a grouping size of three.
562*0e209d39SAndroid Build Coastguard Worker  *
563*0e209d39SAndroid Build Coastguard Worker  * <li>In order to enable significant digits formatting, use a pattern
564*0e209d39SAndroid Build Coastguard Worker  * containing the <code>'@'</code> pattern character.  Alternatively,
565*0e209d39SAndroid Build Coastguard Worker  * call setSignificantDigitsUsed(true).
566*0e209d39SAndroid Build Coastguard Worker  *
567*0e209d39SAndroid Build Coastguard Worker  * <li>In order to disable significant digits formatting, use a
568*0e209d39SAndroid Build Coastguard Worker  * pattern that does not contain the <code>'@'</code> pattern
569*0e209d39SAndroid Build Coastguard Worker  * character. Alternatively, call setSignificantDigitsUsed(false).
570*0e209d39SAndroid Build Coastguard Worker  *
571*0e209d39SAndroid Build Coastguard Worker  * <li>The number of significant digits has no effect on parsing.
572*0e209d39SAndroid Build Coastguard Worker  *
573*0e209d39SAndroid Build Coastguard Worker  * <li>Significant digits may be used together with exponential notation. Such
574*0e209d39SAndroid Build Coastguard Worker  * patterns are equivalent to a normal exponential pattern with a minimum and
575*0e209d39SAndroid Build Coastguard Worker  * maximum integer digit count of one, a minimum fraction digit count of
576*0e209d39SAndroid Build Coastguard Worker  * <code>getMinimumSignificantDigits() - 1</code>, and a maximum fraction digit
577*0e209d39SAndroid Build Coastguard Worker  * count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
578*0e209d39SAndroid Build Coastguard Worker  * pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
579*0e209d39SAndroid Build Coastguard Worker  *
580*0e209d39SAndroid Build Coastguard Worker  * <li>If significant digits are in use, then the integer and fraction
581*0e209d39SAndroid Build Coastguard Worker  * digit counts, as set via the API, are ignored.  If significant
582*0e209d39SAndroid Build Coastguard Worker  * digits are not in use, then the significant digit counts, as set via
583*0e209d39SAndroid Build Coastguard Worker  * the API, are ignored.
584*0e209d39SAndroid Build Coastguard Worker  *
585*0e209d39SAndroid Build Coastguard Worker  * </ul>
586*0e209d39SAndroid Build Coastguard Worker  *
587*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Padding</strong>
588*0e209d39SAndroid Build Coastguard Worker  *
589*0e209d39SAndroid Build Coastguard Worker  * <p>DecimalFormat supports padding the result of
590*0e209d39SAndroid Build Coastguard Worker  * format() to a specific width.  Padding may be specified either
591*0e209d39SAndroid Build Coastguard Worker  * through the API or through the pattern syntax.  In a pattern the pad escape
592*0e209d39SAndroid Build Coastguard Worker  * character, followed by a single pad character, causes padding to be parsed
593*0e209d39SAndroid Build Coastguard Worker  * and formatted.  The pad escape character is '*' in unlocalized patterns, and
594*0e209d39SAndroid Build Coastguard Worker  * can be localized using DecimalFormatSymbols::setSymbol() with a
595*0e209d39SAndroid Build Coastguard Worker  * DecimalFormatSymbols::kPadEscapeSymbol
596*0e209d39SAndroid Build Coastguard Worker  * selector.  For example, <code>"$*x#,##0.00"</code> formats 123 to
597*0e209d39SAndroid Build Coastguard Worker  * <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>.
598*0e209d39SAndroid Build Coastguard Worker  *
599*0e209d39SAndroid Build Coastguard Worker  * <ul>
600*0e209d39SAndroid Build Coastguard Worker  * <li>When padding is in effect, the width of the positive subpattern,
601*0e209d39SAndroid Build Coastguard Worker  * including prefix and suffix, determines the format width.  For example, in
602*0e209d39SAndroid Build Coastguard Worker  * the pattern <code>"* #0 o''clock"</code>, the format width is 10.
603*0e209d39SAndroid Build Coastguard Worker  *
604*0e209d39SAndroid Build Coastguard Worker  * <li>The width is counted in 16-bit code units (char16_ts).
605*0e209d39SAndroid Build Coastguard Worker  *
606*0e209d39SAndroid Build Coastguard Worker  * <li>Some parameters which usually do not matter have meaning when padding is
607*0e209d39SAndroid Build Coastguard Worker  * used, because the pattern width is significant with padding.  In the pattern
608*0e209d39SAndroid Build Coastguard Worker  * "* ##,##,#,##0.##", the format width is 14.  The initial characters "##,##,"
609*0e209d39SAndroid Build Coastguard Worker  * do not affect the grouping size or maximum integer digits, but they do affect
610*0e209d39SAndroid Build Coastguard Worker  * the format width.
611*0e209d39SAndroid Build Coastguard Worker  *
612*0e209d39SAndroid Build Coastguard Worker  * <li>Padding may be inserted at one of four locations: before the prefix,
613*0e209d39SAndroid Build Coastguard Worker  * after the prefix, before the suffix, or after the suffix.  If padding is
614*0e209d39SAndroid Build Coastguard Worker  * specified in any other location, applyPattern()
615*0e209d39SAndroid Build Coastguard Worker  * sets a failing UErrorCode.  If there is no prefix,
616*0e209d39SAndroid Build Coastguard Worker  * before the prefix and after the prefix are equivalent, likewise for the
617*0e209d39SAndroid Build Coastguard Worker  * suffix.
618*0e209d39SAndroid Build Coastguard Worker  *
619*0e209d39SAndroid Build Coastguard Worker  * <li>When specified in a pattern, the 32-bit code point immediately
620*0e209d39SAndroid Build Coastguard Worker  * following the pad escape is the pad character. This may be any character,
621*0e209d39SAndroid Build Coastguard Worker  * including a special pattern character. That is, the pad escape
622*0e209d39SAndroid Build Coastguard Worker  * <em>escapes</em> the following character. If there is no character after
623*0e209d39SAndroid Build Coastguard Worker  * the pad escape, then the pattern is illegal.
624*0e209d39SAndroid Build Coastguard Worker  *
625*0e209d39SAndroid Build Coastguard Worker  * </ul>
626*0e209d39SAndroid Build Coastguard Worker  *
627*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Rounding</strong>
628*0e209d39SAndroid Build Coastguard Worker  *
629*0e209d39SAndroid Build Coastguard Worker  * <p>DecimalFormat supports rounding to a specific increment.  For
630*0e209d39SAndroid Build Coastguard Worker  * example, 1230 rounded to the nearest 50 is 1250.  1.234 rounded to the
631*0e209d39SAndroid Build Coastguard Worker  * nearest 0.65 is 1.3.  The rounding increment may be specified through the API
632*0e209d39SAndroid Build Coastguard Worker  * or in a pattern.  To specify a rounding increment in a pattern, include the
633*0e209d39SAndroid Build Coastguard Worker  * increment in the pattern itself.  "#,#50" specifies a rounding increment of
634*0e209d39SAndroid Build Coastguard Worker  * 50.  "#,##0.05" specifies a rounding increment of 0.05.
635*0e209d39SAndroid Build Coastguard Worker  *
636*0e209d39SAndroid Build Coastguard Worker  * <p>In the absence of an explicit rounding increment numbers are
637*0e209d39SAndroid Build Coastguard Worker  * rounded to their formatted width.
638*0e209d39SAndroid Build Coastguard Worker  *
639*0e209d39SAndroid Build Coastguard Worker  * <ul>
640*0e209d39SAndroid Build Coastguard Worker  * <li>Rounding only affects the string produced by formatting.  It does
641*0e209d39SAndroid Build Coastguard Worker  * not affect parsing or change any numerical values.
642*0e209d39SAndroid Build Coastguard Worker  *
643*0e209d39SAndroid Build Coastguard Worker  * <li>A <em>rounding mode</em> determines how values are rounded; see
644*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat::ERoundingMode.  The default rounding mode is
645*0e209d39SAndroid Build Coastguard Worker  * DecimalFormat::kRoundHalfEven.  The rounding mode can only be set
646*0e209d39SAndroid Build Coastguard Worker  * through the API; it can not be set with a pattern.
647*0e209d39SAndroid Build Coastguard Worker  *
648*0e209d39SAndroid Build Coastguard Worker  * <li>Some locales use rounding in their currency formats to reflect the
649*0e209d39SAndroid Build Coastguard Worker  * smallest currency denomination.
650*0e209d39SAndroid Build Coastguard Worker  *
651*0e209d39SAndroid Build Coastguard Worker  * <li>In a pattern, digits '1' through '9' specify rounding, but otherwise
652*0e209d39SAndroid Build Coastguard Worker  * behave identically to digit '0'.
653*0e209d39SAndroid Build Coastguard Worker  * </ul>
654*0e209d39SAndroid Build Coastguard Worker  *
655*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Synchronization</strong>
656*0e209d39SAndroid Build Coastguard Worker  *
657*0e209d39SAndroid Build Coastguard Worker  * <p>DecimalFormat objects are not synchronized.  Multiple
658*0e209d39SAndroid Build Coastguard Worker  * threads should not access one formatter concurrently.
659*0e209d39SAndroid Build Coastguard Worker  *
660*0e209d39SAndroid Build Coastguard Worker  * <p><strong>Subclassing</strong>
661*0e209d39SAndroid Build Coastguard Worker  *
662*0e209d39SAndroid Build Coastguard Worker  * <p><em>User subclasses are not supported.</em> While clients may write
663*0e209d39SAndroid Build Coastguard Worker  * subclasses, such code will not necessarily work and will not be
664*0e209d39SAndroid Build Coastguard Worker  * guaranteed to work stably from release to release.
665*0e209d39SAndroid Build Coastguard Worker  */
666*0e209d39SAndroid Build Coastguard Worker class U_I18N_API DecimalFormat : public NumberFormat {
667*0e209d39SAndroid Build Coastguard Worker   public:
668*0e209d39SAndroid Build Coastguard Worker     /**
669*0e209d39SAndroid Build Coastguard Worker      * Pad position.
670*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
671*0e209d39SAndroid Build Coastguard Worker      */
672*0e209d39SAndroid Build Coastguard Worker     enum EPadPosition {
673*0e209d39SAndroid Build Coastguard Worker         kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix
674*0e209d39SAndroid Build Coastguard Worker     };
675*0e209d39SAndroid Build Coastguard Worker 
676*0e209d39SAndroid Build Coastguard Worker     /**
677*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat using the default pattern and symbols
678*0e209d39SAndroid Build Coastguard Worker      * for the default locale. This is a convenient way to obtain a
679*0e209d39SAndroid Build Coastguard Worker      * DecimalFormat when internationalization is not the main concern.
680*0e209d39SAndroid Build Coastguard Worker      * <P>
681*0e209d39SAndroid Build Coastguard Worker      * To obtain standard formats for a given locale, use the factory methods
682*0e209d39SAndroid Build Coastguard Worker      * on NumberFormat such as createInstance. These factories will
683*0e209d39SAndroid Build Coastguard Worker      * return the most appropriate sub-class of NumberFormat for a given
684*0e209d39SAndroid Build Coastguard Worker      * locale.
685*0e209d39SAndroid Build Coastguard Worker      * <p>
686*0e209d39SAndroid Build Coastguard Worker      * <strong>NOTE:</strong> New users are strongly encouraged to use
687*0e209d39SAndroid Build Coastguard Worker      * #icu::number::NumberFormatter instead of DecimalFormat.
688*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param set to success/failure code. If the
689*0e209d39SAndroid Build Coastguard Worker      *                  pattern is invalid this will be set to a failure code.
690*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
691*0e209d39SAndroid Build Coastguard Worker      */
692*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(UErrorCode& status);
693*0e209d39SAndroid Build Coastguard Worker 
694*0e209d39SAndroid Build Coastguard Worker     /**
695*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat from the given pattern and the symbols
696*0e209d39SAndroid Build Coastguard Worker      * for the default locale. This is a convenient way to obtain a
697*0e209d39SAndroid Build Coastguard Worker      * DecimalFormat when internationalization is not the main concern.
698*0e209d39SAndroid Build Coastguard Worker      * <P>
699*0e209d39SAndroid Build Coastguard Worker      * To obtain standard formats for a given locale, use the factory methods
700*0e209d39SAndroid Build Coastguard Worker      * on NumberFormat such as createInstance. These factories will
701*0e209d39SAndroid Build Coastguard Worker      * return the most appropriate sub-class of NumberFormat for a given
702*0e209d39SAndroid Build Coastguard Worker      * locale.
703*0e209d39SAndroid Build Coastguard Worker      * <p>
704*0e209d39SAndroid Build Coastguard Worker      * <strong>NOTE:</strong> New users are strongly encouraged to use
705*0e209d39SAndroid Build Coastguard Worker      * #icu::number::NumberFormatter instead of DecimalFormat.
706*0e209d39SAndroid Build Coastguard Worker      * @param pattern   A non-localized pattern string.
707*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param set to success/failure code. If the
708*0e209d39SAndroid Build Coastguard Worker      *                  pattern is invalid this will be set to a failure code.
709*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
710*0e209d39SAndroid Build Coastguard Worker      */
711*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const UnicodeString& pattern, UErrorCode& status);
712*0e209d39SAndroid Build Coastguard Worker 
713*0e209d39SAndroid Build Coastguard Worker     /**
714*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat from the given pattern and symbols.
715*0e209d39SAndroid Build Coastguard Worker      * Use this constructor when you need to completely customize the
716*0e209d39SAndroid Build Coastguard Worker      * behavior of the format.
717*0e209d39SAndroid Build Coastguard Worker      * <P>
718*0e209d39SAndroid Build Coastguard Worker      * To obtain standard formats for a given
719*0e209d39SAndroid Build Coastguard Worker      * locale, use the factory methods on NumberFormat such as
720*0e209d39SAndroid Build Coastguard Worker      * createInstance or createCurrencyInstance. If you need only minor adjustments
721*0e209d39SAndroid Build Coastguard Worker      * to a standard format, you can modify the format returned by
722*0e209d39SAndroid Build Coastguard Worker      * a NumberFormat factory method.
723*0e209d39SAndroid Build Coastguard Worker      * <p>
724*0e209d39SAndroid Build Coastguard Worker      * <strong>NOTE:</strong> New users are strongly encouraged to use
725*0e209d39SAndroid Build Coastguard Worker      * #icu::number::NumberFormatter instead of DecimalFormat.
726*0e209d39SAndroid Build Coastguard Worker      *
727*0e209d39SAndroid Build Coastguard Worker      * @param pattern           a non-localized pattern string
728*0e209d39SAndroid Build Coastguard Worker      * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
729*0e209d39SAndroid Build Coastguard Worker      *                          delete this object after making this call.
730*0e209d39SAndroid Build Coastguard Worker      * @param status            Output param set to success/failure code. If the
731*0e209d39SAndroid Build Coastguard Worker      *                          pattern is invalid this will be set to a failure code.
732*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
733*0e209d39SAndroid Build Coastguard Worker      */
734*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
735*0e209d39SAndroid Build Coastguard Worker 
736*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
737*0e209d39SAndroid Build Coastguard Worker 
738*0e209d39SAndroid Build Coastguard Worker     /**
739*0e209d39SAndroid Build Coastguard Worker      * This API is for ICU use only.
740*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat from the given pattern, symbols, and style.
741*0e209d39SAndroid Build Coastguard Worker      *
742*0e209d39SAndroid Build Coastguard Worker      * @param pattern           a non-localized pattern string
743*0e209d39SAndroid Build Coastguard Worker      * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
744*0e209d39SAndroid Build Coastguard Worker      *                          delete this object after making this call.
745*0e209d39SAndroid Build Coastguard Worker      * @param style             style of decimal format
746*0e209d39SAndroid Build Coastguard Worker      * @param status            Output param set to success/failure code. If the
747*0e209d39SAndroid Build Coastguard Worker      *                          pattern is invalid this will be set to a failure code.
748*0e209d39SAndroid Build Coastguard Worker      * @internal
749*0e209d39SAndroid Build Coastguard Worker      */
750*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
751*0e209d39SAndroid Build Coastguard Worker                   UNumberFormatStyle style, UErrorCode& status);
752*0e209d39SAndroid Build Coastguard Worker 
753*0e209d39SAndroid Build Coastguard Worker #if UCONFIG_HAVE_PARSEALLINPUT
754*0e209d39SAndroid Build Coastguard Worker 
755*0e209d39SAndroid Build Coastguard Worker     /**
756*0e209d39SAndroid Build Coastguard Worker      * @internal
757*0e209d39SAndroid Build Coastguard Worker      */
758*0e209d39SAndroid Build Coastguard Worker     void setParseAllInput(UNumberFormatAttributeValue value);
759*0e209d39SAndroid Build Coastguard Worker 
760*0e209d39SAndroid Build Coastguard Worker #endif
761*0e209d39SAndroid Build Coastguard Worker 
762*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
763*0e209d39SAndroid Build Coastguard Worker 
764*0e209d39SAndroid Build Coastguard Worker   private:
765*0e209d39SAndroid Build Coastguard Worker 
766*0e209d39SAndroid Build Coastguard Worker     /**
767*0e209d39SAndroid Build Coastguard Worker      * Internal constructor for DecimalFormat; sets up internal fields. All public constructors should
768*0e209d39SAndroid Build Coastguard Worker      * call this constructor.
769*0e209d39SAndroid Build Coastguard Worker      */
770*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
771*0e209d39SAndroid Build Coastguard Worker 
772*0e209d39SAndroid Build Coastguard Worker   public:
773*0e209d39SAndroid Build Coastguard Worker 
774*0e209d39SAndroid Build Coastguard Worker     /**
775*0e209d39SAndroid Build Coastguard Worker      * Set an integer attribute on this DecimalFormat.
776*0e209d39SAndroid Build Coastguard Worker      * May return U_UNSUPPORTED_ERROR if this instance does not support
777*0e209d39SAndroid Build Coastguard Worker      * the specified attribute.
778*0e209d39SAndroid Build Coastguard Worker      * @param attr the attribute to set
779*0e209d39SAndroid Build Coastguard Worker      * @param newValue new value
780*0e209d39SAndroid Build Coastguard Worker      * @param status the error type
781*0e209d39SAndroid Build Coastguard Worker      * @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) )
782*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 51
783*0e209d39SAndroid Build Coastguard Worker      */
784*0e209d39SAndroid Build Coastguard Worker     virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status);
785*0e209d39SAndroid Build Coastguard Worker 
786*0e209d39SAndroid Build Coastguard Worker     /**
787*0e209d39SAndroid Build Coastguard Worker      * Get an integer
788*0e209d39SAndroid Build Coastguard Worker      * May return U_UNSUPPORTED_ERROR if this instance does not support
789*0e209d39SAndroid Build Coastguard Worker      * the specified attribute.
790*0e209d39SAndroid Build Coastguard Worker      * @param attr the attribute to set
791*0e209d39SAndroid Build Coastguard Worker      * @param status the error type
792*0e209d39SAndroid Build Coastguard Worker      * @return the attribute value. Undefined if there is an error.
793*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 51
794*0e209d39SAndroid Build Coastguard Worker      */
795*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const;
796*0e209d39SAndroid Build Coastguard Worker 
797*0e209d39SAndroid Build Coastguard Worker 
798*0e209d39SAndroid Build Coastguard Worker     /**
799*0e209d39SAndroid Build Coastguard Worker      * Set whether or not grouping will be used in this format.
800*0e209d39SAndroid Build Coastguard Worker      * @param newValue    True, grouping will be used in this format.
801*0e209d39SAndroid Build Coastguard Worker      * @see getGroupingUsed
802*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 53
803*0e209d39SAndroid Build Coastguard Worker      */
804*0e209d39SAndroid Build Coastguard Worker     void setGroupingUsed(UBool newValue) override;
805*0e209d39SAndroid Build Coastguard Worker 
806*0e209d39SAndroid Build Coastguard Worker     /**
807*0e209d39SAndroid Build Coastguard Worker      * Sets whether or not numbers should be parsed as integers only.
808*0e209d39SAndroid Build Coastguard Worker      * @param value    set True, this format will parse numbers as integers
809*0e209d39SAndroid Build Coastguard Worker      *                 only.
810*0e209d39SAndroid Build Coastguard Worker      * @see isParseIntegerOnly
811*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 53
812*0e209d39SAndroid Build Coastguard Worker      */
813*0e209d39SAndroid Build Coastguard Worker     void setParseIntegerOnly(UBool value) override;
814*0e209d39SAndroid Build Coastguard Worker 
815*0e209d39SAndroid Build Coastguard Worker     /**
816*0e209d39SAndroid Build Coastguard Worker      * Sets whether lenient parsing should be enabled (it is off by default).
817*0e209d39SAndroid Build Coastguard Worker      *
818*0e209d39SAndroid Build Coastguard Worker      * @param enable \c true if lenient parsing should be used,
819*0e209d39SAndroid Build Coastguard Worker      *               \c false otherwise.
820*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.8
821*0e209d39SAndroid Build Coastguard Worker      */
822*0e209d39SAndroid Build Coastguard Worker     void setLenient(UBool enable) override;
823*0e209d39SAndroid Build Coastguard Worker 
824*0e209d39SAndroid Build Coastguard Worker     /**
825*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat from the given pattern and symbols.
826*0e209d39SAndroid Build Coastguard Worker      * Use this constructor when you need to completely customize the
827*0e209d39SAndroid Build Coastguard Worker      * behavior of the format.
828*0e209d39SAndroid Build Coastguard Worker      * <P>
829*0e209d39SAndroid Build Coastguard Worker      * To obtain standard formats for a given
830*0e209d39SAndroid Build Coastguard Worker      * locale, use the factory methods on NumberFormat such as
831*0e209d39SAndroid Build Coastguard Worker      * createInstance or createCurrencyInstance. If you need only minor adjustments
832*0e209d39SAndroid Build Coastguard Worker      * to a standard format, you can modify the format returned by
833*0e209d39SAndroid Build Coastguard Worker      * a NumberFormat factory method.
834*0e209d39SAndroid Build Coastguard Worker      * <p>
835*0e209d39SAndroid Build Coastguard Worker      * <strong>NOTE:</strong> New users are strongly encouraged to use
836*0e209d39SAndroid Build Coastguard Worker      * #icu::number::NumberFormatter instead of DecimalFormat.
837*0e209d39SAndroid Build Coastguard Worker      *
838*0e209d39SAndroid Build Coastguard Worker      * @param pattern           a non-localized pattern string
839*0e209d39SAndroid Build Coastguard Worker      * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
840*0e209d39SAndroid Build Coastguard Worker      *                          delete this object after making this call.
841*0e209d39SAndroid Build Coastguard Worker      * @param parseError        Output param to receive errors occurred during parsing
842*0e209d39SAndroid Build Coastguard Worker      * @param status            Output param set to success/failure code. If the
843*0e209d39SAndroid Build Coastguard Worker      *                          pattern is invalid this will be set to a failure code.
844*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
845*0e209d39SAndroid Build Coastguard Worker      */
846*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
847*0e209d39SAndroid Build Coastguard Worker                   UParseError& parseError, UErrorCode& status);
848*0e209d39SAndroid Build Coastguard Worker 
849*0e209d39SAndroid Build Coastguard Worker     /**
850*0e209d39SAndroid Build Coastguard Worker      * Create a DecimalFormat from the given pattern and symbols.
851*0e209d39SAndroid Build Coastguard Worker      * Use this constructor when you need to completely customize the
852*0e209d39SAndroid Build Coastguard Worker      * behavior of the format.
853*0e209d39SAndroid Build Coastguard Worker      * <P>
854*0e209d39SAndroid Build Coastguard Worker      * To obtain standard formats for a given
855*0e209d39SAndroid Build Coastguard Worker      * locale, use the factory methods on NumberFormat such as
856*0e209d39SAndroid Build Coastguard Worker      * createInstance or createCurrencyInstance. If you need only minor adjustments
857*0e209d39SAndroid Build Coastguard Worker      * to a standard format, you can modify the format returned by
858*0e209d39SAndroid Build Coastguard Worker      * a NumberFormat factory method.
859*0e209d39SAndroid Build Coastguard Worker      * <p>
860*0e209d39SAndroid Build Coastguard Worker      * <strong>NOTE:</strong> New users are strongly encouraged to use
861*0e209d39SAndroid Build Coastguard Worker      * #icu::number::NumberFormatter instead of DecimalFormat.
862*0e209d39SAndroid Build Coastguard Worker      *
863*0e209d39SAndroid Build Coastguard Worker      * @param pattern           a non-localized pattern string
864*0e209d39SAndroid Build Coastguard Worker      * @param symbols   the set of symbols to be used
865*0e209d39SAndroid Build Coastguard Worker      * @param status            Output param set to success/failure code. If the
866*0e209d39SAndroid Build Coastguard Worker      *                          pattern is invalid this will be set to a failure code.
867*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
868*0e209d39SAndroid Build Coastguard Worker      */
869*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status);
870*0e209d39SAndroid Build Coastguard Worker 
871*0e209d39SAndroid Build Coastguard Worker     /**
872*0e209d39SAndroid Build Coastguard Worker      * Copy constructor.
873*0e209d39SAndroid Build Coastguard Worker      *
874*0e209d39SAndroid Build Coastguard Worker      * @param source    the DecimalFormat object to be copied from.
875*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
876*0e209d39SAndroid Build Coastguard Worker      */
877*0e209d39SAndroid Build Coastguard Worker     DecimalFormat(const DecimalFormat& source);
878*0e209d39SAndroid Build Coastguard Worker 
879*0e209d39SAndroid Build Coastguard Worker     /**
880*0e209d39SAndroid Build Coastguard Worker      * Assignment operator.
881*0e209d39SAndroid Build Coastguard Worker      *
882*0e209d39SAndroid Build Coastguard Worker      * @param rhs    the DecimalFormat object to be copied.
883*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
884*0e209d39SAndroid Build Coastguard Worker      */
885*0e209d39SAndroid Build Coastguard Worker     DecimalFormat& operator=(const DecimalFormat& rhs);
886*0e209d39SAndroid Build Coastguard Worker 
887*0e209d39SAndroid Build Coastguard Worker     /**
888*0e209d39SAndroid Build Coastguard Worker      * Destructor.
889*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
890*0e209d39SAndroid Build Coastguard Worker      */
891*0e209d39SAndroid Build Coastguard Worker     ~DecimalFormat() override;
892*0e209d39SAndroid Build Coastguard Worker 
893*0e209d39SAndroid Build Coastguard Worker     /**
894*0e209d39SAndroid Build Coastguard Worker      * Clone this Format object polymorphically. The caller owns the
895*0e209d39SAndroid Build Coastguard Worker      * result and should delete it when done.
896*0e209d39SAndroid Build Coastguard Worker      *
897*0e209d39SAndroid Build Coastguard Worker      * @return    a polymorphic copy of this DecimalFormat.
898*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
899*0e209d39SAndroid Build Coastguard Worker      */
900*0e209d39SAndroid Build Coastguard Worker     DecimalFormat* clone() const override;
901*0e209d39SAndroid Build Coastguard Worker 
902*0e209d39SAndroid Build Coastguard Worker     /**
903*0e209d39SAndroid Build Coastguard Worker      * Return true if the given Format objects are semantically equal.
904*0e209d39SAndroid Build Coastguard Worker      * Objects of different subclasses are considered unequal.
905*0e209d39SAndroid Build Coastguard Worker      *
906*0e209d39SAndroid Build Coastguard Worker      * @param other    the object to be compared with.
907*0e209d39SAndroid Build Coastguard Worker      * @return         true if the given Format objects are semantically equal.
908*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
909*0e209d39SAndroid Build Coastguard Worker      */
910*0e209d39SAndroid Build Coastguard Worker     bool operator==(const Format& other) const override;
911*0e209d39SAndroid Build Coastguard Worker 
912*0e209d39SAndroid Build Coastguard Worker 
913*0e209d39SAndroid Build Coastguard Worker     using NumberFormat::format;
914*0e209d39SAndroid Build Coastguard Worker 
915*0e209d39SAndroid Build Coastguard Worker     /**
916*0e209d39SAndroid Build Coastguard Worker      * Format a double or long number using base-10 representation.
917*0e209d39SAndroid Build Coastguard Worker      *
918*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
919*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
920*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
921*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
922*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
923*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
924*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
925*0e209d39SAndroid Build Coastguard Worker      */
926*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const override;
927*0e209d39SAndroid Build Coastguard Worker 
928*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
929*0e209d39SAndroid Build Coastguard Worker     /**
930*0e209d39SAndroid Build Coastguard Worker      * Format a double or long number using base-10 representation.
931*0e209d39SAndroid Build Coastguard Worker      *
932*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
933*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
934*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
935*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
936*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
937*0e209d39SAndroid Build Coastguard Worker      * @param status
938*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
939*0e209d39SAndroid Build Coastguard Worker      * @internal
940*0e209d39SAndroid Build Coastguard Worker      */
941*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos,
942*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
943*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
944*0e209d39SAndroid Build Coastguard Worker 
945*0e209d39SAndroid Build Coastguard Worker     /**
946*0e209d39SAndroid Build Coastguard Worker      * Format a double or long number using base-10 representation.
947*0e209d39SAndroid Build Coastguard Worker      *
948*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
949*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
950*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
951*0e209d39SAndroid Build Coastguard Worker      * @param posIter   On return, can be used to iterate over positions
952*0e209d39SAndroid Build Coastguard Worker      *                  of fields generated by this format call.
953*0e209d39SAndroid Build Coastguard Worker      *                  Can be nullptr.
954*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
955*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
956*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.4
957*0e209d39SAndroid Build Coastguard Worker      */
958*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
959*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
960*0e209d39SAndroid Build Coastguard Worker 
961*0e209d39SAndroid Build Coastguard Worker     /**
962*0e209d39SAndroid Build Coastguard Worker      * Format a long number using base-10 representation.
963*0e209d39SAndroid Build Coastguard Worker      *
964*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
965*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
966*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
967*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
968*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
969*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
970*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
971*0e209d39SAndroid Build Coastguard Worker      */
972*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const override;
973*0e209d39SAndroid Build Coastguard Worker 
974*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
975*0e209d39SAndroid Build Coastguard Worker     /**
976*0e209d39SAndroid Build Coastguard Worker      * Format a long number using base-10 representation.
977*0e209d39SAndroid Build Coastguard Worker      *
978*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
979*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
980*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
981*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
982*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
983*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
984*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
985*0e209d39SAndroid Build Coastguard Worker      * @internal
986*0e209d39SAndroid Build Coastguard Worker      */
987*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
988*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
989*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
990*0e209d39SAndroid Build Coastguard Worker 
991*0e209d39SAndroid Build Coastguard Worker     /**
992*0e209d39SAndroid Build Coastguard Worker      * Format a long number using base-10 representation.
993*0e209d39SAndroid Build Coastguard Worker      *
994*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
995*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
996*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
997*0e209d39SAndroid Build Coastguard Worker      * @param posIter   On return, can be used to iterate over positions
998*0e209d39SAndroid Build Coastguard Worker      *                  of fields generated by this format call.
999*0e209d39SAndroid Build Coastguard Worker      *                  Can be nullptr.
1000*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1001*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1002*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.4
1003*0e209d39SAndroid Build Coastguard Worker      */
1004*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
1005*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
1006*0e209d39SAndroid Build Coastguard Worker 
1007*0e209d39SAndroid Build Coastguard Worker     /**
1008*0e209d39SAndroid Build Coastguard Worker      * Format an int64 number using base-10 representation.
1009*0e209d39SAndroid Build Coastguard Worker      *
1010*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
1011*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1012*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1013*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
1014*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
1015*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1016*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.8
1017*0e209d39SAndroid Build Coastguard Worker      */
1018*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const override;
1019*0e209d39SAndroid Build Coastguard Worker 
1020*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
1021*0e209d39SAndroid Build Coastguard Worker     /**
1022*0e209d39SAndroid Build Coastguard Worker      * Format an int64 number using base-10 representation.
1023*0e209d39SAndroid Build Coastguard Worker      *
1024*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
1025*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1026*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1027*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
1028*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
1029*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1030*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1031*0e209d39SAndroid Build Coastguard Worker      * @internal
1032*0e209d39SAndroid Build Coastguard Worker      */
1033*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
1034*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
1035*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
1036*0e209d39SAndroid Build Coastguard Worker 
1037*0e209d39SAndroid Build Coastguard Worker     /**
1038*0e209d39SAndroid Build Coastguard Worker      * Format an int64 number using base-10 representation.
1039*0e209d39SAndroid Build Coastguard Worker      *
1040*0e209d39SAndroid Build Coastguard Worker      * @param number    The value to be formatted.
1041*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1042*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1043*0e209d39SAndroid Build Coastguard Worker      * @param posIter   On return, can be used to iterate over positions
1044*0e209d39SAndroid Build Coastguard Worker      *                  of fields generated by this format call.
1045*0e209d39SAndroid Build Coastguard Worker      *                  Can be nullptr.
1046*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1047*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1048*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.4
1049*0e209d39SAndroid Build Coastguard Worker      */
1050*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
1051*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
1052*0e209d39SAndroid Build Coastguard Worker 
1053*0e209d39SAndroid Build Coastguard Worker     /**
1054*0e209d39SAndroid Build Coastguard Worker      * Format a decimal number.
1055*0e209d39SAndroid Build Coastguard Worker      * The syntax of the unformatted number is a "numeric string"
1056*0e209d39SAndroid Build Coastguard Worker      * as defined in the Decimal Arithmetic Specification, available at
1057*0e209d39SAndroid Build Coastguard Worker      * http://speleotrove.com/decimal
1058*0e209d39SAndroid Build Coastguard Worker      *
1059*0e209d39SAndroid Build Coastguard Worker      * @param number    The unformatted number, as a string.
1060*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1061*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1062*0e209d39SAndroid Build Coastguard Worker      * @param posIter   On return, can be used to iterate over positions
1063*0e209d39SAndroid Build Coastguard Worker      *                  of fields generated by this format call.
1064*0e209d39SAndroid Build Coastguard Worker      *                  Can be nullptr.
1065*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1066*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1067*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.4
1068*0e209d39SAndroid Build Coastguard Worker      */
1069*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter,
1070*0e209d39SAndroid Build Coastguard Worker                           UErrorCode& status) const override;
1071*0e209d39SAndroid Build Coastguard Worker 
1072*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
1073*0e209d39SAndroid Build Coastguard Worker 
1074*0e209d39SAndroid Build Coastguard Worker     /**
1075*0e209d39SAndroid Build Coastguard Worker      * Format a decimal number.
1076*0e209d39SAndroid Build Coastguard Worker      * The number is a DecimalQuantity wrapper onto a floating point decimal number.
1077*0e209d39SAndroid Build Coastguard Worker      * The default implementation in NumberFormat converts the decimal number
1078*0e209d39SAndroid Build Coastguard Worker      * to a double and formats that.
1079*0e209d39SAndroid Build Coastguard Worker      *
1080*0e209d39SAndroid Build Coastguard Worker      * @param number    The number, a DecimalQuantity format Decimal Floating Point.
1081*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1082*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1083*0e209d39SAndroid Build Coastguard Worker      * @param posIter   On return, can be used to iterate over positions
1084*0e209d39SAndroid Build Coastguard Worker      *                  of fields generated by this format call.
1085*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1086*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1087*0e209d39SAndroid Build Coastguard Worker      * @internal
1088*0e209d39SAndroid Build Coastguard Worker      */
1089*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
1090*0e209d39SAndroid Build Coastguard Worker                           FieldPositionIterator* posIter, UErrorCode& status) const override;
1091*0e209d39SAndroid Build Coastguard Worker 
1092*0e209d39SAndroid Build Coastguard Worker     /**
1093*0e209d39SAndroid Build Coastguard Worker      * Format a decimal number.
1094*0e209d39SAndroid Build Coastguard Worker      * The number is a DecimalQuantity wrapper onto a floating point decimal number.
1095*0e209d39SAndroid Build Coastguard Worker      * The default implementation in NumberFormat converts the decimal number
1096*0e209d39SAndroid Build Coastguard Worker      * to a double and formats that.
1097*0e209d39SAndroid Build Coastguard Worker      *
1098*0e209d39SAndroid Build Coastguard Worker      * @param number    The number, a DecimalQuantity format Decimal Floating Point.
1099*0e209d39SAndroid Build Coastguard Worker      * @param appendTo  Output parameter to receive result.
1100*0e209d39SAndroid Build Coastguard Worker      *                  Result is appended to existing contents.
1101*0e209d39SAndroid Build Coastguard Worker      * @param pos       On input: an alignment field, if desired.
1102*0e209d39SAndroid Build Coastguard Worker      *                  On output: the offsets of the alignment field.
1103*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param filled with success/failure status.
1104*0e209d39SAndroid Build Coastguard Worker      * @return          Reference to 'appendTo' parameter.
1105*0e209d39SAndroid Build Coastguard Worker      * @internal
1106*0e209d39SAndroid Build Coastguard Worker      */
1107*0e209d39SAndroid Build Coastguard Worker     UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
1108*0e209d39SAndroid Build Coastguard Worker                           FieldPosition& pos, UErrorCode& status) const override;
1109*0e209d39SAndroid Build Coastguard Worker 
1110*0e209d39SAndroid Build Coastguard Worker #endif // U_HIDE_INTERNAL_API
1111*0e209d39SAndroid Build Coastguard Worker 
1112*0e209d39SAndroid Build Coastguard Worker     using NumberFormat::parse;
1113*0e209d39SAndroid Build Coastguard Worker 
1114*0e209d39SAndroid Build Coastguard Worker     /**
1115*0e209d39SAndroid Build Coastguard Worker      * Parse the given string using this object's choices. The method
1116*0e209d39SAndroid Build Coastguard Worker      * does string comparisons to try to find an optimal match.
1117*0e209d39SAndroid Build Coastguard Worker      * If no object can be parsed, index is unchanged, and nullptr is
1118*0e209d39SAndroid Build Coastguard Worker      * returned.  The result is returned as the most parsimonious
1119*0e209d39SAndroid Build Coastguard Worker      * type of Formattable that will accommodate all of the
1120*0e209d39SAndroid Build Coastguard Worker      * necessary precision.  For example, if the result is exactly 12,
1121*0e209d39SAndroid Build Coastguard Worker      * it will be returned as a long.  However, if it is 1.5, it will
1122*0e209d39SAndroid Build Coastguard Worker      * be returned as a double.
1123*0e209d39SAndroid Build Coastguard Worker      *
1124*0e209d39SAndroid Build Coastguard Worker      * @param text           The text to be parsed.
1125*0e209d39SAndroid Build Coastguard Worker      * @param result         Formattable to be set to the parse result.
1126*0e209d39SAndroid Build Coastguard Worker      *                       If parse fails, return contents are undefined.
1127*0e209d39SAndroid Build Coastguard Worker      * @param parsePosition  The position to start parsing at on input.
1128*0e209d39SAndroid Build Coastguard Worker      *                       On output, moved to after the last successfully
1129*0e209d39SAndroid Build Coastguard Worker      *                       parse character. On parse failure, does not change.
1130*0e209d39SAndroid Build Coastguard Worker      * @see Formattable
1131*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1132*0e209d39SAndroid Build Coastguard Worker      */
1133*0e209d39SAndroid Build Coastguard Worker     void parse(const UnicodeString& text, Formattable& result,
1134*0e209d39SAndroid Build Coastguard Worker                ParsePosition& parsePosition) const override;
1135*0e209d39SAndroid Build Coastguard Worker 
1136*0e209d39SAndroid Build Coastguard Worker     /**
1137*0e209d39SAndroid Build Coastguard Worker      * Parses text from the given string as a currency amount.  Unlike
1138*0e209d39SAndroid Build Coastguard Worker      * the parse() method, this method will attempt to parse a generic
1139*0e209d39SAndroid Build Coastguard Worker      * currency name, searching for a match of this object's locale's
1140*0e209d39SAndroid Build Coastguard Worker      * currency display names, or for a 3-letter ISO currency code.
1141*0e209d39SAndroid Build Coastguard Worker      * This method will fail if this format is not a currency format,
1142*0e209d39SAndroid Build Coastguard Worker      * that is, if it does not contain the currency pattern symbol
1143*0e209d39SAndroid Build Coastguard Worker      * (U+00A4) in its prefix or suffix.
1144*0e209d39SAndroid Build Coastguard Worker      *
1145*0e209d39SAndroid Build Coastguard Worker      * @param text the string to parse
1146*0e209d39SAndroid Build Coastguard Worker      * @param pos  input-output position; on input, the position within text
1147*0e209d39SAndroid Build Coastguard Worker      *             to match; must have 0 <= pos.getIndex() < text.length();
1148*0e209d39SAndroid Build Coastguard Worker      *             on output, the position after the last matched character.
1149*0e209d39SAndroid Build Coastguard Worker      *             If the parse fails, the position in unchanged upon output.
1150*0e209d39SAndroid Build Coastguard Worker      * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
1151*0e209d39SAndroid Build Coastguard Worker      *             object (owned by the caller) containing information about
1152*0e209d39SAndroid Build Coastguard Worker      *             the parsed currency; if parse fails, this is nullptr.
1153*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 49
1154*0e209d39SAndroid Build Coastguard Worker      */
1155*0e209d39SAndroid Build Coastguard Worker     CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const override;
1156*0e209d39SAndroid Build Coastguard Worker 
1157*0e209d39SAndroid Build Coastguard Worker     /**
1158*0e209d39SAndroid Build Coastguard Worker      * Returns the decimal format symbols, which is generally not changed
1159*0e209d39SAndroid Build Coastguard Worker      * by the programmer or user.
1160*0e209d39SAndroid Build Coastguard Worker      * @return desired DecimalFormatSymbols
1161*0e209d39SAndroid Build Coastguard Worker      * @see DecimalFormatSymbols
1162*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1163*0e209d39SAndroid Build Coastguard Worker      */
1164*0e209d39SAndroid Build Coastguard Worker     virtual const DecimalFormatSymbols* getDecimalFormatSymbols() const;
1165*0e209d39SAndroid Build Coastguard Worker 
1166*0e209d39SAndroid Build Coastguard Worker     /**
1167*0e209d39SAndroid Build Coastguard Worker      * Sets the decimal format symbols, which is generally not changed
1168*0e209d39SAndroid Build Coastguard Worker      * by the programmer or user.
1169*0e209d39SAndroid Build Coastguard Worker      * @param symbolsToAdopt DecimalFormatSymbols to be adopted.
1170*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1171*0e209d39SAndroid Build Coastguard Worker      */
1172*0e209d39SAndroid Build Coastguard Worker     virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1173*0e209d39SAndroid Build Coastguard Worker 
1174*0e209d39SAndroid Build Coastguard Worker     /**
1175*0e209d39SAndroid Build Coastguard Worker      * Sets the decimal format symbols, which is generally not changed
1176*0e209d39SAndroid Build Coastguard Worker      * by the programmer or user.
1177*0e209d39SAndroid Build Coastguard Worker      * @param symbols DecimalFormatSymbols.
1178*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1179*0e209d39SAndroid Build Coastguard Worker      */
1180*0e209d39SAndroid Build Coastguard Worker     virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1181*0e209d39SAndroid Build Coastguard Worker 
1182*0e209d39SAndroid Build Coastguard Worker 
1183*0e209d39SAndroid Build Coastguard Worker     /**
1184*0e209d39SAndroid Build Coastguard Worker      * Returns the currency plural format information,
1185*0e209d39SAndroid Build Coastguard Worker      * which is generally not changed by the programmer or user.
1186*0e209d39SAndroid Build Coastguard Worker      * @return desired CurrencyPluralInfo
1187*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.2
1188*0e209d39SAndroid Build Coastguard Worker      */
1189*0e209d39SAndroid Build Coastguard Worker     virtual const CurrencyPluralInfo* getCurrencyPluralInfo() const;
1190*0e209d39SAndroid Build Coastguard Worker 
1191*0e209d39SAndroid Build Coastguard Worker     /**
1192*0e209d39SAndroid Build Coastguard Worker      * Sets the currency plural format information,
1193*0e209d39SAndroid Build Coastguard Worker      * which is generally not changed by the programmer or user.
1194*0e209d39SAndroid Build Coastguard Worker      * @param toAdopt CurrencyPluralInfo to be adopted.
1195*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.2
1196*0e209d39SAndroid Build Coastguard Worker      */
1197*0e209d39SAndroid Build Coastguard Worker     virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
1198*0e209d39SAndroid Build Coastguard Worker 
1199*0e209d39SAndroid Build Coastguard Worker     /**
1200*0e209d39SAndroid Build Coastguard Worker      * Sets the currency plural format information,
1201*0e209d39SAndroid Build Coastguard Worker      * which is generally not changed by the programmer or user.
1202*0e209d39SAndroid Build Coastguard Worker      * @param info Currency Plural Info.
1203*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 4.2
1204*0e209d39SAndroid Build Coastguard Worker      */
1205*0e209d39SAndroid Build Coastguard Worker     virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
1206*0e209d39SAndroid Build Coastguard Worker 
1207*0e209d39SAndroid Build Coastguard Worker 
1208*0e209d39SAndroid Build Coastguard Worker     /**
1209*0e209d39SAndroid Build Coastguard Worker      * Get the positive prefix.
1210*0e209d39SAndroid Build Coastguard Worker      *
1211*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the positive prefix.
1212*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1213*0e209d39SAndroid Build Coastguard Worker      * Examples: +123, $123, sFr123
1214*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1215*0e209d39SAndroid Build Coastguard Worker      */
1216*0e209d39SAndroid Build Coastguard Worker     UnicodeString& getPositivePrefix(UnicodeString& result) const;
1217*0e209d39SAndroid Build Coastguard Worker 
1218*0e209d39SAndroid Build Coastguard Worker     /**
1219*0e209d39SAndroid Build Coastguard Worker      * Set the positive prefix.
1220*0e209d39SAndroid Build Coastguard Worker      *
1221*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the the positive prefix to be set.
1222*0e209d39SAndroid Build Coastguard Worker      * Examples: +123, $123, sFr123
1223*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1224*0e209d39SAndroid Build Coastguard Worker      */
1225*0e209d39SAndroid Build Coastguard Worker     virtual void setPositivePrefix(const UnicodeString& newValue);
1226*0e209d39SAndroid Build Coastguard Worker 
1227*0e209d39SAndroid Build Coastguard Worker     /**
1228*0e209d39SAndroid Build Coastguard Worker      * Get the negative prefix.
1229*0e209d39SAndroid Build Coastguard Worker      *
1230*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the negative prefix.
1231*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1232*0e209d39SAndroid Build Coastguard Worker      * Examples: -123, ($123) (with negative suffix), sFr-123
1233*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1234*0e209d39SAndroid Build Coastguard Worker      */
1235*0e209d39SAndroid Build Coastguard Worker     UnicodeString& getNegativePrefix(UnicodeString& result) const;
1236*0e209d39SAndroid Build Coastguard Worker 
1237*0e209d39SAndroid Build Coastguard Worker     /**
1238*0e209d39SAndroid Build Coastguard Worker      * Set the negative prefix.
1239*0e209d39SAndroid Build Coastguard Worker      *
1240*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the the negative prefix to be set.
1241*0e209d39SAndroid Build Coastguard Worker      * Examples: -123, ($123) (with negative suffix), sFr-123
1242*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1243*0e209d39SAndroid Build Coastguard Worker      */
1244*0e209d39SAndroid Build Coastguard Worker     virtual void setNegativePrefix(const UnicodeString& newValue);
1245*0e209d39SAndroid Build Coastguard Worker 
1246*0e209d39SAndroid Build Coastguard Worker     /**
1247*0e209d39SAndroid Build Coastguard Worker      * Get the positive suffix.
1248*0e209d39SAndroid Build Coastguard Worker      *
1249*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the positive suffix.
1250*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1251*0e209d39SAndroid Build Coastguard Worker      * Example: 123%
1252*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1253*0e209d39SAndroid Build Coastguard Worker      */
1254*0e209d39SAndroid Build Coastguard Worker     UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1255*0e209d39SAndroid Build Coastguard Worker 
1256*0e209d39SAndroid Build Coastguard Worker     /**
1257*0e209d39SAndroid Build Coastguard Worker      * Set the positive suffix.
1258*0e209d39SAndroid Build Coastguard Worker      *
1259*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the positive suffix to be set.
1260*0e209d39SAndroid Build Coastguard Worker      * Example: 123%
1261*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1262*0e209d39SAndroid Build Coastguard Worker      */
1263*0e209d39SAndroid Build Coastguard Worker     virtual void setPositiveSuffix(const UnicodeString& newValue);
1264*0e209d39SAndroid Build Coastguard Worker 
1265*0e209d39SAndroid Build Coastguard Worker     /**
1266*0e209d39SAndroid Build Coastguard Worker      * Get the negative suffix.
1267*0e209d39SAndroid Build Coastguard Worker      *
1268*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the negative suffix.
1269*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1270*0e209d39SAndroid Build Coastguard Worker      * Examples: -123%, ($123) (with positive suffixes)
1271*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1272*0e209d39SAndroid Build Coastguard Worker      */
1273*0e209d39SAndroid Build Coastguard Worker     UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1274*0e209d39SAndroid Build Coastguard Worker 
1275*0e209d39SAndroid Build Coastguard Worker     /**
1276*0e209d39SAndroid Build Coastguard Worker      * Set the negative suffix.
1277*0e209d39SAndroid Build Coastguard Worker      *
1278*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the negative suffix to be set.
1279*0e209d39SAndroid Build Coastguard Worker      * Examples: 123%
1280*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1281*0e209d39SAndroid Build Coastguard Worker      */
1282*0e209d39SAndroid Build Coastguard Worker     virtual void setNegativeSuffix(const UnicodeString& newValue);
1283*0e209d39SAndroid Build Coastguard Worker 
1284*0e209d39SAndroid Build Coastguard Worker     /**
1285*0e209d39SAndroid Build Coastguard Worker      * Whether to show the plus sign on positive (non-negative) numbers; for example, "+12"
1286*0e209d39SAndroid Build Coastguard Worker      *
1287*0e209d39SAndroid Build Coastguard Worker      * For more control over sign display, use NumberFormatter.
1288*0e209d39SAndroid Build Coastguard Worker      *
1289*0e209d39SAndroid Build Coastguard Worker      * @return Whether the sign is shown on positive numbers and zero.
1290*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1291*0e209d39SAndroid Build Coastguard Worker      */
1292*0e209d39SAndroid Build Coastguard Worker     UBool isSignAlwaysShown() const;
1293*0e209d39SAndroid Build Coastguard Worker 
1294*0e209d39SAndroid Build Coastguard Worker     /**
1295*0e209d39SAndroid Build Coastguard Worker      * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12".
1296*0e209d39SAndroid Build Coastguard Worker      *
1297*0e209d39SAndroid Build Coastguard Worker      * For more control over sign display, use NumberFormatter.
1298*0e209d39SAndroid Build Coastguard Worker      *
1299*0e209d39SAndroid Build Coastguard Worker      * @param value true to always show a sign; false to hide the sign on positive numbers and zero.
1300*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1301*0e209d39SAndroid Build Coastguard Worker      */
1302*0e209d39SAndroid Build Coastguard Worker     void setSignAlwaysShown(UBool value);
1303*0e209d39SAndroid Build Coastguard Worker 
1304*0e209d39SAndroid Build Coastguard Worker     /**
1305*0e209d39SAndroid Build Coastguard Worker      * Get the multiplier for use in percent, permill, etc.
1306*0e209d39SAndroid Build Coastguard Worker      * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1307*0e209d39SAndroid Build Coastguard Worker      * (For Arabic, use arabic percent symbol).
1308*0e209d39SAndroid Build Coastguard Worker      * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1309*0e209d39SAndroid Build Coastguard Worker      *
1310*0e209d39SAndroid Build Coastguard Worker      * The number may also be multiplied by a power of ten; see getMultiplierScale().
1311*0e209d39SAndroid Build Coastguard Worker      *
1312*0e209d39SAndroid Build Coastguard Worker      * @return    the multiplier for use in percent, permill, etc.
1313*0e209d39SAndroid Build Coastguard Worker      * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1314*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1315*0e209d39SAndroid Build Coastguard Worker      */
1316*0e209d39SAndroid Build Coastguard Worker     int32_t getMultiplier() const;
1317*0e209d39SAndroid Build Coastguard Worker 
1318*0e209d39SAndroid Build Coastguard Worker     /**
1319*0e209d39SAndroid Build Coastguard Worker      * Set the multiplier for use in percent, permill, etc.
1320*0e209d39SAndroid Build Coastguard Worker      * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1321*0e209d39SAndroid Build Coastguard Worker      * (For Arabic, use arabic percent symbol).
1322*0e209d39SAndroid Build Coastguard Worker      * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1323*0e209d39SAndroid Build Coastguard Worker      *
1324*0e209d39SAndroid Build Coastguard Worker      * This method only supports integer multipliers. To multiply by a non-integer, pair this
1325*0e209d39SAndroid Build Coastguard Worker      * method with setMultiplierScale().
1326*0e209d39SAndroid Build Coastguard Worker      *
1327*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the multiplier for use in percent, permill, etc.
1328*0e209d39SAndroid Build Coastguard Worker      * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1329*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1330*0e209d39SAndroid Build Coastguard Worker      */
1331*0e209d39SAndroid Build Coastguard Worker     virtual void setMultiplier(int32_t newValue);
1332*0e209d39SAndroid Build Coastguard Worker 
1333*0e209d39SAndroid Build Coastguard Worker     /**
1334*0e209d39SAndroid Build Coastguard Worker      * Gets the power of ten by which number should be multiplied before formatting, which
1335*0e209d39SAndroid Build Coastguard Worker      * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
1336*0e209d39SAndroid Build Coastguard Worker      *
1337*0e209d39SAndroid Build Coastguard Worker      * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
1338*0e209d39SAndroid Build Coastguard Worker      * of -2 corresponds to multiplication by 0.01.
1339*0e209d39SAndroid Build Coastguard Worker      *
1340*0e209d39SAndroid Build Coastguard Worker      * This method is analogous to UNUM_SCALE in getAttribute.
1341*0e209d39SAndroid Build Coastguard Worker      *
1342*0e209d39SAndroid Build Coastguard Worker      * @return    the current value of the power-of-ten multiplier.
1343*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 62
1344*0e209d39SAndroid Build Coastguard Worker      */
1345*0e209d39SAndroid Build Coastguard Worker     int32_t getMultiplierScale() const;
1346*0e209d39SAndroid Build Coastguard Worker 
1347*0e209d39SAndroid Build Coastguard Worker     /**
1348*0e209d39SAndroid Build Coastguard Worker      * Sets a power of ten by which number should be multiplied before formatting, which
1349*0e209d39SAndroid Build Coastguard Worker      * can be combined with setMultiplier() to multiply by any arbitrary decimal value.
1350*0e209d39SAndroid Build Coastguard Worker      *
1351*0e209d39SAndroid Build Coastguard Worker      * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale
1352*0e209d39SAndroid Build Coastguard Worker      * of -2 corresponds to multiplication by 0.01.
1353*0e209d39SAndroid Build Coastguard Worker      *
1354*0e209d39SAndroid Build Coastguard Worker      * For example, to multiply numbers by 0.5 before formatting, you can do:
1355*0e209d39SAndroid Build Coastguard Worker      *
1356*0e209d39SAndroid Build Coastguard Worker      * <pre>
1357*0e209d39SAndroid Build Coastguard Worker      * df.setMultiplier(5);
1358*0e209d39SAndroid Build Coastguard Worker      * df.setMultiplierScale(-1);
1359*0e209d39SAndroid Build Coastguard Worker      * </pre>
1360*0e209d39SAndroid Build Coastguard Worker      *
1361*0e209d39SAndroid Build Coastguard Worker      * This method is analogous to UNUM_SCALE in setAttribute.
1362*0e209d39SAndroid Build Coastguard Worker      *
1363*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the power-of-ten multiplier.
1364*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 62
1365*0e209d39SAndroid Build Coastguard Worker      */
1366*0e209d39SAndroid Build Coastguard Worker     void setMultiplierScale(int32_t newValue);
1367*0e209d39SAndroid Build Coastguard Worker 
1368*0e209d39SAndroid Build Coastguard Worker     /**
1369*0e209d39SAndroid Build Coastguard Worker      * Get the rounding increment.
1370*0e209d39SAndroid Build Coastguard Worker      * @return A positive rounding increment, or 0.0 if a custom rounding
1371*0e209d39SAndroid Build Coastguard Worker      * increment is not in effect.
1372*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingIncrement
1373*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingMode
1374*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingMode
1375*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1376*0e209d39SAndroid Build Coastguard Worker      */
1377*0e209d39SAndroid Build Coastguard Worker     virtual double getRoundingIncrement() const;
1378*0e209d39SAndroid Build Coastguard Worker 
1379*0e209d39SAndroid Build Coastguard Worker     /**
1380*0e209d39SAndroid Build Coastguard Worker      * Set the rounding increment.  In the absence of a rounding increment,
1381*0e209d39SAndroid Build Coastguard Worker      *    numbers will be rounded to the number of digits displayed.
1382*0e209d39SAndroid Build Coastguard Worker      * @param newValue A positive rounding increment, or 0.0 to
1383*0e209d39SAndroid Build Coastguard Worker      * use the default rounding increment.
1384*0e209d39SAndroid Build Coastguard Worker      * Negative increments are equivalent to 0.0.
1385*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingIncrement
1386*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingMode
1387*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingMode
1388*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1389*0e209d39SAndroid Build Coastguard Worker      */
1390*0e209d39SAndroid Build Coastguard Worker     virtual void setRoundingIncrement(double newValue);
1391*0e209d39SAndroid Build Coastguard Worker 
1392*0e209d39SAndroid Build Coastguard Worker     /**
1393*0e209d39SAndroid Build Coastguard Worker      * Get the rounding mode.
1394*0e209d39SAndroid Build Coastguard Worker      * @return A rounding mode
1395*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingIncrement
1396*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingIncrement
1397*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingMode
1398*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1399*0e209d39SAndroid Build Coastguard Worker      */
1400*0e209d39SAndroid Build Coastguard Worker     virtual ERoundingMode getRoundingMode() const override;
1401*0e209d39SAndroid Build Coastguard Worker 
1402*0e209d39SAndroid Build Coastguard Worker     /**
1403*0e209d39SAndroid Build Coastguard Worker      * Set the rounding mode.
1404*0e209d39SAndroid Build Coastguard Worker      * @param roundingMode A rounding mode
1405*0e209d39SAndroid Build Coastguard Worker      * @see #setRoundingIncrement
1406*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingIncrement
1407*0e209d39SAndroid Build Coastguard Worker      * @see #getRoundingMode
1408*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1409*0e209d39SAndroid Build Coastguard Worker      */
1410*0e209d39SAndroid Build Coastguard Worker     virtual void setRoundingMode(ERoundingMode roundingMode) override;
1411*0e209d39SAndroid Build Coastguard Worker 
1412*0e209d39SAndroid Build Coastguard Worker     /**
1413*0e209d39SAndroid Build Coastguard Worker      * Get the width to which the output of format() is padded.
1414*0e209d39SAndroid Build Coastguard Worker      * The width is counted in 16-bit code units.
1415*0e209d39SAndroid Build Coastguard Worker      * @return the format width, or zero if no padding is in effect
1416*0e209d39SAndroid Build Coastguard Worker      * @see #setFormatWidth
1417*0e209d39SAndroid Build Coastguard Worker      * @see #getPadCharacterString
1418*0e209d39SAndroid Build Coastguard Worker      * @see #setPadCharacter
1419*0e209d39SAndroid Build Coastguard Worker      * @see #getPadPosition
1420*0e209d39SAndroid Build Coastguard Worker      * @see #setPadPosition
1421*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1422*0e209d39SAndroid Build Coastguard Worker      */
1423*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getFormatWidth() const;
1424*0e209d39SAndroid Build Coastguard Worker 
1425*0e209d39SAndroid Build Coastguard Worker     /**
1426*0e209d39SAndroid Build Coastguard Worker      * Set the width to which the output of format() is padded.
1427*0e209d39SAndroid Build Coastguard Worker      * The width is counted in 16-bit code units.
1428*0e209d39SAndroid Build Coastguard Worker      * This method also controls whether padding is enabled.
1429*0e209d39SAndroid Build Coastguard Worker      * @param width the width to which to pad the result of
1430*0e209d39SAndroid Build Coastguard Worker      * format(), or zero to disable padding.  A negative
1431*0e209d39SAndroid Build Coastguard Worker      * width is equivalent to 0.
1432*0e209d39SAndroid Build Coastguard Worker      * @see #getFormatWidth
1433*0e209d39SAndroid Build Coastguard Worker      * @see #getPadCharacterString
1434*0e209d39SAndroid Build Coastguard Worker      * @see #setPadCharacter
1435*0e209d39SAndroid Build Coastguard Worker      * @see #getPadPosition
1436*0e209d39SAndroid Build Coastguard Worker      * @see #setPadPosition
1437*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1438*0e209d39SAndroid Build Coastguard Worker      */
1439*0e209d39SAndroid Build Coastguard Worker     virtual void setFormatWidth(int32_t width);
1440*0e209d39SAndroid Build Coastguard Worker 
1441*0e209d39SAndroid Build Coastguard Worker     /**
1442*0e209d39SAndroid Build Coastguard Worker      * Get the pad character used to pad to the format width.  The
1443*0e209d39SAndroid Build Coastguard Worker      * default is ' '.
1444*0e209d39SAndroid Build Coastguard Worker      * @return a string containing the pad character. This will always
1445*0e209d39SAndroid Build Coastguard Worker      * have a length of one 32-bit code point.
1446*0e209d39SAndroid Build Coastguard Worker      * @see #setFormatWidth
1447*0e209d39SAndroid Build Coastguard Worker      * @see #getFormatWidth
1448*0e209d39SAndroid Build Coastguard Worker      * @see #setPadCharacter
1449*0e209d39SAndroid Build Coastguard Worker      * @see #getPadPosition
1450*0e209d39SAndroid Build Coastguard Worker      * @see #setPadPosition
1451*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1452*0e209d39SAndroid Build Coastguard Worker      */
1453*0e209d39SAndroid Build Coastguard Worker     virtual UnicodeString getPadCharacterString() const;
1454*0e209d39SAndroid Build Coastguard Worker 
1455*0e209d39SAndroid Build Coastguard Worker     /**
1456*0e209d39SAndroid Build Coastguard Worker      * Set the character used to pad to the format width.  If padding
1457*0e209d39SAndroid Build Coastguard Worker      * is not enabled, then this will take effect if padding is later
1458*0e209d39SAndroid Build Coastguard Worker      * enabled.
1459*0e209d39SAndroid Build Coastguard Worker      * @param padChar a string containing the pad character. If the string
1460*0e209d39SAndroid Build Coastguard Worker      * has length 0, then the pad character is set to ' '.  Otherwise
1461*0e209d39SAndroid Build Coastguard Worker      * padChar.char32At(0) will be used as the pad character.
1462*0e209d39SAndroid Build Coastguard Worker      * @see #setFormatWidth
1463*0e209d39SAndroid Build Coastguard Worker      * @see #getFormatWidth
1464*0e209d39SAndroid Build Coastguard Worker      * @see #getPadCharacterString
1465*0e209d39SAndroid Build Coastguard Worker      * @see #getPadPosition
1466*0e209d39SAndroid Build Coastguard Worker      * @see #setPadPosition
1467*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1468*0e209d39SAndroid Build Coastguard Worker      */
1469*0e209d39SAndroid Build Coastguard Worker     virtual void setPadCharacter(const UnicodeString& padChar);
1470*0e209d39SAndroid Build Coastguard Worker 
1471*0e209d39SAndroid Build Coastguard Worker     /**
1472*0e209d39SAndroid Build Coastguard Worker      * Get the position at which padding will take place.  This is the location
1473*0e209d39SAndroid Build Coastguard Worker      * at which padding will be inserted if the result of format()
1474*0e209d39SAndroid Build Coastguard Worker      * is shorter than the format width.
1475*0e209d39SAndroid Build Coastguard Worker      * @return the pad position, one of kPadBeforePrefix,
1476*0e209d39SAndroid Build Coastguard Worker      * kPadAfterPrefix, kPadBeforeSuffix, or
1477*0e209d39SAndroid Build Coastguard Worker      * kPadAfterSuffix.
1478*0e209d39SAndroid Build Coastguard Worker      * @see #setFormatWidth
1479*0e209d39SAndroid Build Coastguard Worker      * @see #getFormatWidth
1480*0e209d39SAndroid Build Coastguard Worker      * @see #setPadCharacter
1481*0e209d39SAndroid Build Coastguard Worker      * @see #getPadCharacterString
1482*0e209d39SAndroid Build Coastguard Worker      * @see #setPadPosition
1483*0e209d39SAndroid Build Coastguard Worker      * @see #EPadPosition
1484*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1485*0e209d39SAndroid Build Coastguard Worker      */
1486*0e209d39SAndroid Build Coastguard Worker     virtual EPadPosition getPadPosition() const;
1487*0e209d39SAndroid Build Coastguard Worker 
1488*0e209d39SAndroid Build Coastguard Worker     /**
1489*0e209d39SAndroid Build Coastguard Worker      * Set the position at which padding will take place.  This is the location
1490*0e209d39SAndroid Build Coastguard Worker      * at which padding will be inserted if the result of format()
1491*0e209d39SAndroid Build Coastguard Worker      * is shorter than the format width.  This has no effect unless padding is
1492*0e209d39SAndroid Build Coastguard Worker      * enabled.
1493*0e209d39SAndroid Build Coastguard Worker      * @param padPos the pad position, one of kPadBeforePrefix,
1494*0e209d39SAndroid Build Coastguard Worker      * kPadAfterPrefix, kPadBeforeSuffix, or
1495*0e209d39SAndroid Build Coastguard Worker      * kPadAfterSuffix.
1496*0e209d39SAndroid Build Coastguard Worker      * @see #setFormatWidth
1497*0e209d39SAndroid Build Coastguard Worker      * @see #getFormatWidth
1498*0e209d39SAndroid Build Coastguard Worker      * @see #setPadCharacter
1499*0e209d39SAndroid Build Coastguard Worker      * @see #getPadCharacterString
1500*0e209d39SAndroid Build Coastguard Worker      * @see #getPadPosition
1501*0e209d39SAndroid Build Coastguard Worker      * @see #EPadPosition
1502*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1503*0e209d39SAndroid Build Coastguard Worker      */
1504*0e209d39SAndroid Build Coastguard Worker     virtual void setPadPosition(EPadPosition padPos);
1505*0e209d39SAndroid Build Coastguard Worker 
1506*0e209d39SAndroid Build Coastguard Worker     /**
1507*0e209d39SAndroid Build Coastguard Worker      * Return whether or not scientific notation is used.
1508*0e209d39SAndroid Build Coastguard Worker      * @return true if this object formats and parses scientific notation
1509*0e209d39SAndroid Build Coastguard Worker      * @see #setScientificNotation
1510*0e209d39SAndroid Build Coastguard Worker      * @see #getMinimumExponentDigits
1511*0e209d39SAndroid Build Coastguard Worker      * @see #setMinimumExponentDigits
1512*0e209d39SAndroid Build Coastguard Worker      * @see #isExponentSignAlwaysShown
1513*0e209d39SAndroid Build Coastguard Worker      * @see #setExponentSignAlwaysShown
1514*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1515*0e209d39SAndroid Build Coastguard Worker      */
1516*0e209d39SAndroid Build Coastguard Worker     virtual UBool isScientificNotation() const;
1517*0e209d39SAndroid Build Coastguard Worker 
1518*0e209d39SAndroid Build Coastguard Worker     /**
1519*0e209d39SAndroid Build Coastguard Worker      * Set whether or not scientific notation is used. When scientific notation
1520*0e209d39SAndroid Build Coastguard Worker      * is used, the effective maximum number of integer digits is <= 8.  If the
1521*0e209d39SAndroid Build Coastguard Worker      * maximum number of integer digits is set to more than 8, the effective
1522*0e209d39SAndroid Build Coastguard Worker      * maximum will be 1.  This allows this call to generate a 'default' scientific
1523*0e209d39SAndroid Build Coastguard Worker      * number format without additional changes.
1524*0e209d39SAndroid Build Coastguard Worker      * @param useScientific true if this object formats and parses scientific
1525*0e209d39SAndroid Build Coastguard Worker      * notation
1526*0e209d39SAndroid Build Coastguard Worker      * @see #isScientificNotation
1527*0e209d39SAndroid Build Coastguard Worker      * @see #getMinimumExponentDigits
1528*0e209d39SAndroid Build Coastguard Worker      * @see #setMinimumExponentDigits
1529*0e209d39SAndroid Build Coastguard Worker      * @see #isExponentSignAlwaysShown
1530*0e209d39SAndroid Build Coastguard Worker      * @see #setExponentSignAlwaysShown
1531*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1532*0e209d39SAndroid Build Coastguard Worker      */
1533*0e209d39SAndroid Build Coastguard Worker     virtual void setScientificNotation(UBool useScientific);
1534*0e209d39SAndroid Build Coastguard Worker 
1535*0e209d39SAndroid Build Coastguard Worker     /**
1536*0e209d39SAndroid Build Coastguard Worker      * Return the minimum exponent digits that will be shown.
1537*0e209d39SAndroid Build Coastguard Worker      * @return the minimum exponent digits that will be shown
1538*0e209d39SAndroid Build Coastguard Worker      * @see #setScientificNotation
1539*0e209d39SAndroid Build Coastguard Worker      * @see #isScientificNotation
1540*0e209d39SAndroid Build Coastguard Worker      * @see #setMinimumExponentDigits
1541*0e209d39SAndroid Build Coastguard Worker      * @see #isExponentSignAlwaysShown
1542*0e209d39SAndroid Build Coastguard Worker      * @see #setExponentSignAlwaysShown
1543*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1544*0e209d39SAndroid Build Coastguard Worker      */
1545*0e209d39SAndroid Build Coastguard Worker     virtual int8_t getMinimumExponentDigits() const;
1546*0e209d39SAndroid Build Coastguard Worker 
1547*0e209d39SAndroid Build Coastguard Worker     /**
1548*0e209d39SAndroid Build Coastguard Worker      * Set the minimum exponent digits that will be shown.  This has no
1549*0e209d39SAndroid Build Coastguard Worker      * effect unless scientific notation is in use.
1550*0e209d39SAndroid Build Coastguard Worker      * @param minExpDig a value >= 1 indicating the fewest exponent digits
1551*0e209d39SAndroid Build Coastguard Worker      * that will be shown.  Values less than 1 will be treated as 1.
1552*0e209d39SAndroid Build Coastguard Worker      * @see #setScientificNotation
1553*0e209d39SAndroid Build Coastguard Worker      * @see #isScientificNotation
1554*0e209d39SAndroid Build Coastguard Worker      * @see #getMinimumExponentDigits
1555*0e209d39SAndroid Build Coastguard Worker      * @see #isExponentSignAlwaysShown
1556*0e209d39SAndroid Build Coastguard Worker      * @see #setExponentSignAlwaysShown
1557*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1558*0e209d39SAndroid Build Coastguard Worker      */
1559*0e209d39SAndroid Build Coastguard Worker     virtual void setMinimumExponentDigits(int8_t minExpDig);
1560*0e209d39SAndroid Build Coastguard Worker 
1561*0e209d39SAndroid Build Coastguard Worker     /**
1562*0e209d39SAndroid Build Coastguard Worker      * Return whether the exponent sign is always shown.
1563*0e209d39SAndroid Build Coastguard Worker      * @return true if the exponent is always prefixed with either the
1564*0e209d39SAndroid Build Coastguard Worker      * localized minus sign or the localized plus sign, false if only negative
1565*0e209d39SAndroid Build Coastguard Worker      * exponents are prefixed with the localized minus sign.
1566*0e209d39SAndroid Build Coastguard Worker      * @see #setScientificNotation
1567*0e209d39SAndroid Build Coastguard Worker      * @see #isScientificNotation
1568*0e209d39SAndroid Build Coastguard Worker      * @see #setMinimumExponentDigits
1569*0e209d39SAndroid Build Coastguard Worker      * @see #getMinimumExponentDigits
1570*0e209d39SAndroid Build Coastguard Worker      * @see #setExponentSignAlwaysShown
1571*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1572*0e209d39SAndroid Build Coastguard Worker      */
1573*0e209d39SAndroid Build Coastguard Worker     virtual UBool isExponentSignAlwaysShown() const;
1574*0e209d39SAndroid Build Coastguard Worker 
1575*0e209d39SAndroid Build Coastguard Worker     /**
1576*0e209d39SAndroid Build Coastguard Worker      * Set whether the exponent sign is always shown.  This has no effect
1577*0e209d39SAndroid Build Coastguard Worker      * unless scientific notation is in use.
1578*0e209d39SAndroid Build Coastguard Worker      * @param expSignAlways true if the exponent is always prefixed with either
1579*0e209d39SAndroid Build Coastguard Worker      * the localized minus sign or the localized plus sign, false if only
1580*0e209d39SAndroid Build Coastguard Worker      * negative exponents are prefixed with the localized minus sign.
1581*0e209d39SAndroid Build Coastguard Worker      * @see #setScientificNotation
1582*0e209d39SAndroid Build Coastguard Worker      * @see #isScientificNotation
1583*0e209d39SAndroid Build Coastguard Worker      * @see #setMinimumExponentDigits
1584*0e209d39SAndroid Build Coastguard Worker      * @see #getMinimumExponentDigits
1585*0e209d39SAndroid Build Coastguard Worker      * @see #isExponentSignAlwaysShown
1586*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1587*0e209d39SAndroid Build Coastguard Worker      */
1588*0e209d39SAndroid Build Coastguard Worker     virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1589*0e209d39SAndroid Build Coastguard Worker 
1590*0e209d39SAndroid Build Coastguard Worker     /**
1591*0e209d39SAndroid Build Coastguard Worker      * Return the grouping size. Grouping size is the number of digits between
1592*0e209d39SAndroid Build Coastguard Worker      * grouping separators in the integer portion of a number.  For example,
1593*0e209d39SAndroid Build Coastguard Worker      * in the number "123,456.78", the grouping size is 3.
1594*0e209d39SAndroid Build Coastguard Worker      *
1595*0e209d39SAndroid Build Coastguard Worker      * @return    the grouping size.
1596*0e209d39SAndroid Build Coastguard Worker      * @see setGroupingSize
1597*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat::isGroupingUsed
1598*0e209d39SAndroid Build Coastguard Worker      * @see DecimalFormatSymbols::getGroupingSeparator
1599*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1600*0e209d39SAndroid Build Coastguard Worker      */
1601*0e209d39SAndroid Build Coastguard Worker     int32_t getGroupingSize() const;
1602*0e209d39SAndroid Build Coastguard Worker 
1603*0e209d39SAndroid Build Coastguard Worker     /**
1604*0e209d39SAndroid Build Coastguard Worker      * Set the grouping size. Grouping size is the number of digits between
1605*0e209d39SAndroid Build Coastguard Worker      * grouping separators in the integer portion of a number.  For example,
1606*0e209d39SAndroid Build Coastguard Worker      * in the number "123,456.78", the grouping size is 3.
1607*0e209d39SAndroid Build Coastguard Worker      *
1608*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the grouping size.
1609*0e209d39SAndroid Build Coastguard Worker      * @see getGroupingSize
1610*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat::setGroupingUsed
1611*0e209d39SAndroid Build Coastguard Worker      * @see DecimalFormatSymbols::setGroupingSeparator
1612*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1613*0e209d39SAndroid Build Coastguard Worker      */
1614*0e209d39SAndroid Build Coastguard Worker     virtual void setGroupingSize(int32_t newValue);
1615*0e209d39SAndroid Build Coastguard Worker 
1616*0e209d39SAndroid Build Coastguard Worker     /**
1617*0e209d39SAndroid Build Coastguard Worker      * Return the secondary grouping size. In some locales one
1618*0e209d39SAndroid Build Coastguard Worker      * grouping interval is used for the least significant integer
1619*0e209d39SAndroid Build Coastguard Worker      * digits (the primary grouping size), and another is used for all
1620*0e209d39SAndroid Build Coastguard Worker      * others (the secondary grouping size).  A formatter supporting a
1621*0e209d39SAndroid Build Coastguard Worker      * secondary grouping size will return a positive integer unequal
1622*0e209d39SAndroid Build Coastguard Worker      * to the primary grouping size returned by
1623*0e209d39SAndroid Build Coastguard Worker      * getGroupingSize().  For example, if the primary
1624*0e209d39SAndroid Build Coastguard Worker      * grouping size is 4, and the secondary grouping size is 2, then
1625*0e209d39SAndroid Build Coastguard Worker      * the number 123456789 formats as "1,23,45,6789", and the pattern
1626*0e209d39SAndroid Build Coastguard Worker      * appears as "#,##,###0".
1627*0e209d39SAndroid Build Coastguard Worker      * @return the secondary grouping size, or a value less than
1628*0e209d39SAndroid Build Coastguard Worker      * one if there is none
1629*0e209d39SAndroid Build Coastguard Worker      * @see setSecondaryGroupingSize
1630*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat::isGroupingUsed
1631*0e209d39SAndroid Build Coastguard Worker      * @see DecimalFormatSymbols::getGroupingSeparator
1632*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
1633*0e209d39SAndroid Build Coastguard Worker      */
1634*0e209d39SAndroid Build Coastguard Worker     int32_t getSecondaryGroupingSize() const;
1635*0e209d39SAndroid Build Coastguard Worker 
1636*0e209d39SAndroid Build Coastguard Worker     /**
1637*0e209d39SAndroid Build Coastguard Worker      * Set the secondary grouping size. If set to a value less than 1,
1638*0e209d39SAndroid Build Coastguard Worker      * then secondary grouping is turned off, and the primary grouping
1639*0e209d39SAndroid Build Coastguard Worker      * size is used for all intervals, not just the least significant.
1640*0e209d39SAndroid Build Coastguard Worker      *
1641*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the secondary grouping size.
1642*0e209d39SAndroid Build Coastguard Worker      * @see getSecondaryGroupingSize
1643*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat#setGroupingUsed
1644*0e209d39SAndroid Build Coastguard Worker      * @see DecimalFormatSymbols::setGroupingSeparator
1645*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
1646*0e209d39SAndroid Build Coastguard Worker      */
1647*0e209d39SAndroid Build Coastguard Worker     virtual void setSecondaryGroupingSize(int32_t newValue);
1648*0e209d39SAndroid Build Coastguard Worker 
1649*0e209d39SAndroid Build Coastguard Worker     /**
1650*0e209d39SAndroid Build Coastguard Worker      * Returns the minimum number of grouping digits.
1651*0e209d39SAndroid Build Coastguard Worker      * Grouping separators are output if there are at least this many
1652*0e209d39SAndroid Build Coastguard Worker      * digits to the left of the first (rightmost) grouping separator,
1653*0e209d39SAndroid Build Coastguard Worker      * that is, there are at least (minimum grouping + grouping size) integer digits.
1654*0e209d39SAndroid Build Coastguard Worker      * (Subject to isGroupingUsed().)
1655*0e209d39SAndroid Build Coastguard Worker      *
1656*0e209d39SAndroid Build Coastguard Worker      * For example, if this value is 2, and the grouping size is 3, then
1657*0e209d39SAndroid Build Coastguard Worker      * 9999 -> "9999" and 10000 -> "10,000"
1658*0e209d39SAndroid Build Coastguard Worker      *
1659*0e209d39SAndroid Build Coastguard Worker      * The default value for this attribute is 0.
1660*0e209d39SAndroid Build Coastguard Worker      * A value of 1, 0, or lower, means that the use of grouping separators
1661*0e209d39SAndroid Build Coastguard Worker      * only depends on the grouping size (and on isGroupingUsed()).
1662*0e209d39SAndroid Build Coastguard Worker      *
1663*0e209d39SAndroid Build Coastguard Worker      * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat.
1664*0e209d39SAndroid Build Coastguard Worker      * This is for backwards compatibility reasons.
1665*0e209d39SAndroid Build Coastguard Worker      *
1666*0e209d39SAndroid Build Coastguard Worker      * For more control over grouping strategies, use NumberFormatter.
1667*0e209d39SAndroid Build Coastguard Worker      *
1668*0e209d39SAndroid Build Coastguard Worker      * @see setMinimumGroupingDigits
1669*0e209d39SAndroid Build Coastguard Worker      * @see getGroupingSize
1670*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1671*0e209d39SAndroid Build Coastguard Worker      */
1672*0e209d39SAndroid Build Coastguard Worker     int32_t getMinimumGroupingDigits() const;
1673*0e209d39SAndroid Build Coastguard Worker 
1674*0e209d39SAndroid Build Coastguard Worker     /**
1675*0e209d39SAndroid Build Coastguard Worker      * Sets the minimum grouping digits. Setting the value to
1676*0e209d39SAndroid Build Coastguard Worker      *  - 1: Turns off minimum grouping digits.
1677*0e209d39SAndroid Build Coastguard Worker      *  - 0 or -1: The behavior is undefined.
1678*0e209d39SAndroid Build Coastguard Worker      *  - UNUM_MINIMUM_GROUPING_DIGITS_AUTO: Display grouping using the default
1679*0e209d39SAndroid Build Coastguard Worker      *      strategy for all locales.
1680*0e209d39SAndroid Build Coastguard Worker      *  - UNUM_MINIMUM_GROUPING_DIGITS_MIN2: Display grouping using locale
1681*0e209d39SAndroid Build Coastguard Worker      *      defaults, except do not show grouping on values smaller than 10000
1682*0e209d39SAndroid Build Coastguard Worker      *      (such that there is a minimum of two digits before the first
1683*0e209d39SAndroid Build Coastguard Worker      *      separator).
1684*0e209d39SAndroid Build Coastguard Worker      *
1685*0e209d39SAndroid Build Coastguard Worker      * For more control over grouping strategies, use NumberFormatter.
1686*0e209d39SAndroid Build Coastguard Worker      *
1687*0e209d39SAndroid Build Coastguard Worker      * @param newValue the new value of minimum grouping digits.
1688*0e209d39SAndroid Build Coastguard Worker      * @see getMinimumGroupingDigits
1689*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1690*0e209d39SAndroid Build Coastguard Worker      */
1691*0e209d39SAndroid Build Coastguard Worker     void setMinimumGroupingDigits(int32_t newValue);
1692*0e209d39SAndroid Build Coastguard Worker 
1693*0e209d39SAndroid Build Coastguard Worker     /**
1694*0e209d39SAndroid Build Coastguard Worker      * Allows you to get the behavior of the decimal separator with integers.
1695*0e209d39SAndroid Build Coastguard Worker      * (The decimal separator will always appear with decimals.)
1696*0e209d39SAndroid Build Coastguard Worker      *
1697*0e209d39SAndroid Build Coastguard Worker      * @return    true if the decimal separator always appear with decimals.
1698*0e209d39SAndroid Build Coastguard Worker      * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1699*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1700*0e209d39SAndroid Build Coastguard Worker      */
1701*0e209d39SAndroid Build Coastguard Worker     UBool isDecimalSeparatorAlwaysShown() const;
1702*0e209d39SAndroid Build Coastguard Worker 
1703*0e209d39SAndroid Build Coastguard Worker     /**
1704*0e209d39SAndroid Build Coastguard Worker      * Allows you to set the behavior of the decimal separator with integers.
1705*0e209d39SAndroid Build Coastguard Worker      * (The decimal separator will always appear with decimals.)
1706*0e209d39SAndroid Build Coastguard Worker      *
1707*0e209d39SAndroid Build Coastguard Worker      * @param newValue    set true if the decimal separator will always appear with decimals.
1708*0e209d39SAndroid Build Coastguard Worker      * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1709*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1710*0e209d39SAndroid Build Coastguard Worker      */
1711*0e209d39SAndroid Build Coastguard Worker     virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1712*0e209d39SAndroid Build Coastguard Worker 
1713*0e209d39SAndroid Build Coastguard Worker     /**
1714*0e209d39SAndroid Build Coastguard Worker      * Allows you to get the parse behavior of the pattern decimal mark.
1715*0e209d39SAndroid Build Coastguard Worker      *
1716*0e209d39SAndroid Build Coastguard Worker      * @return    true if input must contain a match to decimal mark in pattern
1717*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 54
1718*0e209d39SAndroid Build Coastguard Worker      */
1719*0e209d39SAndroid Build Coastguard Worker     UBool isDecimalPatternMatchRequired() const;
1720*0e209d39SAndroid Build Coastguard Worker 
1721*0e209d39SAndroid Build Coastguard Worker     /**
1722*0e209d39SAndroid Build Coastguard Worker      * Allows you to set the parse behavior of the pattern decimal mark.
1723*0e209d39SAndroid Build Coastguard Worker      *
1724*0e209d39SAndroid Build Coastguard Worker      * if true, the input must have a decimal mark if one was specified in the pattern. When
1725*0e209d39SAndroid Build Coastguard Worker      * false the decimal mark may be omitted from the input.
1726*0e209d39SAndroid Build Coastguard Worker      *
1727*0e209d39SAndroid Build Coastguard Worker      * @param newValue    set true if input must contain a match to decimal mark in pattern
1728*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 54
1729*0e209d39SAndroid Build Coastguard Worker      */
1730*0e209d39SAndroid Build Coastguard Worker     virtual void setDecimalPatternMatchRequired(UBool newValue);
1731*0e209d39SAndroid Build Coastguard Worker 
1732*0e209d39SAndroid Build Coastguard Worker     /**
1733*0e209d39SAndroid Build Coastguard Worker      * Returns whether to ignore exponents when parsing.
1734*0e209d39SAndroid Build Coastguard Worker      *
1735*0e209d39SAndroid Build Coastguard Worker      * @return Whether to ignore exponents when parsing.
1736*0e209d39SAndroid Build Coastguard Worker      * @see #setParseNoExponent
1737*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1738*0e209d39SAndroid Build Coastguard Worker      */
1739*0e209d39SAndroid Build Coastguard Worker     UBool isParseNoExponent() const;
1740*0e209d39SAndroid Build Coastguard Worker 
1741*0e209d39SAndroid Build Coastguard Worker     /**
1742*0e209d39SAndroid Build Coastguard Worker      * Specifies whether to stop parsing when an exponent separator is encountered. For
1743*0e209d39SAndroid Build Coastguard Worker      * example, parses "123E4" to 123 (with parse position 3) instead of 1230000 (with parse position
1744*0e209d39SAndroid Build Coastguard Worker      * 5).
1745*0e209d39SAndroid Build Coastguard Worker      *
1746*0e209d39SAndroid Build Coastguard Worker      * @param value true to prevent exponents from being parsed; false to allow them to be parsed.
1747*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1748*0e209d39SAndroid Build Coastguard Worker      */
1749*0e209d39SAndroid Build Coastguard Worker     void setParseNoExponent(UBool value);
1750*0e209d39SAndroid Build Coastguard Worker 
1751*0e209d39SAndroid Build Coastguard Worker     /**
1752*0e209d39SAndroid Build Coastguard Worker      * Returns whether parsing is sensitive to case (lowercase/uppercase).
1753*0e209d39SAndroid Build Coastguard Worker      *
1754*0e209d39SAndroid Build Coastguard Worker      * @return Whether parsing is case-sensitive.
1755*0e209d39SAndroid Build Coastguard Worker      * @see #setParseCaseSensitive
1756*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1757*0e209d39SAndroid Build Coastguard Worker      */
1758*0e209d39SAndroid Build Coastguard Worker     UBool isParseCaseSensitive() const;
1759*0e209d39SAndroid Build Coastguard Worker 
1760*0e209d39SAndroid Build Coastguard Worker     /**
1761*0e209d39SAndroid Build Coastguard Worker      * Whether to pay attention to case when parsing; default is to ignore case (perform
1762*0e209d39SAndroid Build Coastguard Worker      * case-folding). For example, "A" == "a" in case-insensitive but not case-sensitive mode.
1763*0e209d39SAndroid Build Coastguard Worker      *
1764*0e209d39SAndroid Build Coastguard Worker      * Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive
1765*0e209d39SAndroid Build Coastguard Worker      * mode, even though "US$1.00" parses.
1766*0e209d39SAndroid Build Coastguard Worker      *
1767*0e209d39SAndroid Build Coastguard Worker      * @param value true to enable case-sensitive parsing (the default); false to force
1768*0e209d39SAndroid Build Coastguard Worker      *              case-sensitive parsing behavior.
1769*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1770*0e209d39SAndroid Build Coastguard Worker      */
1771*0e209d39SAndroid Build Coastguard Worker     void setParseCaseSensitive(UBool value);
1772*0e209d39SAndroid Build Coastguard Worker 
1773*0e209d39SAndroid Build Coastguard Worker     /**
1774*0e209d39SAndroid Build Coastguard Worker      * Returns whether truncation of high-order integer digits should result in an error.
1775*0e209d39SAndroid Build Coastguard Worker      * By default, setMaximumIntegerDigits truncates high-order digits silently.
1776*0e209d39SAndroid Build Coastguard Worker      *
1777*0e209d39SAndroid Build Coastguard Worker      * @return Whether an error code is set if high-order digits are truncated.
1778*0e209d39SAndroid Build Coastguard Worker      * @see setFormatFailIfMoreThanMaxDigits
1779*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1780*0e209d39SAndroid Build Coastguard Worker      */
1781*0e209d39SAndroid Build Coastguard Worker     UBool isFormatFailIfMoreThanMaxDigits() const;
1782*0e209d39SAndroid Build Coastguard Worker 
1783*0e209d39SAndroid Build Coastguard Worker     /**
1784*0e209d39SAndroid Build Coastguard Worker      * Sets whether truncation of high-order integer digits should result in an error.
1785*0e209d39SAndroid Build Coastguard Worker      * By default, setMaximumIntegerDigits truncates high-order digits silently.
1786*0e209d39SAndroid Build Coastguard Worker      *
1787*0e209d39SAndroid Build Coastguard Worker      * @param value Whether to set an error code if high-order digits are truncated.
1788*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
1789*0e209d39SAndroid Build Coastguard Worker      */
1790*0e209d39SAndroid Build Coastguard Worker     void setFormatFailIfMoreThanMaxDigits(UBool value);
1791*0e209d39SAndroid Build Coastguard Worker 
1792*0e209d39SAndroid Build Coastguard Worker     /**
1793*0e209d39SAndroid Build Coastguard Worker      * Synthesizes a pattern string that represents the current state
1794*0e209d39SAndroid Build Coastguard Worker      * of this Format object.
1795*0e209d39SAndroid Build Coastguard Worker      *
1796*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the pattern.
1797*0e209d39SAndroid Build Coastguard Worker      *                  Previous contents are deleted.
1798*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1799*0e209d39SAndroid Build Coastguard Worker      * @see applyPattern
1800*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1801*0e209d39SAndroid Build Coastguard Worker      */
1802*0e209d39SAndroid Build Coastguard Worker     virtual UnicodeString& toPattern(UnicodeString& result) const;
1803*0e209d39SAndroid Build Coastguard Worker 
1804*0e209d39SAndroid Build Coastguard Worker     /**
1805*0e209d39SAndroid Build Coastguard Worker      * Synthesizes a localized pattern string that represents the current
1806*0e209d39SAndroid Build Coastguard Worker      * state of this Format object.
1807*0e209d39SAndroid Build Coastguard Worker      *
1808*0e209d39SAndroid Build Coastguard Worker      * @param result    Output param which will receive the localized pattern.
1809*0e209d39SAndroid Build Coastguard Worker      *                  Previous contents are deleted.
1810*0e209d39SAndroid Build Coastguard Worker      * @return          A reference to 'result'.
1811*0e209d39SAndroid Build Coastguard Worker      * @see applyPattern
1812*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1813*0e209d39SAndroid Build Coastguard Worker      */
1814*0e209d39SAndroid Build Coastguard Worker     virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
1815*0e209d39SAndroid Build Coastguard Worker 
1816*0e209d39SAndroid Build Coastguard Worker     /**
1817*0e209d39SAndroid Build Coastguard Worker      * Apply the given pattern to this Format object.  A pattern is a
1818*0e209d39SAndroid Build Coastguard Worker      * short-hand specification for the various formatting properties.
1819*0e209d39SAndroid Build Coastguard Worker      * These properties can also be changed individually through the
1820*0e209d39SAndroid Build Coastguard Worker      * various setter methods.
1821*0e209d39SAndroid Build Coastguard Worker      * <P>
1822*0e209d39SAndroid Build Coastguard Worker      * There is no limit to integer digits are set
1823*0e209d39SAndroid Build Coastguard Worker      * by this routine, since that is the typical end-user desire;
1824*0e209d39SAndroid Build Coastguard Worker      * use setMaximumInteger if you want to set a real value.
1825*0e209d39SAndroid Build Coastguard Worker      * For negative numbers, use a second pattern, separated by a semicolon
1826*0e209d39SAndroid Build Coastguard Worker      * <pre>
1827*0e209d39SAndroid Build Coastguard Worker      * .      Example "#,#00.0#" -> 1,234.56
1828*0e209d39SAndroid Build Coastguard Worker      * </pre>
1829*0e209d39SAndroid Build Coastguard Worker      * This means a minimum of 2 integer digits, 1 fraction digit, and
1830*0e209d39SAndroid Build Coastguard Worker      * a maximum of 2 fraction digits.
1831*0e209d39SAndroid Build Coastguard Worker      * <pre>
1832*0e209d39SAndroid Build Coastguard Worker      * .      Example: "#,#00.0#;(#,#00.0#)" for negatives in parentheses.
1833*0e209d39SAndroid Build Coastguard Worker      * </pre>
1834*0e209d39SAndroid Build Coastguard Worker      * In negative patterns, the minimum and maximum counts are ignored;
1835*0e209d39SAndroid Build Coastguard Worker      * these are presumed to be set in the positive pattern.
1836*0e209d39SAndroid Build Coastguard Worker      *
1837*0e209d39SAndroid Build Coastguard Worker      * @param pattern    The pattern to be applied.
1838*0e209d39SAndroid Build Coastguard Worker      * @param parseError Struct to receive information on position
1839*0e209d39SAndroid Build Coastguard Worker      *                   of error if an error is encountered
1840*0e209d39SAndroid Build Coastguard Worker      * @param status     Output param set to success/failure code on
1841*0e209d39SAndroid Build Coastguard Worker      *                   exit. If the pattern is invalid, this will be
1842*0e209d39SAndroid Build Coastguard Worker      *                   set to a failure result.
1843*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1844*0e209d39SAndroid Build Coastguard Worker      */
1845*0e209d39SAndroid Build Coastguard Worker     virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status);
1846*0e209d39SAndroid Build Coastguard Worker 
1847*0e209d39SAndroid Build Coastguard Worker     /**
1848*0e209d39SAndroid Build Coastguard Worker      * Sets the pattern.
1849*0e209d39SAndroid Build Coastguard Worker      * @param pattern   The pattern to be applied.
1850*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param set to success/failure code on
1851*0e209d39SAndroid Build Coastguard Worker      *                  exit. If the pattern is invalid, this will be
1852*0e209d39SAndroid Build Coastguard Worker      *                  set to a failure result.
1853*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1854*0e209d39SAndroid Build Coastguard Worker      */
1855*0e209d39SAndroid Build Coastguard Worker     virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status);
1856*0e209d39SAndroid Build Coastguard Worker 
1857*0e209d39SAndroid Build Coastguard Worker     /**
1858*0e209d39SAndroid Build Coastguard Worker      * Apply the given pattern to this Format object.  The pattern
1859*0e209d39SAndroid Build Coastguard Worker      * is assumed to be in a localized notation. A pattern is a
1860*0e209d39SAndroid Build Coastguard Worker      * short-hand specification for the various formatting properties.
1861*0e209d39SAndroid Build Coastguard Worker      * These properties can also be changed individually through the
1862*0e209d39SAndroid Build Coastguard Worker      * various setter methods.
1863*0e209d39SAndroid Build Coastguard Worker      * <P>
1864*0e209d39SAndroid Build Coastguard Worker      * There is no limit to integer digits are set
1865*0e209d39SAndroid Build Coastguard Worker      * by this routine, since that is the typical end-user desire;
1866*0e209d39SAndroid Build Coastguard Worker      * use setMaximumInteger if you want to set a real value.
1867*0e209d39SAndroid Build Coastguard Worker      * For negative numbers, use a second pattern, separated by a semicolon
1868*0e209d39SAndroid Build Coastguard Worker      * <pre>
1869*0e209d39SAndroid Build Coastguard Worker      * .      Example "#,#00.0#" -> 1,234.56
1870*0e209d39SAndroid Build Coastguard Worker      * </pre>
1871*0e209d39SAndroid Build Coastguard Worker      * This means a minimum of 2 integer digits, 1 fraction digit, and
1872*0e209d39SAndroid Build Coastguard Worker      * a maximum of 2 fraction digits.
1873*0e209d39SAndroid Build Coastguard Worker      *
1874*0e209d39SAndroid Build Coastguard Worker      * Example: "#,#00.0#;(#,#00.0#)" for negatives in parentheses.
1875*0e209d39SAndroid Build Coastguard Worker      *
1876*0e209d39SAndroid Build Coastguard Worker      * In negative patterns, the minimum and maximum counts are ignored;
1877*0e209d39SAndroid Build Coastguard Worker      * these are presumed to be set in the positive pattern.
1878*0e209d39SAndroid Build Coastguard Worker      *
1879*0e209d39SAndroid Build Coastguard Worker      * @param pattern   The localized pattern to be applied.
1880*0e209d39SAndroid Build Coastguard Worker      * @param parseError Struct to receive information on position
1881*0e209d39SAndroid Build Coastguard Worker      *                   of error if an error is encountered
1882*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param set to success/failure code on
1883*0e209d39SAndroid Build Coastguard Worker      *                  exit. If the pattern is invalid, this will be
1884*0e209d39SAndroid Build Coastguard Worker      *                  set to a failure result.
1885*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1886*0e209d39SAndroid Build Coastguard Worker      */
1887*0e209d39SAndroid Build Coastguard Worker     virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError,
1888*0e209d39SAndroid Build Coastguard Worker                                        UErrorCode& status);
1889*0e209d39SAndroid Build Coastguard Worker 
1890*0e209d39SAndroid Build Coastguard Worker     /**
1891*0e209d39SAndroid Build Coastguard Worker      * Apply the given pattern to this Format object.
1892*0e209d39SAndroid Build Coastguard Worker      *
1893*0e209d39SAndroid Build Coastguard Worker      * @param pattern   The localized pattern to be applied.
1894*0e209d39SAndroid Build Coastguard Worker      * @param status    Output param set to success/failure code on
1895*0e209d39SAndroid Build Coastguard Worker      *                  exit. If the pattern is invalid, this will be
1896*0e209d39SAndroid Build Coastguard Worker      *                  set to a failure result.
1897*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1898*0e209d39SAndroid Build Coastguard Worker      */
1899*0e209d39SAndroid Build Coastguard Worker     virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status);
1900*0e209d39SAndroid Build Coastguard Worker 
1901*0e209d39SAndroid Build Coastguard Worker 
1902*0e209d39SAndroid Build Coastguard Worker     /**
1903*0e209d39SAndroid Build Coastguard Worker      * Sets the maximum number of digits allowed in the integer portion of a
1904*0e209d39SAndroid Build Coastguard Worker      * number. This override limits the integer digit count to 309.
1905*0e209d39SAndroid Build Coastguard Worker      *
1906*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the maximum number of digits
1907*0e209d39SAndroid Build Coastguard Worker      *                      allowed in the integer portion of a number.
1908*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat#setMaximumIntegerDigits
1909*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1910*0e209d39SAndroid Build Coastguard Worker      */
1911*0e209d39SAndroid Build Coastguard Worker     void setMaximumIntegerDigits(int32_t newValue) override;
1912*0e209d39SAndroid Build Coastguard Worker 
1913*0e209d39SAndroid Build Coastguard Worker     /**
1914*0e209d39SAndroid Build Coastguard Worker      * Sets the minimum number of digits allowed in the integer portion of a
1915*0e209d39SAndroid Build Coastguard Worker      * number. This override limits the integer digit count to 309.
1916*0e209d39SAndroid Build Coastguard Worker      *
1917*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the minimum number of digits
1918*0e209d39SAndroid Build Coastguard Worker      *                      allowed in the integer portion of a number.
1919*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat#setMinimumIntegerDigits
1920*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1921*0e209d39SAndroid Build Coastguard Worker      */
1922*0e209d39SAndroid Build Coastguard Worker     void setMinimumIntegerDigits(int32_t newValue) override;
1923*0e209d39SAndroid Build Coastguard Worker 
1924*0e209d39SAndroid Build Coastguard Worker     /**
1925*0e209d39SAndroid Build Coastguard Worker      * Sets the maximum number of digits allowed in the fraction portion of a
1926*0e209d39SAndroid Build Coastguard Worker      * number. This override limits the fraction digit count to 340.
1927*0e209d39SAndroid Build Coastguard Worker      *
1928*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the maximum number of digits
1929*0e209d39SAndroid Build Coastguard Worker      *                    allowed in the fraction portion of a number.
1930*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat#setMaximumFractionDigits
1931*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1932*0e209d39SAndroid Build Coastguard Worker      */
1933*0e209d39SAndroid Build Coastguard Worker     void setMaximumFractionDigits(int32_t newValue) override;
1934*0e209d39SAndroid Build Coastguard Worker 
1935*0e209d39SAndroid Build Coastguard Worker     /**
1936*0e209d39SAndroid Build Coastguard Worker      * Sets the minimum number of digits allowed in the fraction portion of a
1937*0e209d39SAndroid Build Coastguard Worker      * number. This override limits the fraction digit count to 340.
1938*0e209d39SAndroid Build Coastguard Worker      *
1939*0e209d39SAndroid Build Coastguard Worker      * @param newValue    the new value of the minimum number of digits
1940*0e209d39SAndroid Build Coastguard Worker      *                    allowed in the fraction portion of a number.
1941*0e209d39SAndroid Build Coastguard Worker      * @see NumberFormat#setMinimumFractionDigits
1942*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
1943*0e209d39SAndroid Build Coastguard Worker      */
1944*0e209d39SAndroid Build Coastguard Worker     void setMinimumFractionDigits(int32_t newValue) override;
1945*0e209d39SAndroid Build Coastguard Worker 
1946*0e209d39SAndroid Build Coastguard Worker     /**
1947*0e209d39SAndroid Build Coastguard Worker      * Returns the minimum number of significant digits that will be
1948*0e209d39SAndroid Build Coastguard Worker      * displayed. This value has no effect unless areSignificantDigitsUsed()
1949*0e209d39SAndroid Build Coastguard Worker      * returns true.
1950*0e209d39SAndroid Build Coastguard Worker      * @return the fewest significant digits that will be shown
1951*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
1952*0e209d39SAndroid Build Coastguard Worker      */
1953*0e209d39SAndroid Build Coastguard Worker     int32_t getMinimumSignificantDigits() const;
1954*0e209d39SAndroid Build Coastguard Worker 
1955*0e209d39SAndroid Build Coastguard Worker     /**
1956*0e209d39SAndroid Build Coastguard Worker      * Returns the maximum number of significant digits that will be
1957*0e209d39SAndroid Build Coastguard Worker      * displayed. This value has no effect unless areSignificantDigitsUsed()
1958*0e209d39SAndroid Build Coastguard Worker      * returns true.
1959*0e209d39SAndroid Build Coastguard Worker      * @return the most significant digits that will be shown
1960*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
1961*0e209d39SAndroid Build Coastguard Worker      */
1962*0e209d39SAndroid Build Coastguard Worker     int32_t getMaximumSignificantDigits() const;
1963*0e209d39SAndroid Build Coastguard Worker 
1964*0e209d39SAndroid Build Coastguard Worker     /**
1965*0e209d39SAndroid Build Coastguard Worker      * Sets the minimum number of significant digits that will be
1966*0e209d39SAndroid Build Coastguard Worker      * displayed.  If <code>min</code> is less than one then it is set
1967*0e209d39SAndroid Build Coastguard Worker      * to one.  If the maximum significant digits count is less than
1968*0e209d39SAndroid Build Coastguard Worker      * <code>min</code>, then it is set to <code>min</code>.
1969*0e209d39SAndroid Build Coastguard Worker      * This function also enables the use of significant digits
1970*0e209d39SAndroid Build Coastguard Worker      * by this formatter - areSignificantDigitsUsed() will return true.
1971*0e209d39SAndroid Build Coastguard Worker      * @see #areSignificantDigitsUsed
1972*0e209d39SAndroid Build Coastguard Worker      * @param min the fewest significant digits to be shown
1973*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
1974*0e209d39SAndroid Build Coastguard Worker      */
1975*0e209d39SAndroid Build Coastguard Worker     void setMinimumSignificantDigits(int32_t min);
1976*0e209d39SAndroid Build Coastguard Worker 
1977*0e209d39SAndroid Build Coastguard Worker     /**
1978*0e209d39SAndroid Build Coastguard Worker      * Sets the maximum number of significant digits that will be
1979*0e209d39SAndroid Build Coastguard Worker      * displayed.  If <code>max</code> is less than one then it is set
1980*0e209d39SAndroid Build Coastguard Worker      * to one.  If the minimum significant digits count is greater
1981*0e209d39SAndroid Build Coastguard Worker      * than <code>max</code>, then it is set to <code>max</code>.
1982*0e209d39SAndroid Build Coastguard Worker      * This function also enables the use of significant digits
1983*0e209d39SAndroid Build Coastguard Worker      * by this formatter - areSignificantDigitsUsed() will return true.
1984*0e209d39SAndroid Build Coastguard Worker      * @see #areSignificantDigitsUsed
1985*0e209d39SAndroid Build Coastguard Worker      * @param max the most significant digits to be shown
1986*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
1987*0e209d39SAndroid Build Coastguard Worker      */
1988*0e209d39SAndroid Build Coastguard Worker     void setMaximumSignificantDigits(int32_t max);
1989*0e209d39SAndroid Build Coastguard Worker 
1990*0e209d39SAndroid Build Coastguard Worker     /**
1991*0e209d39SAndroid Build Coastguard Worker      * Returns true if significant digits are in use, or false if
1992*0e209d39SAndroid Build Coastguard Worker      * integer and fraction digit counts are in use.
1993*0e209d39SAndroid Build Coastguard Worker      * @return true if significant digits are in use
1994*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
1995*0e209d39SAndroid Build Coastguard Worker      */
1996*0e209d39SAndroid Build Coastguard Worker     UBool areSignificantDigitsUsed() const;
1997*0e209d39SAndroid Build Coastguard Worker 
1998*0e209d39SAndroid Build Coastguard Worker     /**
1999*0e209d39SAndroid Build Coastguard Worker      * Sets whether significant digits are in use, or integer and
2000*0e209d39SAndroid Build Coastguard Worker      * fraction digit counts are in use.
2001*0e209d39SAndroid Build Coastguard Worker      * @param useSignificantDigits true to use significant digits, or
2002*0e209d39SAndroid Build Coastguard Worker      * false to use integer and fraction digit counts
2003*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
2004*0e209d39SAndroid Build Coastguard Worker      */
2005*0e209d39SAndroid Build Coastguard Worker     void setSignificantDigitsUsed(UBool useSignificantDigits);
2006*0e209d39SAndroid Build Coastguard Worker 
2007*0e209d39SAndroid Build Coastguard Worker     /**
2008*0e209d39SAndroid Build Coastguard Worker      * Sets the currency used to display currency
2009*0e209d39SAndroid Build Coastguard Worker      * amounts.  This takes effect immediately, if this format is a
2010*0e209d39SAndroid Build Coastguard Worker      * currency format.  If this format is not a currency format, then
2011*0e209d39SAndroid Build Coastguard Worker      * the currency is used if and when this object becomes a
2012*0e209d39SAndroid Build Coastguard Worker      * currency format through the application of a new pattern.
2013*0e209d39SAndroid Build Coastguard Worker      * @param theCurrency a 3-letter ISO code indicating new currency
2014*0e209d39SAndroid Build Coastguard Worker      * to use.  It need not be null-terminated.  May be the empty
2015*0e209d39SAndroid Build Coastguard Worker      * string or nullptr to indicate no currency.
2016*0e209d39SAndroid Build Coastguard Worker      * @param ec input-output error code
2017*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.0
2018*0e209d39SAndroid Build Coastguard Worker      */
2019*0e209d39SAndroid Build Coastguard Worker     void setCurrency(const char16_t* theCurrency, UErrorCode& ec) override;
2020*0e209d39SAndroid Build Coastguard Worker 
2021*0e209d39SAndroid Build Coastguard Worker #ifndef U_FORCE_HIDE_DEPRECATED_API
2022*0e209d39SAndroid Build Coastguard Worker     /**
2023*0e209d39SAndroid Build Coastguard Worker      * Sets the currency used to display currency amounts.  See
2024*0e209d39SAndroid Build Coastguard Worker      * setCurrency(const char16_t*, UErrorCode&).
2025*0e209d39SAndroid Build Coastguard Worker      * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&).
2026*0e209d39SAndroid Build Coastguard Worker      */
2027*0e209d39SAndroid Build Coastguard Worker     virtual void setCurrency(const char16_t* theCurrency);
2028*0e209d39SAndroid Build Coastguard Worker #endif  // U_FORCE_HIDE_DEPRECATED_API
2029*0e209d39SAndroid Build Coastguard Worker 
2030*0e209d39SAndroid Build Coastguard Worker     /**
2031*0e209d39SAndroid Build Coastguard Worker      * Sets the `Currency Usage` object used to display currency.
2032*0e209d39SAndroid Build Coastguard Worker      * This takes effect immediately, if this format is a
2033*0e209d39SAndroid Build Coastguard Worker      * currency format.
2034*0e209d39SAndroid Build Coastguard Worker      * @param newUsage new currency usage object to use.
2035*0e209d39SAndroid Build Coastguard Worker      * @param ec input-output error code
2036*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 54
2037*0e209d39SAndroid Build Coastguard Worker      */
2038*0e209d39SAndroid Build Coastguard Worker     void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
2039*0e209d39SAndroid Build Coastguard Worker 
2040*0e209d39SAndroid Build Coastguard Worker     /**
2041*0e209d39SAndroid Build Coastguard Worker      * Returns the `Currency Usage` object used to display currency
2042*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 54
2043*0e209d39SAndroid Build Coastguard Worker      */
2044*0e209d39SAndroid Build Coastguard Worker     UCurrencyUsage getCurrencyUsage() const;
2045*0e209d39SAndroid Build Coastguard Worker 
2046*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
2047*0e209d39SAndroid Build Coastguard Worker 
2048*0e209d39SAndroid Build Coastguard Worker     /**
2049*0e209d39SAndroid Build Coastguard Worker      *  Format a number and save it into the given DecimalQuantity.
2050*0e209d39SAndroid Build Coastguard Worker      *  Internal, not intended for public use.
2051*0e209d39SAndroid Build Coastguard Worker      *  @internal
2052*0e209d39SAndroid Build Coastguard Worker      */
2053*0e209d39SAndroid Build Coastguard Worker     void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output,
2054*0e209d39SAndroid Build Coastguard Worker                                  UErrorCode& status) const;
2055*0e209d39SAndroid Build Coastguard Worker 
2056*0e209d39SAndroid Build Coastguard Worker     /**
2057*0e209d39SAndroid Build Coastguard Worker      *  Get a DecimalQuantity corresponding to a formattable as it would be
2058*0e209d39SAndroid Build Coastguard Worker      *  formatted by this DecimalFormat.
2059*0e209d39SAndroid Build Coastguard Worker      *  Internal, not intended for public use.
2060*0e209d39SAndroid Build Coastguard Worker      *  @internal
2061*0e209d39SAndroid Build Coastguard Worker      */
2062*0e209d39SAndroid Build Coastguard Worker     void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output,
2063*0e209d39SAndroid Build Coastguard Worker                                  UErrorCode& status) const;
2064*0e209d39SAndroid Build Coastguard Worker 
2065*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
2066*0e209d39SAndroid Build Coastguard Worker 
2067*0e209d39SAndroid Build Coastguard Worker     /**
2068*0e209d39SAndroid Build Coastguard Worker      * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting
2069*0e209d39SAndroid Build Coastguard Worker      * in ICU 60, NumberFormatter is the recommended way to format numbers.
2070*0e209d39SAndroid Build Coastguard Worker      * You can use the returned LocalizedNumberFormatter to format numbers and
2071*0e209d39SAndroid Build Coastguard Worker      * get a FormattedNumber, which contains a string as well as additional
2072*0e209d39SAndroid Build Coastguard Worker      * annotations about the formatted value.
2073*0e209d39SAndroid Build Coastguard Worker      *
2074*0e209d39SAndroid Build Coastguard Worker      * If a memory allocation failure occurs, the return value of this method
2075*0e209d39SAndroid Build Coastguard Worker      * might be null. If you are concerned about correct recovery from
2076*0e209d39SAndroid Build Coastguard Worker      * out-of-memory situations, use this pattern:
2077*0e209d39SAndroid Build Coastguard Worker      *
2078*0e209d39SAndroid Build Coastguard Worker      * <pre>
2079*0e209d39SAndroid Build Coastguard Worker      * FormattedNumber result;
2080*0e209d39SAndroid Build Coastguard Worker      * if (auto* ptr = df->toNumberFormatter(status)) {
2081*0e209d39SAndroid Build Coastguard Worker      *     result = ptr->formatDouble(123, status);
2082*0e209d39SAndroid Build Coastguard Worker      * }
2083*0e209d39SAndroid Build Coastguard Worker      * </pre>
2084*0e209d39SAndroid Build Coastguard Worker      *
2085*0e209d39SAndroid Build Coastguard Worker      * If you are not concerned about out-of-memory situations, or if your
2086*0e209d39SAndroid Build Coastguard Worker      * environment throws exceptions when memory allocation failure occurs,
2087*0e209d39SAndroid Build Coastguard Worker      * you can chain the methods, like this:
2088*0e209d39SAndroid Build Coastguard Worker      *
2089*0e209d39SAndroid Build Coastguard Worker      * <pre>
2090*0e209d39SAndroid Build Coastguard Worker      * FormattedNumber result = df
2091*0e209d39SAndroid Build Coastguard Worker      *     ->toNumberFormatter(status)
2092*0e209d39SAndroid Build Coastguard Worker      *     ->formatDouble(123, status);
2093*0e209d39SAndroid Build Coastguard Worker      * </pre>
2094*0e209d39SAndroid Build Coastguard Worker      *
2095*0e209d39SAndroid Build Coastguard Worker      * NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat.
2096*0e209d39SAndroid Build Coastguard Worker      * If a non-const method is called on the DecimalFormat, or if the DecimalFormat
2097*0e209d39SAndroid Build Coastguard Worker      * is deleted, the object becomes invalid. If you plan to keep the return value
2098*0e209d39SAndroid Build Coastguard Worker      * beyond the lifetime of the DecimalFormat, copy it to a local variable:
2099*0e209d39SAndroid Build Coastguard Worker      *
2100*0e209d39SAndroid Build Coastguard Worker      * <pre>
2101*0e209d39SAndroid Build Coastguard Worker      * LocalizedNumberFormatter lnf;
2102*0e209d39SAndroid Build Coastguard Worker      * if (auto* ptr = df->toNumberFormatter(status)) {
2103*0e209d39SAndroid Build Coastguard Worker      *     lnf = *ptr;
2104*0e209d39SAndroid Build Coastguard Worker      * }
2105*0e209d39SAndroid Build Coastguard Worker      * </pre>
2106*0e209d39SAndroid Build Coastguard Worker      *
2107*0e209d39SAndroid Build Coastguard Worker      * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR.
2108*0e209d39SAndroid Build Coastguard Worker      * @return A pointer to an internal object, or nullptr on failure.
2109*0e209d39SAndroid Build Coastguard Worker      *         Do not delete the return value!
2110*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 64
2111*0e209d39SAndroid Build Coastguard Worker      */
2112*0e209d39SAndroid Build Coastguard Worker     const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const;
2113*0e209d39SAndroid Build Coastguard Worker 
2114*0e209d39SAndroid Build Coastguard Worker     /**
2115*0e209d39SAndroid Build Coastguard Worker      * Return the class ID for this class.  This is useful only for
2116*0e209d39SAndroid Build Coastguard Worker      * comparing to a return value from getDynamicClassID().  For example:
2117*0e209d39SAndroid Build Coastguard Worker      * <pre>
2118*0e209d39SAndroid Build Coastguard Worker      * .      Base* polymorphic_pointer = createPolymorphicObject();
2119*0e209d39SAndroid Build Coastguard Worker      * .      if (polymorphic_pointer->getDynamicClassID() ==
2120*0e209d39SAndroid Build Coastguard Worker      * .          Derived::getStaticClassID()) ...
2121*0e209d39SAndroid Build Coastguard Worker      * </pre>
2122*0e209d39SAndroid Build Coastguard Worker      * @return          The class ID for all objects of this class.
2123*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
2124*0e209d39SAndroid Build Coastguard Worker      */
2125*0e209d39SAndroid Build Coastguard Worker     static UClassID U_EXPORT2 getStaticClassID();
2126*0e209d39SAndroid Build Coastguard Worker 
2127*0e209d39SAndroid Build Coastguard Worker     /**
2128*0e209d39SAndroid Build Coastguard Worker      * Returns a unique class ID POLYMORPHICALLY.  Pure virtual override.
2129*0e209d39SAndroid Build Coastguard Worker      * This method is to implement a simple version of RTTI, since not all
2130*0e209d39SAndroid Build Coastguard Worker      * C++ compilers support genuine RTTI.  Polymorphic operator==() and
2131*0e209d39SAndroid Build Coastguard Worker      * clone() methods call this method.
2132*0e209d39SAndroid Build Coastguard Worker      *
2133*0e209d39SAndroid Build Coastguard Worker      * @return          The class ID for this object. All objects of a
2134*0e209d39SAndroid Build Coastguard Worker      *                  given class have the same class ID.  Objects of
2135*0e209d39SAndroid Build Coastguard Worker      *                  other classes have different class IDs.
2136*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.0
2137*0e209d39SAndroid Build Coastguard Worker      */
2138*0e209d39SAndroid Build Coastguard Worker     UClassID getDynamicClassID() const override;
2139*0e209d39SAndroid Build Coastguard Worker 
2140*0e209d39SAndroid Build Coastguard Worker   private:
2141*0e209d39SAndroid Build Coastguard Worker 
2142*0e209d39SAndroid Build Coastguard Worker     /** Rebuilds the formatter object from the property bag. */
2143*0e209d39SAndroid Build Coastguard Worker     void touch(UErrorCode& status);
2144*0e209d39SAndroid Build Coastguard Worker 
2145*0e209d39SAndroid Build Coastguard Worker     /** Rebuilds the formatter object, ignoring any error code. */
2146*0e209d39SAndroid Build Coastguard Worker     void touchNoError();
2147*0e209d39SAndroid Build Coastguard Worker 
2148*0e209d39SAndroid Build Coastguard Worker     /**
2149*0e209d39SAndroid Build Coastguard Worker      * Updates the property bag with settings from the given pattern.
2150*0e209d39SAndroid Build Coastguard Worker      *
2151*0e209d39SAndroid Build Coastguard Worker      * @param pattern The pattern string to parse.
2152*0e209d39SAndroid Build Coastguard Worker      * @param ignoreRounding Whether to leave out rounding information (minFrac, maxFrac, and rounding
2153*0e209d39SAndroid Build Coastguard Worker      *     increment) when parsing the pattern. This may be desirable if a custom rounding mode, such
2154*0e209d39SAndroid Build Coastguard Worker      *     as CurrencyUsage, is to be used instead. One of {@link
2155*0e209d39SAndroid Build Coastguard Worker      *     PatternStringParser#IGNORE_ROUNDING_ALWAYS}, {@link PatternStringParser#IGNORE_ROUNDING_IF_CURRENCY},
2156*0e209d39SAndroid Build Coastguard Worker      *     or {@link PatternStringParser#IGNORE_ROUNDING_NEVER}.
2157*0e209d39SAndroid Build Coastguard Worker      * @see PatternAndPropertyUtils#parseToExistingProperties
2158*0e209d39SAndroid Build Coastguard Worker      */
2159*0e209d39SAndroid Build Coastguard Worker     void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
2160*0e209d39SAndroid Build Coastguard Worker                                   UErrorCode& status);
2161*0e209d39SAndroid Build Coastguard Worker 
2162*0e209d39SAndroid Build Coastguard Worker     const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const;
2163*0e209d39SAndroid Build Coastguard Worker 
2164*0e209d39SAndroid Build Coastguard Worker     const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const;
2165*0e209d39SAndroid Build Coastguard Worker 
2166*0e209d39SAndroid Build Coastguard Worker     static void fieldPositionHelper(
2167*0e209d39SAndroid Build Coastguard Worker         const number::impl::UFormattedNumberData& formatted,
2168*0e209d39SAndroid Build Coastguard Worker         FieldPosition& fieldPosition,
2169*0e209d39SAndroid Build Coastguard Worker         int32_t offset,
2170*0e209d39SAndroid Build Coastguard Worker         UErrorCode& status);
2171*0e209d39SAndroid Build Coastguard Worker 
2172*0e209d39SAndroid Build Coastguard Worker     static void fieldPositionIteratorHelper(
2173*0e209d39SAndroid Build Coastguard Worker         const number::impl::UFormattedNumberData& formatted,
2174*0e209d39SAndroid Build Coastguard Worker         FieldPositionIterator* fpi,
2175*0e209d39SAndroid Build Coastguard Worker         int32_t offset,
2176*0e209d39SAndroid Build Coastguard Worker         UErrorCode& status);
2177*0e209d39SAndroid Build Coastguard Worker 
2178*0e209d39SAndroid Build Coastguard Worker     void setupFastFormat();
2179*0e209d39SAndroid Build Coastguard Worker 
2180*0e209d39SAndroid Build Coastguard Worker     bool fastFormatDouble(double input, UnicodeString& output) const;
2181*0e209d39SAndroid Build Coastguard Worker 
2182*0e209d39SAndroid Build Coastguard Worker     bool fastFormatInt64(int64_t input, UnicodeString& output) const;
2183*0e209d39SAndroid Build Coastguard Worker 
2184*0e209d39SAndroid Build Coastguard Worker     void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const;
2185*0e209d39SAndroid Build Coastguard Worker 
2186*0e209d39SAndroid Build Coastguard Worker     //=====================================================================================//
2187*0e209d39SAndroid Build Coastguard Worker     //                                   INSTANCE FIELDS                                   //
2188*0e209d39SAndroid Build Coastguard Worker     //=====================================================================================//
2189*0e209d39SAndroid Build Coastguard Worker 
2190*0e209d39SAndroid Build Coastguard Worker 
2191*0e209d39SAndroid Build Coastguard Worker     // One instance field for the implementation, keep all fields inside of an implementation
2192*0e209d39SAndroid Build Coastguard Worker     // class defined in number_mapper.h
2193*0e209d39SAndroid Build Coastguard Worker     number::impl::DecimalFormatFields* fields = nullptr;
2194*0e209d39SAndroid Build Coastguard Worker 
2195*0e209d39SAndroid Build Coastguard Worker     // Allow child class CompactDecimalFormat to access fProperties:
2196*0e209d39SAndroid Build Coastguard Worker     friend class CompactDecimalFormat;
2197*0e209d39SAndroid Build Coastguard Worker 
2198*0e209d39SAndroid Build Coastguard Worker     // Allow MeasureFormat to use fieldPositionHelper:
2199*0e209d39SAndroid Build Coastguard Worker     friend class MeasureFormat;
2200*0e209d39SAndroid Build Coastguard Worker 
2201*0e209d39SAndroid Build Coastguard Worker };
2202*0e209d39SAndroid Build Coastguard Worker 
2203*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
2204*0e209d39SAndroid Build Coastguard Worker 
2205*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_FORMATTING */
2206*0e209d39SAndroid Build Coastguard Worker 
2207*0e209d39SAndroid Build Coastguard Worker #endif /* U_SHOW_CPLUSPLUS_API */
2208*0e209d39SAndroid Build Coastguard Worker 
2209*0e209d39SAndroid Build Coastguard Worker #endif // _DECIMFMT
2210*0e209d39SAndroid Build Coastguard Worker //eof
2211