1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************************
31b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert*   Copyright (C) 1997-2015, 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
8111b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * @stable 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
8201b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * @stable ICU 53
821fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     */
822fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    virtual void setParseIntegerOnly(UBool value);
823103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
824fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    /**
825fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Set a particular UDisplayContext value in the formatter, such as
826fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
827fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param value The UDisplayContext value to set.
828fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * @param status Input/output status. If at entry this indicates a failure
829fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     *               status, the function will do nothing; otherwise this will be
830fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     *               updated with any new status from the function.
8311b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert     * @stable ICU 53
832fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     */
833fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    virtual void setContext(UDisplayContext value, UErrorCode& status);
834103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
83585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and symbols.
837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Use this constructor when you need to completely customize the
838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * behavior of the format.
839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given
841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale, use the factory methods on NumberFormat such as
842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * createInstance or createCurrencyInstance. If you need only minor adjustments
843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to a standard format, you can modify the format returned by
844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a NumberFormat factory method.
845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern           a non-localized pattern string
847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbolsToAdopt    the set of symbols to be used.  The caller should not
848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          delete this object after making this call.
84950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError        Output param to receive errors occured during parsing
850ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status            Output param set to success/failure code. If the
851ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          pattern is invalid this will be set to a failure code.
852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
854ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(  const UnicodeString& pattern,
855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    DecimalFormatSymbols* symbolsToAdopt,
856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UParseError& parseError,
857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UErrorCode& status);
858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Create a DecimalFormat from the given pattern and symbols.
860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Use this constructor when you need to completely customize the
861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * behavior of the format.
862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * To obtain standard formats for a given
864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale, use the factory methods on NumberFormat such as
865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * createInstance or createCurrencyInstance. If you need only minor adjustments
866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to a standard format, you can modify the format returned by
867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a NumberFormat factory method.
868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern           a non-localized pattern string
870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbols   the set of symbols to be used
871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status            Output param set to success/failure code. If the
872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                          pattern is invalid this will be set to a failure code.
873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(  const UnicodeString& pattern,
876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    const DecimalFormatSymbols& symbols,
877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    UErrorCode& status);
878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Copy constructor.
88150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
882ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param source    the DecimalFormat object to be copied from.
883ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
885ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(const DecimalFormat& source);
886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Assignment operator.
889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param rhs    the DecimalFormat object to be copied.
891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
893ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat& operator=(const DecimalFormat& rhs);
894ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
895ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
896ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Destructor.
897ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
898ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
899ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ~DecimalFormat();
900ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
901ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
902ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Clone this Format object polymorphically. The caller owns the
903ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * result and should delete it when done.
904ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
905ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    a polymorphic copy of this DecimalFormat.
906ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
907ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual Format* clone(void) const;
909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
910ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
911ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return true if the given Format objects are semantically equal.
912ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Objects of different subclasses are considered unequal.
913ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
914ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param other    the object to be compared with.
915ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return         true if the given Format objects are semantically equal.
916ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
917ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
918ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UBool operator==(const Format& other) const;
919ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
92050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
92150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    using NumberFormat::format;
92250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
923ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
924ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format a double or long number using base-10 representation.
925ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
926ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
927ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
928ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
929ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
930ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
931ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
932ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
93350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
934ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(double number,
935ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
936ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
9377c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
93854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
93954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
94054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format a double or long number using base-10 representation.
94154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
94254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
94354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
94454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
94554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
94654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
94754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param status
94854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
94954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
95054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
95154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(double number,
95254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
95354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
95454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
95554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
95650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
95750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a double or long number using base-10 representation.
95850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
95950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
96050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
96150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
96250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
96350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
96450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
96550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
96650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
96727f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
96850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
9697c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(double number,
9707c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
97150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
97250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
9737c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
974ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
975ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format a long number using base-10 representation.
976ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
978ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
981ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
982ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
983ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
984ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
985ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(int32_t number,
986ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
987ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
9887c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
98950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
99050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a long number using base-10 representation.
99150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
99250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
99350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
99450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
99554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
99654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
99754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
99854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
99954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
100054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(int32_t number,
100154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
100254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
100354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
100454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
100554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
100654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format a long number using base-10 representation.
100754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
100854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
100954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
101054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
101150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
101250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
101350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
101450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
101550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
101627f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
101750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
10187c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(int32_t number,
10197c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
102050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
102150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
10227c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
1023ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1024ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Format an int64 number using base-10 representation.
1025ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1026ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param number    The value to be formatted.
1027ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo  Output parameter to receive result.
1028ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Result is appended to existing contents.
1029ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pos       On input: an alignment field, if desired.
1030ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  On output: the offsets of the alignment field.
1031ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          Reference to 'appendTo' parameter.
1032ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.8
1033ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1034ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& format(int64_t number,
1035ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  UnicodeString& appendTo,
1036ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                  FieldPosition& pos) const;
1037ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1038b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**
103950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format an int64 number using base-10 representation.
104050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
104150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The value to be formatted.
104250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
104350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
104454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param pos       On input: an alignment field, if desired.
104554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  On output: the offsets of the alignment field.
104654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @return          Reference to 'appendTo' parameter.
104754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @internal
104854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     */
104954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    virtual UnicodeString& format(int64_t number,
105054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UnicodeString& appendTo,
105154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  FieldPosition& pos,
105254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                                  UErrorCode &status) const;
105354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
105454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    /**
105554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * Format an int64 number using base-10 representation.
105654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *
105754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param number    The value to be formatted.
105854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     * @param appendTo  Output parameter to receive result.
105954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius     *                  Result is appended to existing contents.
106050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
106150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
106250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
106350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
106450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
106527f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
106650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
10677c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru    virtual UnicodeString& format(int64_t number,
10687c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  UnicodeString& appendTo,
106950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
107050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
107150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
107250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
107350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Format a decimal number.
107450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The syntax of the unformatted number is a "numeric string"
107550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * as defined in the Decimal Arithmetic Specification, available at
107650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * http://speleotrove.com/decimal
107750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
107850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The unformatted number, as a string.
107950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
108050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
108150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
108250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
108350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Can be NULL.
108450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
108550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
108627f654740f2a26ad62a5c155af9199af9e69b889claireho     * @stable 4.4
108750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
108850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const StringPiece &number,
108950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
109050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
109250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
109350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
109450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
1095fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Format a decimal number.
109650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The number is a DigitList wrapper onto a floating point decimal number.
109750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The default implementation in NumberFormat converts the decimal number
109850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * to a double and formats that.
109950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
110050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The number, a DigitList format Decimal Floating Point.
110150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
110250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
110350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param posIter   On return, can be used to iterate over positions
110450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  of fields generated by this format call.
110550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
110650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
110750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @internal
110850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
110950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const DigitList &number,
111050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
111150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  FieldPositionIterator* posIter,
111250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
111350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
111450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
1115fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Format a decimal number.
111650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The number is a DigitList wrapper onto a floating point decimal number.
111750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * The default implementation in NumberFormat converts the decimal number
1118fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * to a double and formats that.
111950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
112050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param number    The number, a DigitList format Decimal Floating Point.
112150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param appendTo  Output parameter to receive result.
112250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  Result is appended to existing contents.
112350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param pos       On input: an alignment field, if desired.
112450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *                  On output: the offsets of the alignment field.
112550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param status    Output param filled with success/failure status.
112650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @return          Reference to 'appendTo' parameter.
112750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @internal
112850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
112950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    virtual UnicodeString& format(const DigitList &number,
113050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UnicodeString& appendTo,
11317c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru                                  FieldPosition& pos,
113250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                                  UErrorCode& status) const;
113350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
113459d709d503bab6e2b61931737e662dd293b40578ccornelius   using NumberFormat::parse;
11357c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
1136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   /**
1137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * Parse the given string using this object's choices. The method
1138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * does string comparisons to try to find an optimal match.
1139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * If no object can be parsed, index is unchanged, and NULL is
1140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * returned.  The result is returned as the most parsimonious
1141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * type of Formattable that will accomodate all of the
1142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * necessary precision.  For example, if the result is exactly 12,
1143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * it will be returned as a long.  However, if it is 1.5, it will
1144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * be returned as a double.
1145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *
1146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param text           The text to be parsed.
1147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param result         Formattable to be set to the parse result.
1148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       If parse fails, return contents are undefined.
1149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @param parsePosition  The position to start parsing at on input.
1150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       On output, moved to after the last successfully
1151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    *                       parse character. On parse failure, does not change.
1152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @see Formattable
1153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    * @stable ICU 2.0
1154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    */
1155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void parse(const UnicodeString& text,
1156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                       Formattable& result,
1157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                       ParsePosition& parsePosition) const;
1158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Parses text from the given string as a currency amount.  Unlike
1161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the parse() method, this method will attempt to parse a generic
1162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency name, searching for a match of this object's locale's
1163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency display names, or for a 3-letter ISO currency code.
1164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method will fail if this format is not a currency format,
1165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that is, if it does not contain the currency pattern symbol
1166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (U+00A4) in its prefix or suffix.
1167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param text the string to parse
1169103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @param pos  input-output position; on input, the position within text
1170103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             to match; must have 0 <= pos.getIndex() < text.length();
1171103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             on output, the position after the last matched character.
1172103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             If the parse fails, the position in unchanged upon output.
1173103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
1174103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             object (owned by the caller) containing information about
1175103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     *             the parsed currency; if parse fails, this is NULL.
11768393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @stable ICU 49
1177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1178103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
1179103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius                                          ParsePosition& pos) const;
1180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the decimal format symbols, which is generally not changed
1183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return desired DecimalFormatSymbols
1185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols
1186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the decimal format symbols, which is generally not changed
1192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbolsToAdopt DecimalFormatSymbols to be adopted.
1194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the decimal format symbols, which is generally not changed
1200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by the programmer or user.
1201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param symbols DecimalFormatSymbols.
1202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
120850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Returns the currency plural format information,
120985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
121085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @return desired CurrencyPluralInfo
121150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
121285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
121385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
121485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
121585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
121650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Sets the currency plural format information,
121785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
121885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param toAdopt CurrencyPluralInfo to be adopted.
121950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
122085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
122185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
122285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
122385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
122450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Sets the currency plural format information,
122585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * which is generally not changed by the programmer or user.
122685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @param info Currency Plural Info.
122750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @stable ICU 4.2
122885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
122985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
123085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
123185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
123285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /**
1233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the positive prefix.
1234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the positive prefix.
1236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: +123, $123, sFr123
1238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getPositivePrefix(UnicodeString& result) const;
1241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the positive prefix.
1244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the the positive prefix to be set.
1246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: +123, $123, sFr123
1247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPositivePrefix(const UnicodeString& newValue);
1250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the negative prefix.
1253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the negative prefix.
1255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123, ($123) (with negative suffix), sFr-123
1257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getNegativePrefix(UnicodeString& result) const;
1260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the negative prefix.
1263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the the negative prefix to be set.
1265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123, ($123) (with negative suffix), sFr-123
1266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setNegativePrefix(const UnicodeString& newValue);
1269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the positive suffix.
1272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the positive suffix.
1274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: 123%
1276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the positive suffix.
1282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the positive suffix to be set.
1284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: 123%
1285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPositiveSuffix(const UnicodeString& newValue);
1288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the negative suffix.
1291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the negative suffix.
1293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: -123%, ($123) (with positive suffixes)
1295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the negative suffix.
1301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the negative suffix to be set.
1303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: 123%
1304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setNegativeSuffix(const UnicodeString& newValue);
1307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the multiplier for use in percent, permill, etc.
1310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (For Arabic, use arabic percent symbol).
1312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    the multiplier for use in percent, permill, etc.
1315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMultiplier(void) const;
1319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the multiplier for use in percent, permill, etc.
1322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
1323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (For Arabic, use arabic percent symbol).
1324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
1325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the multiplier for use in percent, permill, etc.
1327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
1328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMultiplier(int32_t newValue);
1331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the rounding increment.
133459d709d503bab6e2b61931737e662dd293b40578ccornelius     * @return A positive rounding increment, or 0.0 if a custom rounding
133527f654740f2a26ad62a5c155af9199af9e69b889claireho     * increment is not in effect.
1336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual double getRoundingIncrement(void) const;
1342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
134427f654740f2a26ad62a5c155af9199af9e69b889claireho     * Set the rounding increment.  In the absence of a rounding increment,
134527f654740f2a26ad62a5c155af9199af9e69b889claireho     *    numbers will be rounded to the number of digits displayed.
134659d709d503bab6e2b61931737e662dd293b40578ccornelius     * @param newValue A positive rounding increment, or 0.0 to
134759d709d503bab6e2b61931737e662dd293b40578ccornelius     * use the default rounding increment.
1348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Negative increments are equivalent to 0.0.
1349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setRoundingIncrement(double newValue);
1355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the rounding mode.
1358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return A rounding mode
1359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingMode
1362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual ERoundingMode getRoundingMode(void) const;
1365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1367fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Set the rounding mode.
1368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param roundingMode A rounding mode
1369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setRoundingIncrement
1370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingIncrement
1371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getRoundingMode
1372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setRoundingMode(ERoundingMode roundingMode);
1375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the width to which the output of format() is padded.
1378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The width is counted in 16-bit code units.
1379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the format width, or zero if no padding is in effect
1380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual int32_t getFormatWidth(void) const;
1388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the width to which the output of format() is padded.
1391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The width is counted in 16-bit code units.
1392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method also controls whether padding is enabled.
1393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param width the width to which to pad the result of
1394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * format(), or zero to disable padding.  A negative
1395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * width is equivalent to 0.
1396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setFormatWidth(int32_t width);
1404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the pad character used to pad to the format width.  The
1407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * default is ' '.
1408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return a string containing the pad character. This will always
1409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * have a length of one 32-bit code point.
1410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString getPadCharacterString() const;
1418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the character used to pad to the format width.  If padding
1421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is not enabled, then this will take effect if padding is later
1422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * enabled.
1423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param padChar a string containing the pad charcter. If the string
1424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * has length 0, then the pad characer is set to ' '.  Otherwise
1425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * padChar.char32At(0) will be used as the pad character.
1426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
1430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
1431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPadCharacter(const UnicodeString &padChar);
1434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get the position at which padding will take place.  This is the location
1437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * at which padding will be inserted if the result of format()
1438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is shorter than the format width.
1439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the pad position, one of kPadBeforePrefix,
1440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterPrefix, kPadBeforeSuffix, or
1441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterSuffix.
1442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadPosition
144785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @see #EPadPosition
1448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual EPadPosition getPadPosition(void) const;
1451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the position at which padding will take place.  This is the location
1454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * at which padding will be inserted if the result of format()
1455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is shorter than the format width.  This has no effect unless padding is
1456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * enabled.
1457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param padPos the pad position, one of kPadBeforePrefix,
1458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterPrefix, kPadBeforeSuffix, or
1459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * kPadAfterSuffix.
1460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setFormatWidth
1461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getFormatWidth
1462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setPadCharacter
1463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadCharacterString
1464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getPadPosition
146585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * @see #EPadPosition
1466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setPadPosition(EPadPosition padPos);
1469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return whether or not scientific notation is used.
1472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return TRUE if this object formats and parses scientific notation
1473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
148059d709d503bab6e2b61931737e662dd293b40578ccornelius    virtual UBool isScientificNotation(void) const;
1481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set whether or not scientific notation is used. When scientific notation
1484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is used, the effective maximum number of integer digits is <= 8.  If the
1485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * maximum number of integer digits is set to more than 8, the effective
1486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * maximum will be 1.  This allows this call to generate a 'default' scientific
1487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number format without additional changes.
1488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param useScientific TRUE if this object formats and parses scientific
1489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * notation
1490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setScientificNotation(UBool useScientific);
1498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the minimum exponent digits that will be shown.
1501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the minimum exponent digits that will be shown
1502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual int8_t getMinimumExponentDigits(void) const;
1510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the minimum exponent digits that will be shown.  This has no
1513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * effect unless scientific notation is in use.
1514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param minExpDig a value >= 1 indicating the fewest exponent digits
1515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that will be shown.  Values less than 1 will be treated as 1.
1516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumExponentDigits(int8_t minExpDig);
1524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return whether the exponent sign is always shown.
1527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return TRUE if the exponent is always prefixed with either the
1528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * localized minus sign or the localized plus sign, false if only negative
1529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * exponents are prefixed with the localized minus sign.
1530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setExponentSignAlwaysShown
1535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
153759d709d503bab6e2b61931737e662dd293b40578ccornelius    virtual UBool isExponentSignAlwaysShown(void) const;
1538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set whether the exponent sign is always shown.  This has no effect
1541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * unless scientific notation is in use.
1542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param expSignAlways TRUE if the exponent is always prefixed with either
1543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the localized minus sign or the localized plus sign, false if only
1544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * negative exponents are prefixed with the localized minus sign.
1545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setScientificNotation
1546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isScientificNotation
1547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #setMinimumExponentDigits
1548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #getMinimumExponentDigits
1549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see #isExponentSignAlwaysShown
1550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the grouping size. Grouping size is the number of digits between
1556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping separators in the integer portion of a number.  For example,
1557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * in the number "123,456.78", the grouping size is 3.
1558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    the grouping size.
1560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see setGroupingSize
1561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::isGroupingUsed
1562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::getGroupingSeparator
1563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getGroupingSize(void) const;
1566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the grouping size. Grouping size is the number of digits between
1569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping separators in the integer portion of a number.  For example,
1570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * in the number "123,456.78", the grouping size is 3.
1571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the grouping size.
1573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see getGroupingSize
1574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::setGroupingUsed
1575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::setGroupingSeparator
1576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setGroupingSize(int32_t newValue);
1579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the secondary grouping size. In some locales one
1582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping interval is used for the least significant integer
1583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * digits (the primary grouping size), and another is used for all
1584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * others (the secondary grouping size).  A formatter supporting a
1585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * secondary grouping size will return a positive integer unequal
1586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to the primary grouping size returned by
1587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * getGroupingSize().  For example, if the primary
1588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * grouping size is 4, and the secondary grouping size is 2, then
1589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the number 123456789 formats as "1,23,45,6789", and the pattern
1590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * appears as "#,##,###0".
1591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the secondary grouping size, or a value less than
1592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * one if there is none
1593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see setSecondaryGroupingSize
1594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat::isGroupingUsed
1595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::getGroupingSeparator
1596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
1597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getSecondaryGroupingSize(void) const;
1599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Set the secondary grouping size. If set to a value less than 1,
1602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * then secondary grouping is turned off, and the primary grouping
1603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * size is used for all intervals, not just the least significant.
1604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    the new value of the secondary grouping size.
1606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see getSecondaryGroupingSize
1607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setGroupingUsed
1608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see DecimalFormatSymbols::setGroupingSeparator
1609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.4
1610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setSecondaryGroupingSize(int32_t newValue);
1612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Allows you to get the behavior of the decimal separator with integers.
1615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (The decimal separator will always appear with decimals.)
1616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return    TRUE if the decimal separator always appear with decimals.
1618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isDecimalSeparatorAlwaysShown(void) const;
1622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Allows you to set the behavior of the decimal separator with integers.
1625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * (The decimal separator will always appear with decimals.)
1626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param newValue    set TRUE if the decimal separator will always appear with decimals.
1628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
1629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1633f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DRAFT_API
1634f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    /**
1635f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * Allows you to get the parse behavior of the pattern decimal mark.
1636f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     *
1637f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @return    TRUE if input must contain a match to decimal mark in pattern
1638f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @draft ICU 54
1639f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     */
1640f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    UBool isDecimalPatternMatchRequired(void) const;
1641f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DRAFT_API */
1642f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1643f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    /**
1644f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * Allows you to set the behavior of the pattern decimal mark.
1645f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     *
1646f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * if TRUE, the input must have a decimal mark if one was specified in the pattern. When
1647f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * FALSE the decimal mark may be omitted from the input.
1648f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     *
1649f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @param newValue    set TRUE if input must contain a match to decimal mark in pattern
1650f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @draft ICU 54
1651f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     */
1652f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    virtual void setDecimalPatternMatchRequired(UBool newValue);
1653f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1654f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Synthesizes a pattern string that represents the current state
1657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * of this Format object.
1658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the pattern.
1660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Previous contents are deleted.
1661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see applyPattern
1663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& toPattern(UnicodeString& result) const;
1666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Synthesizes a localized pattern string that represents the current
1669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * state of this Format object.
1670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result    Output param which will receive the localized pattern.
1672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  Previous contents are deleted.
1673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          A reference to 'result'.
1674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see applyPattern
1675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
167850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
1679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.  A pattern is a
1681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * short-hand specification for the various formatting properties.
1682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * These properties can also be changed individually through the
1683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * various setter methods.
1684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
1685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * There is no limit to integer digits are set
1686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this routine, since that is the typical end-user desire;
1687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * use setMaximumInteger if you want to set a real value.
1688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For negative numbers, use a second pattern, separated by a semicolon
1689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example "#,#00.0#" -> 1,234.56
1691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This means a minimum of 2 integer digits, 1 fraction digit, and
1693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a maximum of 2 fraction digits.
1694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
1696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * In negative patterns, the minimum and maximum counts are ignored;
1698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * these are presumed to be set in the positive pattern.
1699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern    The pattern to be applied.
170150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
1702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
1703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status     Output param set to success/failure code on
1704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   exit. If the pattern is invalid, this will be
1705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   set to a failure result.
1706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyPattern(const UnicodeString& pattern,
1709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UParseError& parseError,
1710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UErrorCode& status);
1711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the pattern.
1713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The pattern to be applied.
1714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
171850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
1719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyPattern(const UnicodeString& pattern,
1720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                             UErrorCode& status);
1721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.  The pattern
1724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is assumed to be in a localized notation. A pattern is a
1725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * short-hand specification for the various formatting properties.
1726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * These properties can also be changed individually through the
1727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * various setter methods.
1728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <P>
1729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * There is no limit to integer digits are set
1730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * by this routine, since that is the typical end-user desire;
1731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * use setMaximumInteger if you want to set a real value.
1732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * For negative numbers, use a second pattern, separated by a semicolon
1733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Example "#,#00.0#" -> 1,234.56
1735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This means a minimum of 2 integer digits, 1 fraction digit, and
1737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * a maximum of 2 fraction digits.
1738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
1740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * In negative patterns, the minimum and maximum counts are ignored;
1742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * these are presumed to be set in the positive pattern.
1743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The localized pattern to be applied.
174550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
1746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
1747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyLocalizedPattern(const UnicodeString& pattern,
1753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UParseError& parseError,
1754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UErrorCode& status);
1755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Apply the given pattern to this Format object.
1758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern   The localized pattern to be applied.
1760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status    Output param set to success/failure code on
1761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  exit. If the pattern is invalid, this will be
1762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  set to a failure result.
1763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void applyLocalizedPattern(const UnicodeString& pattern,
1766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                       UErrorCode& status);
1767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of digits allowed in the integer portion of a
1771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the integer digit count to 309.
1772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
177350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the maximum number of digits
1774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      allowed in the integer portion of a number.
1775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMaximumIntegerDigits
1776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMaximumIntegerDigits(int32_t newValue);
1779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of digits allowed in the integer portion of a
1782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the integer digit count to 309.
178350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *
178450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the minimum number of digits
1785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                      allowed in the integer portion of a number.
1786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMinimumIntegerDigits
1787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumIntegerDigits(int32_t newValue);
1790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of digits allowed in the fraction portion of a
1793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the fraction digit count to 340.
1794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
179550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the maximum number of digits
1796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                    allowed in the fraction portion of a number.
1797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMaximumFractionDigits
1798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMaximumFractionDigits(int32_t newValue);
1801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of digits allowed in the fraction portion of a
1804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number. This override limits the fraction digit count to 340.
1805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
180650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param newValue    the new value of the minimum number of digits
1807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                    allowed in the fraction portion of a number.
1808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @see NumberFormat#setMinimumFractionDigits
1809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setMinimumFractionDigits(int32_t newValue);
1812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the minimum number of significant digits that will be
1815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed. This value has no effect unless areSignificantDigitsUsed()
1816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
1817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the fewest significant digits that will be shown
1818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMinimumSignificantDigits() const;
1821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the maximum number of significant digits that will be
1824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed. This value has no effect unless areSignificantDigitsUsed()
1825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * returns true.
1826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return the most significant digits that will be shown
1827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1829ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t getMaximumSignificantDigits() const;
1830ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1831ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1832ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the minimum number of significant digits that will be
1833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed.  If <code>min</code> is less than one then it is set
1834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to one.  If the maximum significant digits count is less than
183559d709d503bab6e2b61931737e662dd293b40578ccornelius     * <code>min</code>, then it is set to <code>min</code>.
183659d709d503bab6e2b61931737e662dd293b40578ccornelius     * This function also enables the use of significant digits
183759d709d503bab6e2b61931737e662dd293b40578ccornelius     * by this formatter - areSignificantDigitsUsed() will return TRUE.
183859d709d503bab6e2b61931737e662dd293b40578ccornelius     * @see #areSignificantDigitsUsed
183950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param min the fewest significant digits to be shown
1840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setMinimumSignificantDigits(int32_t min);
1843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the maximum number of significant digits that will be
1846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * displayed.  If <code>max</code> is less than one then it is set
1847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to one.  If the minimum significant digits count is greater
1848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * than <code>max</code>, then it is set to <code>max</code>.
184959d709d503bab6e2b61931737e662dd293b40578ccornelius     * This function also enables the use of significant digits
185059d709d503bab6e2b61931737e662dd293b40578ccornelius     * by this formatter - areSignificantDigitsUsed() will return TRUE.
185159d709d503bab6e2b61931737e662dd293b40578ccornelius     * @see #areSignificantDigitsUsed
185250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param max the most significant digits to be shown
1853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1854ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setMaximumSignificantDigits(int32_t max);
1856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns true if significant digits are in use, or false if
1859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * integer and fraction digit counts are in use.
1860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return true if significant digits are in use
1861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool areSignificantDigitsUsed() const;
1864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets whether significant digits are in use, or integer and
1867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * fraction digit counts are in use.
1868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param useSignificantDigits true to use significant digits, or
1869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * false to use integer and fraction digit counts
1870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setSignificantDigitsUsed(UBool useSignificantDigits);
1873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public:
1875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the currency used to display currency
1877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * amounts.  This takes effect immediately, if this format is a
1878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency format.  If this format is not a currency format, then
1879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * the currency is used if and when this object becomes a
1880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * currency format through the application of a new pattern.
1881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param theCurrency a 3-letter ISO code indicating new currency
1882ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to use.  It need not be null-terminated.  May be the empty
1883ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * string or NULL to indicate no currency.
1884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param ec input-output error code
1885ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 3.0
1886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
1888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Sets the currency used to display currency amounts.  See
1891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * setCurrency(const UChar*, UErrorCode&).
1892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&).
1893ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1894ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void setCurrency(const UChar* theCurrency);
1895ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1896f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DRAFT_API
1897f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    /**
1898f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * Sets the <tt>Currency Context</tt> object used to display currency.
1899f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * This takes effect immediately, if this format is a
1900f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * currency format.
1901f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @param currencyContext new currency context object to use.
1902f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @draft ICU 54
1903f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     */
1904f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
1905f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1906f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    /**
1907f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * Returns the <tt>Currency Context</tt> object used to display currency
1908f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     * @draft ICU 54
1909f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius     */
1910f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    UCurrencyUsage getCurrencyUsage() const;
1911f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DRAFT_API */
1912f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1913f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
1914f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#ifndef U_HIDE_DEPRECATED_API
1915ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1916ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * The resource tags we use to retrieve decimal format data from
1917ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * locale resource bundles.
1918ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @deprecated ICU 3.4. This string has no public purpose. Please don't use it.
1919ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1920ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const char fgNumberPatterns[];
1921f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#endif  /* U_HIDE_DEPRECATED_API */
1922ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
192359d709d503bab6e2b61931737e662dd293b40578ccornelius#ifndef U_HIDE_INTERNAL_API
192459d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
192559d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a double as it would be
192659d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat.
192759d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
192859d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
192959d709d503bab6e2b61931737e662dd293b40578ccornelius     */
193059d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(double number, UErrorCode &status) const;
193159d709d503bab6e2b61931737e662dd293b40578ccornelius
193259d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
193359d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a formattable as it would be
193459d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat.
193559d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
193659d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
193759d709d503bab6e2b61931737e662dd293b40578ccornelius     */
193859d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const;
193959d709d503bab6e2b61931737e662dd293b40578ccornelius
194059d709d503bab6e2b61931737e662dd293b40578ccornelius    /**
194159d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Get a FixedDecimal corresponding to a DigitList as it would be
194259d709d503bab6e2b61931737e662dd293b40578ccornelius     *  formatted by this DecimalFormat. Note: the DigitList may be modified.
194359d709d503bab6e2b61931737e662dd293b40578ccornelius     *  Internal, not intended for public use.
194459d709d503bab6e2b61931737e662dd293b40578ccornelius     *  @internal
194559d709d503bab6e2b61931737e662dd293b40578ccornelius     */
194659d709d503bab6e2b61931737e662dd293b40578ccornelius     FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const;
194759d709d503bab6e2b61931737e662dd293b40578ccornelius#endif  /* U_HIDE_INTERNAL_API */
194859d709d503bab6e2b61931737e662dd293b40578ccornelius
1949ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic:
1950ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1951ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1952ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Return the class ID for this class.  This is useful only for
1953ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * comparing to a return value from getDynamicClassID().  For example:
1954ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * <pre>
1955ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      Base* polymorphic_pointer = createPolymorphicObject();
1956ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .      if (polymorphic_pointer->getDynamicClassID() ==
1957ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * .          Derived::getStaticClassID()) ...
1958ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * </pre>
1959ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for all objects of this class.
1960ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1961ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1962ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static UClassID U_EXPORT2 getStaticClassID(void);
1963ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1964ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1965ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a unique class ID POLYMORPHICALLY.  Pure virtual override.
1966ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * This method is to implement a simple version of RTTI, since not all
1967ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * C++ compilers support genuine RTTI.  Polymorphic operator==() and
1968ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * clone() methods call this method.
1969ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
1970ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return          The class ID for this object. All objects of a
1971ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  given class have the same class ID.  Objects of
1972ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                  other classes have different class IDs.
1973ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.0
1974ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
1975ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual UClassID getDynamicClassID(void) const;
1976ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate:
197885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
1979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormat(); // default constructor not implemented
1980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
198150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    int32_t precision() const;
198250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
198350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /**
198459d709d503bab6e2b61931737e662dd293b40578ccornelius     *   Initialize all fields of a new DecimalFormatter to a safe default value.
198550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     *      Common code for use by constructors.
198650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     */
198759d709d503bab6e2b61931737e662dd293b40578ccornelius    void init();
1988ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1989ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1990ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Do real work of constructing a new DecimalFormat.
1991ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
199259d709d503bab6e2b61931737e662dd293b40578ccornelius    void construct(UErrorCode&              status,
1993ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   UParseError&             parseErr,
1994ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   const UnicodeString*     pattern = 0,
1995ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   DecimalFormatSymbols*    symbolsToAdopt = 0
1996ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   );
1997ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
1998ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
1999ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Does the real work of generating a pattern.
2000ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
2001ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param result     Output param which will receive the pattern.
2002ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   Previous contents are deleted.
2003ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param localized  TRUE return localized pattern.
2004ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return           A reference to 'result'.
2005ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2006ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
2007ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2008ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2009ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Does the real work of applying a pattern.
2010ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param pattern    The pattern to be applied.
2011ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param localized  If true, the pattern is localized; else false.
201250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param parseError Struct to recieve information on position
2013ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   of error if an error is encountered
2014ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param status     Output param set to success/failure code on
2015ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   exit. If the pattern is invalid, this will be
2016ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                   set to a failure result.
2017ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2018ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void applyPattern(const UnicodeString& pattern,
2019ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UBool localized,
2020ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UParseError& parseError,
2021ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UErrorCode& status);
202285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
202350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    /*
202450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * similar to applyPattern, but without re-gen affix for currency
202585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
202685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void applyPatternInternally(const UnicodeString& pluralCount,
202785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                const UnicodeString& pattern,
202885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UBool localized,
202985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UParseError& parseError,
203085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                UErrorCode& status);
203185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
203285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
203385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * only apply pattern without expand affixes
203485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
203585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
203685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UBool localized,
203785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UParseError& parseError,
203885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                        UErrorCode& status);
203985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
204085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
204185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
204285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * expand affixes (after apply patter) and re-compute fFormatWidth
204385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
204485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void expandAffixAdjustWidth(const UnicodeString* pluralCount);
204585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
204650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2047ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2048ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Do the work of formatting a number, either a double or a long.
2049ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *
2050ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param appendTo       Output parameter to receive result.
2051ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     *                       Result is appended to existing contents.
205250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * @param handler        Records information about field positions.
2053ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param digits         the digits to be formatted.
2054ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @param isInteger      if TRUE format the digits as Integer.
2055ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @return               Reference to 'appendTo' parameter.
2056ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2057ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString& subformat(UnicodeString& appendTo,
205850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                             FieldPositionHandler& handler,
205950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                             DigitList&     digits,
2060fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius                             UBool          isInteger,
206154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                             UErrorCode &status) const;
20627c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
206385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2064ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void parse(const UnicodeString& text,
2065ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru               Formattable& result,
2066ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru               ParsePosition& pos,
2067103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius               UChar* currency) const;
2068ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2069ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    enum {
2070ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        fgStatusInfinite,
2071ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        fgStatusLength      // Leave last in list.
2072ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    } StatusFlags;
2073ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
207450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UBool subparse(const UnicodeString& text,
207585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* negPrefix,
207685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* negSuffix,
207785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* posPrefix,
207885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   const UnicodeString* posSuffix,
207959d709d503bab6e2b61931737e662dd293b40578ccornelius                   UBool complexCurrencyParsing,
208085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   int8_t type,
208185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                   ParsePosition& parsePosition,
2082ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   DigitList& digits, UBool* status,
2083ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                   UChar* currency) const;
2084ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
208585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Mixed style parsing for currency.
208650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // It parses against the current currency pattern
208785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // using complex affix comparison
208885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // parses against the currency plural patterns using complex affix comparison,
208985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and parses against the current pattern using simple affix comparison.
209050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UBool parseForCurrency(const UnicodeString& text,
209185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           ParsePosition& parsePosition,
209285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           DigitList& digits,
209385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           UBool* status,
209485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           UChar* currency) const;
209585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2096ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t skipPadding(const UnicodeString& text, int32_t position) const;
2097ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2098ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t compareAffix(const UnicodeString& input,
2099ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         int32_t pos,
2100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UBool isNegative,
2101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UBool isPrefix,
210285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                         const UnicodeString* affixPat,
210359d709d503bab6e2b61931737e662dd293b40578ccornelius                         UBool complexCurrencyParsing,
210485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                         int8_t type,
2105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                         UChar* currency) const;
210650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
210759d709d503bab6e2b61931737e662dd293b40578ccornelius    static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix);
210859d709d503bab6e2b61931737e662dd293b40578ccornelius
210959d709d503bab6e2b61931737e662dd293b40578ccornelius    UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const;
211059d709d503bab6e2b61931737e662dd293b40578ccornelius
211159d709d503bab6e2b61931737e662dd293b40578ccornelius    int32_t compareSimpleAffix(const UnicodeString& affix,
2112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                      const UnicodeString& input,
2113b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                                      int32_t pos,
211459d709d503bab6e2b61931737e662dd293b40578ccornelius                                      UBool lenient) const;
211550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2116b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
211750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
211950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
212059d709d503bab6e2b61931737e662dd293b40578ccornelius    static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos);
212159d709d503bab6e2b61931737e662dd293b40578ccornelius
212259d709d503bab6e2b61931737e662dd293b40578ccornelius    static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
212359d709d503bab6e2b61931737e662dd293b40578ccornelius
2124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t compareComplexAffix(const UnicodeString& affixPat,
2125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                const UnicodeString& input,
2126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                int32_t pos,
212785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                int8_t type,
2128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                                UChar* currency) const;
2129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
2131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
2133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2134b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
2135b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UnicodeSet *sset, UChar32 schar);
2136b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2137b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchDecimal(UChar32 symbolChar,
2138b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                            UBool sawDecimal,  UChar32 sawDecimalChar,
2139b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             const UnicodeSet *sset, UChar32 schar);
2140b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2141b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho    static UBool matchGrouping(UChar32 groupingChar,
2142b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                            UBool sawGrouping, UChar32 sawGroupingChar,
2143b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             const UnicodeSet *sset,
2144b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UChar32 decimalChar, const UnicodeSet *decimalSet,
2145b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho                             UChar32 schar);
2146b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho
2147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Get a decimal format symbol.
2149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns a const reference to the symbol string.
2150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
2151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
2153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
215450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    int32_t appendAffix(UnicodeString& buf,
215550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        double number,
215650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        FieldPositionHandler& handler,
215750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        UBool isNegative,
215850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                        UBool isPrefix) const;
215985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Append an affix to the given UnicodeString, using quotes if
2162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * there are special characters.  Single quotes themselves must be
2163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * escaped in either case.
2164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
216585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
2166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            UBool localized) const;
2167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void appendAffixPattern(UnicodeString& appendTo,
2169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            const UnicodeString* affixPattern,
2170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                            const UnicodeString& expAffix, UBool localized) const;
2171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void expandAffix(const UnicodeString& pattern,
2173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                     UnicodeString& affix,
2174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                     double number,
217550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                     FieldPositionHandler& handler,
217685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                     UBool doFormat,
217785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                     const UnicodeString* pluralCount) const;
21787c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru
217985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void expandAffixes(const UnicodeString* pluralCount);
2180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void addPadding(UnicodeString& appendTo,
218250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                    FieldPositionHandler& handler,
2183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru                    int32_t prefixLen, int32_t suffixLen) const;
2184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool isGroupingPosition(int32_t pos) const;
2186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    void setCurrencyForSymbols();
2188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
218985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // similar to setCurrency without re-compute the affixes for currency.
219085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // If currency changes, the affix pattern for currency is not changed,
219150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // but the affix will be changed. So, affixes need to be
219285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // re-computed in setCurrency(), but not in setCurrencyInternally().
219385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
219485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
219585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // set up currency affix patterns for mix parsing.
219685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // The patterns saved here are the affix patterns of default currency
219785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // pattern and the unique affix patterns of the plural currency patterns.
219885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Those patterns are used by parseForCurrency().
219985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void setupCurrencyAffixPatterns(UErrorCode& status);
220085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
220185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // set up the currency affixes used in currency plural formatting.
220285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It sets up both fAffixesForCurrency for currency pattern if the current
220350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // pattern contains 3 currency signs,
220485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and it sets up fPluralAffixesForCurrency for currency plural patterns.
220550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    void setupCurrencyAffixes(const UnicodeString& pattern,
220685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UBool setupForCurrentPattern,
220785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UBool setupForPluralPattern,
220885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                              UErrorCode& status);
2209f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
2210f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    // get the currency rounding with respect to currency usage
2211f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    double getCurrencyRounding(const UChar* currency,
2212f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius                               UErrorCode* ec) const;
2213f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
2214f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    // get the currency fraction with respect to currency usage
2215f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    int getCurrencyFractionDigits(const UChar* currency,
2216f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius                                  UErrorCode* ec) const;
221750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
221885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // hashtable operations
221985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* initHashForAffixPattern(UErrorCode& status);
222085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* initHashForAffix(UErrorCode& status);
222185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
222285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void deleteHashForAffixPattern();
222385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void deleteHashForAffix(Hashtable*& table);
222485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
222585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void copyHashForAffixPattern(const Hashtable* source,
222685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 Hashtable* target, UErrorCode& status);
222785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    void copyHashForAffix(const Hashtable* source,
222885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                          Hashtable* target, UErrorCode& status);
222985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
223050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(int64_t number,
223150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
223254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           FieldPositionHandler& handler,
223354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           UErrorCode &status) const;
223450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(double number,
223550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
223654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           FieldPositionHandler& handler,
223754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                           UErrorCode &status) const;
223850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    UnicodeString& _format(const DigitList &number,
223950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UnicodeString& appendTo,
224050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           FieldPositionHandler& handler,
224150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                           UErrorCode &status) const;
224250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
2243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Constants.
2245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fPositivePrefix;
2248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fPositiveSuffix;
2249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fNegativePrefix;
2250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString           fNegativeSuffix;
2251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fPosPrefixPattern;
2252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fPosSuffixPattern;
2253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fNegPrefixPattern;
2254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UnicodeString*          fNegSuffixPattern;
2255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Formatter for ChoiceFormat-based currency names.  If this field
2258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * is not null, then delegate to it to format currency symbols.
2259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @since ICU 2.6
2260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ChoiceFormat*           fCurrencyChoice;
2262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
226350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    DigitList *             fMultiplier;   // NULL for multiplier of one
2264fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius    int32_t                 fScale;
2265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fGroupingSize;
2266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fGroupingSize2;
2267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fDecimalSeparatorAlwaysShown;
2268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    DecimalFormatSymbols*   fSymbols;
2269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fUseSignificantDigits;
2271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fMinSignificantDigits;
2272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fMaxSignificantDigits;
2273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fUseExponentialNotation;
2275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int8_t                  fMinExponentDigits;
2276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UBool                   fExponentSignAlwaysShown;
2277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
227854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius    EnumSet<UNumberFormatAttribute,
2279fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius            UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
2280fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius            UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
228154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius                            fBoolFlags;
228254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
228350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    DigitList*              fRoundingIncrement;  // NULL if no rounding increment specified.
2284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    ERoundingMode           fRoundingMode;
2285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    UChar32                 fPad;
2287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    int32_t                 fFormatWidth;
2288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    EPadPosition            fPadPosition;
2289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
229085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
229185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Following are used for currency format
229285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
229385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // pattern used in this formatter
229485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    UnicodeString fFormatPattern;
229585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // style is only valid when decimal formatter is constructed by
229685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // DecimalFormat(pattern, decimalFormatSymbol, style)
229785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    int fStyle;
229885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /*
229985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * Represents whether this is a currency format, and which
230085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * currency format style.
230185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 0: not currency format type;
230285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 1: currency style -- symbol name, such as "$" for US dollar.
230385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 2: currency style -- ISO name, such as USD for US dollar.
230485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * 3: currency style -- plural long name, such as "US Dollar" for
230585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      "1.00 US Dollar", or "US Dollars" for
230685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     *                      "3.00 US Dollars".
230785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
230885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    int fCurrencySignCount;
230985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
231085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
231185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /* For currency parsing purose,
231250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * Need to remember all prefix patterns and suffix patterns of
231350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * every currency format pattern,
231485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * including the pattern of default currecny style
231585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * and plural currency style. And the patterns are set through applyPattern.
231685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
231785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // TODO: innerclass?
2318103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
231985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    struct AffixPatternsForCurrency : public UMemory {
232085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative prefix pattern
232185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negPrefixPatternForCurrency;
232285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative suffix pattern
232385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negSuffixPatternForCurrency;
232485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive prefix pattern
232585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posPrefixPatternForCurrency;
232685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive suffix pattern
232785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posSuffixPatternForCurrency;
232885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        int8_t patternType;
232950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
233050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho        AffixPatternsForCurrency(const UnicodeString& negPrefix,
233185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& negSuffix,
233285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& posPrefix,
233385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 const UnicodeString& posSuffix,
233485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                                 int8_t type) {
233585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negPrefixPatternForCurrency = negPrefix;
233685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negSuffixPatternForCurrency = negSuffix;
233785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posPrefixPatternForCurrency = posPrefix;
233885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posSuffixPatternForCurrency = posSuffix;
233985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            patternType = type;
234085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        }
234185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    };
234250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    */
234350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
234485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    /* affix for currency formatting when the currency sign in the pattern
234550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho     * equals to 3, such as the pattern contains 3 currency sign or
234685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     * the formatter style is currency plural format style.
234785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho     */
2348103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
234985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    struct AffixesForCurrency : public UMemory {
235085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative prefix
235185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negPrefixForCurrency;
235285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // negative suffix
235385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString negSuffixForCurrency;
235485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive prefix
235585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posPrefixForCurrency;
235685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        // positive suffix
235785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        UnicodeString posSuffixForCurrency;
235850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
235985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        int32_t formatWidth;
236085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
236185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        AffixesForCurrency(const UnicodeString& negPrefix,
236285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& negSuffix,
236385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& posPrefix,
236485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho                           const UnicodeString& posSuffix) {
236585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negPrefixForCurrency = negPrefix;
236685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            negSuffixForCurrency = negSuffix;
236785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posPrefixForCurrency = posPrefix;
236885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho            posSuffixForCurrency = posSuffix;
236985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho        }
237085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    };
237150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    */
237285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
237385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Affix pattern set for currency.
237485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is a set of AffixPatternsForCurrency,
237585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // each element of the set saves the negative prefix pattern,
237650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho    // negative suffix pattern, positive prefix pattern,
237785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and positive suffix  pattern of a pattern.
237885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is used for currency mixed style parsing.
237985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is actually is a set.
238085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // The set contains the default currency pattern from the locale,
238185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // and the currency plural patterns.
238285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Since it is a set, it does not contain duplicated items.
238385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // For example, if 2 currency plural patterns are the same, only one pattern
238485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // is included in the set. When parsing, we do not check whether the plural
238585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // count match or not.
238685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fAffixPatternsForCurrency;
238785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
238885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Following 2 are affixes for currency.
238985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is a hash map from plural count to AffixesForCurrency.
239085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // AffixesForCurrency saves the negative prefix,
239185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // negative suffix, positive prefix, and positive suffix of a pattern.
239285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // It is used during currency formatting only when the currency sign count
239385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // is 3. In which case, the affixes are getting from here, not
239485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // from the fNegativePrefix etc.
239585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fAffixesForCurrency;  // for current pattern
239685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    Hashtable* fPluralAffixesForCurrency;  // for plural pattern
239785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
239885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    // Information needed for DecimalFormat to format/parse currency plural.
239985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho    CurrencyPluralInfo* fCurrencyPluralInfo;
240085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho
2401103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_HAVE_PARSEALLINPUT
2402103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    UNumberFormatAttributeValue fParseAllInput;
2403103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif
2404103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
240559d709d503bab6e2b61931737e662dd293b40578ccornelius    // Decimal Format Static Sets singleton.
240659d709d503bab6e2b61931737e662dd293b40578ccornelius    const DecimalFormatStaticSets *fStaticSets;
2407f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
2408f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    // Currency Usage(STANDARD vs CASH)
2409f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius    UCurrencyUsage fCurrencyUsage;
2410103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected:
2412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
24138393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#ifndef U_HIDE_INTERNAL_API
24148393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    /**
24158393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * Rounds a value according to the rules of this object.
24168393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     * @internal
24178393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius     */
24188393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius    DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const;
24198393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif  /* U_HIDE_INTERNAL_API */
24208393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius
2421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * Returns the currency in effect for this formatter.  Subclasses
2423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * should override this method as needed.  Unlike getCurrency(),
2424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * this method should never return "".
2425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @result output parameter for null-terminated result, which must
2426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * have a capacity of at least 4
2427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @internal
2428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
2430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
243150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  /** number of integer digits
2432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @stable ICU 2.4
243350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   */
2434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kDoubleIntegerDigits;
243550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  /** number of fraction digits
2436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru   * @stable ICU 2.4
243750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   */
2438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kDoubleFractionDigits;
2439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    /**
2441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * When someone turns on scientific mode, we assume that more than this
2442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * number of digits is due to flipping from some other mode that didn't
2443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * restrict the maximum, and so we force 1 integer digit.  We don't bother
2444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * to track and see if someone is using exponential notation with more than
2445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * this number, it wouldn't make sense anyway, and this is just to make sure
2446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * that someone turning on scientific mode with default settings doesn't
2447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * end up with lots of zeroes.
2448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     * @stable ICU 2.8
2449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru     */
2450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    static const int32_t  kMaxScientificIntegerDigits;
2451103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2452103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_FORMAT_FASTPATHS_49
2453103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius private:
2454103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
2455fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius     * Internal state.
2456103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * @internal
2457103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
2458103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE];
2459103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2460103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
2461103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    /**
2462103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     * Called whenever any state changes. Recomputes whether fastpath is OK to use.
2463103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius     */
2464103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius    void handleChanged();
2465103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif
2466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru};
2467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UnicodeString &
2469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
2470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    return fSymbols->getConstSymbol(symbol);
2471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
247254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius
2473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
2474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */
2476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
2477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _DECIMFMT
2478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof
2479