1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************************
3fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius*   Copyright (C) 1997-2014, International Business Machines
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   Corporation and others.  All Rights Reserved.
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************************
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* File DECIMFMT.H
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History:
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   Date        Name        Description
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   02/19/97    aliu        Converted from java.
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   03/20/97    clhuang     Updated per C++ implementation.
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   04/03/97    aliu        Rewrote parsing and formatting completely, and
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*                           cleaned up and debugged.  Actually works now.
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   04/17/97    aliu        Changed DigitCount to int per code review.
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   07/10/97    helena      Made ParsePosition a class and get rid of the function
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*                           hiding problems.
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   09/09/97    aliu        Ported over support for exponential formats.
208393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius*   07/20/98    stephen     Changed documentation
218393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius*   01/30/13    emmons      Added Scaling methods
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************************
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
2450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef DECIMFMT_H
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define DECIMFMT_H
2750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h"
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
3050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \file
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Formats decimal numbers.
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
3350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/dcfmtsym.h"
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/numfmt.h"
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/locid.h"
3950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/fpositer.h"
4050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/stringpiece.h"
41103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#include "unicode/curramt.h"
4254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius#include "unicode/enumset.h"
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
44103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/**
4554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * \def UNUM_DECIMALFORMAT_INTERNAL_SIZE
46103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @internal
47103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */
48103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_FORMAT_FASTPATHS_49
49103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16
50103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif
5185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass DigitList;
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass ChoiceFormat;
5685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass CurrencyPluralInfo;
5785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass Hashtable;
58b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2clairehoclass UnicodeSet;
5950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoclass FieldPositionHandler;
6059d709d503bab6e2b61931737e662dd293b40578ccorneliusclass DecimalFormatStaticSets;
6159d709d503bab6e2b61931737e662dd293b40578ccorneliusclass FixedDecimal;
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
6354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius// explicit template instantiation. see digitlst.h
6454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius#if defined (_MSC_VER)
6554dcd9b6a06071f647dac967e9e267abb9410720Craig Corneliustemplate class U_I18N_API    EnumSet<UNumberFormatAttribute,
66fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius            UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
6754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius            UNUM_LIMIT_BOOLEAN_ATTRIBUTE>;
6854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius#endif
6954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat is a concrete subclass of NumberFormat that formats decimal
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * numbers. It has a variety of features designed to make it possible to parse
73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and format numbers in any locale, including support for Western, Arabic, or
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Indic digits.  It also supports different flavors of numbers, including
75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integers ("123"), fixed-point numbers ("123.4"), scientific notation
7685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123",
7785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "123 US dollars").  All of these flavors can be easily localized.
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>To obtain a NumberFormat for a specific locale (including the default
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale) call one of NumberFormat's factory methods such as
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance(). Do not call the DecimalFormat constructors directly, unless
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * you know what you are doing, since the NumberFormat factory methods may
83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return subclasses other than DecimalFormat.
84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Example Usage</strong>
86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \code
88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     // Normally we would have a GUI with a menu for this
89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     int32_t locCount;
90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     const Locale* locales = NumberFormat::getAvailableLocales(locCount);
9150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     double myNumber = -1234.56;
93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     UErrorCode success = U_ZERO_ERROR;
94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     NumberFormat* form;
9550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     // Print out a number with the localized number, currency and percent
97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     // format for each locale.
98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     UnicodeString countryName;
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     UnicodeString displayName;
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     UnicodeString str;
101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     UnicodeString pattern;
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     Formattable fmtable;
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     for (int32_t j = 0; j < 3; ++j) {
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         cout << endl << "FORMAT " << j << endl;
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         for (int32_t i = 0; i < locCount; ++i) {
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             if (locales[i].getCountry(countryName).size() == 0) {
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 // skip language-only
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 continue;
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             }
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             switch (j) {
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             case 0:
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 form = NumberFormat::createInstance(locales[i], success ); break;
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             case 1:
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             default:
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 form = NumberFormat::createPercentInstance(locales[i], success ); break;
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             }
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             if (form) {
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 str.remove();
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 pattern = ((DecimalFormat*)form)->toPattern(pattern);
121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 cout << locales[i].getDisplayName(displayName) << ": " << pattern;
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 cout << "  ->  " << form->format(myNumber,str) << endl;
123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *                 form->parse(form->format(myNumber,str), fmtable, success);
12450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *                 delete form;
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *             }
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         }
127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     }
128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \endcode
12985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <P>
13085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Another example use createInstance(style)
13185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <P>
13285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <pre>
13385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <strong>// Print out a number using the localized number, currency,
13485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * // percent, scientific, integer, iso currency, and plural currency
13585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * // format for each locale</strong>
13685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Locale* locale = new Locale("en", "US");
13785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * double myNumber = 1234.56;
13885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * UErrorCode success = U_ZERO_ERROR;
13985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * UnicodeString str;
14085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Formattable fmtable;
14150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * for (int j=NumberFormat::kNumberStyle;
14250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *      j<=NumberFormat::kPluralCurrencyStyle;
14385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *      ++j) {
14485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *     NumberFormat* format = NumberFormat::createInstance(locale, j, success);
14585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *     str.remove();
14685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *     cout << "format result " << form->format(myNumber, str) << endl;
14785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *     format->parse(form->format(myNumber, str), fmtable, success);
14850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * }</pre>
14985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *
150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Patterns</strong>
152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>A DecimalFormat consists of a <em>pattern</em> and a set of
154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>symbols</em>.  The pattern may be set directly using
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * applyPattern(), or indirectly using other API methods which
156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * manipulate aspects of the pattern, such as the minimum number of integer
157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits.  The symbols are stored in a DecimalFormatSymbols
158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * object.  When using the NumberFormat factory methods, the
159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern and symbols are read from ICU's locale data.
16050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Special Pattern Characters</strong>
162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Many characters in a pattern are taken literally; they are matched during
164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing and output unchanged during formatting.  Special characters, on the
165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * other hand, stand for other characters, strings, or classes of characters.
166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, the '#' character is replaced by a localized digit.  Often the
167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * replacement character is the same as the pattern character; in the U.S. locale,
168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the ',' grouping character is replaced by ','.  However, the replacement is
169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * still happening, and if the symbols are modified, the grouping character
170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * changes.  Some special characters affect the behavior of the formatter by
171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * their presence; for example, if the percent character is seen, then the
172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value is multiplied by 100 before being displayed.
173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>To insert a special character in a pattern as a literal, that is, without
175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * any special meaning, the character must be quoted.  There are some exceptions to
176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this which are noted below.
177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The characters listed here are used in non-localized patterns.  Localized
179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * patterns use the corresponding characters taken from this formatter's
180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object instead, and these characters lose
181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * their special status.  Two exceptions are the currency sign and quote, which
182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are not localized.
183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <table border=0 cellspacing=3 cellpadding=0>
185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr bgcolor="#ccccff">
186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left><strong>Symbol</strong>
187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left><strong>Location</strong>
188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left><strong>Localized?</strong>
189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left><strong>Meaning</strong>
190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>0</code>
192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Digit
195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>1-9</code>
197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>'1' through '9' indicate rounding.
200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\htmlonly&#x40;\endhtmlonly</code> <!--doxygen doesn't like @-->
202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>No
204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Significant digit
205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>#</code>
207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Digit, zero shows as absent
210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>.</code>
212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Decimal separator or monetary decimal separator
215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>-</code>
217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Minus sign
220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>,</code>
222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Grouping separator
225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>E</code>
227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Number
228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Separates mantissa and exponent in scientific notation.
230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         <em>Need not be quoted in prefix or suffix.</em>
231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>+</code>
233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Exponent
234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix positive exponents with localized plus sign.
236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         <em>Need not be quoted in prefix or suffix.</em>
237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>;</code>
239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Subpattern boundary
240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Separates positive and negative subpatterns
242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\%</code>
244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix or suffix
245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Multiply by 100 and show as percentage
247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\\u2030</code>
249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix or suffix
250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Multiply by 1000 and show as per mille
252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\htmlonly&curren;\endhtmlonly</code> (<code>\\u00A4</code>)
254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix or suffix
255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>No
256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Currency sign, replaced by currency symbol.  If
257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         doubled, replaced by international currency symbol.
25885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *         If tripled, replaced by currency plural names, for example,
25985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *         "US dollar" or "US dollars" for America.
260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         If present in a pattern, the monetary decimal separator
261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         is used instead of the decimal separator.
262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>'</code>
264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix or suffix
265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>No
266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Used to quote special characters in a prefix or suffix,
267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         for example, <code>"'#'#"</code> formats 123 to
268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         <code>"#123"</code>.  To create a single quote
269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *         itself, use two in a row: <code>"# o''clock"</code>.
270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>*</code>
272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Prefix or suffix boundary
273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Yes
274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>Pad escape, precedes pad character
275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </table>
276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>A DecimalFormat pattern contains a postive and negative
278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern, for example, "#,##0.00;(#,##0.00)".  Each subpattern has a
279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix, a numeric part, and a suffix.  If there is no explicit negative
280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern, the negative subpattern is the localized minus sign prefixed to the
281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00".  If there
282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is an explicit negative subpattern, it serves only to specify the negative
283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix and suffix; the number of digits, minimal digits, and other
284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characteristics are ignored in the negative subpattern. That means that
285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)".
286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The prefixes, suffixes, and various symbols used for infinity, digits,
288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * thousands separators, decimal separators, etc. may be set to arbitrary
289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * values, and they will appear properly during formatting.  However, care must
290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be taken that the symbols and strings do not conflict, or parsing will be
291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unreliable.  For example, either the positive and negative prefixes or the
292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffixes must be distinct for parse() to be able
293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to distinguish positive from negative values.  Another example is that the
294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal separator and thousands separator should be distinct characters, or
295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing will be impossible.
296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The <em>grouping separator</em> is a character that separates clusters of
298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer digits to make large numbers more legible.  It commonly used for
299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * thousands, but in some locales it separates ten-thousands.  The <em>grouping
300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * size</em> is the number of digits between the grouping separators, such as 3
301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for "100,000,000" or 4 for "1 0000 0000". There are actually two different
302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping sizes: One used for the least significant integer digits, the
303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>primary grouping size</em>, and one used for all others, the
304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>secondary grouping size</em>.  In most locales these are the same, but
305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sometimes they are different. For example, if the primary grouping interval
306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is 3, and the secondary is 2, then this corresponds to the pattern
307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "#,##,##0", and the number 123456789 is formatted as "12,34,56,789".  If a
308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern contains multiple grouping separators, the interval between the last
309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * one and the end of the integer defines the primary grouping size, and the
310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * interval between the last two defines the secondary grouping size. All others
311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####".
312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause
314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat to set a failing UErrorCode.
315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Pattern BNF</strong>
317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre>
319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern    := subpattern (';' subpattern)?
320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern := prefix? number exponent? suffix?
321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number     := (integer ('.' fraction)?) | sigDigits
322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer    := '#'* '0'* '0'
325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction   := '0'* '#'*
326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sigDigits  := '#'* '@' '@'* '#'*
327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent   := 'E' '+'? '0'* '0'
328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padSpec    := '*' padChar
329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padChar    := '\\u0000'..'\\uFFFD' - quote
330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * &nbsp;
331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Notation:
332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   X*       0 or more instances of X
333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   X?       0 or 1 instances of X
334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   X|Y      either X or Y
335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   C..D     any character from C up to D, inclusive
336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   S-T      characters in S, except those in T
337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre>
338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The first subpattern is for positive numbers. The second (optional)
339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern is for negative numbers.
34050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Not indicated in the BNF syntax above:
342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul><li>The grouping separator ',' can occur inside the integer and
344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sigDigits elements, between any two pattern characters of that
345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * element, as long as the integer or sigDigits element is not
346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * followed by the exponent element.
347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Two grouping intervals are recognized: That between the
349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     decimal point and the first grouping symbol, and that
350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     between the first and second grouping symbols. These
351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     intervals are identical in most locales, but in some
352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     locales they differ. For example, the pattern
353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     &quot;#,##,###&quot; formats the number 123456789 as
354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     &quot;12,34,56,789&quot;.</li>
35550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The pad specifier <code>padSpec</code> may appear before the prefix,
357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * after the prefix, before the suffix, after the suffix, or not at all.
358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In place of '0', the digits '1' through '9' may be used to
360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indicate a rounding increment.
361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Parsing</strong>
364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat parses all Unicode characters that represent
366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal digits, as defined by u_charDigitValue().  In addition,
367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat also recognizes as digits the ten consecutive
368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters starting with the localized zero digit defined in the
369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object.  During formatting, the
370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols-based digits are output.
371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
372b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * <p>During parsing, grouping separators are ignored if in lenient mode;
373b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * otherwise, if present, they must be in appropriate positions.
374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
37585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <p>For currency parsing, the formatter is able to parse every currency
37685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * style formats no matter which style the formatter is constructed with.
37750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * For example, a formatter instance gotten from
37885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse
37985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * formats such as "USD1.00" and "3.00 US dollars".
38085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho *
381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>If parse(UnicodeString&,Formattable&,ParsePosition&)
382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fails to parse a string, it leaves the parse position unchanged.
383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&)
384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indicates parse failure by setting a failing
385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UErrorCode.
386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Formatting</strong>
388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Formatting is guided by several parameters, all of which can be
390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specified either using a pattern or using the API.  The following
391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * description applies to formats that do not use <a href="#sci">scientific
392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation</a> or <a href="#sigdig">significant digits</a>.
393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul><li>If the number of actual integer digits exceeds the
395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>maximum integer digits</em>, then only the least significant
396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are shown.  For example, 1997 is formatted as "97" if the
397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum integer digits is set to 2.
398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual integer digits is less than the
400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>minimum integer digits</em>, then leading zeros are added.  For
401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, 1997 is formatted as "01997" if the minimum integer digits
402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is set to 5.
403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual fraction digits exceeds the <em>maximum
40527f654740f2a26ad62a5c155af9199af9e69b889claireho * fraction digits</em>, then rounding is performed to the
406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum fraction digits.  For example, 0.125 is formatted as "0.12"
407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if the maximum fraction digits is 2.  This behavior can be changed
40827f654740f2a26ad62a5c155af9199af9e69b889claireho * by specifying a rounding increment and/or a rounding mode.
409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual fraction digits is less than the
411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>minimum fraction digits</em>, then trailing zeros are added.
412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, 0.125 is formatted as "0.1250" if the mimimum fraction
413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits is set to 4.
414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Trailing fractional zeros are not displayed if they occur
416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>j</em> positions after the decimal, where <em>j</em> is less
417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * than the maximum fraction digits. For example, 0.10004 is
418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * formatted as "0.1" if the maximum fraction digits is four or less.
419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Special Values</strong>
422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><code>NaN</code> is represented as a single character, typically
424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>\\uFFFD</code>.  This character is determined by the
425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object.  This is the only value for which
426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the prefixes and suffixes are not used.
427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Infinity is represented as a single character, typically
429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>\\u221E</code>, with the positive or negative prefixes and suffixes
430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * applied.  The infinity character is determined by the
431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object.
432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <a name="sci"><strong>Scientific Notation</strong></a>
434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Numbers in scientific notation are expressed as the product of a mantissa
436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and a power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The
437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0),
438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * but it need not be.  DecimalFormat supports arbitrary mantissas.
439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat can be instructed to use scientific
440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation through the API or through the pattern.  In a pattern, the exponent
441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character immediately followed by one or more digit characters indicates
442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * scientific notation.  Example: "0.###E0" formats the number 1234 as
443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "1.234E3".
444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul>
446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of digit characters after the exponent character gives the
447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * minimum exponent digit count.  There is no maximum.  Negative exponents are
448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * formatted using the localized minus sign, <em>not</em> the prefix and suffix
449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * from the pattern.  This allows patterns such as "0.###E0 m/s".  To prefix
450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * positive exponents with a localized plus sign, specify '+' between the
451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0",
452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "1E-1", etc.  (In localized patterns, use the localized plus sign rather than
453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * '+'.)
454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The minimum number of integer digits is achieved by adjusting the
456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent.  Example: 0.00123 formatted with "00.###E0" yields "12.3E-4".  This
457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * only happens if there is no maximum number of integer digits.  If there is a
458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum, then the minimum number of integer digits is fixed at one.
459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The maximum number of integer digits, if present, specifies the exponent
461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping.  The most common use of this is to generate <em>engineering
462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation</em>, in which the exponent is a multiple of three, e.g.,
463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "##0.###E0".  The number 12345 is formatted using "##0.####E0" as "12.345E3".
464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When using scientific notation, the formatter controls the
466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digit counts using significant digits logic.  The maximum number of
467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits limits the total number of integer and fraction
468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits that will be shown in the mantissa; it does not affect
469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing.  For example, 12345 formatted with "##0.##E0" is "12.3E3".
470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * See the section on significant digits for more details.
471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of significant digits shown is determined as
473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * follows: If areSignificantDigitsUsed() returns false, then the
474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * minimum number of significant digits shown is one, and the maximum
475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number of significant digits shown is the sum of the <em>minimum
476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer</em> and <em>maximum fraction</em> digits, and is
477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unaffected by the maximum integer digits.  If this sum is zero,
478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then all significant digits are shown.  If
479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * areSignificantDigitsUsed() returns true, then the significant digit
480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * counts are specified by getMinimumSignificantDigits() and
481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * getMaximumSignificantDigits().  In this case, the number of
482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer digits is fixed at one, and there is no exponent grouping.
483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Exponential patterns may not contain grouping separators.
485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <a name="sigdig"><strong>Significant Digits</strong></a>
488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>DecimalFormat</code> has two ways of controlling how many
490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are shows: (a) significant digits counts, or (b) integer and
491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction digit counts.  Integer and fraction digit counts are
492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * described above.  When a formatter is using significant digits
493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * counts, the number of integer and fraction digits is not specified
494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * directly, and the formatter settings for these counts are ignored.
495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Instead, the formatter uses however many integer and fraction
496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are required to display the specified number of significant
497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits.  Examples:
498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <table border=0 cellspacing=3 cellpadding=0>
500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr bgcolor="#ccccff">
501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left>Pattern
502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left>Minimum significant digits
503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left>Maximum significant digits
504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left>Number
505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td align=left>Output of format()
506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\@\@\@</code>
508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>3
509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>3
510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>12345
511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>12300</code>
512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\@\@\@</code>
514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>3
515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>3
516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>0.12345
517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>0.123</code>
518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top>
519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\@\@##</code>
520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>2
521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>4
522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>3.14159
523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>3.142</code>
524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *   <tr valign=top bgcolor="#eeeeff">
525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>\@\@##</code>
526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>2
527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>4
528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td>1.23004
529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *     <td><code>1.23</code>
530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </table>
531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul>
533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Significant digit counts may be expressed using patterns that
534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specify a minimum and maximum number of significant digits.  These
535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are indicated by the <code>'@'</code> and <code>'#'</code>
536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters.  The minimum number of significant digits is the number
537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of <code>'@'</code> characters.  The maximum number of significant
538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits is the number of <code>'@'</code> characters plus the number
539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of <code>'#'</code> characters following on the right.  For
540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, the pattern <code>"@@@"</code> indicates exactly 3
541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits.  The pattern <code>"@##"</code> indicates from
542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1 to 3 significant digits.  Trailing zero digits to the right of
543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the decimal separator are suppressed after the minimum number of
544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits have been shown.  For example, the pattern
545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"@##"</code> formats the number 0.1203 as
546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"0.12"</code>.
547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If a pattern uses significant digits, it may not contain a
549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal separator, nor the <code>'0'</code> pattern character.
550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Patterns such as <code>"@00"</code> or <code>"@.###"</code> are
551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * disallowed.
552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Any number of <code>'#'</code> characters may be prepended to
554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the left of the leftmost <code>'@'</code> character.  These have no
555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * effect on the minimum and maximum significant digits counts, but
556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * may be used to position grouping separators.  For example,
557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"#,#@#"</code> indicates a minimum of one significant digits,
558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of two significant digits, and a grouping size of three.
559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In order to enable significant digits formatting, use a pattern
561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * containing the <code>'@'</code> pattern character.  Alternatively,
562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * call setSignificantDigitsUsed(TRUE).
563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In order to disable significant digits formatting, use a
565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern that does not contain the <code>'@'</code> pattern
566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character. Alternatively, call setSignificantDigitsUsed(FALSE).
567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of significant digits has no effect on parsing.
569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Significant digits may be used together with exponential notation. Such
571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * patterns are equivalent to a normal exponential pattern with a minimum and
572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum integer digit count of one, a minimum fraction digit count of
573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getMinimumSignificantDigits() - 1</code>, and a maximum fraction digit
574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If signficant digits are in use, then the integer and fraction
578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digit counts, as set via the API, are ignored.  If significant
579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are not in use, then the signficant digit counts, as set via
580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the API, are ignored.
581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Padding</strong>
585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat supports padding the result of
587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * format() to a specific width.  Padding may be specified either
588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * through the API or through the pattern syntax.  In a pattern the pad escape
589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character, followed by a single pad character, causes padding to be parsed
590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and formatted.  The pad escape character is '*' in unlocalized patterns, and
591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * can be localized using DecimalFormatSymbols::setSymbol() with a
592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols::kPadEscapeSymbol
593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * selector.  For example, <code>"$*x#,##0.00"</code> formats 123 to
594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>.
595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul>
597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When padding is in effect, the width of the positive subpattern,
598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including prefix and suffix, determines the format width.  For example, in
599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the pattern <code>"* #0 o''clock"</code>, the format width is 10.
600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The width is counted in 16-bit code units (UChars).
602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Some parameters which usually do not matter have meaning when padding is
604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * used, because the pattern width is significant with padding.  In the pattern
605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "* ##,##,#,##0.##", the format width is 14.  The initial characters "##,##,"
606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * do not affect the grouping size or maximum integer digits, but they do affect
607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the format width.
608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Padding may be inserted at one of four locations: before the prefix,
610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * after the prefix, before the suffix, or after the suffix.  If padding is
611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specified in any other location, applyPattern()
612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sets a failing UErrorCode.  If there is no prefix,
613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * before the prefix and after the prefix are equivalent, likewise for the
614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffix.
615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When specified in a pattern, the 32-bit code point immediately
617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * following the pad escape is the pad character. This may be any character,
618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including a special pattern character. That is, the pad escape
619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>escapes</em> the following character. If there is no character after
620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the pad escape, then the pattern is illegal.
621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Rounding</strong>
625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat supports rounding to a specific increment.  For
627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, 1230 rounded to the nearest 50 is 1250.  1.234 rounded to the
628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * nearest 0.65 is 1.3.  The rounding increment may be specified through the API
629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or in a pattern.  To specify a rounding increment in a pattern, include the
630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * increment in the pattern itself.  "#,#50" specifies a rounding increment of
631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 50.  "#,##0.05" specifies a rounding increment of 0.05.
632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
63327f654740f2a26ad62a5c155af9199af9e69b889claireho * <p>In the absense of an explicit rounding increment numbers are
63427f654740f2a26ad62a5c155af9199af9e69b889claireho * rounded to their formatted width.
63527f654740f2a26ad62a5c155af9199af9e69b889claireho *
636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul>
637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Rounding only affects the string produced by formatting.  It does
638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * not affect parsing or change any numerical values.
639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>A <em>rounding mode</em> determines how values are rounded; see
64127f654740f2a26ad62a5c155af9199af9e69b889claireho * DecimalFormat::ERoundingMode.  The default rounding mode is
64227f654740f2a26ad62a5c155af9199af9e69b889claireho * DecimalFormat::kRoundHalfEven.  The rounding mode can only be set
64327f654740f2a26ad62a5c155af9199af9e69b889claireho * through the API; it can not be set with a pattern.
644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Some locales use rounding in their currency formats to reflect the
646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * smallest currency denomination.
647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In a pattern, digits '1' through '9' specify rounding, but otherwise
649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behave identically to digit '0'.
650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul>
651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Synchronization</strong>
653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat objects are not synchronized.  Multiple
655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * threads should not access one formatter concurrently.
656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Subclassing</strong>
658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><em>User subclasses are not supported.</em> While clients may write
660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subclasses, such code will not necessarily work and will not be
661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * guaranteed to work stably from release to release.
662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API DecimalFormat: public NumberFormat {
664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Rounding mode.
667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum ERoundingMode {
670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundCeiling,  /**< Round towards positive infinity */
671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundFloor,    /**< Round towards negative infinity */
672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundDown,     /**< Round towards zero */
673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundUp,       /**< Round away from zero */
674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundHalfEven, /**< Round towards the nearest integer, or
675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             towards the nearest even integer if equidistant */
676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kRoundHalfDown, /**< Round towards the nearest integer, or
677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             towards zero if equidistant */
678b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho        kRoundHalfUp,   /**< Round towards the nearest integer, or
679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             away from zero if equidistant */
680b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho        /**
681fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius          *  Return U_FORMAT_INEXACT_ERROR if number does not format exactly.
682fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius          *  @stable ICU 4.8
683b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho          */
684103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius        kRoundUnnecessary
685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    };
686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Pad position.
689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum EPadPosition {
692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kPadBeforePrefix,
693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kPadAfterPrefix,
694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kPadBeforeSuffix,
695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        kPadAfterSuffix
696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    };
697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat using the default pattern and symbols
700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * for the default locale. This is a convenient way to obtain a
701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * DecimalFormat when internationalization is not the main concern.
702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given locale, use the factory methods
704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * on NumberFormat such as createInstance. These factories will
705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * return the most appropriate sub-class of NumberFormat for a given
706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale.
707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code. If the
708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  pattern is invalid this will be set to a failure code.
709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(UErrorCode& status);
712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and the symbols
715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * for the default locale. This is a convenient way to obtain a
716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * DecimalFormat when internationalization is not the main concern.
717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given locale, use the factory methods
719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * on NumberFormat such as createInstance. These factories will
720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * return the most appropriate sub-class of NumberFormat for a given
721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale.
722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   A non-localized pattern string.
723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code. If the
724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  pattern is invalid this will be set to a failure code.
725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(const UnicodeString& pattern,
728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                  UErrorCode& status);
729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and symbols.
732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Use this constructor when you need to completely customize the
733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * behavior of the format.
734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given
736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale, use the factory methods on NumberFormat such as
737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * createInstance or createCurrencyInstance. If you need only minor adjustments
738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to a standard format, you can modify the format returned by
739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a NumberFormat factory method.
740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern           a non-localized pattern string
742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          delete this object after making this call.
744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status            Output param set to success/failure code. If the
745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          pattern is invalid this will be set to a failure code.
746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(  const UnicodeString& pattern,
749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    DecimalFormatSymbols* symbolsToAdopt,
750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UErrorCode& status);
751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
752103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API
753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
75485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * This API is for ICU use only.
75585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Create a DecimalFormat from the given pattern, symbols, and style.
75685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *
75785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param pattern           a non-localized pattern string
75885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
75985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                          delete this object after making this call.
760b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho     * @param style             style of decimal format
76185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param status            Output param set to success/failure code. If the
76285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                          pattern is invalid this will be set to a failure code.
7638393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @internal
76485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
76585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    DecimalFormat(  const UnicodeString& pattern,
76685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                    DecimalFormatSymbols* symbolsToAdopt,
767b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                    UNumberFormatStyle style,
76885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                    UErrorCode& status);
76985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
7708393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#if UCONFIG_HAVE_PARSEALLINPUT
7718393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    /**
7728393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @internal
7738393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     */
7748393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    void setParseAllInput(UNumberFormatAttributeValue value);
7758393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif
7768393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius
7778393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif  /* U_HIDE_INTERNAL_API */
7788393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius
779103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
78054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
78154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Set an integer attribute on this DecimalFormat.
78254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * May return U_UNSUPPORTED_ERROR if this instance does not support
78354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * the specified attribute.
78454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param attr the attribute to set
78554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param newvalue new value
78654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param status the error type
7878393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) )
788fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @stable ICU 51
78954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
79054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr,
79154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                       int32_t newvalue,
79254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                       UErrorCode &status);
79354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
79454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
79554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Get an integer
79654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * May return U_UNSUPPORTED_ERROR if this instance does not support
79754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * the specified attribute.
79854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param attr the attribute to set
79954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param status the error type
80054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return the attribute value. Undefined if there is an error.
801fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @stable ICU 51
80254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
80354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual int32_t getAttribute( UNumberFormatAttribute attr,
80454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
80554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
806fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
807fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    /**
808fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Set whether or not grouping will be used in this format.
809fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param newValue    True, grouping will be used in this format.
810fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @see getGroupingUsed
811fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @draft ICU 53
812fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     */
813fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    virtual void setGroupingUsed(UBool newValue);
814fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius
815fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    /**
816fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Sets whether or not numbers should be parsed as integers only.
817fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param value    set True, this format will parse numbers as integers
818fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     *                 only.
819fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @see isParseIntegerOnly
820fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @draft ICU 53
821fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     */
822fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    virtual void setParseIntegerOnly(UBool value);
823103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
824fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
825fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    /**
826fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Set a particular UDisplayContext value in the formatter, such as
827fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
828fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param value The UDisplayContext value to set.
829fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param status Input/output status. If at entry this indicates a failure
830fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     *               status, the function will do nothing; otherwise this will be
831fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     *               updated with any new status from the function.
832fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @draft ICU 53
833fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     */
834fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    virtual void setContext(UDisplayContext value, UErrorCode& status);
835103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
83685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and symbols.
838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Use this constructor when you need to completely customize the
839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * behavior of the format.
840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given
842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale, use the factory methods on NumberFormat such as
843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * createInstance or createCurrencyInstance. If you need only minor adjustments
844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to a standard format, you can modify the format returned by
845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a NumberFormat factory method.
846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern           a non-localized pattern string
848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
849ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          delete this object after making this call.
85050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError        Output param to receive errors occured during parsing
851ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status            Output param set to success/failure code. If the
852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          pattern is invalid this will be set to a failure code.
853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
854ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(  const UnicodeString& pattern,
856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    DecimalFormatSymbols* symbolsToAdopt,
857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UParseError& parseError,
858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UErrorCode& status);
859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and symbols.
861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Use this constructor when you need to completely customize the
862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * behavior of the format.
863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given
865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale, use the factory methods on NumberFormat such as
866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * createInstance or createCurrencyInstance. If you need only minor adjustments
867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to a standard format, you can modify the format returned by
868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a NumberFormat factory method.
869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern           a non-localized pattern string
871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbols   the set of symbols to be used
872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status            Output param set to success/failure code. If the
873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          pattern is invalid this will be set to a failure code.
874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(  const UnicodeString& pattern,
877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    const DecimalFormatSymbols& symbols,
878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UErrorCode& status);
879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
88250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
883ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    the DecimalFormat object to be copied from.
884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
885ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(const DecimalFormat& source);
887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rhs    the DecimalFormat object to be copied.
892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
893ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
894ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat& operator=(const DecimalFormat& rhs);
895ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
896ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
897ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
898ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
899ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
900ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~DecimalFormat();
901ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
902ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
903ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this Format object polymorphically. The caller owns the
904ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * result and should delete it when done.
905ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
906ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    a polymorphic copy of this DecimalFormat.
907ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual Format* clone(void) const;
910ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
911ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
912ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given Format objects are semantically equal.
913ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Objects of different subclasses are considered unequal.
914ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
915ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param other    the object to be compared with.
916ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return         true if the given Format objects are semantically equal.
917ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
918ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
919ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const Format& other) const;
920ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
92150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
92250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    using NumberFormat::format;
92350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
924ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
925ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format a double or long number using base-10 representation.
926ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
927ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
928ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
929ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
930ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
931ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
932ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
933ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
93450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
935ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(double number,
936ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
937ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
9387c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
93954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
94054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
94154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format a double or long number using base-10 representation.
94254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
94354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
94454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
94554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
94654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
94754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
94854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param status
94954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
95054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
95154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
95254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(double number,
95354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
95454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
95554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
95654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
95750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
95850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a double or long number using base-10 representation.
95950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
96050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
96150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
96250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
96350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
96450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
96550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
96650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
96750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
96827f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
96950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
9707c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(double number,
9717c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
97250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
97350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
9747c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
975ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
976ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format a long number using base-10 representation.
977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
978ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
981ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
982ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
983ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
984ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
985ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
986ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(int32_t number,
987ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
988ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
9897c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
99050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
99150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a long number using base-10 representation.
99250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
99350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
99450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
99550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
99654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
99754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
99854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
99954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
100054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
100154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(int32_t number,
100254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
100354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
100454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
100554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
100654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
100754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format a long number using base-10 representation.
100854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
100954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
101054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
101154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
101250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
101350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
101450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
101550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
101650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
101727f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
101850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
10197c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(int32_t number,
10207c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
102150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
102250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
10237c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
1024ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1025ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format an int64 number using base-10 representation.
1026ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1027ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
1028ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
1029ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
1030ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
1031ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
1032ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
1033ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.8
1034ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1035ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(int64_t number,
1036ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
1037ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
1038ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1039b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
104050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format an int64 number using base-10 representation.
104150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
104250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
104350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
104450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
104554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
104654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
104754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
104854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
104954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
105054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(int64_t number,
105154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
105254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
105354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
105454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
105554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
105654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format an int64 number using base-10 representation.
105754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
105854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
105954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
106054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
106150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
106250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
106350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
106450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
106550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
106627f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
106750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
10687c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(int64_t number,
10697c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
107050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
107150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
107250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
107350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
107450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a decimal number.
107550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The syntax of the unformatted number is a "numeric string"
107650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * as defined in the Decimal Arithmetic Specification, available at
107750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * http://speleotrove.com/decimal
107850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
107950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The unformatted number, as a string.
108050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
108150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
108250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
108350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
108450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
108550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
108650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
108727f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
108850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
108950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const StringPiece &number,
109050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
109250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
109350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
109450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
109550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
1096fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Format a decimal number.
109750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The number is a DigitList wrapper onto a floating point decimal number.
109850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The default implementation in NumberFormat converts the decimal number
109950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * to a double and formats that.
110050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
110150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The number, a DigitList format Decimal Floating Point.
110250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
110350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
110450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
110550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
110650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
110750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
110850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @internal
110950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
111050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const DigitList &number,
111150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
111250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
111350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
111450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
111550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
1116fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Format a decimal number.
111750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The number is a DigitList wrapper onto a floating point decimal number.
111850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The default implementation in NumberFormat converts the decimal number
1119fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * to a double and formats that.
112050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
112150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The number, a DigitList format Decimal Floating Point.
112250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
112350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
112450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param pos       On input: an alignment field, if desired.
112550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  On output: the offsets of the alignment field.
112650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
112750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
112850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @internal
112950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
113050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const DigitList &number,
113150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
11327c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  FieldPosition& pos,
113350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
113450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
113559d709d503bab6e2b61931737e662dd293b40578ccornelius   using NumberFormat::parse;
11367c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
1137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   /**
1138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * Parse the given string using this object's choices. The method
1139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * does string comparisons to try to find an optimal match.
1140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * If no object can be parsed, index is unchanged, and NULL is
1141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * returned.  The result is returned as the most parsimonious
1142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * type of Formattable that will accomodate all of the
1143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * necessary precision.  For example, if the result is exactly 12,
1144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * it will be returned as a long.  However, if it is 1.5, it will
1145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * be returned as a double.
1146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *
1147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param text           The text to be parsed.
1148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param result         Formattable to be set to the parse result.
1149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       If parse fails, return contents are undefined.
1150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param parsePosition  The position to start parsing at on input.
1151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       On output, moved to after the last successfully
1152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       parse character. On parse failure, does not change.
1153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @see Formattable
1154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @stable ICU 2.0
1155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    */
1156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void parse(const UnicodeString& text,
1157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                       Formattable& result,
1158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                       ParsePosition& parsePosition) const;
1159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Parses text from the given string as a currency amount.  Unlike
1162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the parse() method, this method will attempt to parse a generic
1163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency name, searching for a match of this object's locale's
1164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency display names, or for a 3-letter ISO currency code.
1165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method will fail if this format is not a currency format,
1166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that is, if it does not contain the currency pattern symbol
1167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (U+00A4) in its prefix or suffix.
1168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param text the string to parse
1170103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @param pos  input-output position; on input, the position within text
1171103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             to match; must have 0 <= pos.getIndex() < text.length();
1172103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             on output, the position after the last matched character.
1173103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             If the parse fails, the position in unchanged upon output.
1174103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
1175103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             object (owned by the caller) containing information about
1176103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             the parsed currency; if parse fails, this is NULL.
11778393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @stable ICU 49
1178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1179103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
1180103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                                          ParsePosition& pos) const;
1181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the decimal format symbols, which is generally not changed
1184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return desired DecimalFormatSymbols
1186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols
1187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the decimal format symbols, which is generally not changed
1193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbolsToAdopt DecimalFormatSymbols to be adopted.
1195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the decimal format symbols, which is generally not changed
1201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbols DecimalFormatSymbols.
1203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
120950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Returns the currency plural format information,
121085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
121185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @return desired CurrencyPluralInfo
121250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
121385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
121485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
121585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
121685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
121750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Sets the currency plural format information,
121885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
121985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param toAdopt CurrencyPluralInfo to be adopted.
122050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
122185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
122285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
122385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
122485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
122550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Sets the currency plural format information,
122685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
122785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param info Currency Plural Info.
122850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
122985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
123085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
123185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
123285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
123385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
1234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the positive prefix.
1235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the positive prefix.
1237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: +123, $123, sFr123
1239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getPositivePrefix(UnicodeString& result) const;
1242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the positive prefix.
1245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the the positive prefix to be set.
1247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: +123, $123, sFr123
1248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPositivePrefix(const UnicodeString& newValue);
1251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the negative prefix.
1254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the negative prefix.
1256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123, ($123) (with negative suffix), sFr-123
1258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getNegativePrefix(UnicodeString& result) const;
1261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the negative prefix.
1264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the the negative prefix to be set.
1266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123, ($123) (with negative suffix), sFr-123
1267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setNegativePrefix(const UnicodeString& newValue);
1270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the positive suffix.
1273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the positive suffix.
1275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: 123%
1277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the positive suffix.
1283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the positive suffix to be set.
1285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: 123%
1286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPositiveSuffix(const UnicodeString& newValue);
1289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the negative suffix.
1292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the negative suffix.
1294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123%, ($123) (with positive suffixes)
1296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the negative suffix.
1302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the negative suffix to be set.
1304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: 123%
1305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setNegativeSuffix(const UnicodeString& newValue);
1308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the multiplier for use in percent, permill, etc.
1311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (For Arabic, use arabic percent symbol).
1313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    the multiplier for use in percent, permill, etc.
1316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMultiplier(void) const;
1320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the multiplier for use in percent, permill, etc.
1323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (For Arabic, use arabic percent symbol).
1325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the multiplier for use in percent, permill, etc.
1328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMultiplier(int32_t newValue);
1332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the rounding increment.
133559d709d503bab6e2b61931737e662dd293b40578ccornelius     * @return A positive rounding increment, or 0.0 if a custom rounding
133627f654740f2a26ad62a5c155af9199af9e69b889claireho     * increment is not in effect.
1337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual double getRoundingIncrement(void) const;
1343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
134527f654740f2a26ad62a5c155af9199af9e69b889claireho     * Set the rounding increment.  In the absence of a rounding increment,
134627f654740f2a26ad62a5c155af9199af9e69b889claireho     *    numbers will be rounded to the number of digits displayed.
134759d709d503bab6e2b61931737e662dd293b40578ccornelius     * @param newValue A positive rounding increment, or 0.0 to
134859d709d503bab6e2b61931737e662dd293b40578ccornelius     * use the default rounding increment.
1349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Negative increments are equivalent to 0.0.
1350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setRoundingIncrement(double newValue);
1356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the rounding mode.
1359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return A rounding mode
1360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ERoundingMode getRoundingMode(void) const;
1366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1368fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Set the rounding mode.
1369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param roundingMode A rounding mode
1370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setRoundingMode(ERoundingMode roundingMode);
1376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the width to which the output of format() is padded.
1379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The width is counted in 16-bit code units.
1380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the format width, or zero if no padding is in effect
1381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual int32_t getFormatWidth(void) const;
1389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the width to which the output of format() is padded.
1392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The width is counted in 16-bit code units.
1393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method also controls whether padding is enabled.
1394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param width the width to which to pad the result of
1395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * format(), or zero to disable padding.  A negative
1396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * width is equivalent to 0.
1397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setFormatWidth(int32_t width);
1405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the pad character used to pad to the format width.  The
1408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * default is ' '.
1409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return a string containing the pad character. This will always
1410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * have a length of one 32-bit code point.
1411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString getPadCharacterString() const;
1419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the character used to pad to the format width.  If padding
1422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is not enabled, then this will take effect if padding is later
1423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * enabled.
1424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param padChar a string containing the pad charcter. If the string
1425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * has length 0, then the pad characer is set to ' '.  Otherwise
1426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * padChar.char32At(0) will be used as the pad character.
1427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPadCharacter(const UnicodeString &padChar);
1435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the position at which padding will take place.  This is the location
1438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * at which padding will be inserted if the result of format()
1439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is shorter than the format width.
1440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the pad position, one of kPadBeforePrefix,
1441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterPrefix, kPadBeforeSuffix, or
1442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterSuffix.
1443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
144885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @see #EPadPosition
1449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual EPadPosition getPadPosition(void) const;
1452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the position at which padding will take place.  This is the location
1455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * at which padding will be inserted if the result of format()
1456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is shorter than the format width.  This has no effect unless padding is
1457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * enabled.
1458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param padPos the pad position, one of kPadBeforePrefix,
1459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterPrefix, kPadBeforeSuffix, or
1460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterSuffix.
1461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
146685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @see #EPadPosition
1467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPadPosition(EPadPosition padPos);
1470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return whether or not scientific notation is used.
1473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return TRUE if this object formats and parses scientific notation
1474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
148159d709d503bab6e2b61931737e662dd293b40578ccornelius    virtual UBool isScientificNotation(void) const;
1482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set whether or not scientific notation is used. When scientific notation
1485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is used, the effective maximum number of integer digits is <= 8.  If the
1486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * maximum number of integer digits is set to more than 8, the effective
1487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * maximum will be 1.  This allows this call to generate a 'default' scientific
1488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number format without additional changes.
1489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param useScientific TRUE if this object formats and parses scientific
1490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * notation
1491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setScientificNotation(UBool useScientific);
1499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the minimum exponent digits that will be shown.
1502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the minimum exponent digits that will be shown
1503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual int8_t getMinimumExponentDigits(void) const;
1511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the minimum exponent digits that will be shown.  This has no
1514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * effect unless scientific notation is in use.
1515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param minExpDig a value >= 1 indicating the fewest exponent digits
1516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that will be shown.  Values less than 1 will be treated as 1.
1517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumExponentDigits(int8_t minExpDig);
1525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return whether the exponent sign is always shown.
1528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return TRUE if the exponent is always prefixed with either the
1529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * localized minus sign or the localized plus sign, false if only negative
1530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * exponents are prefixed with the localized minus sign.
1531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
153859d709d503bab6e2b61931737e662dd293b40578ccornelius    virtual UBool isExponentSignAlwaysShown(void) const;
1539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set whether the exponent sign is always shown.  This has no effect
1542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * unless scientific notation is in use.
1543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param expSignAlways TRUE if the exponent is always prefixed with either
1544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the localized minus sign or the localized plus sign, false if only
1545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * negative exponents are prefixed with the localized minus sign.
1546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the grouping size. Grouping size is the number of digits between
1557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping separators in the integer portion of a number.  For example,
1558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * in the number "123,456.78", the grouping size is 3.
1559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    the grouping size.
1561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see setGroupingSize
1562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::isGroupingUsed
1563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::getGroupingSeparator
1564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getGroupingSize(void) const;
1567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the grouping size. Grouping size is the number of digits between
1570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping separators in the integer portion of a number.  For example,
1571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * in the number "123,456.78", the grouping size is 3.
1572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the grouping size.
1574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see getGroupingSize
1575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::setGroupingUsed
1576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::setGroupingSeparator
1577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setGroupingSize(int32_t newValue);
1580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the secondary grouping size. In some locales one
1583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping interval is used for the least significant integer
1584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * digits (the primary grouping size), and another is used for all
1585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * others (the secondary grouping size).  A formatter supporting a
1586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * secondary grouping size will return a positive integer unequal
1587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to the primary grouping size returned by
1588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * getGroupingSize().  For example, if the primary
1589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping size is 4, and the secondary grouping size is 2, then
1590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the number 123456789 formats as "1,23,45,6789", and the pattern
1591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * appears as "#,##,###0".
1592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the secondary grouping size, or a value less than
1593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * one if there is none
1594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see setSecondaryGroupingSize
1595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::isGroupingUsed
1596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::getGroupingSeparator
1597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
1598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getSecondaryGroupingSize(void) const;
1600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the secondary grouping size. If set to a value less than 1,
1603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * then secondary grouping is turned off, and the primary grouping
1604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * size is used for all intervals, not just the least significant.
1605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the secondary grouping size.
1607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see getSecondaryGroupingSize
1608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setGroupingUsed
1609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::setGroupingSeparator
1610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
1611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setSecondaryGroupingSize(int32_t newValue);
1613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Allows you to get the behavior of the decimal separator with integers.
1616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (The decimal separator will always appear with decimals.)
1617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    TRUE if the decimal separator always appear with decimals.
1619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isDecimalSeparatorAlwaysShown(void) const;
1623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Allows you to set the behavior of the decimal separator with integers.
1626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (The decimal separator will always appear with decimals.)
1627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    set TRUE if the decimal separator will always appear with decimals.
1629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Synthesizes a pattern string that represents the current state
1636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of this Format object.
1637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the pattern.
1639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Previous contents are deleted.
1640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see applyPattern
1642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& toPattern(UnicodeString& result) const;
1645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Synthesizes a localized pattern string that represents the current
1648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * state of this Format object.
1649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the localized pattern.
1651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Previous contents are deleted.
1652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see applyPattern
1654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
165750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
1658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.  A pattern is a
1660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * short-hand specification for the various formatting properties.
1661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * These properties can also be changed individually through the
1662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * various setter methods.
1663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
1664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * There is no limit to integer digits are set
1665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this routine, since that is the typical end-user desire;
1666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * use setMaximumInteger if you want to set a real value.
1667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For negative numbers, use a second pattern, separated by a semicolon
1668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example "#,#00.0#" -> 1,234.56
1670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This means a minimum of 2 integer digits, 1 fraction digit, and
1672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a maximum of 2 fraction digits.
1673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
1675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * In negative patterns, the minimum and maximum counts are ignored;
1677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * these are presumed to be set in the positive pattern.
1678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern    The pattern to be applied.
168050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
1681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
1682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status     Output param set to success/failure code on
1683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   exit. If the pattern is invalid, this will be
1684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   set to a failure result.
1685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyPattern(const UnicodeString& pattern,
1688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UParseError& parseError,
1689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UErrorCode& status);
1690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the pattern.
1692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The pattern to be applied.
1693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
169750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
1698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyPattern(const UnicodeString& pattern,
1699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UErrorCode& status);
1700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.  The pattern
1703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is assumed to be in a localized notation. A pattern is a
1704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * short-hand specification for the various formatting properties.
1705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * These properties can also be changed individually through the
1706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * various setter methods.
1707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
1708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * There is no limit to integer digits are set
1709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this routine, since that is the typical end-user desire;
1710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * use setMaximumInteger if you want to set a real value.
1711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For negative numbers, use a second pattern, separated by a semicolon
1712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example "#,#00.0#" -> 1,234.56
1714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This means a minimum of 2 integer digits, 1 fraction digit, and
1716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a maximum of 2 fraction digits.
1717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
1719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * In negative patterns, the minimum and maximum counts are ignored;
1721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * these are presumed to be set in the positive pattern.
1722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The localized pattern to be applied.
172450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
1725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
1726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyLocalizedPattern(const UnicodeString& pattern,
1732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UParseError& parseError,
1733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UErrorCode& status);
1734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.
1737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The localized pattern to be applied.
1739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyLocalizedPattern(const UnicodeString& pattern,
1745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UErrorCode& status);
1746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of digits allowed in the integer portion of a
1750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the integer digit count to 309.
1751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
175250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the maximum number of digits
1753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      allowed in the integer portion of a number.
1754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMaximumIntegerDigits
1755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMaximumIntegerDigits(int32_t newValue);
1758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of digits allowed in the integer portion of a
1761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the integer digit count to 309.
176250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
176350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the minimum number of digits
1764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      allowed in the integer portion of a number.
1765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMinimumIntegerDigits
1766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumIntegerDigits(int32_t newValue);
1769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of digits allowed in the fraction portion of a
1772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the fraction digit count to 340.
1773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
177450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the maximum number of digits
1775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                    allowed in the fraction portion of a number.
1776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMaximumFractionDigits
1777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMaximumFractionDigits(int32_t newValue);
1780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of digits allowed in the fraction portion of a
1783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the fraction digit count to 340.
1784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
178550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the minimum number of digits
1786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                    allowed in the fraction portion of a number.
1787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMinimumFractionDigits
1788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumFractionDigits(int32_t newValue);
1791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the minimum number of significant digits that will be
1794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed. This value has no effect unless areSignificantDigitsUsed()
1795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
1796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the fewest significant digits that will be shown
1797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMinimumSignificantDigits() const;
1800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the maximum number of significant digits that will be
1803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed. This value has no effect unless areSignificantDigitsUsed()
1804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
1805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the most significant digits that will be shown
1806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMaximumSignificantDigits() const;
1809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of significant digits that will be
1812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed.  If <code>min</code> is less than one then it is set
1813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to one.  If the maximum significant digits count is less than
181459d709d503bab6e2b61931737e662dd293b40578ccornelius     * <code>min</code>, then it is set to <code>min</code>.
181559d709d503bab6e2b61931737e662dd293b40578ccornelius     * This function also enables the use of significant digits
181659d709d503bab6e2b61931737e662dd293b40578ccornelius     * by this formatter - areSignificantDigitsUsed() will return TRUE.
181759d709d503bab6e2b61931737e662dd293b40578ccornelius     * @see #areSignificantDigitsUsed
181850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param min the fewest significant digits to be shown
1819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setMinimumSignificantDigits(int32_t min);
1822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of significant digits that will be
1825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed.  If <code>max</code> is less than one then it is set
1826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to one.  If the minimum significant digits count is greater
1827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * than <code>max</code>, then it is set to <code>max</code>.
182859d709d503bab6e2b61931737e662dd293b40578ccornelius     * This function also enables the use of significant digits
182959d709d503bab6e2b61931737e662dd293b40578ccornelius     * by this formatter - areSignificantDigitsUsed() will return TRUE.
183059d709d503bab6e2b61931737e662dd293b40578ccornelius     * @see #areSignificantDigitsUsed
183150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param max the most significant digits to be shown
1832ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setMaximumSignificantDigits(int32_t max);
1835ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns true if significant digits are in use, or false if
1838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * integer and fraction digit counts are in use.
1839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return true if significant digits are in use
1840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool areSignificantDigitsUsed() const;
1843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets whether significant digits are in use, or integer and
1846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * fraction digit counts are in use.
1847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param useSignificantDigits true to use significant digits, or
1848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * false to use integer and fraction digit counts
1849ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1850ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1851ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setSignificantDigitsUsed(UBool useSignificantDigits);
1852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public:
1854ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the currency used to display currency
1856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * amounts.  This takes effect immediately, if this format is a
1857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency format.  If this format is not a currency format, then
1858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the currency is used if and when this object becomes a
1859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency format through the application of a new pattern.
1860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param theCurrency a 3-letter ISO code indicating new currency
1861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to use.  It need not be null-terminated.  May be the empty
1862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * string or NULL to indicate no currency.
1863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param ec input-output error code
1864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
1867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the currency used to display currency amounts.  See
1870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * setCurrency(const UChar*, UErrorCode&).
1871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&).
1872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setCurrency(const UChar* theCurrency);
1874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The resource tags we use to retrieve decimal format data from
1877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale resource bundles.
1878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @deprecated ICU 3.4. This string has no public purpose. Please don't use it.
1879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const char fgNumberPatterns[];
1881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
188259d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_INTERNAL_API
188359d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
188459d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a double as it would be
188559d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat.
188659d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
188759d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
188859d709d503bab6e2b61931737e662dd293b40578ccornelius     */
188959d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(double number, UErrorCode &status) const;
189059d709d503bab6e2b61931737e662dd293b40578ccornelius
189159d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
189259d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a formattable as it would be
189359d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat.
189459d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
189559d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
189659d709d503bab6e2b61931737e662dd293b40578ccornelius     */
189759d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const;
189859d709d503bab6e2b61931737e662dd293b40578ccornelius
189959d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
190059d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a DigitList as it would be
190159d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat. Note: the DigitList may be modified.
190259d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
190359d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
190459d709d503bab6e2b61931737e662dd293b40578ccornelius     */
190559d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const;
190659d709d503bab6e2b61931737e662dd293b40578ccornelius#endif  /* U_HIDE_INTERNAL_API */
190759d709d503bab6e2b61931737e662dd293b40578ccornelius
1908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
1909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1910ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1911ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class.  This is useful only for
1912ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * comparing to a return value from getDynamicClassID().  For example:
1913ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1914ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Base* polymorphic_pointer = createPolymorphicObject();
1915ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      if (polymorphic_pointer->getDynamicClassID() ==
1916ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .          Derived::getStaticClassID()) ...
1917ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1918ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
1919ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1920ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1921ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
1922ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1923ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1924ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY.  Pure virtual override.
1925ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method is to implement a simple version of RTTI, since not all
1926ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * C++ compilers support genuine RTTI.  Polymorphic operator==() and
1927ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * clone() methods call this method.
1928ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1929ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
1930ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
1931ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
1932ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1933ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1934ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
1935ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1936ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
193785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
1938ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(); // default constructor not implemented
1939ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
194050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    int32_t precision() const;
194150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
194250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
194359d709d503bab6e2b61931737e662dd293b40578ccornelius     *   Initialize all fields of a new DecimalFormatter to a safe default value.
194450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *      Common code for use by constructors.
194550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
194659d709d503bab6e2b61931737e662dd293b40578ccornelius    void init();
1947ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1948ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1949ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Do real work of constructing a new DecimalFormat.
1950ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
195159d709d503bab6e2b61931737e662dd293b40578ccornelius    void construct(UErrorCode&              status,
1952ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   UParseError&             parseErr,
1953ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   const UnicodeString*     pattern = 0,
1954ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   DecimalFormatSymbols*    symbolsToAdopt = 0
1955ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   );
1956ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1957ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1958ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Does the real work of generating a pattern.
1959ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1960ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result     Output param which will receive the pattern.
1961ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   Previous contents are deleted.
1962ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param localized  TRUE return localized pattern.
1963ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return           A reference to 'result'.
1964ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1965ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
1966ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1967ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1968ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Does the real work of applying a pattern.
1969ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern    The pattern to be applied.
1970ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param localized  If true, the pattern is localized; else false.
197150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
1972ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
1973ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status     Output param set to success/failure code on
1974ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   exit. If the pattern is invalid, this will be
1975ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   set to a failure result.
1976ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void applyPattern(const UnicodeString& pattern,
1978ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UBool localized,
1979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UParseError& parseError,
1980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UErrorCode& status);
198185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
198250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /*
198350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * similar to applyPattern, but without re-gen affix for currency
198485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
198585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void applyPatternInternally(const UnicodeString& pluralCount,
198685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                const UnicodeString& pattern,
198785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UBool localized,
198885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UParseError& parseError,
198985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UErrorCode& status);
199085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
199185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
199285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * only apply pattern without expand affixes
199385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
199485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
199585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UBool localized,
199685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UParseError& parseError,
199785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UErrorCode& status);
199885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
199985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
200085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
200185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * expand affixes (after apply patter) and re-compute fFormatWidth
200285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
200385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void expandAffixAdjustWidth(const UnicodeString* pluralCount);
200485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
200550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2006ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2007ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Do the work of formatting a number, either a double or a long.
2008ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
2009ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo       Output parameter to receive result.
2010ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                       Result is appended to existing contents.
201150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param handler        Records information about field positions.
2012ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param digits         the digits to be formatted.
2013ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param isInteger      if TRUE format the digits as Integer.
2014ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return               Reference to 'appendTo' parameter.
2015ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2016ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& subformat(UnicodeString& appendTo,
201750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                             FieldPositionHandler& handler,
201850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                             DigitList&     digits,
2019fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius                             UBool          isInteger,
202054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                             UErrorCode &status) const;
20217c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
202285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2023ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void parse(const UnicodeString& text,
2024ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru               Formattable& result,
2025ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru               ParsePosition& pos,
2026103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius               UChar* currency) const;
2027ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2028ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum {
2029ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        fgStatusInfinite,
2030ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        fgStatusLength      // Leave last in list.
2031ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    } StatusFlags;
2032ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
203350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UBool subparse(const UnicodeString& text,
203485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* negPrefix,
203585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* negSuffix,
203685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* posPrefix,
203785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* posSuffix,
203859d709d503bab6e2b61931737e662dd293b40578ccornelius                   UBool complexCurrencyParsing,
203985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   int8_t type,
204085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   ParsePosition& parsePosition,
2041ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   DigitList& digits, UBool* status,
2042ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   UChar* currency) const;
2043ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
204485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Mixed style parsing for currency.
204550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // It parses against the current currency pattern
204685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // using complex affix comparison
204785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // parses against the currency plural patterns using complex affix comparison,
204885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and parses against the current pattern using simple affix comparison.
204950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UBool parseForCurrency(const UnicodeString& text,
205085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           ParsePosition& parsePosition,
205185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           DigitList& digits,
205285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           UBool* status,
205385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           UChar* currency) const;
205485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2055ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t skipPadding(const UnicodeString& text, int32_t position) const;
2056ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2057ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t compareAffix(const UnicodeString& input,
2058ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         int32_t pos,
2059ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UBool isNegative,
2060ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UBool isPrefix,
206185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                         const UnicodeString* affixPat,
206259d709d503bab6e2b61931737e662dd293b40578ccornelius                         UBool complexCurrencyParsing,
206385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                         int8_t type,
2064ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UChar* currency) const;
206550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
206659d709d503bab6e2b61931737e662dd293b40578ccornelius    static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix);
206759d709d503bab6e2b61931737e662dd293b40578ccornelius
206859d709d503bab6e2b61931737e662dd293b40578ccornelius    UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const;
206959d709d503bab6e2b61931737e662dd293b40578ccornelius
207059d709d503bab6e2b61931737e662dd293b40578ccornelius    int32_t compareSimpleAffix(const UnicodeString& affix,
2071ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                      const UnicodeString& input,
2072b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                                      int32_t pos,
207359d709d503bab6e2b61931737e662dd293b40578ccornelius                                      UBool lenient) const;
207450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2075b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
207650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2077ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
207850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
207959d709d503bab6e2b61931737e662dd293b40578ccornelius    static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos);
208059d709d503bab6e2b61931737e662dd293b40578ccornelius
208159d709d503bab6e2b61931737e662dd293b40578ccornelius    static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
208259d709d503bab6e2b61931737e662dd293b40578ccornelius
2083ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t compareComplexAffix(const UnicodeString& affixPat,
2084ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                const UnicodeString& input,
2085ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                int32_t pos,
208685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                int8_t type,
2087ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                UChar* currency) const;
2088ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2089ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
2090ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2091ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
2092ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2093b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
2094b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UnicodeSet *sset, UChar32 schar);
2095b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2096b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchDecimal(UChar32 symbolChar,
2097b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                            UBool sawDecimal,  UChar32 sawDecimalChar,
2098b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             const UnicodeSet *sset, UChar32 schar);
2099b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2100b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchGrouping(UChar32 groupingChar,
2101b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                            UBool sawGrouping, UChar32 sawGroupingChar,
2102b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             const UnicodeSet *sset,
2103b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UChar32 decimalChar, const UnicodeSet *decimalSet,
2104b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UChar32 schar);
2105b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get a decimal format symbol.
2108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a const reference to the symbol string.
2109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
2110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
2112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
211350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    int32_t appendAffix(UnicodeString& buf,
211450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        double number,
211550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        FieldPositionHandler& handler,
211650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        UBool isNegative,
211750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        UBool isPrefix) const;
211885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Append an affix to the given UnicodeString, using quotes if
2121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * there are special characters.  Single quotes themselves must be
2122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * escaped in either case.
2123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
212485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
2125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UBool localized) const;
2126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void appendAffixPattern(UnicodeString& appendTo,
2128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            const UnicodeString* affixPattern,
2129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            const UnicodeString& expAffix, UBool localized) const;
2130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void expandAffix(const UnicodeString& pattern,
2132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                     UnicodeString& affix,
2133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                     double number,
213450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                     FieldPositionHandler& handler,
213585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                     UBool doFormat,
213685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                     const UnicodeString* pluralCount) const;
21377c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
213885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void expandAffixes(const UnicodeString* pluralCount);
2139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void addPadding(UnicodeString& appendTo,
214150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                    FieldPositionHandler& handler,
2142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    int32_t prefixLen, int32_t suffixLen) const;
2143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isGroupingPosition(int32_t pos) const;
2145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setCurrencyForSymbols();
2147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
214885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // similar to setCurrency without re-compute the affixes for currency.
214985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // If currency changes, the affix pattern for currency is not changed,
215050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // but the affix will be changed. So, affixes need to be
215185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // re-computed in setCurrency(), but not in setCurrencyInternally().
215285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
215385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
215485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // set up currency affix patterns for mix parsing.
215585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // The patterns saved here are the affix patterns of default currency
215685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // pattern and the unique affix patterns of the plural currency patterns.
215785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Those patterns are used by parseForCurrency().
215885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void setupCurrencyAffixPatterns(UErrorCode& status);
215985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
216085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // set up the currency affixes used in currency plural formatting.
216185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It sets up both fAffixesForCurrency for currency pattern if the current
216250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // pattern contains 3 currency signs,
216385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and it sets up fPluralAffixesForCurrency for currency plural patterns.
216450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    void setupCurrencyAffixes(const UnicodeString& pattern,
216585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UBool setupForCurrentPattern,
216685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UBool setupForPluralPattern,
216785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UErrorCode& status);
216850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
216985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // hashtable operations
217085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* initHashForAffixPattern(UErrorCode& status);
217185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* initHashForAffix(UErrorCode& status);
217285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
217385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void deleteHashForAffixPattern();
217485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void deleteHashForAffix(Hashtable*& table);
217585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
217685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void copyHashForAffixPattern(const Hashtable* source,
217785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 Hashtable* target, UErrorCode& status);
217885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void copyHashForAffix(const Hashtable* source,
217985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                          Hashtable* target, UErrorCode& status);
218085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
218150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(int64_t number,
218250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
218354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           FieldPositionHandler& handler,
218454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           UErrorCode &status) const;
218550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(double number,
218650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
218754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           FieldPositionHandler& handler,
218854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           UErrorCode &status) const;
218950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(const DigitList &number,
219050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
219150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           FieldPositionHandler& handler,
219250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UErrorCode &status) const;
219350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constants.
2196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fPositivePrefix;
2199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fPositiveSuffix;
2200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fNegativePrefix;
2201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fNegativeSuffix;
2202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fPosPrefixPattern;
2203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fPosSuffixPattern;
2204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fNegPrefixPattern;
2205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fNegSuffixPattern;
2206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Formatter for ChoiceFormat-based currency names.  If this field
2209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is not null, then delegate to it to format currency symbols.
2210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @since ICU 2.6
2211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ChoiceFormat*           fCurrencyChoice;
2213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
221450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    DigitList *             fMultiplier;   // NULL for multiplier of one
2215fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    int32_t                 fScale;
2216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fGroupingSize;
2217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fGroupingSize2;
2218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fDecimalSeparatorAlwaysShown;
2219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormatSymbols*   fSymbols;
2220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fUseSignificantDigits;
2222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fMinSignificantDigits;
2223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fMaxSignificantDigits;
2224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fUseExponentialNotation;
2226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int8_t                  fMinExponentDigits;
2227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fExponentSignAlwaysShown;
2228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
222954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    EnumSet<UNumberFormatAttribute,
2230fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius            UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
2231fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius            UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
223254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                            fBoolFlags;
223354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
223450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    DigitList*              fRoundingIncrement;  // NULL if no rounding increment specified.
2235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ERoundingMode           fRoundingMode;
2236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UChar32                 fPad;
2238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fFormatWidth;
2239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    EPadPosition            fPadPosition;
2240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
224185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
224285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Following are used for currency format
224385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
224485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // pattern used in this formatter
224585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    UnicodeString fFormatPattern;
224685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // style is only valid when decimal formatter is constructed by
224785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // DecimalFormat(pattern, decimalFormatSymbol, style)
224885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    int fStyle;
224985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
225085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Represents whether this is a currency format, and which
225185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * currency format style.
225285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 0: not currency format type;
225385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 1: currency style -- symbol name, such as "$" for US dollar.
225485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 2: currency style -- ISO name, such as USD for US dollar.
225585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 3: currency style -- plural long name, such as "US Dollar" for
225685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      "1.00 US Dollar", or "US Dollars" for
225785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      "3.00 US Dollars".
225885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
225985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    int fCurrencySignCount;
226085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
226185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
226285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /* For currency parsing purose,
226350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Need to remember all prefix patterns and suffix patterns of
226450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * every currency format pattern,
226585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * including the pattern of default currecny style
226685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * and plural currency style. And the patterns are set through applyPattern.
226785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
226885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // TODO: innerclass?
2269103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
227085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    struct AffixPatternsForCurrency : public UMemory {
227185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative prefix pattern
227285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negPrefixPatternForCurrency;
227385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative suffix pattern
227485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negSuffixPatternForCurrency;
227585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive prefix pattern
227685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posPrefixPatternForCurrency;
227785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive suffix pattern
227885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posSuffixPatternForCurrency;
227985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        int8_t patternType;
228050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
228150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho        AffixPatternsForCurrency(const UnicodeString& negPrefix,
228285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& negSuffix,
228385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& posPrefix,
228485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& posSuffix,
228585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 int8_t type) {
228685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negPrefixPatternForCurrency = negPrefix;
228785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negSuffixPatternForCurrency = negSuffix;
228885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posPrefixPatternForCurrency = posPrefix;
228985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posSuffixPatternForCurrency = posSuffix;
229085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            patternType = type;
229185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        }
229285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    };
229350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    */
229450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
229585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /* affix for currency formatting when the currency sign in the pattern
229650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * equals to 3, such as the pattern contains 3 currency sign or
229785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * the formatter style is currency plural format style.
229885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
2299103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
230085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    struct AffixesForCurrency : public UMemory {
230185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative prefix
230285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negPrefixForCurrency;
230385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative suffix
230485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negSuffixForCurrency;
230585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive prefix
230685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posPrefixForCurrency;
230785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive suffix
230885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posSuffixForCurrency;
230950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
231085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        int32_t formatWidth;
231185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
231285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        AffixesForCurrency(const UnicodeString& negPrefix,
231385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& negSuffix,
231485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& posPrefix,
231585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& posSuffix) {
231685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negPrefixForCurrency = negPrefix;
231785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negSuffixForCurrency = negSuffix;
231885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posPrefixForCurrency = posPrefix;
231985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posSuffixForCurrency = posSuffix;
232085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        }
232185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    };
232250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    */
232385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
232485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Affix pattern set for currency.
232585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is a set of AffixPatternsForCurrency,
232685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // each element of the set saves the negative prefix pattern,
232750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // negative suffix pattern, positive prefix pattern,
232885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and positive suffix  pattern of a pattern.
232985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is used for currency mixed style parsing.
233085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is actually is a set.
233185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // The set contains the default currency pattern from the locale,
233285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and the currency plural patterns.
233385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Since it is a set, it does not contain duplicated items.
233485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // For example, if 2 currency plural patterns are the same, only one pattern
233585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // is included in the set. When parsing, we do not check whether the plural
233685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // count match or not.
233785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fAffixPatternsForCurrency;
233885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
233985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Following 2 are affixes for currency.
234085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is a hash map from plural count to AffixesForCurrency.
234185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // AffixesForCurrency saves the negative prefix,
234285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // negative suffix, positive prefix, and positive suffix of a pattern.
234385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is used during currency formatting only when the currency sign count
234485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // is 3. In which case, the affixes are getting from here, not
234585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // from the fNegativePrefix etc.
234685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fAffixesForCurrency;  // for current pattern
234785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fPluralAffixesForCurrency;  // for plural pattern
234885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
234985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Information needed for DecimalFormat to format/parse currency plural.
235085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    CurrencyPluralInfo* fCurrencyPluralInfo;
235185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2352103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_HAVE_PARSEALLINPUT
2353103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UNumberFormatAttributeValue fParseAllInput;
2354103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif
2355103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
235659d709d503bab6e2b61931737e662dd293b40578ccornelius    // Decimal Format Static Sets singleton.
235759d709d503bab6e2b61931737e662dd293b40578ccornelius    const DecimalFormatStaticSets *fStaticSets;
235859d709d503bab6e2b61931737e662dd293b40578ccornelius
2359103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected:
2361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
23628393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#ifndef U_HIDE_INTERNAL_API
23638393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    /**
23648393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * Rounds a value according to the rules of this object.
23658393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @internal
23668393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     */
23678393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const;
23688393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif  /* U_HIDE_INTERNAL_API */
23698393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius
2370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the currency in effect for this formatter.  Subclasses
2372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should override this method as needed.  Unlike getCurrency(),
2373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * this method should never return "".
2374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @result output parameter for null-terminated result, which must
2375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * have a capacity of at least 4
2376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
2377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
2379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
238050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  /** number of integer digits
2381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @stable ICU 2.4
238250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   */
2383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kDoubleIntegerDigits;
238450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  /** number of fraction digits
2385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @stable ICU 2.4
238650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   */
2387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kDoubleFractionDigits;
2388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When someone turns on scientific mode, we assume that more than this
2391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number of digits is due to flipping from some other mode that didn't
2392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * restrict the maximum, and so we force 1 integer digit.  We don't bother
2393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to track and see if someone is using exponential notation with more than
2394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * this number, it wouldn't make sense anyway, and this is just to make sure
2395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that someone turning on scientific mode with default settings doesn't
2396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * end up with lots of zeroes.
2397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.8
2398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kMaxScientificIntegerDigits;
2400103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2401103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_FORMAT_FASTPATHS_49
2402103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius private:
2403103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
2404fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Internal state.
2405103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @internal
2406103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
2407103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE];
2408103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2409103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2410103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
2411103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * Called whenever any state changes. Recomputes whether fastpath is OK to use.
2412103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
2413103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    void handleChanged();
2414103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif
2415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
2416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UnicodeString &
2418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
2419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    return fSymbols->getConstSymbol(symbol);
2420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
242154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
2422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
2423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */
2425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _DECIMFMT
2427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof
2428