1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 38393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius* Copyright (C) 1997-2013, 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 448393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#ifndef U_HIDE_INTERNAL_API 45103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius/** 4654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * \def UNUM_DECIMALFORMAT_INTERNAL_SIZE 47103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @internal 48103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 49103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_FORMAT_FASTPATHS_49 50103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16 51103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif 528393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif /* U_HIDE_INTERNAL_API */ 5385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass DigitList; 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass ChoiceFormat; 5885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass CurrencyPluralInfo; 5985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass Hashtable; 60b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2clairehoclass UnicodeSet; 6150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoclass FieldPositionHandler; 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, 6654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 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@\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¤\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 * 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 * "#,##,###" formats the number 123456789 as 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "12,34,56,789".</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 /** 681b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. 682103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @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(...) ) 7888393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @draft 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. 8018393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @draft ICU 51 80254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 80354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual int32_t getAttribute( UNumberFormatAttribute attr, 80454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 80554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 806103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 807103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 80885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and symbols. 810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Use this constructor when you need to completely customize the 811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behavior of the format. 812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given 814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale, use the factory methods on NumberFormat such as 815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance or createCurrencyInstance. If you need only minor adjustments 816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to a standard format, you can modify the format returned by 817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a NumberFormat factory method. 818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern a non-localized pattern string 820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbolsToAdopt the set of symbols to be used. The caller should not 821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delete this object after making this call. 82250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Output param to receive errors occured during parsing 823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat( const UnicodeString& pattern, 828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* symbolsToAdopt, 829ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 830ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 831ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 832ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and symbols. 833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Use this constructor when you need to completely customize the 834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behavior of the format. 835ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given 837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale, use the factory methods on NumberFormat such as 838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance or createCurrencyInstance. If you need only minor adjustments 839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to a standard format, you can modify the format returned by 840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a NumberFormat factory method. 841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern a non-localized pattern string 843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbols the set of symbols to be used 844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat( const UnicodeString& pattern, 849ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const DecimalFormatSymbols& symbols, 850ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 851ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Copy constructor. 85450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the DecimalFormat object to be copied from. 856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(const DecimalFormat& source); 859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Assignment operator. 862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param rhs the DecimalFormat object to be copied. 864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat& operator=(const DecimalFormat& rhs); 867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Destructor. 870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~DecimalFormat(); 873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Clone this Format object polymorphically. The caller owns the 876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * result and should delete it when done. 877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a polymorphic copy of this DecimalFormat. 879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual Format* clone(void) const; 882ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 883ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return true if the given Format objects are semantically equal. 885ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Objects of different subclasses are considered unequal. 886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param other the object to be compared with. 888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if the given Format objects are semantically equal. 889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool operator==(const Format& other) const; 892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 89350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 89450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho using NumberFormat::format; 89550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 896ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 897ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a double or long number using base-10 representation. 898ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 899ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 900ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 901ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 902ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 903ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 904ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 905ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 90650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 907ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(double number, 908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 9107c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 91154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 91254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius /** 91354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Format a double or long number using base-10 representation. 91454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 91554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param number The value to be formatted. 91654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param appendTo Output parameter to receive result. 91754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Result is appended to existing contents. 91854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param pos On input: an alignment field, if desired. 91954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * On output: the offsets of the alignment field. 92054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param status 92154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return Reference to 'appendTo' parameter. 92254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @internal 92354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 92454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual UnicodeString& format(double number, 92554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UnicodeString& appendTo, 92654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius FieldPosition& pos, 92754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 92854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 92950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 93050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a double or long number using base-10 representation. 93150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 93250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 93350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 93450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 93550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 93650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 93750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 93850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 93950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 94027f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 94150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 9427c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(double number, 9437c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 94450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 94550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 9467c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 947ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 948ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a long number using base-10 representation. 949ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 950ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 951ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 952ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 953ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 954ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 955ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 956ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 957ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 958ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(int32_t number, 959ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 960ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 9617c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 96250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 96350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a long number using base-10 representation. 96450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 96550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 96650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 96750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 96854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param pos On input: an alignment field, if desired. 96954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * On output: the offsets of the alignment field. 97054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return Reference to 'appendTo' parameter. 97154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @internal 97254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 97354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual UnicodeString& format(int32_t number, 97454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UnicodeString& appendTo, 97554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius FieldPosition& pos, 97654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 97754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 97854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius /** 97954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Format a long number using base-10 representation. 98054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 98154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param number The value to be formatted. 98254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param appendTo Output parameter to receive result. 98354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Result is appended to existing contents. 98450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 98550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 98650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 98750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 98850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 98927f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 99050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 9917c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(int32_t number, 9927c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 99350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 99450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 9957c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 996ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 997ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format an int64 number using base-10 representation. 998ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 999ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1000ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1001ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1002ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 1003ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 1004ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1005ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 1006ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1007ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(int64_t number, 1008ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 1009ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 1010ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1011b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 101250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format an int64 number using base-10 representation. 101350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 101450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 101550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 101650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 101754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param pos On input: an alignment field, if desired. 101854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * On output: the offsets of the alignment field. 101954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @return Reference to 'appendTo' parameter. 102054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @internal 102154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius */ 102254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius virtual UnicodeString& format(int64_t number, 102354dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UnicodeString& appendTo, 102454dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius FieldPosition& pos, 102554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 102654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 102754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius /** 102854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Format an int64 number using base-10 representation. 102954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * 103054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param number The value to be formatted. 103154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param appendTo Output parameter to receive result. 103254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * Result is appended to existing contents. 103350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 103450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 103550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 103650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 103750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 103827f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 103950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 10407c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(int64_t number, 10417c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 104250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 104350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 104450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 104550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 104650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 104750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The syntax of the unformatted number is a "numeric string" 104850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * as defined in the Decimal Arithmetic Specification, available at 104950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * http://speleotrove.com/decimal 105050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 105150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The unformatted number, as a string. 105250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 105350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 105450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 105550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 105650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 105750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 105850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 105927f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 106050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 106150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const StringPiece &number, 106250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 106350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 106450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 106550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 106650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 106750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 106850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 106950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The number is a DigitList wrapper onto a floating point decimal number. 107050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The default implementation in NumberFormat converts the decimal number 107150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to a double and formats that. 107250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 107350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The number, a DigitList format Decimal Floating Point. 107450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 107550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 107650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 107750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 107850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 107950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 108050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @internal 108150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 108250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const DigitList &number, 108350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 108450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 108550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 108650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 108750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 108850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 108950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The number is a DigitList wrapper onto a floating point decimal number. 109050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The default implementation in NumberFormat converts the decimal number 109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to a double and formats that. 109250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 109350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The number, a DigitList format Decimal Floating Point. 109450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 109550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 109650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pos On input: an alignment field, if desired. 109750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * On output: the offsets of the alignment field. 109850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 109950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 110050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @internal 110150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 110250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const DigitList &number, 110350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 11047c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru FieldPosition& pos, 110550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 110650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 11077c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 1108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a Formattable using base-10 representation. 1110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param obj The value to be formatted. 1112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 1115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 1116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Error code indicating success or failure. 1117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(const Formattable& obj, 1121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 1122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos, 1123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const; 1124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Formats an object to produce a string. 1128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param obj The object to format. 1130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output parameter filled in with success or failure status. 1133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(const Formattable& obj, 1137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 1138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const; 1139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a double number. 1143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(double number, 1151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a long number. These methods call the NumberFormat 1156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pure virtual format() methods with the default FieldPosition. 1157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(int32_t number, 1165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format an int64 number. These methods call the NumberFormat 1170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pure virtual format() methods with the default FieldPosition. 1171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 1177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(int64_t number, 1179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parse the given string using this object's choices. The method 1182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * does string comparisons to try to find an optimal match. 1183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If no object can be parsed, index is unchanged, and NULL is 1184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returned. The result is returned as the most parsimonious 1185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * type of Formattable that will accomodate all of the 1186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * necessary precision. For example, if the result is exactly 12, 1187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * it will be returned as a long. However, if it is 1.5, it will 1188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be returned as a double. 1189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The text to be parsed. 1191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Formattable to be set to the parse result. 1192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If parse fails, return contents are undefined. 1193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parsePosition The position to start parsing at on input. 1194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output, moved to after the last successfully 1195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parse character. On parse failure, does not change. 1196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see Formattable 1197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void parse(const UnicodeString& text, 1200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Formattable& result, 1201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ParsePosition& parsePosition) const; 1202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Declare here again to get rid of function hiding problems. 120450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 1205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parse the given string using this object's choices. 1206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The text to be parsed. 1208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Formattable to be set to the parse result. 1209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output parameter filled in with success or failure status. 1210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1212bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru virtual void parse(const UnicodeString& text, 1213bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru Formattable& result, 1214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status) const; 1215bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru 1216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parses text from the given string as a currency amount. Unlike 1218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the parse() method, this method will attempt to parse a generic 1219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency name, searching for a match of this object's locale's 1220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency display names, or for a 3-letter ISO currency code. 1221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method will fail if this format is not a currency format, 1222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that is, if it does not contain the currency pattern symbol 1223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (U+00A4) in its prefix or suffix. 1224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text the string to parse 1226103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @param pos input-output position; on input, the position within text 1227103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * to match; must have 0 <= pos.getIndex() < text.length(); 1228103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * on output, the position after the last matched character. 1229103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * If the parse fails, the position in unchanged upon output. 1230103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @return if parse succeeds, a pointer to a newly-created CurrencyAmount 1231103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * object (owned by the caller) containing information about 1232103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * the parsed currency; if parse fails, this is NULL. 12338393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @stable ICU 49 1234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1235103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius virtual CurrencyAmount* parseCurrency(const UnicodeString& text, 1236103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius ParsePosition& pos) const; 1237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the decimal format symbols, which is generally not changed 1240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return desired DecimalFormatSymbols 1242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols 1243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const; 1246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the decimal format symbols, which is generally not changed 1249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbolsToAdopt DecimalFormatSymbols to be adopted. 1251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt); 1254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the decimal format symbols, which is generally not changed 1257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbols DecimalFormatSymbols. 1259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols); 1262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 126550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Returns the currency plural format information, 126685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 126785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @return desired CurrencyPluralInfo 126850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 126985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 127085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const; 127185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 127285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 127350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Sets the currency plural format information, 127485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 127585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param toAdopt CurrencyPluralInfo to be adopted. 127650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 127785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 127885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt); 127985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 128085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 128150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Sets the currency plural format information, 128285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 128385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param info Currency Plural Info. 128450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 128585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 128685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); 128785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 128885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 128985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 1290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the positive prefix. 1291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the positive prefix. 1293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: +123, $123, sFr123 1295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getPositivePrefix(UnicodeString& result) const; 1298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the positive prefix. 1301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the the positive prefix to be set. 1303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: +123, $123, sFr123 1304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPositivePrefix(const UnicodeString& newValue); 1307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the negative prefix. 1310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the negative prefix. 1312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123, ($123) (with negative suffix), sFr-123 1314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getNegativePrefix(UnicodeString& result) const; 1317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the negative prefix. 1320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the the negative prefix to be set. 1322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123, ($123) (with negative suffix), sFr-123 1323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setNegativePrefix(const UnicodeString& newValue); 1326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the positive suffix. 1329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the positive suffix. 1331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: 123% 1333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getPositiveSuffix(UnicodeString& result) const; 1336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the positive suffix. 1339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the positive suffix to be set. 1341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: 123% 1342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPositiveSuffix(const UnicodeString& newValue); 1345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the negative suffix. 1348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the negative suffix. 1350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123%, ($123) (with positive suffixes) 1352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getNegativeSuffix(UnicodeString& result) const; 1355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the negative suffix. 1358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the negative suffix to be set. 1360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: 123% 1361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setNegativeSuffix(const UnicodeString& newValue); 1364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the multiplier for use in percent, permill, etc. 1367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a percentage, set the suffixes to have "%" and the multiplier to be 100. 1368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (For Arabic, use arabic percent symbol). 1369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. 1370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the multiplier for use in percent, permill, etc. 1372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 1373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMultiplier(void) const; 1376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the multiplier for use in percent, permill, etc. 1379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a percentage, set the suffixes to have "%" and the multiplier to be 100. 1380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (For Arabic, use arabic percent symbol). 1381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. 1382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the multiplier for use in percent, permill, etc. 1384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 1385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMultiplier(int32_t newValue); 1388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the rounding increment. 139127f654740f2a26ad62a5c155af9199af9e69b889claireho * @return A positive rounding increment, or 0.0 if a rounding 139227f654740f2a26ad62a5c155af9199af9e69b889claireho * increment is not in effect. 1393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual double getRoundingIncrement(void) const; 1399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 140127f654740f2a26ad62a5c155af9199af9e69b889claireho * Set the rounding increment. In the absence of a rounding increment, 140227f654740f2a26ad62a5c155af9199af9e69b889claireho * numbers will be rounded to the number of digits displayed. 140327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param newValue A positive rounding increment. 1404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Negative increments are equivalent to 0.0. 1405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setRoundingIncrement(double newValue); 1411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the rounding mode. 1414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A rounding mode 1415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ERoundingMode getRoundingMode(void) const; 1421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 142327f654740f2a26ad62a5c155af9199af9e69b889claireho * Set the rounding mode. 1424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param roundingMode A rounding mode 1425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setRoundingMode(ERoundingMode roundingMode); 1431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the width to which the output of format() is padded. 1434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The width is counted in 16-bit code units. 1435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the format width, or zero if no padding is in effect 1436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t getFormatWidth(void) const; 1444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the width to which the output of format() is padded. 1447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The width is counted in 16-bit code units. 1448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method also controls whether padding is enabled. 1449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param width the width to which to pad the result of 1450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * format(), or zero to disable padding. A negative 1451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * width is equivalent to 0. 1452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setFormatWidth(int32_t width); 1460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the pad character used to pad to the format width. The 1463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default is ' '. 1464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a string containing the pad character. This will always 1465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * have a length of one 32-bit code point. 1466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString getPadCharacterString() const; 1474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the character used to pad to the format width. If padding 1477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is not enabled, then this will take effect if padding is later 1478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * enabled. 1479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param padChar a string containing the pad charcter. If the string 1480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * has length 0, then the pad characer is set to ' '. Otherwise 1481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padChar.char32At(0) will be used as the pad character. 1482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPadCharacter(const UnicodeString &padChar); 1490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the position at which padding will take place. This is the location 1493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at which padding will be inserted if the result of format() 1494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is shorter than the format width. 1495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pad position, one of kPadBeforePrefix, 1496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterPrefix, kPadBeforeSuffix, or 1497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterSuffix. 1498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 150385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see #EPadPosition 1504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual EPadPosition getPadPosition(void) const; 1507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the position at which padding will take place. This is the location 1510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at which padding will be inserted if the result of format() 1511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is shorter than the format width. This has no effect unless padding is 1512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * enabled. 1513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param padPos the pad position, one of kPadBeforePrefix, 1514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterPrefix, kPadBeforeSuffix, or 1515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterSuffix. 1516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 152185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see #EPadPosition 1522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPadPosition(EPadPosition padPos); 1525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return whether or not scientific notation is used. 1528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if this object formats and parses scientific notation 1529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool isScientificNotation(void); 1537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set whether or not scientific notation is used. When scientific notation 1540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is used, the effective maximum number of integer digits is <= 8. If the 1541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum number of integer digits is set to more than 8, the effective 1542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum will be 1. This allows this call to generate a 'default' scientific 1543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number format without additional changes. 1544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useScientific TRUE if this object formats and parses scientific 1545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation 1546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setScientificNotation(UBool useScientific); 1554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the minimum exponent digits that will be shown. 1557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the minimum exponent digits that will be shown 1558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int8_t getMinimumExponentDigits(void) const; 1566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the minimum exponent digits that will be shown. This has no 1569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * effect unless scientific notation is in use. 1570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param minExpDig a value >= 1 indicating the fewest exponent digits 1571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that will be shown. Values less than 1 will be treated as 1. 1572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumExponentDigits(int8_t minExpDig); 1580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return whether the exponent sign is always shown. 1583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if the exponent is always prefixed with either the 1584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * localized minus sign or the localized plus sign, false if only negative 1585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponents are prefixed with the localized minus sign. 1586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool isExponentSignAlwaysShown(void); 1594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set whether the exponent sign is always shown. This has no effect 1597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unless scientific notation is in use. 1598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param expSignAlways TRUE if the exponent is always prefixed with either 1599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the localized minus sign or the localized plus sign, false if only 1600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * negative exponents are prefixed with the localized minus sign. 1601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setExponentSignAlwaysShown(UBool expSignAlways); 1609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the grouping size. Grouping size is the number of digits between 1612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping separators in the integer portion of a number. For example, 1613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in the number "123,456.78", the grouping size is 3. 1614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the grouping size. 1616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see setGroupingSize 1617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::isGroupingUsed 1618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::getGroupingSeparator 1619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getGroupingSize(void) const; 1622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1623ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the grouping size. Grouping size is the number of digits between 1625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping separators in the integer portion of a number. For example, 1626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in the number "123,456.78", the grouping size is 3. 1627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the grouping size. 1629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getGroupingSize 1630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::setGroupingUsed 1631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::setGroupingSeparator 1632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setGroupingSize(int32_t newValue); 1635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the secondary grouping size. In some locales one 1638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping interval is used for the least significant integer 1639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits (the primary grouping size), and another is used for all 1640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * others (the secondary grouping size). A formatter supporting a 1641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * secondary grouping size will return a positive integer unequal 1642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to the primary grouping size returned by 1643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * getGroupingSize(). For example, if the primary 1644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping size is 4, and the secondary grouping size is 2, then 1645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the number 123456789 formats as "1,23,45,6789", and the pattern 1646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * appears as "#,##,###0". 1647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the secondary grouping size, or a value less than 1648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * one if there is none 1649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see setSecondaryGroupingSize 1650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::isGroupingUsed 1651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::getGroupingSeparator 1652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 1653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getSecondaryGroupingSize(void) const; 1655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the secondary grouping size. If set to a value less than 1, 1658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then secondary grouping is turned off, and the primary grouping 1659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * size is used for all intervals, not just the least significant. 1660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the secondary grouping size. 1662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getSecondaryGroupingSize 1663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setGroupingUsed 1664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::setGroupingSeparator 1665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 1666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setSecondaryGroupingSize(int32_t newValue); 1668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Allows you to get the behavior of the decimal separator with integers. 1671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (The decimal separator will always appear with decimals.) 1672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if the decimal separator always appear with decimals. 1674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 1675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isDecimalSeparatorAlwaysShown(void) const; 1678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Allows you to set the behavior of the decimal separator with integers. 1681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (The decimal separator will always appear with decimals.) 1682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue set TRUE if the decimal separator will always appear with decimals. 1684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 1685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setDecimalSeparatorAlwaysShown(UBool newValue); 1688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Synthesizes a pattern string that represents the current state 1691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of this Format object. 1692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the pattern. 1694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see applyPattern 1697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& toPattern(UnicodeString& result) const; 1700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Synthesizes a localized pattern string that represents the current 1703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * state of this Format object. 1704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the localized pattern. 1706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see applyPattern 1709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const; 171250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. A pattern is a 1715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * short-hand specification for the various formatting properties. 1716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * These properties can also be changed individually through the 1717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * various setter methods. 1718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 1719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * There is no limit to integer digits are set 1720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by this routine, since that is the typical end-user desire; 1721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use setMaximumInteger if you want to set a real value. 1722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For negative numbers, use a second pattern, separated by a semicolon 1723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example "#,#00.0#" -> 1,234.56 1725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This means a minimum of 2 integer digits, 1 fraction digit, and 1727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of 2 fraction digits. 1728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses. 1730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In negative patterns, the minimum and maximum counts are ignored; 1732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * these are presumed to be set in the positive pattern. 1733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 173550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyPattern(const UnicodeString& pattern, 1743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 1744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the pattern. 1747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 1748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 175250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 1753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyPattern(const UnicodeString& pattern, 1754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. The pattern 1758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is assumed to be in a localized notation. A pattern is a 1759ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * short-hand specification for the various formatting properties. 1760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * These properties can also be changed individually through the 1761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * various setter methods. 1762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 1763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * There is no limit to integer digits are set 1764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by this routine, since that is the typical end-user desire; 1765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use setMaximumInteger if you want to set a real value. 1766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For negative numbers, use a second pattern, separated by a semicolon 1767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example "#,#00.0#" -> 1,234.56 1769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This means a minimum of 2 integer digits, 1 fraction digit, and 1771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of 2 fraction digits. 1772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses. 1774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In negative patterns, the minimum and maximum counts are ignored; 1776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * these are presumed to be set in the positive pattern. 1777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The localized pattern to be applied. 177950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyLocalizedPattern(const UnicodeString& pattern, 1787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 1788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. 1792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The localized pattern to be applied. 1794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyLocalizedPattern(const UnicodeString& pattern, 1800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of digits allowed in the integer portion of a 1805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the integer digit count to 309. 1806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 180750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the maximum number of digits 1808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the integer portion of a number. 1809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMaximumIntegerDigits 1810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMaximumIntegerDigits(int32_t newValue); 1813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of digits allowed in the integer portion of a 1816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the integer digit count to 309. 181750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 181850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the minimum number of digits 1819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the integer portion of a number. 1820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMinimumIntegerDigits 1821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumIntegerDigits(int32_t newValue); 1824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of digits allowed in the fraction portion of a 1827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the fraction digit count to 340. 1828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 182950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the maximum number of digits 1830ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the fraction portion of a number. 1831ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMaximumFractionDigits 1832ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMaximumFractionDigits(int32_t newValue); 1835ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of digits allowed in the fraction portion of a 1838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the fraction digit count to 340. 1839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 184050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the minimum number of digits 1841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the fraction portion of a number. 1842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMinimumFractionDigits 1843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumFractionDigits(int32_t newValue); 1846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the minimum number of significant digits that will be 1849ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. This value has no effect unless areSignificantDigitsUsed() 1850ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns true. 1851ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the fewest significant digits that will be shown 1852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1854ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMinimumSignificantDigits() const; 1855ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1856ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1857ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the maximum number of significant digits that will be 1858ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. This value has no effect unless areSignificantDigitsUsed() 1859ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns true. 1860ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the most significant digits that will be shown 1861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMaximumSignificantDigits() const; 1864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of significant digits that will be 1867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. If <code>min</code> is less than one then it is set 1868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to one. If the maximum significant digits count is less than 1869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>min</code>, then it is set to <code>min</code>. This 1870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value has no effect unless areSignificantDigits() returns true. 187150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param min the fewest significant digits to be shown 1872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setMinimumSignificantDigits(int32_t min); 1875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of significant digits that will be 1878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. If <code>max</code> is less than one then it is set 1879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to one. If the minimum significant digits count is greater 1880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * than <code>max</code>, then it is set to <code>max</code>. 1881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This value has no effect unless areSignificantDigits() returns 1882ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * true. 188350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param max the most significant digits to be shown 1884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1885ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setMaximumSignificantDigits(int32_t max); 1887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns true if significant digits are in use, or false if 1890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer and fraction digit counts are in use. 1891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if significant digits are in use 1892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1893ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1894ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool areSignificantDigitsUsed() const; 1895ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1896ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1897ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets whether significant digits are in use, or integer and 1898ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction digit counts are in use. 1899ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useSignificantDigits true to use significant digits, or 1900ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * false to use integer and fraction digit counts 1901ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1902ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1903ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setSignificantDigitsUsed(UBool useSignificantDigits); 1904ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1905ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 1906ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1907ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the currency used to display currency 1908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * amounts. This takes effect immediately, if this format is a 1909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency format. If this format is not a currency format, then 1910ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the currency is used if and when this object becomes a 1911ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency format through the application of a new pattern. 1912ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param theCurrency a 3-letter ISO code indicating new currency 1913ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to use. It need not be null-terminated. May be the empty 1914ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * string or NULL to indicate no currency. 1915ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ec input-output error code 1916ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1917ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1918ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); 1919ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1920ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1921ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the currency used to display currency amounts. See 1922ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * setCurrency(const UChar*, UErrorCode&). 1923ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&). 1924ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1925ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setCurrency(const UChar* theCurrency); 1926ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1927ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1928ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The resource tags we use to retrieve decimal format data from 1929ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale resource bundles. 1930ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 3.4. This string has no public purpose. Please don't use it. 1931ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1932ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgNumberPatterns[]; 1933ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1934ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 1935ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1936ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1937ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the class ID for this class. This is useful only for 1938ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * comparing to a return value from getDynamicClassID(). For example: 1939ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1940ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Base* polymorphic_pointer = createPolymorphicObject(); 1941ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . if (polymorphic_pointer->getDynamicClassID() == 1942ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Derived::getStaticClassID()) ... 1943ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1944ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for all objects of this class. 1945ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1946ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1947ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(void); 1948ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1949ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1950ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. 1951ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method is to implement a simple version of RTTI, since not all 1952ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * C++ compilers support genuine RTTI. Polymorphic operator==() and 1953ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * clone() methods call this method. 1954ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1955ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for this object. All objects of a 1956ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * given class have the same class ID. Objects of 1957ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * other classes have different class IDs. 1958ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1959ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1960ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID(void) const; 1961ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1962ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 196385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 1964ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(); // default constructor not implemented 1965ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 196650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t precision() const; 196750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 196850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 196950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Initialize all fields of a new DecimalFormatter. 197050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Common code for use by constructors. 197150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 1972103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius void init(UErrorCode& status); 1973ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1974ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1975ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Do real work of constructing a new DecimalFormat. 1976ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void construct(UErrorCode& status, 1978ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseErr, 1979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString* pattern = 0, 1980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* symbolsToAdopt = 0 1981ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ); 1982ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1983ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1984ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Does the real work of generating a pattern. 1985ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1986ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the pattern. 1987ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1988ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param localized TRUE return localized pattern. 1989ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1990ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1991ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& toPattern(UnicodeString& result, UBool localized) const; 1992ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1993ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1994ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Does the real work of applying a pattern. 1995ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 1996ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param localized If true, the pattern is localized; else false. 199750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1998ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1999ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 2000ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 2001ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 2002ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2003ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void applyPattern(const UnicodeString& pattern, 2004ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool localized, 2005ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 2006ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 200785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 200850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /* 200950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * similar to applyPattern, but without re-gen affix for currency 201085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 201185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void applyPatternInternally(const UnicodeString& pluralCount, 201285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& pattern, 201385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool localized, 201485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UParseError& parseError, 201585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 201685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 201785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 201885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * only apply pattern without expand affixes 201985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 202085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void applyPatternWithoutExpandAffix(const UnicodeString& pattern, 202185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool localized, 202285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UParseError& parseError, 202385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 202485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 202585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 202685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 202785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * expand affixes (after apply patter) and re-compute fFormatWidth 202885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 202985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void expandAffixAdjustWidth(const UnicodeString* pluralCount); 203085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 203150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 2032ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2033ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Do the work of formatting a number, either a double or a long. 2034ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 2035ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 2036ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 203750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param handler Records information about field positions. 2038ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param digits the digits to be formatted. 2039ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param isInteger if TRUE format the digits as Integer. 2040ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 2041ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2042ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& subformat(UnicodeString& appendTo, 204350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 204450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList& digits, 204554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UBool isInteger, 204654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 20477c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 204885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2049ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void parse(const UnicodeString& text, 2050ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Formattable& result, 2051ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ParsePosition& pos, 2052103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius UChar* currency) const; 2053ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2054ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum { 2055ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fgStatusInfinite, 2056ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fgStatusLength // Leave last in list. 2057ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } StatusFlags; 2058ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 205950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool subparse(const UnicodeString& text, 206085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* negPrefix, 206185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* negSuffix, 206285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* posPrefix, 206385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* posSuffix, 206485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool currencyParsing, 206585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 206685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho ParsePosition& parsePosition, 2067ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DigitList& digits, UBool* status, 2068ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 2069ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 207085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Mixed style parsing for currency. 207150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // It parses against the current currency pattern 207285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // using complex affix comparison 207385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // parses against the currency plural patterns using complex affix comparison, 207485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and parses against the current pattern using simple affix comparison. 207550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool parseForCurrency(const UnicodeString& text, 207685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho ParsePosition& parsePosition, 207785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho DigitList& digits, 207885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool* status, 207985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UChar* currency) const; 208085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2081ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t skipPadding(const UnicodeString& text, int32_t position) const; 2082ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2083ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t compareAffix(const UnicodeString& input, 2084ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t pos, 2085ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isNegative, 2086ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isPrefix, 208785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* affixPat, 208885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool currencyParsing, 208985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 2090ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 209150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 2092ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t compareSimpleAffix(const UnicodeString& affix, 2093ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& input, 2094b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho int32_t pos, 2095b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UBool lenient); 209650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 2097b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos); 209850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 2099ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); 210050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 2101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t compareComplexAffix(const UnicodeString& affixPat, 2102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& input, 2103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t pos, 210485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 2105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 2106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch); 2108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str); 2110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2111b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol, 2112b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UnicodeSet *sset, UChar32 schar); 2113b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 2114b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static UBool matchDecimal(UChar32 symbolChar, 2115b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UBool sawDecimal, UChar32 sawDecimalChar, 2116b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho const UnicodeSet *sset, UChar32 schar); 2117b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 2118b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho static UBool matchGrouping(UChar32 groupingChar, 2119b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UBool sawGrouping, UChar32 sawGroupingChar, 2120b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho const UnicodeSet *sset, 2121b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UChar32 decimalChar, const UnicodeSet *decimalSet, 2122b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho UChar32 schar); 2123b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho 2124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get a decimal format symbol. 2126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns a const reference to the symbol string. 2127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 2128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const; 2130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 213150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t appendAffix(UnicodeString& buf, 213250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho double number, 213350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 213450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool isNegative, 213550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool isPrefix) const; 213685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Append an affix to the given UnicodeString, using quotes if 2139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * there are special characters. Single quotes themselves must be 2140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * escaped in either case. 2141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 214285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix, 2143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool localized) const; 2144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void appendAffixPattern(UnicodeString& appendTo, 2146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString* affixPattern, 2147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& expAffix, UBool localized) const; 2148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void expandAffix(const UnicodeString& pattern, 2150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& affix, 2151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru double number, 215250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 215385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool doFormat, 215485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* pluralCount) const; 21557c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 215685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void expandAffixes(const UnicodeString* pluralCount); 2157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void addPadding(UnicodeString& appendTo, 215950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 2160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t prefixLen, int32_t suffixLen) const; 2161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isGroupingPosition(int32_t pos) const; 2163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setCurrencyForSymbols(); 2165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 216685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // similar to setCurrency without re-compute the affixes for currency. 216785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // If currency changes, the affix pattern for currency is not changed, 216850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // but the affix will be changed. So, affixes need to be 216985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // re-computed in setCurrency(), but not in setCurrencyInternally(). 217085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec); 217185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 217285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // set up currency affix patterns for mix parsing. 217385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // The patterns saved here are the affix patterns of default currency 217485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // pattern and the unique affix patterns of the plural currency patterns. 217585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Those patterns are used by parseForCurrency(). 217685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void setupCurrencyAffixPatterns(UErrorCode& status); 217785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 217885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // set up the currency affixes used in currency plural formatting. 217985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It sets up both fAffixesForCurrency for currency pattern if the current 218050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // pattern contains 3 currency signs, 218185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and it sets up fPluralAffixesForCurrency for currency plural patterns. 218250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho void setupCurrencyAffixes(const UnicodeString& pattern, 218385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool setupForCurrentPattern, 218485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool setupForPluralPattern, 218585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 218650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 218785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // hashtable operations 218885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* initHashForAffixPattern(UErrorCode& status); 218985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* initHashForAffix(UErrorCode& status); 219085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 219185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void deleteHashForAffixPattern(); 219285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void deleteHashForAffix(Hashtable*& table); 219385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 219485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void copyHashForAffixPattern(const Hashtable* source, 219585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* target, UErrorCode& status); 219685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void copyHashForAffix(const Hashtable* source, 219785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* target, UErrorCode& status); 219885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 219950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(int64_t number, 220050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 220154dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius FieldPositionHandler& handler, 220254dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 220350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(double number, 220450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 220554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius FieldPositionHandler& handler, 220654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UErrorCode &status) const; 220750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(const DigitList &number, 220850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 220950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 221050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode &status) const; 221150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 221285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // currency sign count 221385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho enum { 221485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountZero, 221585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInSymbolFormat, 221685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInISOFormat, 221785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInPluralFormat 221885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } CurrencySignCount; 221985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constants. 2222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fPositivePrefix; 2225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fPositiveSuffix; 2226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fNegativePrefix; 2227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fNegativeSuffix; 2228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fPosPrefixPattern; 2229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fPosSuffixPattern; 2230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fNegPrefixPattern; 2231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fNegSuffixPattern; 2232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Formatter for ChoiceFormat-based currency names. If this field 2235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is not null, then delegate to it to format currency symbols. 2236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @since ICU 2.6 2237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ChoiceFormat* fCurrencyChoice; 2239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 224050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList * fMultiplier; // NULL for multiplier of one 22418393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius int32_t fScale; 2242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGroupingSize; 2243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGroupingSize2; 2244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fDecimalSeparatorAlwaysShown; 2245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* fSymbols; 2246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fUseSignificantDigits; 2248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fMinSignificantDigits; 2249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fMaxSignificantDigits; 2250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fUseExponentialNotation; 2252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int8_t fMinExponentDigits; 2253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fExponentSignAlwaysShown; 2254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 225554dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius EnumSet<UNumberFormatAttribute, 225654dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1, 225754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius UNUM_LIMIT_BOOLEAN_ATTRIBUTE> 225854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius fBoolFlags; 225954dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 226050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList* fRoundingIncrement; // NULL if no rounding increment specified. 2261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ERoundingMode fRoundingMode; 2262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar32 fPad; 2264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fFormatWidth; 2265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru EPadPosition fPadPosition; 2266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 226785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 226885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Following are used for currency format 226985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 227085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // pattern used in this formatter 227185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString fFormatPattern; 227285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // style is only valid when decimal formatter is constructed by 227385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // DecimalFormat(pattern, decimalFormatSymbol, style) 227485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int fStyle; 227585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 227685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Represents whether this is a currency format, and which 227785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * currency format style. 227885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 0: not currency format type; 227985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 1: currency style -- symbol name, such as "$" for US dollar. 228085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 2: currency style -- ISO name, such as USD for US dollar. 228185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 3: currency style -- plural long name, such as "US Dollar" for 228285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "1.00 US Dollar", or "US Dollars" for 228385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "3.00 US Dollars". 228485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 228585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int fCurrencySignCount; 228685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 228785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 228885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* For currency parsing purose, 228950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Need to remember all prefix patterns and suffix patterns of 229050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * every currency format pattern, 229185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * including the pattern of default currecny style 229285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * and plural currency style. And the patterns are set through applyPattern. 229385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 229485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // TODO: innerclass? 2295103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 229685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho struct AffixPatternsForCurrency : public UMemory { 229785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative prefix pattern 229885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negPrefixPatternForCurrency; 229985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix pattern 230085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negSuffixPatternForCurrency; 230185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive prefix pattern 230285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posPrefixPatternForCurrency; 230385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive suffix pattern 230485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posSuffixPatternForCurrency; 230585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t patternType; 230650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 230750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho AffixPatternsForCurrency(const UnicodeString& negPrefix, 230885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& negSuffix, 230985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posPrefix, 231085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posSuffix, 231185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type) { 231285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negPrefixPatternForCurrency = negPrefix; 231385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negSuffixPatternForCurrency = negSuffix; 231485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posPrefixPatternForCurrency = posPrefix; 231585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posSuffixPatternForCurrency = posSuffix; 231685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho patternType = type; 231785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 231885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho }; 231950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 232050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 232185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* affix for currency formatting when the currency sign in the pattern 232250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * equals to 3, such as the pattern contains 3 currency sign or 232385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * the formatter style is currency plural format style. 232485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 2325103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 232685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho struct AffixesForCurrency : public UMemory { 232785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative prefix 232885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negPrefixForCurrency; 232985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix 233085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negSuffixForCurrency; 233185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive prefix 233285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posPrefixForCurrency; 233385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive suffix 233485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posSuffixForCurrency; 233550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 233685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int32_t formatWidth; 233785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 233885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho AffixesForCurrency(const UnicodeString& negPrefix, 233985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& negSuffix, 234085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posPrefix, 234185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posSuffix) { 234285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negPrefixForCurrency = negPrefix; 234385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negSuffixForCurrency = negSuffix; 234485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posPrefixForCurrency = posPrefix; 234585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posSuffixForCurrency = posSuffix; 234685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 234785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho }; 234850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 234985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 235085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Affix pattern set for currency. 235185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is a set of AffixPatternsForCurrency, 235285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // each element of the set saves the negative prefix pattern, 235350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // negative suffix pattern, positive prefix pattern, 235485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and positive suffix pattern of a pattern. 235585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is used for currency mixed style parsing. 235685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is actually is a set. 235785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // The set contains the default currency pattern from the locale, 235885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and the currency plural patterns. 235985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Since it is a set, it does not contain duplicated items. 236085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // For example, if 2 currency plural patterns are the same, only one pattern 236185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // is included in the set. When parsing, we do not check whether the plural 236285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // count match or not. 236385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fAffixPatternsForCurrency; 236485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 236585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Following 2 are affixes for currency. 236685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is a hash map from plural count to AffixesForCurrency. 236785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // AffixesForCurrency saves the negative prefix, 236885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix, positive prefix, and positive suffix of a pattern. 236985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is used during currency formatting only when the currency sign count 237085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // is 3. In which case, the affixes are getting from here, not 237185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // from the fNegativePrefix etc. 237285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fAffixesForCurrency; // for current pattern 237385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fPluralAffixesForCurrency; // for plural pattern 237485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 237585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Information needed for DecimalFormat to format/parse currency plural. 237685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho CurrencyPluralInfo* fCurrencyPluralInfo; 237785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2378103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_HAVE_PARSEALLINPUT 2379103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius UNumberFormatAttributeValue fParseAllInput; 2380103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif 2381103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 2382103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 2383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 2384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23858393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#ifndef U_HIDE_INTERNAL_API 23868393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius /** 23878393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * Rounds a value according to the rules of this object. 23888393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius * @internal 23898393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius */ 23908393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const; 23918393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif /* U_HIDE_INTERNAL_API */ 23928393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius 2393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the currency in effect for this formatter. Subclasses 2395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should override this method as needed. Unlike getCurrency(), 2396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this method should never return "". 2397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @result output parameter for null-terminated result, which must 2398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * have a capacity of at least 4 2399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 2400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; 2402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 240350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** number of integer digits 2404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 240550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 2406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kDoubleIntegerDigits; 240750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** number of fraction digits 2408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 240950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 2410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kDoubleFractionDigits; 2411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * When someone turns on scientific mode, we assume that more than this 2414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number of digits is due to flipping from some other mode that didn't 2415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * restrict the maximum, and so we force 1 integer digit. We don't bother 2416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to track and see if someone is using exponential notation with more than 2417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this number, it wouldn't make sense anyway, and this is just to make sure 2418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that someone turning on scientific mode with default settings doesn't 2419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * end up with lots of zeroes. 2420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 2421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kMaxScientificIntegerDigits; 2423103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 2424103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#if UCONFIG_FORMAT_FASTPATHS_49 2425103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius private: 2426103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /** 2427103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Internal state. 2428103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @internal 2429103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 2430103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius uint8_t fReserved[UNUM_DECIMALFORMAT_INTERNAL_SIZE]; 2431103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 2432103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 2433103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius /** 2434103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * Called whenever any state changes. Recomputes whether fastpath is OK to use. 2435103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius */ 2436103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius void handleChanged(); 2437103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif 2438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 2439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(const Formattable& obj, 2442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 2443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const { 2444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Don't use Format:: - use immediate base class only, 2445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // in case immediate base modifies behavior later. 2446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NumberFormat::format(obj, appendTo, status); 2447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(double number, 2451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const { 2452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition pos(0); 2453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return format(number, appendTo, pos); 2454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(int32_t number, 2458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const { 2459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition pos(0); 2460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return format((int64_t)number, appendTo, pos); 2461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UnicodeString & 2464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const { 2465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fSymbols->getConstSymbol(symbol); 2466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 246754dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius 2468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 2469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 2471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _DECIMFMT 2473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof 2474