1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho* Copyright (C) 1997-2010, 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. 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 07/20/98 stephen Changed documentation 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************** 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 2350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef DECIMFMT_H 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define DECIMFMT_H 2650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 2950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \file 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Formats decimal numbers. 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 3250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_FORMATTING 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/dcfmtsym.h" 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/numfmt.h" 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/locid.h" 3850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/fpositer.h" 3950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/stringpiece.h" 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hounion UHashTok; 4285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass DigitList; 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass ChoiceFormat; 4785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass CurrencyPluralInfo; 4885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass Hashtable; 4950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoclass FieldPositionHandler; 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat is a concrete subclass of NumberFormat that formats decimal 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * numbers. It has a variety of features designed to make it possible to parse 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and format numbers in any locale, including support for Western, Arabic, or 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Indic digits. It also supports different flavors of numbers, including 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integers ("123"), fixed-point numbers ("123.4"), scientific notation 5785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", 5885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "123 US dollars"). All of these flavors can be easily localized. 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>To obtain a NumberFormat for a specific locale (including the default 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale) call one of NumberFormat's factory methods such as 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance(). Do not call the DecimalFormat constructors directly, unless 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * you know what you are doing, since the NumberFormat factory methods may 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return subclasses other than DecimalFormat. 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Example Usage</strong> 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \code 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // Normally we would have a GUI with a menu for this 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * int32_t locCount; 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * const Locale* locales = NumberFormat::getAvailableLocales(locCount); 7250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * double myNumber = -1234.56; 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UErrorCode success = U_ZERO_ERROR; 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * NumberFormat* form; 7650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // Print out a number with the localized number, currency and percent 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // format for each locale. 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString countryName; 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString displayName; 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString str; 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString pattern; 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Formattable fmtable; 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for (int32_t j = 0; j < 3; ++j) { 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << endl << "FORMAT " << j << endl; 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for (int32_t i = 0; i < locCount; ++i) { 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if (locales[i].getCountry(countryName).size() == 0) { 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * // skip language-only 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * continue; 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * switch (j) { 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * case 0: 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * form = NumberFormat::createInstance(locales[i], success ); break; 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * case 1: 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * form = NumberFormat::createCurrencyInstance(locales[i], success ); break; 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default: 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * form = NumberFormat::createPercentInstance(locales[i], success ); break; 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if (form) { 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * str.remove(); 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern = ((DecimalFormat*)form)->toPattern(pattern); 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << locales[i].getDisplayName(displayName) << ": " << pattern; 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * cout << " -> " << form->format(myNumber,str) << endl; 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * form->parse(form->format(myNumber,str), fmtable, success); 10550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * delete form; 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * } 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \endcode 11085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <P> 11185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Another example use createInstance(style) 11285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <P> 11385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <pre> 11485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <strong>// Print out a number using the localized number, currency, 11585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * // percent, scientific, integer, iso currency, and plural currency 11685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * // format for each locale</strong> 11785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Locale* locale = new Locale("en", "US"); 11885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * double myNumber = 1234.56; 11985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * UErrorCode success = U_ZERO_ERROR; 12085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * UnicodeString str; 12185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Formattable fmtable; 12250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * for (int j=NumberFormat::kNumberStyle; 12350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * j<=NumberFormat::kPluralCurrencyStyle; 12485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * ++j) { 12585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * NumberFormat* format = NumberFormat::createInstance(locale, j, success); 12685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * str.remove(); 12785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * cout << "format result " << form->format(myNumber, str) << endl; 12885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * format->parse(form->format(myNumber, str), fmtable, success); 12950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * }</pre> 13085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Patterns</strong> 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>A DecimalFormat consists of a <em>pattern</em> and a set of 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>symbols</em>. The pattern may be set directly using 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * applyPattern(), or indirectly using other API methods which 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * manipulate aspects of the pattern, such as the minimum number of integer 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits. The symbols are stored in a DecimalFormatSymbols 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * object. When using the NumberFormat factory methods, the 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern and symbols are read from ICU's locale data. 14150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Special Pattern Characters</strong> 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Many characters in a pattern are taken literally; they are matched during 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing and output unchanged during formatting. Special characters, on the 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * other hand, stand for other characters, strings, or classes of characters. 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, the '#' character is replaced by a localized digit. Often the 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * replacement character is the same as the pattern character; in the U.S. locale, 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the ',' grouping character is replaced by ','. However, the replacement is 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * still happening, and if the symbols are modified, the grouping character 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * changes. Some special characters affect the behavior of the formatter by 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * their presence; for example, if the percent character is seen, then the 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value is multiplied by 100 before being displayed. 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>To insert a special character in a pattern as a literal, that is, without 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * any special meaning, the character must be quoted. There are some exceptions to 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this which are noted below. 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The characters listed here are used in non-localized patterns. Localized 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * patterns use the corresponding characters taken from this formatter's 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object instead, and these characters lose 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * their special status. Two exceptions are the currency sign and quote, which 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are not localized. 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <table border=0 cellspacing=3 cellpadding=0> 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr bgcolor="#ccccff"> 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left><strong>Symbol</strong> 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left><strong>Location</strong> 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left><strong>Localized?</strong> 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left><strong>Meaning</strong> 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>0</code> 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Digit 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>1-9</code> 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>'1' through '9' indicate rounding. 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\htmlonly@\endhtmlonly</code> <!--doxygen doesn't like @--> 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>No 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Significant digit 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>#</code> 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Digit, zero shows as absent 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>.</code> 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Decimal separator or monetary decimal separator 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>-</code> 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Minus sign 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>,</code> 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Grouping separator 206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>E</code> 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Number 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Separates mantissa and exponent in scientific notation. 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>Need not be quoted in prefix or suffix.</em> 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>+</code> 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Exponent 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix positive exponents with localized plus sign. 217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>Need not be quoted in prefix or suffix.</em> 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>;</code> 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Subpattern boundary 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Separates positive and negative subpatterns 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\%</code> 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix or suffix 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Multiply by 100 and show as percentage 228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\\u2030</code> 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix or suffix 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Multiply by 1000 and show as per mille 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\htmlonly¤\endhtmlonly</code> (<code>\\u00A4</code>) 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix or suffix 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>No 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Currency sign, replaced by currency symbol. If 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * doubled, replaced by international currency symbol. 23985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * If tripled, replaced by currency plural names, for example, 24085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "US dollar" or "US dollars" for America. 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If present in a pattern, the monetary decimal separator 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is used instead of the decimal separator. 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>'</code> 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix or suffix 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>No 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Used to quote special characters in a prefix or suffix, 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for example, <code>"'#'#"</code> formats 123 to 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"#123"</code>. To create a single quote 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * itself, use two in a row: <code>"# o''clock"</code>. 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>*</code> 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Prefix or suffix boundary 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Yes 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>Pad escape, precedes pad character 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </table> 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>A DecimalFormat pattern contains a postive and negative 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix, a numeric part, and a suffix. If there is no explicit negative 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern, the negative subpattern is the localized minus sign prefixed to the 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is an explicit negative subpattern, it serves only to specify the negative 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix and suffix; the number of digits, minimal digits, and other 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characteristics are ignored in the negative subpattern. That means that 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)". 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The prefixes, suffixes, and various symbols used for infinity, digits, 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * thousands separators, decimal separators, etc. may be set to arbitrary 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * values, and they will appear properly during formatting. However, care must 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be taken that the symbols and strings do not conflict, or parsing will be 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unreliable. For example, either the positive and negative prefixes or the 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffixes must be distinct for parse() to be able 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to distinguish positive from negative values. Another example is that the 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal separator and thousands separator should be distinct characters, or 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing will be impossible. 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>The <em>grouping separator</em> is a character that separates clusters of 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer digits to make large numbers more legible. It commonly used for 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * thousands, but in some locales it separates ten-thousands. The <em>grouping 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * size</em> is the number of digits between the grouping separators, such as 3 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for "100,000,000" or 4 for "1 0000 0000". There are actually two different 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping sizes: One used for the least significant integer digits, the 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>primary grouping size</em>, and one used for all others, the 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>secondary grouping size</em>. In most locales these are the same, but 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sometimes they are different. For example, if the primary grouping interval 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is 3, and the secondary is 2, then this corresponds to the pattern 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "#,##,##0", and the number 123456789 is formatted as "12,34,56,789". If a 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern contains multiple grouping separators, the interval between the last 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * one and the end of the integer defines the primary grouping size, and the 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * interval between the last two defines the secondary grouping size. All others 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####". 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat to set a failing UErrorCode. 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Pattern BNF</strong> 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern := subpattern (';' subpattern)? 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern := prefix? number exponent? suffix? 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number := (integer ('.' fraction)?) | sigDigits 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * prefix := '\\u0000'..'\\uFFFD' - specialCharacters 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffix := '\\u0000'..'\\uFFFD' - specialCharacters 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer := '#'* '0'* '0' 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction := '0'* '#'* 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sigDigits := '#'* '@' '@'* '#'* 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent := 'E' '+'? '0'* '0' 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padSpec := '*' padChar 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padChar := '\\u0000'..'\\uFFFD' - quote 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Notation: 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X* 0 or more instances of X 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X? 0 or 1 instances of X 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * X|Y either X or Y 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * C..D any character from C up to D, inclusive 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * S-T characters in S, except those in T 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The first subpattern is for positive numbers. The second (optional) 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subpattern is for negative numbers. 32150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Not indicated in the BNF syntax above: 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul><li>The grouping separator ',' can occur inside the integer and 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sigDigits elements, between any two pattern characters of that 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * element, as long as the integer or sigDigits element is not 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * followed by the exponent element. 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Two grouping intervals are recognized: That between the 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal point and the first grouping symbol, and that 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * between the first and second grouping symbols. These 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * intervals are identical in most locales, but in some 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locales they differ. For example, the pattern 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "#,##,###" formats the number 123456789 as 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "12,34,56,789".</li> 33650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The pad specifier <code>padSpec</code> may appear before the prefix, 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * after the prefix, before the suffix, after the suffix, or not at all. 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In place of '0', the digits '1' through '9' may be used to 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indicate a rounding increment. 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Parsing</strong> 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat parses all Unicode characters that represent 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal digits, as defined by u_charDigitValue(). In addition, 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat also recognizes as digits the ten consecutive 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters starting with the localized zero digit defined in the 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object. During formatting, the 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols-based digits are output. 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>During parsing, grouping separators are ignored. 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 35585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * <p>For currency parsing, the formatter is able to parse every currency 35685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * style formats no matter which style the formatter is constructed with. 35750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * For example, a formatter instance gotten from 35885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse 35985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * formats such as "USD1.00" and "3.00 US dollars". 36085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>If parse(UnicodeString&,Formattable&,ParsePosition&) 362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fails to parse a string, it leaves the parse position unchanged. 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&) 364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * indicates parse failure by setting a failing 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UErrorCode. 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Formatting</strong> 368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Formatting is guided by several parameters, all of which can be 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specified either using a pattern or using the API. The following 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * description applies to formats that do not use <a href="#sci">scientific 372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation</a> or <a href="#sigdig">significant digits</a>. 373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul><li>If the number of actual integer digits exceeds the 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>maximum integer digits</em>, then only the least significant 376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are shown. For example, 1997 is formatted as "97" if the 377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum integer digits is set to 2. 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual integer digits is less than the 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>minimum integer digits</em>, then leading zeros are added. For 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, 1997 is formatted as "01997" if the minimum integer digits 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is set to 5. 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual fraction digits exceeds the <em>maximum 38527f654740f2a26ad62a5c155af9199af9e69b889claireho * fraction digits</em>, then rounding is performed to the 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum fraction digits. For example, 0.125 is formatted as "0.12" 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if the maximum fraction digits is 2. This behavior can be changed 38827f654740f2a26ad62a5c155af9199af9e69b889claireho * by specifying a rounding increment and/or a rounding mode. 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If the number of actual fraction digits is less than the 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>minimum fraction digits</em>, then trailing zeros are added. 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For example, 0.125 is formatted as "0.1250" if the mimimum fraction 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits is set to 4. 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Trailing fractional zeros are not displayed if they occur 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>j</em> positions after the decimal, where <em>j</em> is less 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * than the maximum fraction digits. For example, 0.10004 is 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * formatted as "0.1" if the maximum fraction digits is four or less. 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Special Values</strong> 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><code>NaN</code> is represented as a single character, typically 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>\\uFFFD</code>. This character is determined by the 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object. This is the only value for which 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the prefixes and suffixes are not used. 407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Infinity is represented as a single character, typically 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>\\u221E</code>, with the positive or negative prefixes and suffixes 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * applied. The infinity character is determined by the 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols object. 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <a name="sci"><strong>Scientific Notation</strong></a> 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>Numbers in scientific notation are expressed as the product of a mantissa 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and a power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0), 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * but it need not be. DecimalFormat supports arbitrary mantissas. 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat can be instructed to use scientific 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation through the API or through the pattern. In a pattern, the exponent 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character immediately followed by one or more digit characters indicates 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * scientific notation. Example: "0.###E0" formats the number 1234 as 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "1.234E3". 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul> 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of digit characters after the exponent character gives the 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * minimum exponent digit count. There is no maximum. Negative exponents are 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * formatted using the localized minus sign, <em>not</em> the prefix and suffix 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * from the pattern. This allows patterns such as "0.###E0 m/s". To prefix 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * positive exponents with a localized plus sign, specify '+' between the 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0", 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "1E-1", etc. (In localized patterns, use the localized plus sign rather than 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * '+'.) 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The minimum number of integer digits is achieved by adjusting the 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponent. Example: 0.00123 formatted with "00.###E0" yields "12.3E-4". This 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * only happens if there is no maximum number of integer digits. If there is a 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum, then the minimum number of integer digits is fixed at one. 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The maximum number of integer digits, if present, specifies the exponent 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping. The most common use of this is to generate <em>engineering 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation</em>, in which the exponent is a multiple of three, e.g., 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "##0.###E0". The number 12345 is formatted using "##0.####E0" as "12.345E3". 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When using scientific notation, the formatter controls the 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digit counts using significant digits logic. The maximum number of 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits limits the total number of integer and fraction 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits that will be shown in the mantissa; it does not affect 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parsing. For example, 12345 formatted with "##0.##E0" is "12.3E3". 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * See the section on significant digits for more details. 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of significant digits shown is determined as 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * follows: If areSignificantDigitsUsed() returns false, then the 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * minimum number of significant digits shown is one, and the maximum 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number of significant digits shown is the sum of the <em>minimum 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer</em> and <em>maximum fraction</em> digits, and is 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unaffected by the maximum integer digits. If this sum is zero, 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then all significant digits are shown. If 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * areSignificantDigitsUsed() returns true, then the significant digit 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * counts are specified by getMinimumSignificantDigits() and 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * getMaximumSignificantDigits(). In this case, the number of 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer digits is fixed at one, and there is no exponent grouping. 463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Exponential patterns may not contain grouping separators. 465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <a name="sigdig"><strong>Significant Digits</strong></a> 468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>DecimalFormat</code> has two ways of controlling how many 470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are shows: (a) significant digits counts, or (b) integer and 471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction digit counts. Integer and fraction digit counts are 472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * described above. When a formatter is using significant digits 473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * counts, the number of integer and fraction digits is not specified 474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * directly, and the formatter settings for these counts are ignored. 475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Instead, the formatter uses however many integer and fraction 476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are required to display the specified number of significant 477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits. Examples: 478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <table border=0 cellspacing=3 cellpadding=0> 480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr bgcolor="#ccccff"> 481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left>Pattern 482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left>Minimum significant digits 483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left>Maximum significant digits 484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left>Number 485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td align=left>Output of format() 486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\@\@\@</code> 488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>3 489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>3 490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>12345 491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>12300</code> 492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\@\@\@</code> 494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>3 495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>3 496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>0.12345 497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>0.123</code> 498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top> 499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\@\@##</code> 500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>2 501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>4 502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>3.14159 503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>3.142</code> 504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <tr valign=top bgcolor="#eeeeff"> 505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>\@\@##</code> 506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>2 507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>4 508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td>1.23004 509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <td><code>1.23</code> 510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </table> 511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul> 513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Significant digit counts may be expressed using patterns that 514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specify a minimum and maximum number of significant digits. These 515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * are indicated by the <code>'@'</code> and <code>'#'</code> 516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * characters. The minimum number of significant digits is the number 517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of <code>'@'</code> characters. The maximum number of significant 518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits is the number of <code>'@'</code> characters plus the number 519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of <code>'#'</code> characters following on the right. For 520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, the pattern <code>"@@@"</code> indicates exactly 3 521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits. The pattern <code>"@##"</code> indicates from 522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1 to 3 significant digits. Trailing zero digits to the right of 523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the decimal separator are suppressed after the minimum number of 524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * significant digits have been shown. For example, the pattern 525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"@##"</code> formats the number 0.1203 as 526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"0.12"</code>. 527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If a pattern uses significant digits, it may not contain a 529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * decimal separator, nor the <code>'0'</code> pattern character. 530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Patterns such as <code>"@00"</code> or <code>"@.###"</code> are 531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * disallowed. 532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Any number of <code>'#'</code> characters may be prepended to 534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the left of the leftmost <code>'@'</code> character. These have no 535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * effect on the minimum and maximum significant digits counts, but 536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * may be used to position grouping separators. For example, 537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"#,#@#"</code> indicates a minimum of one significant digits, 538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of two significant digits, and a grouping size of three. 539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In order to enable significant digits formatting, use a pattern 541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * containing the <code>'@'</code> pattern character. Alternatively, 542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * call setSignificantDigitsUsed(TRUE). 543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In order to disable significant digits formatting, use a 545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern that does not contain the <code>'@'</code> pattern 546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character. Alternatively, call setSignificantDigitsUsed(FALSE). 547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The number of significant digits has no effect on parsing. 549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Significant digits may be used together with exponential notation. Such 551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * patterns are equivalent to a normal exponential pattern with a minimum and 552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum integer digit count of one, a minimum fraction digit count of 553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>getMinimumSignificantDigits() - 1</code>, and a maximum fraction digit 554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * count of <code>getMaximumSignificantDigits() - 1</code>. For example, the 555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>. 556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>If signficant digits are in use, then the integer and fraction 558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digit counts, as set via the API, are ignored. If significant 559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits are not in use, then the signficant digit counts, as set via 560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the API, are ignored. 561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Padding</strong> 565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat supports padding the result of 567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * format() to a specific width. Padding may be specified either 568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * through the API or through the pattern syntax. In a pattern the pad escape 569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * character, followed by a single pad character, causes padding to be parsed 570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and formatted. The pad escape character is '*' in unlocalized patterns, and 571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * can be localized using DecimalFormatSymbols::setSymbol() with a 572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormatSymbols::kPadEscapeSymbol 573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * selector. For example, <code>"$*x#,##0.00"</code> formats 123 to 574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>. 575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul> 577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When padding is in effect, the width of the positive subpattern, 578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including prefix and suffix, determines the format width. For example, in 579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the pattern <code>"* #0 o''clock"</code>, the format width is 10. 580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>The width is counted in 16-bit code units (UChars). 582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Some parameters which usually do not matter have meaning when padding is 584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * used, because the pattern width is significant with padding. In the pattern 585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "* ##,##,#,##0.##", the format width is 14. The initial characters "##,##," 586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * do not affect the grouping size or maximum integer digits, but they do affect 587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the format width. 588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Padding may be inserted at one of four locations: before the prefix, 590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * after the prefix, before the suffix, or after the suffix. If padding is 591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specified in any other location, applyPattern() 592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sets a failing UErrorCode. If there is no prefix, 593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * before the prefix and after the prefix are equivalent, likewise for the 594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * suffix. 595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>When specified in a pattern, the 32-bit code point immediately 597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * following the pad escape is the pad character. This may be any character, 598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * including a special pattern character. That is, the pad escape 599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <em>escapes</em> the following character. If there is no character after 600ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the pad escape, then the pattern is illegal. 601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Rounding</strong> 605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat supports rounding to a specific increment. For 607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the 608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * nearest 0.65 is 1.3. The rounding increment may be specified through the API 609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or in a pattern. To specify a rounding increment in a pattern, include the 610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * increment in the pattern itself. "#,#50" specifies a rounding increment of 611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 50. "#,##0.05" specifies a rounding increment of 0.05. 612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 61327f654740f2a26ad62a5c155af9199af9e69b889claireho * <p>In the absense of an explicit rounding increment numbers are 61427f654740f2a26ad62a5c155af9199af9e69b889claireho * rounded to their formatted width. 61527f654740f2a26ad62a5c155af9199af9e69b889claireho * 616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <ul> 617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Rounding only affects the string produced by formatting. It does 618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * not affect parsing or change any numerical values. 619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>A <em>rounding mode</em> determines how values are rounded; see 62127f654740f2a26ad62a5c155af9199af9e69b889claireho * DecimalFormat::ERoundingMode. The default rounding mode is 62227f654740f2a26ad62a5c155af9199af9e69b889claireho * DecimalFormat::kRoundHalfEven. The rounding mode can only be set 62327f654740f2a26ad62a5c155af9199af9e69b889claireho * through the API; it can not be set with a pattern. 624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>Some locales use rounding in their currency formats to reflect the 626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * smallest currency denomination. 627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <li>In a pattern, digits '1' through '9' specify rounding, but otherwise 629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behave identically to digit '0'. 630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </ul> 631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Synchronization</strong> 633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p>DecimalFormat objects are not synchronized. Multiple 635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * threads should not access one formatter concurrently. 636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><strong>Subclassing</strong> 638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <p><em>User subclasses are not supported.</em> While clients may write 640ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * subclasses, such code will not necessarily work and will not be 641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * guaranteed to work stably from release to release. 642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass U_I18N_API DecimalFormat: public NumberFormat { 644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Rounding mode. 647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum ERoundingMode { 650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundCeiling, /**< Round towards positive infinity */ 651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundFloor, /**< Round towards negative infinity */ 652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundDown, /**< Round towards zero */ 653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundUp, /**< Round away from zero */ 654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundHalfEven, /**< Round towards the nearest integer, or 655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru towards the nearest even integer if equidistant */ 656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundHalfDown, /**< Round towards the nearest integer, or 657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru towards zero if equidistant */ 658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kRoundHalfUp /**< Round towards the nearest integer, or 659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru away from zero if equidistant */ 660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // We don't support ROUND_UNNECESSARY 661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Pad position. 665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 667ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum EPadPosition { 668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPadBeforePrefix, 669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPadAfterPrefix, 670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPadBeforeSuffix, 671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru kPadAfterSuffix 672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat using the default pattern and symbols 676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for the default locale. This is a convenient way to obtain a 677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat when internationalization is not the main concern. 678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given locale, use the factory methods 680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * on NumberFormat such as createInstance. These factories will 681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the most appropriate sub-class of NumberFormat for a given 682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale. 683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(UErrorCode& status); 688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and the symbols 691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * for the default locale. This is a convenient way to obtain a 692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DecimalFormat when internationalization is not the main concern. 693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given locale, use the factory methods 695ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * on NumberFormat such as createInstance. These factories will 696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * return the most appropriate sub-class of NumberFormat for a given 697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale. 698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern A non-localized pattern string. 699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(const UnicodeString& pattern, 704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 705ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 706ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and symbols. 708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Use this constructor when you need to completely customize the 709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behavior of the format. 710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given 712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale, use the factory methods on NumberFormat such as 713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance or createCurrencyInstance. If you need only minor adjustments 714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to a standard format, you can modify the format returned by 715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a NumberFormat factory method. 716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 717ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern a non-localized pattern string 718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbolsToAdopt the set of symbols to be used. The caller should not 719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delete this object after making this call. 720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat( const UnicodeString& pattern, 725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* symbolsToAdopt, 726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 728ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 72985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * This API is for ICU use only. 73085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Create a DecimalFormat from the given pattern, symbols, and style. 73185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 73285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param pattern a non-localized pattern string 73385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param symbolsToAdopt the set of symbols to be used. The caller should not 73485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * delete this object after making this call. 73585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param style style of decimal format, kNumberStyle etc. 73685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param status Output param set to success/failure code. If the 73785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * pattern is invalid this will be set to a failure code. 73885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @internal ICU 4.2 73985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 74085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho DecimalFormat( const UnicodeString& pattern, 74185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho DecimalFormatSymbols* symbolsToAdopt, 74285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho NumberFormat::EStyles style, 74385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 74485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 74585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and symbols. 747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Use this constructor when you need to completely customize the 748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behavior of the format. 749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given 751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale, use the factory methods on NumberFormat such as 752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance or createCurrencyInstance. If you need only minor adjustments 753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to a standard format, you can modify the format returned by 754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a NumberFormat factory method. 755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern a non-localized pattern string 757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbolsToAdopt the set of symbols to be used. The caller should not 758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delete this object after making this call. 75950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Output param to receive errors occured during parsing 760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat( const UnicodeString& pattern, 765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* symbolsToAdopt, 766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Create a DecimalFormat from the given pattern and symbols. 770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Use this constructor when you need to completely customize the 771ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * behavior of the format. 772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To obtain standard formats for a given 774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale, use the factory methods on NumberFormat such as 775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * createInstance or createCurrencyInstance. If you need only minor adjustments 776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to a standard format, you can modify the format returned by 777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a NumberFormat factory method. 778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern a non-localized pattern string 780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbols the set of symbols to be used 781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. If the 782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pattern is invalid this will be set to a failure code. 783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat( const UnicodeString& pattern, 786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const DecimalFormatSymbols& symbols, 787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Copy constructor. 79150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the DecimalFormat object to be copied from. 793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(const DecimalFormat& source); 796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Assignment operator. 799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param rhs the DecimalFormat object to be copied. 801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat& operator=(const DecimalFormat& rhs); 804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Destructor. 807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~DecimalFormat(); 810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Clone this Format object polymorphically. The caller owns the 813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * result and should delete it when done. 814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a polymorphic copy of this DecimalFormat. 816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual Format* clone(void) const; 819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return true if the given Format objects are semantically equal. 822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Objects of different subclasses are considered unequal. 823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param other the object to be compared with. 825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if the given Format objects are semantically equal. 826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool operator==(const Format& other) const; 829ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 83050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 83150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho using NumberFormat::format; 83250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a double or long number using base-10 representation. 835ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 84350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(double number, 845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 8477c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 84850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 84950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a double or long number using base-10 representation. 85050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 85150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 85250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 85350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 85450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 85550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 85650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 85750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 85850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 85927f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 86050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 8617c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(double number, 8627c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 86350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 86450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 8657c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a long number using base-10 representation. 868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(int32_t number, 878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 8807c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 88150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 88250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a long number using base-10 representation. 88350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 88450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 88550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 88650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 88750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 88850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 88950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 89050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 89150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 89227f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 89350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 8947c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(int32_t number, 8957c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 89650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 89750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 8987c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 899ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 900ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format an int64 number using base-10 representation. 901ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 902ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 903ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 904ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 905ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 906ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 907ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 908ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 909ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 910ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(int64_t number, 911ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 912ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos) const; 913ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 914b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 91550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format an int64 number using base-10 representation. 91650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 91750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The value to be formatted. 91850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 91950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 92050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 92150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 92250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 92350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 92450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 92527f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 92650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 9277c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru virtual UnicodeString& format(int64_t number, 9287c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru UnicodeString& appendTo, 92950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 93050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 93150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 93250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 93350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 93450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The syntax of the unformatted number is a "numeric string" 93550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * as defined in the Decimal Arithmetic Specification, available at 93650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * http://speleotrove.com/decimal 93750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 93850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The unformatted number, as a string. 93950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 94050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 94150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 94250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 94350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Can be NULL. 94450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 94550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 94627f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable 4.4 94750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 94850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const StringPiece &number, 94950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 95050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 95150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 95250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 95350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 95450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 95550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 95650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The number is a DigitList wrapper onto a floating point decimal number. 95750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The default implementation in NumberFormat converts the decimal number 95850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to a double and formats that. 95950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 96050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The number, a DigitList format Decimal Floating Point. 96150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 96250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 96350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param posIter On return, can be used to iterate over positions 96450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields generated by this format call. 96550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 96650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 96750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @internal 96850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 96950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const DigitList &number, 97050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 97150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionIterator* posIter, 97250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 97350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 97450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 97550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Format a decimal number. 97650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The number is a DigitList wrapper onto a floating point decimal number. 97750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The default implementation in NumberFormat converts the decimal number 97850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to a double and formats that. 97950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 98050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param number The number, a DigitList format Decimal Floating Point. 98150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param appendTo Output parameter to receive result. 98250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Result is appended to existing contents. 98350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param pos On input: an alignment field, if desired. 98450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * On output: the offsets of the alignment field. 98550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status Output param filled with success/failure status. 98650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return Reference to 'appendTo' parameter. 98750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @internal 98850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 98950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho virtual UnicodeString& format(const DigitList &number, 99050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 9917c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru FieldPosition& pos, 99250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode& status) const; 99350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 9947c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 995ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 996ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a Formattable using base-10 representation. 997ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 998ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param obj The value to be formatted. 999ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1000ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1001ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos On input: an alignment field, if desired. 1002ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output: the offsets of the alignment field. 1003ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Error code indicating success or failure. 1004ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1005ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1006ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1007ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& format(const Formattable& obj, 1008ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 1009ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition& pos, 1010ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const; 1011ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1012ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1013ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1014ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Formats an object to produce a string. 1015ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1016ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param obj The object to format. 1017ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1018ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1019ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output parameter filled in with success or failure status. 1020ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1021ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1022ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1023ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(const Formattable& obj, 1024ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 1025ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const; 1026ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1027ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1028ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1029ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a double number. 1030ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1031ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1032ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1033ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1034ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1035ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1036ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1037ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(double number, 1038ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1039ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1040ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1041ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1042ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format a long number. These methods call the NumberFormat 1043ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pure virtual format() methods with the default FieldPosition. 1044ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1045ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1046ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1047ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1048ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1049ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1050ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1051ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(int32_t number, 1052ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1053ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1054ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1055ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Redeclared NumberFormat method. 1056ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Format an int64 number. These methods call the NumberFormat 1057ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pure virtual format() methods with the default FieldPosition. 1058ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1059ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param number The value to be formatted. 1060ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1061ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 1062ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1063ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 1064ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1065ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& format(int64_t number, 1066ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const; 1067ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1068ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parse the given string using this object's choices. The method 1069ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * does string comparisons to try to find an optimal match. 1070ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If no object can be parsed, index is unchanged, and NULL is 1071ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returned. The result is returned as the most parsimonious 1072ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * type of Formattable that will accomodate all of the 1073ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * necessary precision. For example, if the result is exactly 12, 1074ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * it will be returned as a long. However, if it is 1.5, it will 1075ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be returned as a double. 1076ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1077ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The text to be parsed. 1078ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Formattable to be set to the parse result. 1079ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If parse fails, return contents are undefined. 1080ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parsePosition The position to start parsing at on input. 1081ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * On output, moved to after the last successfully 1082ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * parse character. On parse failure, does not change. 1083ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see Formattable 1084ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1085ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1086ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void parse(const UnicodeString& text, 1087ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Formattable& result, 1088ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ParsePosition& parsePosition) const; 1089ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1090ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Declare here again to get rid of function hiding problems. 109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 1092ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parse the given string using this object's choices. 1093ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1094ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text The text to be parsed. 1095ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Formattable to be set to the parse result. 1096ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output parameter filled in with success or failure status. 1097ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1098ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1099bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru virtual void parse(const UnicodeString& text, 1100bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru Formattable& result, 1101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode& status) const; 1102bbb04983e06b0e11d9f393bbd3850bbe8f47f6d0Jean-Baptiste Queru 1103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Parses text from the given string as a currency amount. Unlike 1105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the parse() method, this method will attempt to parse a generic 1106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency name, searching for a match of this object's locale's 1107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency display names, or for a 3-letter ISO currency code. 1108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method will fail if this format is not a currency format, 1109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that is, if it does not contain the currency pattern symbol 1110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (U+00A4) in its prefix or suffix. 1111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param text the string to parse 1113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result output parameter to receive result. This will have 1114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * its currency set to the parsed ISO currency code. 1115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pos input-output position; on input, the position within 1116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * text to match; must have 0 <= pos.getIndex() < text.length(); 1117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * on output, the position after the last matched character. If 1118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the parse fails, the position in unchanged upon output. 1119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a reference to result 1120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 1121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual Formattable& parseCurrency(const UnicodeString& text, 1123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Formattable& result, 1124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ParsePosition& pos) const; 1125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the decimal format symbols, which is generally not changed 1128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return desired DecimalFormatSymbols 1130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols 1131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const; 1134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the decimal format symbols, which is generally not changed 1137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbolsToAdopt DecimalFormatSymbols to be adopted. 1139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt); 1142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the decimal format symbols, which is generally not changed 1145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by the programmer or user. 1146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param symbols DecimalFormatSymbols. 1147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols); 1150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 115350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Returns the currency plural format information, 115485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 115585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @return desired CurrencyPluralInfo 115650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 115785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 115885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const; 115985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 116085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 116150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Sets the currency plural format information, 116285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 116385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param toAdopt CurrencyPluralInfo to be adopted. 116450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 116585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 116685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt); 116785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 116885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 116950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Sets the currency plural format information, 117085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * which is generally not changed by the programmer or user. 117185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @param info Currency Plural Info. 117250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @stable ICU 4.2 117385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 117485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); 117585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 117685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 117785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 1178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the positive prefix. 1179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the positive prefix. 1181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: +123, $123, sFr123 1183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getPositivePrefix(UnicodeString& result) const; 1186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the positive prefix. 1189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the the positive prefix to be set. 1191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: +123, $123, sFr123 1192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPositivePrefix(const UnicodeString& newValue); 1195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the negative prefix. 1198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the negative prefix. 1200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123, ($123) (with negative suffix), sFr-123 1202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getNegativePrefix(UnicodeString& result) const; 1205ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1206ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the negative prefix. 1208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the the negative prefix to be set. 1210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123, ($123) (with negative suffix), sFr-123 1211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setNegativePrefix(const UnicodeString& newValue); 1214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1216ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the positive suffix. 1217ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the positive suffix. 1219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: 123% 1221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getPositiveSuffix(UnicodeString& result) const; 1224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the positive suffix. 1227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1228ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the positive suffix to be set. 1229ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: 123% 1230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPositiveSuffix(const UnicodeString& newValue); 1233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the negative suffix. 1236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the negative suffix. 1238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1239ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: -123%, ($123) (with positive suffixes) 1240ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getNegativeSuffix(UnicodeString& result) const; 1243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the negative suffix. 1246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the negative suffix to be set. 1248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: 123% 1249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setNegativeSuffix(const UnicodeString& newValue); 1252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the multiplier for use in percent, permill, etc. 1255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a percentage, set the suffixes to have "%" and the multiplier to be 100. 1256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (For Arabic, use arabic percent symbol). 1257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. 1258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the multiplier for use in percent, permill, etc. 1260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 1261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMultiplier(void) const; 1264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the multiplier for use in percent, permill, etc. 1267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a percentage, set the suffixes to have "%" and the multiplier to be 100. 1268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (For Arabic, use arabic percent symbol). 1269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. 1270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the multiplier for use in percent, permill, etc. 1272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 1273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMultiplier(int32_t newValue); 1276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the rounding increment. 127927f654740f2a26ad62a5c155af9199af9e69b889claireho * @return A positive rounding increment, or 0.0 if a rounding 128027f654740f2a26ad62a5c155af9199af9e69b889claireho * increment is not in effect. 1281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual double getRoundingIncrement(void) const; 1287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 128927f654740f2a26ad62a5c155af9199af9e69b889claireho * Set the rounding increment. In the absence of a rounding increment, 129027f654740f2a26ad62a5c155af9199af9e69b889claireho * numbers will be rounded to the number of digits displayed. 129127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param newValue A positive rounding increment. 1292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Negative increments are equivalent to 0.0. 1293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setRoundingIncrement(double newValue); 1299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the rounding mode. 1302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A rounding mode 1303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingMode 1306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ERoundingMode getRoundingMode(void) const; 1309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 131127f654740f2a26ad62a5c155af9199af9e69b889claireho * Set the rounding mode. 1312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param roundingMode A rounding mode 1313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setRoundingIncrement 1314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingIncrement 1315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getRoundingMode 1316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setRoundingMode(ERoundingMode roundingMode); 1319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the width to which the output of format() is padded. 1322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The width is counted in 16-bit code units. 1323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the format width, or zero if no padding is in effect 1324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t getFormatWidth(void) const; 1332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the width to which the output of format() is padded. 1335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The width is counted in 16-bit code units. 1336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method also controls whether padding is enabled. 1337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param width the width to which to pad the result of 1338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * format(), or zero to disable padding. A negative 1339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * width is equivalent to 0. 1340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setFormatWidth(int32_t width); 1348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the pad character used to pad to the format width. The 1351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * default is ' '. 1352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return a string containing the pad character. This will always 1353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * have a length of one 32-bit code point. 1354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString getPadCharacterString() const; 1362ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1364ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the character used to pad to the format width. If padding 1365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is not enabled, then this will take effect if padding is later 1366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * enabled. 1367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param padChar a string containing the pad charcter. If the string 1368ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * has length 0, then the pad characer is set to ' '. Otherwise 1369ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * padChar.char32At(0) will be used as the pad character. 1370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1372ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1373ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 1374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 1375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1376ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1377ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPadCharacter(const UnicodeString &padChar); 1378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get the position at which padding will take place. This is the location 1381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at which padding will be inserted if the result of format() 1382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is shorter than the format width. 1383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the pad position, one of kPadBeforePrefix, 1384ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterPrefix, kPadBeforeSuffix, or 1385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterSuffix. 1386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1388ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadPosition 139185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see #EPadPosition 1392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual EPadPosition getPadPosition(void) const; 1395ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the position at which padding will take place. This is the location 1398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at which padding will be inserted if the result of format() 1399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is shorter than the format width. This has no effect unless padding is 1400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * enabled. 1401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param padPos the pad position, one of kPadBeforePrefix, 1402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterPrefix, kPadBeforeSuffix, or 1403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * kPadAfterSuffix. 1404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setFormatWidth 1405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getFormatWidth 1406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setPadCharacter 1407ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadCharacterString 1408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getPadPosition 140985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * @see #EPadPosition 1410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setPadPosition(EPadPosition padPos); 1413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return whether or not scientific notation is used. 1416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if this object formats and parses scientific notation 1417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool isScientificNotation(void); 1425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set whether or not scientific notation is used. When scientific notation 1428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is used, the effective maximum number of integer digits is <= 8. If the 1429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum number of integer digits is set to more than 8, the effective 1430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * maximum will be 1. This allows this call to generate a 'default' scientific 1431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number format without additional changes. 1432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useScientific TRUE if this object formats and parses scientific 1433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * notation 1434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setScientificNotation(UBool useScientific); 1442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the minimum exponent digits that will be shown. 1445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the minimum exponent digits that will be shown 1446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int8_t getMinimumExponentDigits(void) const; 1454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the minimum exponent digits that will be shown. This has no 1457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * effect unless scientific notation is in use. 1458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param minExpDig a value >= 1 indicating the fewest exponent digits 1459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that will be shown. Values less than 1 will be treated as 1. 1460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1463ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1464ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1465ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1466ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1467ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumExponentDigits(int8_t minExpDig); 1468ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1469ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1470ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return whether the exponent sign is always shown. 1471ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if the exponent is always prefixed with either the 1472ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * localized minus sign or the localized plus sign, false if only negative 1473ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exponents are prefixed with the localized minus sign. 1474ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1475ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1476ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1477ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1478ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setExponentSignAlwaysShown 1479ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1480ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1481ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UBool isExponentSignAlwaysShown(void); 1482ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1483ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1484ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set whether the exponent sign is always shown. This has no effect 1485ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unless scientific notation is in use. 1486ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param expSignAlways TRUE if the exponent is always prefixed with either 1487ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the localized minus sign or the localized plus sign, false if only 1488ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * negative exponents are prefixed with the localized minus sign. 1489ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setScientificNotation 1490ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isScientificNotation 1491ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #setMinimumExponentDigits 1492ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #getMinimumExponentDigits 1493ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see #isExponentSignAlwaysShown 1494ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1495ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1496ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setExponentSignAlwaysShown(UBool expSignAlways); 1497ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1498ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1499ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the grouping size. Grouping size is the number of digits between 1500ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping separators in the integer portion of a number. For example, 1501ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in the number "123,456.78", the grouping size is 3. 1502ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1503ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the grouping size. 1504ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see setGroupingSize 1505ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::isGroupingUsed 1506ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::getGroupingSeparator 1507ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1508ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1509ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getGroupingSize(void) const; 1510ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1511ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1512ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the grouping size. Grouping size is the number of digits between 1513ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping separators in the integer portion of a number. For example, 1514ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * in the number "123,456.78", the grouping size is 3. 1515ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1516ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the grouping size. 1517ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getGroupingSize 1518ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::setGroupingUsed 1519ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::setGroupingSeparator 1520ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1521ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1522ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setGroupingSize(int32_t newValue); 1523ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1524ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1525ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the secondary grouping size. In some locales one 1526ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping interval is used for the least significant integer 1527ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * digits (the primary grouping size), and another is used for all 1528ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * others (the secondary grouping size). A formatter supporting a 1529ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * secondary grouping size will return a positive integer unequal 1530ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to the primary grouping size returned by 1531ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * getGroupingSize(). For example, if the primary 1532ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * grouping size is 4, and the secondary grouping size is 2, then 1533ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the number 123456789 formats as "1,23,45,6789", and the pattern 1534ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * appears as "#,##,###0". 1535ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the secondary grouping size, or a value less than 1536ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * one if there is none 1537ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see setSecondaryGroupingSize 1538ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat::isGroupingUsed 1539ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::getGroupingSeparator 1540ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 1541ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1542ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getSecondaryGroupingSize(void) const; 1543ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1544ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1545ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set the secondary grouping size. If set to a value less than 1, 1546ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then secondary grouping is turned off, and the primary grouping 1547ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * size is used for all intervals, not just the least significant. 1548ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1549ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue the new value of the secondary grouping size. 1550ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see getSecondaryGroupingSize 1551ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setGroupingUsed 1552ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see DecimalFormatSymbols::setGroupingSeparator 1553ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 1554ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1555ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setSecondaryGroupingSize(int32_t newValue); 1556ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1557ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1558ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Allows you to get the behavior of the decimal separator with integers. 1559ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (The decimal separator will always appear with decimals.) 1560ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1561ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return TRUE if the decimal separator always appear with decimals. 1562ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 1563ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1564ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1565ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isDecimalSeparatorAlwaysShown(void) const; 1566ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1567ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1568ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Allows you to set the behavior of the decimal separator with integers. 1569ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (The decimal separator will always appear with decimals.) 1570ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1571ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param newValue set TRUE if the decimal separator will always appear with decimals. 1572ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 1573ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1574ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1575ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setDecimalSeparatorAlwaysShown(UBool newValue); 1576ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1577ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1578ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Synthesizes a pattern string that represents the current state 1579ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of this Format object. 1580ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1581ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the pattern. 1582ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1583ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1584ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see applyPattern 1585ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1586ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1587ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& toPattern(UnicodeString& result) const; 1588ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1589ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1590ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Synthesizes a localized pattern string that represents the current 1591ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * state of this Format object. 1592ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1593ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the localized pattern. 1594ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1595ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1596ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see applyPattern 1597ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1598ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1599ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const; 160050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1601ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1602ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. A pattern is a 1603ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * short-hand specification for the various formatting properties. 1604ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * These properties can also be changed individually through the 1605ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * various setter methods. 1606ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 1607ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * There is no limit to integer digits are set 1608ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by this routine, since that is the typical end-user desire; 1609ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use setMaximumInteger if you want to set a real value. 1610ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For negative numbers, use a second pattern, separated by a semicolon 1611ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1612ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example "#,#00.0#" -> 1,234.56 1613ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1614ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This means a minimum of 2 integer digits, 1 fraction digit, and 1615ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of 2 fraction digits. 1616ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1617ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses. 1618ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1619ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In negative patterns, the minimum and maximum counts are ignored; 1620ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * these are presumed to be set in the positive pattern. 1621ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1622ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 162350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1624ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1625ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1626ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1627ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1628ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1629ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1630ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyPattern(const UnicodeString& pattern, 1631ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 1632ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1633ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1634ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the pattern. 1635ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 1636ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1637ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1638ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1639ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 164050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 1641ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyPattern(const UnicodeString& pattern, 1642ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1643ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1644ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1645ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. The pattern 1646ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is assumed to be in a localized notation. A pattern is a 1647ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * short-hand specification for the various formatting properties. 1648ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * These properties can also be changed individually through the 1649ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * various setter methods. 1650ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <P> 1651ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * There is no limit to integer digits are set 1652ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by this routine, since that is the typical end-user desire; 1653ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * use setMaximumInteger if you want to set a real value. 1654ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * For negative numbers, use a second pattern, separated by a semicolon 1655ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1656ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Example "#,#00.0#" -> 1,234.56 1657ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1658ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This means a minimum of 2 integer digits, 1 fraction digit, and 1659ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a maximum of 2 fraction digits. 1660ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1661ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses. 1662ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1663ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * In negative patterns, the minimum and maximum counts are ignored; 1664ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * these are presumed to be set in the positive pattern. 1665ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1666ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The localized pattern to be applied. 166750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1668ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1669ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1670ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1671ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1672ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1673ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1674ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyLocalizedPattern(const UnicodeString& pattern, 1675ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 1676ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1677ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1678ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1679ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Apply the given pattern to this Format object. 1680ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1681ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The localized pattern to be applied. 1682ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1683ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1684ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1685ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1686ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1687ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void applyLocalizedPattern(const UnicodeString& pattern, 1688ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 1689ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1690ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1691ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1692ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of digits allowed in the integer portion of a 1693ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the integer digit count to 309. 1694ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 169550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the maximum number of digits 1696ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the integer portion of a number. 1697ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMaximumIntegerDigits 1698ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1699ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1700ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMaximumIntegerDigits(int32_t newValue); 1701ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1702ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1703ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of digits allowed in the integer portion of a 1704ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the integer digit count to 309. 170550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 170650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the minimum number of digits 1707ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the integer portion of a number. 1708ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMinimumIntegerDigits 1709ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1710ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1711ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumIntegerDigits(int32_t newValue); 1712ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1713ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1714ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of digits allowed in the fraction portion of a 1715ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the fraction digit count to 340. 1716ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 171750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the maximum number of digits 1718ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the fraction portion of a number. 1719ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMaximumFractionDigits 1720ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1721ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1722ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMaximumFractionDigits(int32_t newValue); 1723ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1724ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1725ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of digits allowed in the fraction portion of a 1726ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number. This override limits the fraction digit count to 340. 1727ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 172850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param newValue the new value of the minimum number of digits 1729ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * allowed in the fraction portion of a number. 1730ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @see NumberFormat#setMinimumFractionDigits 1731ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1732ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1733ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setMinimumFractionDigits(int32_t newValue); 1734ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1735ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1736ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the minimum number of significant digits that will be 1737ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. This value has no effect unless areSignificantDigitsUsed() 1738ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns true. 1739ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the fewest significant digits that will be shown 1740ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1741ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1742ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMinimumSignificantDigits() const; 1743ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1744ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1745ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the maximum number of significant digits that will be 1746ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. This value has no effect unless areSignificantDigitsUsed() 1747ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns true. 1748ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the most significant digits that will be shown 1749ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1750ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1751ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t getMaximumSignificantDigits() const; 1752ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1753ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1754ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the minimum number of significant digits that will be 1755ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. If <code>min</code> is less than one then it is set 1756ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to one. If the maximum significant digits count is less than 1757ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <code>min</code>, then it is set to <code>min</code>. This 1758ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * value has no effect unless areSignificantDigits() returns true. 175950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param min the fewest significant digits to be shown 1760ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1761ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1762ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setMinimumSignificantDigits(int32_t min); 1763ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1764ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1765ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the maximum number of significant digits that will be 1766ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * displayed. If <code>max</code> is less than one then it is set 1767ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to one. If the minimum significant digits count is greater 1768ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * than <code>max</code>, then it is set to <code>max</code>. 1769ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This value has no effect unless areSignificantDigits() returns 1770ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * true. 177150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param max the most significant digits to be shown 1772ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1773ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1774ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setMaximumSignificantDigits(int32_t max); 1775ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1776ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1777ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns true if significant digits are in use, or false if 1778ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * integer and fraction digit counts are in use. 1779ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return true if significant digits are in use 1780ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1781ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1782ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool areSignificantDigitsUsed() const; 1783ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1784ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1785ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets whether significant digits are in use, or integer and 1786ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * fraction digit counts are in use. 1787ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param useSignificantDigits true to use significant digits, or 1788ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * false to use integer and fraction digit counts 1789ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1790ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1791ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setSignificantDigitsUsed(UBool useSignificantDigits); 1792ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1793ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 1794ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1795ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the currency used to display currency 1796ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * amounts. This takes effect immediately, if this format is a 1797ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency format. If this format is not a currency format, then 1798ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the currency is used if and when this object becomes a 1799ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * currency format through the application of a new pattern. 1800ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param theCurrency a 3-letter ISO code indicating new currency 1801ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to use. It need not be null-terminated. May be the empty 1802ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * string or NULL to indicate no currency. 1803ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ec input-output error code 1804ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 3.0 1805ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1806ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); 1807ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1808ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1809ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Sets the currency used to display currency amounts. See 1810ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * setCurrency(const UChar*, UErrorCode&). 1811ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&). 1812ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1813ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void setCurrency(const UChar* theCurrency); 1814ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1815ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1816ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The resource tags we use to retrieve decimal format data from 1817ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * locale resource bundles. 1818ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @deprecated ICU 3.4. This string has no public purpose. Please don't use it. 1819ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1820ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const char fgNumberPatterns[]; 1821ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1822ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 1823ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1824ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1825ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the class ID for this class. This is useful only for 1826ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * comparing to a return value from getDynamicClassID(). For example: 1827ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * <pre> 1828ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Base* polymorphic_pointer = createPolymorphicObject(); 1829ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . if (polymorphic_pointer->getDynamicClassID() == 1830ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * . Derived::getStaticClassID()) ... 1831ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * </pre> 1832ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for all objects of this class. 1833ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1834ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1835ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(void); 1836ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1837ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1838ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. 1839ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method is to implement a simple version of RTTI, since not all 1840ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * C++ compilers support genuine RTTI. Polymorphic operator==() and 1841ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * clone() methods call this method. 1842ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1843ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return The class ID for this object. All objects of a 1844ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * given class have the same class ID. Objects of 1845ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * other classes have different class IDs. 1846ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.0 1847ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1848ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID(void) const; 1849ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1850ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 185185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 1852ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormat(); // default constructor not implemented 1853ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 185450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t precision() const; 185550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 185650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 185750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Initialize all fields of a new DecimalFormatter. 185850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Common code for use by constructors. 185950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 186050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho void init(); 1861ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1862ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1863ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Do real work of constructing a new DecimalFormat. 1864ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1865ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void construct(UErrorCode& status, 1866ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseErr, 1867ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString* pattern = 0, 1868ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* symbolsToAdopt = 0 1869ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ); 1870ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1871ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1872ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Does the real work of generating a pattern. 1873ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1874ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result Output param which will receive the pattern. 1875ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Previous contents are deleted. 1876ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param localized TRUE return localized pattern. 1877ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return A reference to 'result'. 1878ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1879ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& toPattern(UnicodeString& result, UBool localized) const; 1880ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1881ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1882ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Does the real work of applying a pattern. 1883ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param pattern The pattern to be applied. 1884ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param localized If true, the pattern is localized; else false. 188550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param parseError Struct to recieve information on position 1886ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 1887ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code on 1888ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * exit. If the pattern is invalid, this will be 1889ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * set to a failure result. 1890ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1891ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void applyPattern(const UnicodeString& pattern, 1892ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool localized, 1893ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& parseError, 1894ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 189585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 189650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /* 189750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * similar to applyPattern, but without re-gen affix for currency 189885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 189985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void applyPatternInternally(const UnicodeString& pluralCount, 190085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& pattern, 190185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool localized, 190285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UParseError& parseError, 190385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 190485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 190585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 190685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * only apply pattern without expand affixes 190785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 190885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void applyPatternWithoutExpandAffix(const UnicodeString& pattern, 190985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool localized, 191085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UParseError& parseError, 191185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 191285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 191385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 191485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 191585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * expand affixes (after apply patter) and re-compute fFormatWidth 191685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 191785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void expandAffixAdjustWidth(const UnicodeString* pluralCount); 191885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 191950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1920ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1921ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Do the work of formatting a number, either a double or a long. 1922ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 1923ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param appendTo Output parameter to receive result. 1924ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Result is appended to existing contents. 192550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param handler Records information about field positions. 1926ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param digits the digits to be formatted. 1927ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param isInteger if TRUE format the digits as Integer. 1928ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return Reference to 'appendTo' parameter. 1929ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 1930ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& subformat(UnicodeString& appendTo, 193150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 193250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList& digits, 193350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool isInteger) const; 19347c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 193585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 1936ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void parse(const UnicodeString& text, 1937ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Formattable& result, 1938ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ParsePosition& pos, 1939ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool parseCurrency) const; 1940ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1941ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum { 1942ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fgStatusInfinite, 1943ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru fgStatusLength // Leave last in list. 1944ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru } StatusFlags; 1945ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 194650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool subparse(const UnicodeString& text, 194785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* negPrefix, 194885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* negSuffix, 194985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* posPrefix, 195085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* posSuffix, 195185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool currencyParsing, 195285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 195385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho ParsePosition& parsePosition, 1954ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DigitList& digits, UBool* status, 1955ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 1956ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 195785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Mixed style parsing for currency. 195850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // It parses against the current currency pattern 195985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // using complex affix comparison 196085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // parses against the currency plural patterns using complex affix comparison, 196185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and parses against the current pattern using simple affix comparison. 196250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool parseForCurrency(const UnicodeString& text, 196385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho ParsePosition& parsePosition, 196485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho DigitList& digits, 196585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool* status, 196685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UChar* currency) const; 196785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 1968ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t skipPadding(const UnicodeString& text, int32_t position) const; 1969ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1970ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t compareAffix(const UnicodeString& input, 1971ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t pos, 1972ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isNegative, 1973ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isPrefix, 197485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* affixPat, 197585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool currencyParsing, 197685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 1977ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 197850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1979ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t compareSimpleAffix(const UnicodeString& affix, 1980ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& input, 1981ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t pos); 198250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1983ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t pos); 198450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1985ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); 198650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1987ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t compareComplexAffix(const UnicodeString& affixPat, 1988ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& input, 1989ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t pos, 199085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type, 1991ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar* currency) const; 1992ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1993ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch); 1994ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1995ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str); 1996ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1997ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 1998ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Get a decimal format symbol. 1999ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns a const reference to the symbol string. 2000ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 2001ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2002ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const; 2003ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 200450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t appendAffix(UnicodeString& buf, 200550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho double number, 200650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 200750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool isNegative, 200850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UBool isPrefix) const; 200985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2010ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2011ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Append an affix to the given UnicodeString, using quotes if 2012ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * there are special characters. Single quotes themselves must be 2013ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * escaped in either case. 2014ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 201585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix, 2016ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool localized) const; 2017ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2018ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void appendAffixPattern(UnicodeString& appendTo, 2019ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString* affixPattern, 2020ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& expAffix, UBool localized) const; 2021ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2022ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void expandAffix(const UnicodeString& pattern, 2023ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& affix, 2024ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru double number, 202550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 202685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool doFormat, 202785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString* pluralCount) const; 20287c971b21cb09c84a9bd948bdf2918b727d46992cJean-Baptiste Queru 202985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void expandAffixes(const UnicodeString* pluralCount); 2030ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2031ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void addPadding(UnicodeString& appendTo, 203250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 2033ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t prefixLen, int32_t suffixLen) const; 2034ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2035ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isGroupingPosition(int32_t pos) const; 2036ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2037ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void setCurrencyForSymbols(); 2038ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 203985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // similar to setCurrency without re-compute the affixes for currency. 204085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // If currency changes, the affix pattern for currency is not changed, 204150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // but the affix will be changed. So, affixes need to be 204285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // re-computed in setCurrency(), but not in setCurrencyInternally(). 204385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec); 204485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 204585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // set up currency affix patterns for mix parsing. 204685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // The patterns saved here are the affix patterns of default currency 204785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // pattern and the unique affix patterns of the plural currency patterns. 204885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Those patterns are used by parseForCurrency(). 204985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void setupCurrencyAffixPatterns(UErrorCode& status); 205085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 205185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // set up the currency affixes used in currency plural formatting. 205285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It sets up both fAffixesForCurrency for currency pattern if the current 205350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // pattern contains 3 currency signs, 205485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and it sets up fPluralAffixesForCurrency for currency plural patterns. 205550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho void setupCurrencyAffixes(const UnicodeString& pattern, 205685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool setupForCurrentPattern, 205785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool setupForPluralPattern, 205885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& status); 205950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 206085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // hashtable operations 206185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* initHashForAffixPattern(UErrorCode& status); 206285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* initHashForAffix(UErrorCode& status); 206385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 206485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void deleteHashForAffixPattern(); 206585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void deleteHashForAffix(Hashtable*& table); 206685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 206785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void copyHashForAffixPattern(const Hashtable* source, 206885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* target, UErrorCode& status); 206985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void copyHashForAffix(const Hashtable* source, 207085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* target, UErrorCode& status); 207185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 207250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(int64_t number, 207350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 207450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler) const; 207550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(double number, 207650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 207750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler) const; 207850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& _format(const DigitList &number, 207950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UnicodeString& appendTo, 208050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho FieldPositionHandler& handler, 208150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode &status) const; 208250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 208385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // currency sign count 208485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho enum { 208585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountZero, 208685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInSymbolFormat, 208785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInISOFormat, 208885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho fgCurrencySignCountInPluralFormat 208985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } CurrencySignCount; 209085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2091ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2092ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Constants. 2093ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2094ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2095ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fPositivePrefix; 2096ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fPositiveSuffix; 2097ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fNegativePrefix; 2098ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString fNegativeSuffix; 2099ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fPosPrefixPattern; 2100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fPosSuffixPattern; 2101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fNegPrefixPattern; 2102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString* fNegSuffixPattern; 2103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Formatter for ChoiceFormat-based currency names. If this field 2106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is not null, then delegate to it to format currency symbols. 2107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @since ICU 2.6 2108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ChoiceFormat* fCurrencyChoice; 2110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 211150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList * fMultiplier; // NULL for multiplier of one 2112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGroupingSize; 2113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fGroupingSize2; 2114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fDecimalSeparatorAlwaysShown; 2115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DecimalFormatSymbols* fSymbols; 2116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fUseSignificantDigits; 2118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fMinSignificantDigits; 2119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fMaxSignificantDigits; 2120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fUseExponentialNotation; 2122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int8_t fMinExponentDigits; 2123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool fExponentSignAlwaysShown; 2124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 212550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho DigitList* fRoundingIncrement; // NULL if no rounding increment specified. 2126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ERoundingMode fRoundingMode; 2127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UChar32 fPad; 2129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t fFormatWidth; 2130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru EPadPosition fPadPosition; 2131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 213285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 213385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Following are used for currency format 213485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 213585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // pattern used in this formatter 213685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString fFormatPattern; 213785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // style is only valid when decimal formatter is constructed by 213885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // DecimalFormat(pattern, decimalFormatSymbol, style) 213985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int fStyle; 214085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* 214185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Represents whether this is a currency format, and which 214285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * currency format style. 214385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 0: not currency format type; 214485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 1: currency style -- symbol name, such as "$" for US dollar. 214585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 2: currency style -- ISO name, such as USD for US dollar. 214685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * 3: currency style -- plural long name, such as "US Dollar" for 214785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "1.00 US Dollar", or "US Dollars" for 214885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * "3.00 US Dollars". 214985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 215085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int fCurrencySignCount; 215185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 215285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 215385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* For currency parsing purose, 215450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Need to remember all prefix patterns and suffix patterns of 215550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * every currency format pattern, 215685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * including the pattern of default currecny style 215785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * and plural currency style. And the patterns are set through applyPattern. 215885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 215985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // TODO: innerclass? 216050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 216185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho struct AffixPatternsForCurrency : public UMemory { 216285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative prefix pattern 216385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negPrefixPatternForCurrency; 216485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix pattern 216585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negSuffixPatternForCurrency; 216685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive prefix pattern 216785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posPrefixPatternForCurrency; 216885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive suffix pattern 216985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posSuffixPatternForCurrency; 217085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t patternType; 217150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 217250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho AffixPatternsForCurrency(const UnicodeString& negPrefix, 217385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& negSuffix, 217485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posPrefix, 217585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posSuffix, 217685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int8_t type) { 217785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negPrefixPatternForCurrency = negPrefix; 217885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negSuffixPatternForCurrency = negSuffix; 217985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posPrefixPatternForCurrency = posPrefix; 218085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posSuffixPatternForCurrency = posSuffix; 218185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho patternType = type; 218285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 218385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho }; 218450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 218550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 218685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /* affix for currency formatting when the currency sign in the pattern 218750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * equals to 3, such as the pattern contains 3 currency sign or 218885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * the formatter style is currency plural format style. 218985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 219050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 219185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho struct AffixesForCurrency : public UMemory { 219285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative prefix 219385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negPrefixForCurrency; 219485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix 219585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString negSuffixForCurrency; 219685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive prefix 219785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posPrefixForCurrency; 219885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // positive suffix 219985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UnicodeString posSuffixForCurrency; 220050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 220185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho int32_t formatWidth; 220285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 220385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho AffixesForCurrency(const UnicodeString& negPrefix, 220485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& negSuffix, 220585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posPrefix, 220685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const UnicodeString& posSuffix) { 220785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negPrefixForCurrency = negPrefix; 220885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho negSuffixForCurrency = negSuffix; 220985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posPrefixForCurrency = posPrefix; 221085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho posSuffixForCurrency = posSuffix; 221185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho } 221285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho }; 221350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 221485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 221585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Affix pattern set for currency. 221685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is a set of AffixPatternsForCurrency, 221785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // each element of the set saves the negative prefix pattern, 221850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho // negative suffix pattern, positive prefix pattern, 221985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and positive suffix pattern of a pattern. 222085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is used for currency mixed style parsing. 222185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is actually is a set. 222285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // The set contains the default currency pattern from the locale, 222385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // and the currency plural patterns. 222485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Since it is a set, it does not contain duplicated items. 222585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // For example, if 2 currency plural patterns are the same, only one pattern 222685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // is included in the set. When parsing, we do not check whether the plural 222785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // count match or not. 222885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fAffixPatternsForCurrency; 222985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 223085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Following 2 are affixes for currency. 223185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is a hash map from plural count to AffixesForCurrency. 223285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // AffixesForCurrency saves the negative prefix, 223385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // negative suffix, positive prefix, and positive suffix of a pattern. 223485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // It is used during currency formatting only when the currency sign count 223585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // is 3. In which case, the affixes are getting from here, not 223685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // from the fNegativePrefix etc. 223785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fAffixesForCurrency; // for current pattern 223885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho Hashtable* fPluralAffixesForCurrency; // for plural pattern 223985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 224085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho // Information needed for DecimalFormat to format/parse currency plural. 224185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho CurrencyPluralInfo* fCurrencyPluralInfo; 224285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 2243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprotected: 2244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Returns the currency in effect for this formatter. Subclasses 2247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should override this method as needed. Unlike getCurrency(), 2248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this method should never return "". 2249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @result output parameter for null-terminated result, which must 2250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * have a capacity of at least 4 2251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 2252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; 2254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 225550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** number of integer digits 2256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 225750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 2258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kDoubleIntegerDigits; 225950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** number of fraction digits 2260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.4 226150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 2262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kDoubleFractionDigits; 2263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 2265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * When someone turns on scientific mode, we assume that more than this 2266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * number of digits is due to flipping from some other mode that didn't 2267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * restrict the maximum, and so we force 1 integer digit. We don't bother 2268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * to track and see if someone is using exponential notation with more than 2269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * this number, it wouldn't make sense anyway, and this is just to make sure 2270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that someone turning on scientific mode with default settings doesn't 2271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * end up with lots of zeroes. 2272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable ICU 2.8 2273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 2274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const int32_t kMaxScientificIntegerDigits; 2275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 2276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(const Formattable& obj, 2279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo, 2280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status) const { 2281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Don't use Format:: - use immediate base class only, 2282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // in case immediate base modifies behavior later. 2283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return NumberFormat::format(obj, appendTo, status); 2284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(double number, 2288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const { 2289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition pos(0); 2290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return format(number, appendTo, pos); 2291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline UnicodeString& 2294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::format(int32_t number, 2295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& appendTo) const { 2296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru FieldPosition pos(0); 2297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru return format((int64_t)number, appendTo, pos); 2298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruinline const UnicodeString & 2301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const { 2302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru return fSymbols->getConstSymbol(symbol); 2303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 2304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 2306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_FORMATTING */ 2308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // _DECIMFMT 2310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof 2311