ICU 49.1.1  49.1.1
decimfmt.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
6 *
7 * File DECIMFMT.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 02/19/97 aliu Converted from java.
13 * 03/20/97 clhuang Updated per C++ implementation.
14 * 04/03/97 aliu Rewrote parsing and formatting completely, and
15 * cleaned up and debugged. Actually works now.
16 * 04/17/97 aliu Changed DigitCount to int per code review.
17 * 07/10/97 helena Made ParsePosition a class and get rid of the function
18 * hiding problems.
19 * 09/09/97 aliu Ported over support for exponential formats.
20 * 07/20/98 stephen Changed documentation
21 ********************************************************************************
22 */
23 
24 #ifndef DECIMFMT_H
25 #define DECIMFMT_H
26 
27 #include "unicode/utypes.h"
33 #if !UCONFIG_NO_FORMATTING
34 
35 #include "unicode/dcfmtsym.h"
36 #include "unicode/numfmt.h"
37 #include "unicode/locid.h"
38 #include "unicode/fpositer.h"
39 #include "unicode/stringpiece.h"
40 #include "unicode/curramt.h"
41 
43 
44 class DigitList;
45 class ChoiceFormat;
46 class CurrencyPluralInfo;
47 class Hashtable;
48 class UnicodeSet;
49 class FieldPositionHandler;
50 
645 public:
655  kRoundHalfEven,
657  kRoundHalfDown,
659  kRoundHalfUp,
665  kRoundUnnecessary
666  };
667 
673  kPadBeforePrefix,
674  kPadAfterPrefix,
675  kPadBeforeSuffix,
676  kPadAfterSuffix
677  };
678 
692  DecimalFormat(UErrorCode& status);
693 
708  DecimalFormat(const UnicodeString& pattern,
709  UErrorCode& status);
710 
729  DecimalFormat( const UnicodeString& pattern,
730  DecimalFormatSymbols* symbolsToAdopt,
731  UErrorCode& status);
732 
733 #ifndef U_HIDE_INTERNAL_API
734 
746  DecimalFormat( const UnicodeString& pattern,
747  DecimalFormatSymbols* symbolsToAdopt,
748  UNumberFormatStyle style,
749  UErrorCode& status);
750 #endif /* U_HIDE_INTERNAL_API */
751 
771  DecimalFormat( const UnicodeString& pattern,
772  DecimalFormatSymbols* symbolsToAdopt,
773  UParseError& parseError,
774  UErrorCode& status);
792  DecimalFormat( const UnicodeString& pattern,
793  const DecimalFormatSymbols& symbols,
794  UErrorCode& status);
795 
802  DecimalFormat(const DecimalFormat& source);
803 
811 
816  virtual ~DecimalFormat();
817 
825  virtual Format* clone(void) const;
826 
835  virtual UBool operator==(const Format& other) const;
836 
837 
838  using NumberFormat::format;
839 
851  virtual UnicodeString& format(double number,
852  UnicodeString& appendTo,
853  FieldPosition& pos) const;
854 
868  virtual UnicodeString& format(double number,
869  UnicodeString& appendTo,
870  FieldPositionIterator* posIter,
871  UErrorCode& status) const;
872 
884  virtual UnicodeString& format(int32_t number,
885  UnicodeString& appendTo,
886  FieldPosition& pos) const;
887 
901  virtual UnicodeString& format(int32_t number,
902  UnicodeString& appendTo,
903  FieldPositionIterator* posIter,
904  UErrorCode& status) const;
905 
917  virtual UnicodeString& format(int64_t number,
918  UnicodeString& appendTo,
919  FieldPosition& pos) const;
920 
934  virtual UnicodeString& format(int64_t number,
935  UnicodeString& appendTo,
936  FieldPositionIterator* posIter,
937  UErrorCode& status) const;
938 
955  virtual UnicodeString& format(const StringPiece &number,
956  UnicodeString& appendTo,
957  FieldPositionIterator* posIter,
958  UErrorCode& status) const;
959 
960 
976  virtual UnicodeString& format(const DigitList &number,
977  UnicodeString& appendTo,
978  FieldPositionIterator* posIter,
979  UErrorCode& status) const;
980 
996  virtual UnicodeString& format(const DigitList &number,
997  UnicodeString& appendTo,
998  FieldPosition& pos,
999  UErrorCode& status) const;
1000 
1001 
1014  virtual UnicodeString& format(const Formattable& obj,
1015  UnicodeString& appendTo,
1016  FieldPosition& pos,
1017  UErrorCode& status) const;
1018 
1030  UnicodeString& format(const Formattable& obj,
1031  UnicodeString& appendTo,
1032  UErrorCode& status) const;
1033 
1044  UnicodeString& format(double number,
1045  UnicodeString& appendTo) const;
1046 
1058  UnicodeString& format(int32_t number,
1059  UnicodeString& appendTo) const;
1060 
1072  UnicodeString& format(int64_t number,
1073  UnicodeString& appendTo) const;
1093  virtual void parse(const UnicodeString& text,
1094  Formattable& result,
1095  ParsePosition& parsePosition) const;
1096 
1097  // Declare here again to get rid of function hiding problems.
1106  virtual void parse(const UnicodeString& text,
1107  Formattable& result,
1108  UErrorCode& status) const;
1109 
1110 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
1130  virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
1131  ParsePosition& pos) const;
1132 
1140  virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1141 
1148  virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1149 
1156  virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1157 
1158 
1165  virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
1166 
1173  virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
1174 
1181  virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
1182 
1183 
1192  UnicodeString& getPositivePrefix(UnicodeString& result) const;
1193 
1201  virtual void setPositivePrefix(const UnicodeString& newValue);
1202 
1211  UnicodeString& getNegativePrefix(UnicodeString& result) const;
1212 
1220  virtual void setNegativePrefix(const UnicodeString& newValue);
1221 
1230  UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1231 
1239  virtual void setPositiveSuffix(const UnicodeString& newValue);
1240 
1249  UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1250 
1258  virtual void setNegativeSuffix(const UnicodeString& newValue);
1259 
1270  int32_t getMultiplier(void) const;
1271 
1282  virtual void setMultiplier(int32_t newValue);
1283 
1293  virtual double getRoundingIncrement(void) const;
1294 
1305  virtual void setRoundingIncrement(double newValue);
1306 
1315  virtual ERoundingMode getRoundingMode(void) const;
1316 
1325  virtual void setRoundingMode(ERoundingMode roundingMode);
1326 
1338  virtual int32_t getFormatWidth(void) const;
1339 
1354  virtual void setFormatWidth(int32_t width);
1355 
1368  virtual UnicodeString getPadCharacterString() const;
1369 
1384  virtual void setPadCharacter(const UnicodeString &padChar);
1385 
1401  virtual EPadPosition getPadPosition(void) const;
1402 
1419  virtual void setPadPosition(EPadPosition padPos);
1420 
1431  virtual UBool isScientificNotation(void);
1432 
1448  virtual void setScientificNotation(UBool useScientific);
1449 
1460  virtual int8_t getMinimumExponentDigits(void) const;
1461 
1474  virtual void setMinimumExponentDigits(int8_t minExpDig);
1475 
1488  virtual UBool isExponentSignAlwaysShown(void);
1489 
1503  virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1504 
1516  int32_t getGroupingSize(void) const;
1517 
1529  virtual void setGroupingSize(int32_t newValue);
1530 
1549  int32_t getSecondaryGroupingSize(void) const;
1550 
1562  virtual void setSecondaryGroupingSize(int32_t newValue);
1563 
1572  UBool isDecimalSeparatorAlwaysShown(void) const;
1573 
1582  virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1583 
1594  virtual UnicodeString& toPattern(UnicodeString& result) const;
1595 
1606  virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
1607 
1637  virtual void applyPattern(const UnicodeString& pattern,
1638  UParseError& parseError,
1639  UErrorCode& status);
1648  virtual void applyPattern(const UnicodeString& pattern,
1649  UErrorCode& status);
1650 
1681  virtual void applyLocalizedPattern(const UnicodeString& pattern,
1682  UParseError& parseError,
1683  UErrorCode& status);
1684 
1694  virtual void applyLocalizedPattern(const UnicodeString& pattern,
1695  UErrorCode& status);
1696 
1697 
1707  virtual void setMaximumIntegerDigits(int32_t newValue);
1708 
1718  virtual void setMinimumIntegerDigits(int32_t newValue);
1719 
1729  virtual void setMaximumFractionDigits(int32_t newValue);
1730 
1740  virtual void setMinimumFractionDigits(int32_t newValue);
1741 
1749  int32_t getMinimumSignificantDigits() const;
1750 
1758  int32_t getMaximumSignificantDigits() const;
1759 
1769  void setMinimumSignificantDigits(int32_t min);
1770 
1781  void setMaximumSignificantDigits(int32_t max);
1782 
1789  UBool areSignificantDigitsUsed() const;
1790 
1798  void setSignificantDigitsUsed(UBool useSignificantDigits);
1799 
1800  public:
1813  virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
1814 
1820  virtual void setCurrency(const UChar* theCurrency);
1821 
1827  static const char fgNumberPatterns[];
1828 
1829 public:
1830 
1842  static UClassID U_EXPORT2 getStaticClassID(void);
1843 
1855  virtual UClassID getDynamicClassID(void) const;
1856 
1857 private:
1858 
1859  DecimalFormat(); // default constructor not implemented
1860 
1861  int32_t precision() const;
1862 
1867  void init();
1868 
1872  void construct(UErrorCode& status,
1873  UParseError& parseErr,
1874  const UnicodeString* pattern = 0,
1875  DecimalFormatSymbols* symbolsToAdopt = 0
1876  );
1877 
1886  UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
1887 
1898  void applyPattern(const UnicodeString& pattern,
1899  UBool localized,
1900  UParseError& parseError,
1901  UErrorCode& status);
1902 
1903  /*
1904  * similar to applyPattern, but without re-gen affix for currency
1905  */
1906  void applyPatternInternally(const UnicodeString& pluralCount,
1907  const UnicodeString& pattern,
1908  UBool localized,
1909  UParseError& parseError,
1910  UErrorCode& status);
1911 
1912  /*
1913  * only apply pattern without expand affixes
1914  */
1915  void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
1916  UBool localized,
1917  UParseError& parseError,
1918  UErrorCode& status);
1919 
1920 
1921  /*
1922  * expand affixes (after apply patter) and re-compute fFormatWidth
1923  */
1924  void expandAffixAdjustWidth(const UnicodeString* pluralCount);
1925 
1926 
1937  UnicodeString& subformat(UnicodeString& appendTo,
1938  FieldPositionHandler& handler,
1939  DigitList& digits,
1940  UBool isInteger) const;
1941 
1942 
1943  void parse(const UnicodeString& text,
1944  Formattable& result,
1945  ParsePosition& pos,
1946  UChar* currency) const;
1947 
1948  enum {
1949  fgStatusInfinite,
1950  fgStatusLength // Leave last in list.
1951  } StatusFlags;
1952 
1953  UBool subparse(const UnicodeString& text,
1954  const UnicodeString* negPrefix,
1955  const UnicodeString* negSuffix,
1956  const UnicodeString* posPrefix,
1957  const UnicodeString* posSuffix,
1958  UBool currencyParsing,
1959  int8_t type,
1960  ParsePosition& parsePosition,
1961  DigitList& digits, UBool* status,
1962  UChar* currency) const;
1963 
1964  // Mixed style parsing for currency.
1965  // It parses against the current currency pattern
1966  // using complex affix comparison
1967  // parses against the currency plural patterns using complex affix comparison,
1968  // and parses against the current pattern using simple affix comparison.
1969  UBool parseForCurrency(const UnicodeString& text,
1970  ParsePosition& parsePosition,
1971  DigitList& digits,
1972  UBool* status,
1973  UChar* currency) const;
1974 
1975  int32_t skipPadding(const UnicodeString& text, int32_t position) const;
1976 
1977  int32_t compareAffix(const UnicodeString& input,
1978  int32_t pos,
1979  UBool isNegative,
1980  UBool isPrefix,
1981  const UnicodeString* affixPat,
1982  UBool currencyParsing,
1983  int8_t type,
1984  UChar* currency) const;
1985 
1986  static int32_t compareSimpleAffix(const UnicodeString& affix,
1987  const UnicodeString& input,
1988  int32_t pos,
1989  UBool lenient);
1990 
1991  static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
1992 
1993  static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
1994 
1995  int32_t compareComplexAffix(const UnicodeString& affixPat,
1996  const UnicodeString& input,
1997  int32_t pos,
1998  int8_t type,
1999  UChar* currency) const;
2000 
2001  static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
2002 
2003  static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
2004 
2005  static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
2006  UnicodeSet *sset, UChar32 schar);
2007 
2008  static UBool matchDecimal(UChar32 symbolChar,
2009  UBool sawDecimal, UChar32 sawDecimalChar,
2010  const UnicodeSet *sset, UChar32 schar);
2011 
2012  static UBool matchGrouping(UChar32 groupingChar,
2013  UBool sawGrouping, UChar32 sawGroupingChar,
2014  const UnicodeSet *sset,
2015  UChar32 decimalChar, const UnicodeSet *decimalSet,
2016  UChar32 schar);
2017 
2023  inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
2024 
2025  int32_t appendAffix(UnicodeString& buf,
2026  double number,
2027  FieldPositionHandler& handler,
2028  UBool isNegative,
2029  UBool isPrefix) const;
2030 
2036  void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
2037  UBool localized) const;
2038 
2039  void appendAffixPattern(UnicodeString& appendTo,
2040  const UnicodeString* affixPattern,
2041  const UnicodeString& expAffix, UBool localized) const;
2042 
2043  void expandAffix(const UnicodeString& pattern,
2044  UnicodeString& affix,
2045  double number,
2046  FieldPositionHandler& handler,
2047  UBool doFormat,
2048  const UnicodeString* pluralCount) const;
2049 
2050  void expandAffixes(const UnicodeString* pluralCount);
2051 
2052  void addPadding(UnicodeString& appendTo,
2053  FieldPositionHandler& handler,
2054  int32_t prefixLen, int32_t suffixLen) const;
2055 
2056  UBool isGroupingPosition(int32_t pos) const;
2057 
2058  void setCurrencyForSymbols();
2059 
2060  // similar to setCurrency without re-compute the affixes for currency.
2061  // If currency changes, the affix pattern for currency is not changed,
2062  // but the affix will be changed. So, affixes need to be
2063  // re-computed in setCurrency(), but not in setCurrencyInternally().
2064  virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
2065 
2066  // set up currency affix patterns for mix parsing.
2067  // The patterns saved here are the affix patterns of default currency
2068  // pattern and the unique affix patterns of the plural currency patterns.
2069  // Those patterns are used by parseForCurrency().
2070  void setupCurrencyAffixPatterns(UErrorCode& status);
2071 
2072  // set up the currency affixes used in currency plural formatting.
2073  // It sets up both fAffixesForCurrency for currency pattern if the current
2074  // pattern contains 3 currency signs,
2075  // and it sets up fPluralAffixesForCurrency for currency plural patterns.
2076  void setupCurrencyAffixes(const UnicodeString& pattern,
2077  UBool setupForCurrentPattern,
2078  UBool setupForPluralPattern,
2079  UErrorCode& status);
2080 
2081  // hashtable operations
2082  Hashtable* initHashForAffixPattern(UErrorCode& status);
2083  Hashtable* initHashForAffix(UErrorCode& status);
2084 
2085  void deleteHashForAffixPattern();
2086  void deleteHashForAffix(Hashtable*& table);
2087 
2088  void copyHashForAffixPattern(const Hashtable* source,
2089  Hashtable* target, UErrorCode& status);
2090  void copyHashForAffix(const Hashtable* source,
2091  Hashtable* target, UErrorCode& status);
2092 
2093  UnicodeString& _format(int64_t number,
2094  UnicodeString& appendTo,
2095  FieldPositionHandler& handler) const;
2096  UnicodeString& _format(double number,
2097  UnicodeString& appendTo,
2098  FieldPositionHandler& handler) const;
2099  UnicodeString& _format(const DigitList &number,
2100  UnicodeString& appendTo,
2101  FieldPositionHandler& handler,
2102  UErrorCode &status) const;
2103 
2104  // currency sign count
2105  enum {
2106  fgCurrencySignCountZero,
2107  fgCurrencySignCountInSymbolFormat,
2108  fgCurrencySignCountInISOFormat,
2109  fgCurrencySignCountInPluralFormat
2110  } CurrencySignCount;
2111 
2116  UnicodeString fPositivePrefix;
2117  UnicodeString fPositiveSuffix;
2118  UnicodeString fNegativePrefix;
2119  UnicodeString fNegativeSuffix;
2120  UnicodeString* fPosPrefixPattern;
2121  UnicodeString* fPosSuffixPattern;
2122  UnicodeString* fNegPrefixPattern;
2123  UnicodeString* fNegSuffixPattern;
2124 
2130  ChoiceFormat* fCurrencyChoice;
2131 
2132  DigitList * fMultiplier; // NULL for multiplier of one
2133  int32_t fGroupingSize;
2134  int32_t fGroupingSize2;
2135  UBool fDecimalSeparatorAlwaysShown;
2136  DecimalFormatSymbols* fSymbols;
2137 
2138  UBool fUseSignificantDigits;
2139  int32_t fMinSignificantDigits;
2140  int32_t fMaxSignificantDigits;
2141 
2142  UBool fUseExponentialNotation;
2143  int8_t fMinExponentDigits;
2144  UBool fExponentSignAlwaysShown;
2145 
2146  DigitList* fRoundingIncrement; // NULL if no rounding increment specified.
2147  ERoundingMode fRoundingMode;
2148 
2149  UChar32 fPad;
2150  int32_t fFormatWidth;
2151  EPadPosition fPadPosition;
2152 
2153  /*
2154  * Following are used for currency format
2155  */
2156  // pattern used in this formatter
2157  UnicodeString fFormatPattern;
2158  // style is only valid when decimal formatter is constructed by
2159  // DecimalFormat(pattern, decimalFormatSymbol, style)
2160  int fStyle;
2161  /*
2162  * Represents whether this is a currency format, and which
2163  * currency format style.
2164  * 0: not currency format type;
2165  * 1: currency style -- symbol name, such as "$" for US dollar.
2166  * 2: currency style -- ISO name, such as USD for US dollar.
2167  * 3: currency style -- plural long name, such as "US Dollar" for
2168  * "1.00 US Dollar", or "US Dollars" for
2169  * "3.00 US Dollars".
2170  */
2171  int fCurrencySignCount;
2172 
2173 
2174  /* For currency parsing purose,
2175  * Need to remember all prefix patterns and suffix patterns of
2176  * every currency format pattern,
2177  * including the pattern of default currecny style
2178  * and plural currency style. And the patterns are set through applyPattern.
2179  */
2180  // TODO: innerclass?
2181  /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
2182  struct AffixPatternsForCurrency : public UMemory {
2183  // negative prefix pattern
2184  UnicodeString negPrefixPatternForCurrency;
2185  // negative suffix pattern
2186  UnicodeString negSuffixPatternForCurrency;
2187  // positive prefix pattern
2188  UnicodeString posPrefixPatternForCurrency;
2189  // positive suffix pattern
2190  UnicodeString posSuffixPatternForCurrency;
2191  int8_t patternType;
2192 
2193  AffixPatternsForCurrency(const UnicodeString& negPrefix,
2194  const UnicodeString& negSuffix,
2195  const UnicodeString& posPrefix,
2196  const UnicodeString& posSuffix,
2197  int8_t type) {
2198  negPrefixPatternForCurrency = negPrefix;
2199  negSuffixPatternForCurrency = negSuffix;
2200  posPrefixPatternForCurrency = posPrefix;
2201  posSuffixPatternForCurrency = posSuffix;
2202  patternType = type;
2203  }
2204  };
2205  */
2206 
2207  /* affix for currency formatting when the currency sign in the pattern
2208  * equals to 3, such as the pattern contains 3 currency sign or
2209  * the formatter style is currency plural format style.
2210  */
2211  /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
2212  struct AffixesForCurrency : public UMemory {
2213  // negative prefix
2214  UnicodeString negPrefixForCurrency;
2215  // negative suffix
2216  UnicodeString negSuffixForCurrency;
2217  // positive prefix
2218  UnicodeString posPrefixForCurrency;
2219  // positive suffix
2220  UnicodeString posSuffixForCurrency;
2221 
2222  int32_t formatWidth;
2223 
2224  AffixesForCurrency(const UnicodeString& negPrefix,
2225  const UnicodeString& negSuffix,
2226  const UnicodeString& posPrefix,
2227  const UnicodeString& posSuffix) {
2228  negPrefixForCurrency = negPrefix;
2229  negSuffixForCurrency = negSuffix;
2230  posPrefixForCurrency = posPrefix;
2231  posSuffixForCurrency = posSuffix;
2232  }
2233  };
2234  */
2235 
2236  // Affix pattern set for currency.
2237  // It is a set of AffixPatternsForCurrency,
2238  // each element of the set saves the negative prefix pattern,
2239  // negative suffix pattern, positive prefix pattern,
2240  // and positive suffix pattern of a pattern.
2241  // It is used for currency mixed style parsing.
2242  // It is actually is a set.
2243  // The set contains the default currency pattern from the locale,
2244  // and the currency plural patterns.
2245  // Since it is a set, it does not contain duplicated items.
2246  // For example, if 2 currency plural patterns are the same, only one pattern
2247  // is included in the set. When parsing, we do not check whether the plural
2248  // count match or not.
2249  Hashtable* fAffixPatternsForCurrency;
2250 
2251  // Following 2 are affixes for currency.
2252  // It is a hash map from plural count to AffixesForCurrency.
2253  // AffixesForCurrency saves the negative prefix,
2254  // negative suffix, positive prefix, and positive suffix of a pattern.
2255  // It is used during currency formatting only when the currency sign count
2256  // is 3. In which case, the affixes are getting from here, not
2257  // from the fNegativePrefix etc.
2258  Hashtable* fAffixesForCurrency; // for current pattern
2259  Hashtable* fPluralAffixesForCurrency; // for plural pattern
2260 
2261  // Information needed for DecimalFormat to format/parse currency plural.
2262  CurrencyPluralInfo* fCurrencyPluralInfo;
2263 
2264 protected:
2265 
2274  virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
2275 
2279  static const int32_t kDoubleIntegerDigits;
2283  static const int32_t kDoubleFractionDigits;
2284 
2295  static const int32_t kMaxScientificIntegerDigits;
2296 };
2297 
2298 inline UnicodeString&
2300  UnicodeString& appendTo,
2301  UErrorCode& status) const {
2302  // Don't use Format:: - use immediate base class only,
2303  // in case immediate base modifies behavior later.
2304  return NumberFormat::format(obj, appendTo, status);
2305 }
2306 
2307 inline UnicodeString&
2309  UnicodeString& appendTo) const {
2310  FieldPosition pos(0);
2311  return format(number, appendTo, pos);
2312 }
2313 
2314 inline UnicodeString&
2315 DecimalFormat::format(int32_t number,
2316  UnicodeString& appendTo) const {
2317  FieldPosition pos(0);
2318  return format((int64_t)number, appendTo, pos);
2319 }
2320 
2321 #ifndef U_HIDE_INTERNAL_API
2322 inline const UnicodeString &
2323 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
2324  return fSymbols->getConstSymbol(symbol);
2325 }
2326 #endif
2327 
2329 
2330 #endif /* #if !UCONFIG_NO_FORMATTING */
2331 
2332 #endif // _DECIMFMT
2333 //eof