ICU 4.4.2 4.4.2
decimfmt.h
Go to the documentation of this file.
00001 /*
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2010, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 ********************************************************************************
00006 *
00007 * File DECIMFMT.H
00008 *
00009 * Modification History:
00010 *
00011 *   Date        Name        Description
00012 *   02/19/97    aliu        Converted from java.
00013 *   03/20/97    clhuang     Updated per C++ implementation.
00014 *   04/03/97    aliu        Rewrote parsing and formatting completely, and
00015 *                           cleaned up and debugged.  Actually works now.
00016 *   04/17/97    aliu        Changed DigitCount to int per code review.
00017 *   07/10/97    helena      Made ParsePosition a class and get rid of the function
00018 *                           hiding problems.
00019 *   09/09/97    aliu        Ported over support for exponential formats.
00020 *    07/20/98    stephen        Changed documentation
00021 ********************************************************************************
00022 */
00023 
00024 #ifndef DECIMFMT_H
00025 #define DECIMFMT_H
00026 
00027 #include "unicode/utypes.h"
00033 #if !UCONFIG_NO_FORMATTING
00034 
00035 #include "unicode/dcfmtsym.h"
00036 #include "unicode/numfmt.h"
00037 #include "unicode/locid.h"
00038 #include "unicode/fpositer.h"
00039 #include "unicode/stringpiece.h"
00040 
00041 union UHashTok;
00042 
00043 U_NAMESPACE_BEGIN
00044 
00045 class DigitList;
00046 class ChoiceFormat;
00047 class CurrencyPluralInfo;
00048 class Hashtable;
00049 class FieldPositionHandler;
00050 
00639 class U_I18N_API DecimalFormat: public NumberFormat {
00640 public:
00645     enum ERoundingMode {
00646         kRoundCeiling,  
00647         kRoundFloor,    
00648         kRoundDown,     
00649         kRoundUp,       
00650         kRoundHalfEven, 
00652         kRoundHalfDown, 
00654         kRoundHalfUp    
00656         // We don't support ROUND_UNNECESSARY
00657     };
00658 
00663     enum EPadPosition {
00664         kPadBeforePrefix,
00665         kPadAfterPrefix,
00666         kPadBeforeSuffix,
00667         kPadAfterSuffix
00668     };
00669 
00683     DecimalFormat(UErrorCode& status);
00684 
00699     DecimalFormat(const UnicodeString& pattern,
00700                   UErrorCode& status);
00701 
00720     DecimalFormat(  const UnicodeString& pattern,
00721                     DecimalFormatSymbols* symbolsToAdopt,
00722                     UErrorCode& status);
00723 
00736     DecimalFormat(  const UnicodeString& pattern,
00737                     DecimalFormatSymbols* symbolsToAdopt,
00738                     NumberFormat::EStyles style,
00739                     UErrorCode& status);
00740 
00760     DecimalFormat(  const UnicodeString& pattern,
00761                     DecimalFormatSymbols* symbolsToAdopt,
00762                     UParseError& parseError,
00763                     UErrorCode& status);
00781     DecimalFormat(  const UnicodeString& pattern,
00782                     const DecimalFormatSymbols& symbols,
00783                     UErrorCode& status);
00784 
00791     DecimalFormat(const DecimalFormat& source);
00792 
00799     DecimalFormat& operator=(const DecimalFormat& rhs);
00800 
00805     virtual ~DecimalFormat();
00806 
00814     virtual Format* clone(void) const;
00815 
00824     virtual UBool operator==(const Format& other) const;
00825 
00826 
00827     using NumberFormat::format;
00828 
00840     virtual UnicodeString& format(double number,
00841                                   UnicodeString& appendTo,
00842                                   FieldPosition& pos) const;
00843 
00857     virtual UnicodeString& format(double number,
00858                                   UnicodeString& appendTo,
00859                                   FieldPositionIterator* posIter,
00860                                   UErrorCode& status) const;
00861 
00873     virtual UnicodeString& format(int32_t number,
00874                                   UnicodeString& appendTo,
00875                                   FieldPosition& pos) const;
00876 
00890     virtual UnicodeString& format(int32_t number,
00891                                   UnicodeString& appendTo,
00892                                   FieldPositionIterator* posIter,
00893                                   UErrorCode& status) const;
00894 
00906     virtual UnicodeString& format(int64_t number,
00907                                   UnicodeString& appendTo,
00908                                   FieldPosition& pos) const;
00909 
00923     virtual UnicodeString& format(int64_t number,
00924                                   UnicodeString& appendTo,
00925                                   FieldPositionIterator* posIter,
00926                                   UErrorCode& status) const;
00927 
00944     virtual UnicodeString& format(const StringPiece &number,
00945                                   UnicodeString& appendTo,
00946                                   FieldPositionIterator* posIter,
00947                                   UErrorCode& status) const;
00948 
00949 
00965     virtual UnicodeString& format(const DigitList &number,
00966                                   UnicodeString& appendTo,
00967                                   FieldPositionIterator* posIter,
00968                                   UErrorCode& status) const;
00969 
00985     virtual UnicodeString& format(const DigitList &number,
00986                                   UnicodeString& appendTo,
00987                                   FieldPosition& pos,
00988                                   UErrorCode& status) const;
00989 
00990 
01003     virtual UnicodeString& format(const Formattable& obj,
01004                                   UnicodeString& appendTo,
01005                                   FieldPosition& pos,
01006                                   UErrorCode& status) const;
01007 
01019     UnicodeString& format(const Formattable& obj,
01020                           UnicodeString& appendTo,
01021                           UErrorCode& status) const;
01022 
01033     UnicodeString& format(double number,
01034                           UnicodeString& appendTo) const;
01035 
01047     UnicodeString& format(int32_t number,
01048                           UnicodeString& appendTo) const;
01049 
01061     UnicodeString& format(int64_t number,
01062                           UnicodeString& appendTo) const;
01082     virtual void parse(const UnicodeString& text,
01083                        Formattable& result,
01084                        ParsePosition& parsePosition) const;
01085 
01086     // Declare here again to get rid of function hiding problems.
01095     virtual void parse(const UnicodeString& text,
01096                        Formattable& result,
01097                        UErrorCode& status) const;
01098 
01118     virtual Formattable& parseCurrency(const UnicodeString& text,
01119                                        Formattable& result,
01120                                        ParsePosition& pos) const;
01121 
01129     virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
01130 
01137     virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
01138 
01145     virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
01146 
01147 
01154     virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
01155 
01162     virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
01163 
01170     virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
01171 
01172 
01181     UnicodeString& getPositivePrefix(UnicodeString& result) const;
01182 
01190     virtual void setPositivePrefix(const UnicodeString& newValue);
01191 
01200     UnicodeString& getNegativePrefix(UnicodeString& result) const;
01201 
01209     virtual void setNegativePrefix(const UnicodeString& newValue);
01210 
01219     UnicodeString& getPositiveSuffix(UnicodeString& result) const;
01220 
01228     virtual void setPositiveSuffix(const UnicodeString& newValue);
01229 
01238     UnicodeString& getNegativeSuffix(UnicodeString& result) const;
01239 
01247     virtual void setNegativeSuffix(const UnicodeString& newValue);
01248 
01259     int32_t getMultiplier(void) const;
01260 
01271     virtual void setMultiplier(int32_t newValue);
01272 
01282     virtual double getRoundingIncrement(void) const;
01283 
01294     virtual void setRoundingIncrement(double newValue);
01295 
01304     virtual ERoundingMode getRoundingMode(void) const;
01305 
01315     virtual void setRoundingMode(ERoundingMode roundingMode);
01316 
01328     virtual int32_t getFormatWidth(void) const;
01329 
01344     virtual void setFormatWidth(int32_t width);
01345 
01358     virtual UnicodeString getPadCharacterString() const;
01359 
01374     virtual void setPadCharacter(const UnicodeString &padChar);
01375 
01391     virtual EPadPosition getPadPosition(void) const;
01392 
01409     virtual void setPadPosition(EPadPosition padPos);
01410 
01421     virtual UBool isScientificNotation(void);
01422 
01438     virtual void setScientificNotation(UBool useScientific);
01439 
01450     virtual int8_t getMinimumExponentDigits(void) const;
01451 
01464     virtual void setMinimumExponentDigits(int8_t minExpDig);
01465 
01478     virtual UBool isExponentSignAlwaysShown(void);
01479 
01493     virtual void setExponentSignAlwaysShown(UBool expSignAlways);
01494 
01506     int32_t getGroupingSize(void) const;
01507 
01519     virtual void setGroupingSize(int32_t newValue);
01520 
01539     int32_t getSecondaryGroupingSize(void) const;
01540 
01552     virtual void setSecondaryGroupingSize(int32_t newValue);
01553 
01562     UBool isDecimalSeparatorAlwaysShown(void) const;
01563 
01572     virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
01573 
01584     virtual UnicodeString& toPattern(UnicodeString& result) const;
01585 
01596     virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
01597 
01627     virtual void applyPattern(const UnicodeString& pattern,
01628                              UParseError& parseError,
01629                              UErrorCode& status);
01638     virtual void applyPattern(const UnicodeString& pattern,
01639                              UErrorCode& status);
01640 
01671     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01672                                        UParseError& parseError,
01673                                        UErrorCode& status);
01674 
01684     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01685                                        UErrorCode& status);
01686 
01687 
01697     virtual void setMaximumIntegerDigits(int32_t newValue);
01698 
01708     virtual void setMinimumIntegerDigits(int32_t newValue);
01709 
01719     virtual void setMaximumFractionDigits(int32_t newValue);
01720 
01730     virtual void setMinimumFractionDigits(int32_t newValue);
01731 
01739     int32_t getMinimumSignificantDigits() const;
01740 
01748     int32_t getMaximumSignificantDigits() const;
01749 
01759     void setMinimumSignificantDigits(int32_t min);
01760 
01771     void setMaximumSignificantDigits(int32_t max);
01772 
01779     UBool areSignificantDigitsUsed() const;
01780 
01788     void setSignificantDigitsUsed(UBool useSignificantDigits);
01789 
01790  public:
01803     virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
01804 
01810     virtual void setCurrency(const UChar* theCurrency);
01811 
01817     static const char fgNumberPatterns[];
01818 
01819 public:
01820 
01832     static UClassID U_EXPORT2 getStaticClassID(void);
01833 
01845     virtual UClassID getDynamicClassID(void) const;
01846 
01847 private:
01848 
01849     DecimalFormat(); // default constructor not implemented
01850 
01851     int32_t precision() const;
01852 
01857     void init();
01858 
01862     void construct(UErrorCode&               status,
01863                    UParseError&             parseErr,
01864                    const UnicodeString*     pattern = 0,
01865                    DecimalFormatSymbols*    symbolsToAdopt = 0
01866                    );
01867 
01876     UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
01877 
01888     void applyPattern(const UnicodeString& pattern,
01889                             UBool localized,
01890                             UParseError& parseError,
01891                             UErrorCode& status);
01892 
01893     /*
01894      * similar to applyPattern, but without re-gen affix for currency
01895      */
01896     void applyPatternInternally(const UnicodeString& pluralCount,
01897                                 const UnicodeString& pattern,
01898                                 UBool localized,
01899                                 UParseError& parseError,
01900                                 UErrorCode& status);
01901 
01902     /*
01903      * only apply pattern without expand affixes
01904      */
01905     void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
01906                                         UBool localized,
01907                                         UParseError& parseError,
01908                                         UErrorCode& status);
01909 
01910 
01911     /*
01912      * expand affixes (after apply patter) and re-compute fFormatWidth
01913      */
01914     void expandAffixAdjustWidth(const UnicodeString* pluralCount);
01915 
01916 
01927     UnicodeString& subformat(UnicodeString& appendTo,
01928                              FieldPositionHandler& handler,
01929                              DigitList&     digits,
01930                              UBool          isInteger) const;
01931 
01932 
01933     void parse(const UnicodeString& text,
01934                Formattable& result,
01935                ParsePosition& pos,
01936                UBool parseCurrency) const;
01937 
01938     enum {
01939         fgStatusInfinite,
01940         fgStatusLength      // Leave last in list.
01941     } StatusFlags;
01942 
01943     UBool subparse(const UnicodeString& text,
01944                    const UnicodeString* negPrefix,
01945                    const UnicodeString* negSuffix,
01946                    const UnicodeString* posPrefix,
01947                    const UnicodeString* posSuffix,
01948                    UBool currencyParsing,
01949                    int8_t type,
01950                    ParsePosition& parsePosition,
01951                    DigitList& digits, UBool* status,
01952                    UChar* currency) const;
01953 
01954     // Mixed style parsing for currency.
01955     // It parses against the current currency pattern
01956     // using complex affix comparison
01957     // parses against the currency plural patterns using complex affix comparison,
01958     // and parses against the current pattern using simple affix comparison.
01959     UBool parseForCurrency(const UnicodeString& text,
01960                            ParsePosition& parsePosition,
01961                            DigitList& digits,
01962                            UBool* status,
01963                            UChar* currency) const;
01964 
01965     int32_t skipPadding(const UnicodeString& text, int32_t position) const;
01966 
01967     int32_t compareAffix(const UnicodeString& input,
01968                          int32_t pos,
01969                          UBool isNegative,
01970                          UBool isPrefix,
01971                          const UnicodeString* affixPat,
01972                          UBool currencyParsing,
01973                          int8_t type,
01974                          UChar* currency) const;
01975 
01976     static int32_t compareSimpleAffix(const UnicodeString& affix,
01977                                       const UnicodeString& input,
01978                                       int32_t pos);
01979 
01980     static int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t pos);
01981 
01982     static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
01983 
01984     int32_t compareComplexAffix(const UnicodeString& affixPat,
01985                                 const UnicodeString& input,
01986                                 int32_t pos,
01987                                 int8_t type,
01988                                 UChar* currency) const;
01989 
01990     static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
01991 
01992     static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
01993 
01999     inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
02000 
02001     int32_t appendAffix(UnicodeString& buf,
02002                         double number,
02003                         FieldPositionHandler& handler,
02004                         UBool isNegative,
02005                         UBool isPrefix) const;
02006 
02012     void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
02013                             UBool localized) const;
02014 
02015     void appendAffixPattern(UnicodeString& appendTo,
02016                             const UnicodeString* affixPattern,
02017                             const UnicodeString& expAffix, UBool localized) const;
02018 
02019     void expandAffix(const UnicodeString& pattern,
02020                      UnicodeString& affix,
02021                      double number,
02022                      FieldPositionHandler& handler,
02023                      UBool doFormat,
02024                      const UnicodeString* pluralCount) const;
02025 
02026     void expandAffixes(const UnicodeString* pluralCount);
02027 
02028     void addPadding(UnicodeString& appendTo,
02029                     FieldPositionHandler& handler,
02030                     int32_t prefixLen, int32_t suffixLen) const;
02031 
02032     UBool isGroupingPosition(int32_t pos) const;
02033 
02034     void setCurrencyForSymbols();
02035 
02036     // similar to setCurrency without re-compute the affixes for currency.
02037     // If currency changes, the affix pattern for currency is not changed,
02038     // but the affix will be changed. So, affixes need to be
02039     // re-computed in setCurrency(), but not in setCurrencyInternally().
02040     virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
02041 
02042     // set up currency affix patterns for mix parsing.
02043     // The patterns saved here are the affix patterns of default currency
02044     // pattern and the unique affix patterns of the plural currency patterns.
02045     // Those patterns are used by parseForCurrency().
02046     void setupCurrencyAffixPatterns(UErrorCode& status);
02047 
02048     // set up the currency affixes used in currency plural formatting.
02049     // It sets up both fAffixesForCurrency for currency pattern if the current
02050     // pattern contains 3 currency signs,
02051     // and it sets up fPluralAffixesForCurrency for currency plural patterns.
02052     void setupCurrencyAffixes(const UnicodeString& pattern,
02053                               UBool setupForCurrentPattern,
02054                               UBool setupForPluralPattern,
02055                               UErrorCode& status);
02056 
02057     // hashtable operations
02058     Hashtable* initHashForAffixPattern(UErrorCode& status);
02059     Hashtable* initHashForAffix(UErrorCode& status);
02060 
02061     void deleteHashForAffixPattern();
02062     void deleteHashForAffix(Hashtable*& table);
02063 
02064     void copyHashForAffixPattern(const Hashtable* source,
02065                                  Hashtable* target, UErrorCode& status);
02066     void copyHashForAffix(const Hashtable* source,
02067                           Hashtable* target, UErrorCode& status);
02068 
02069     UnicodeString& _format(int64_t number,
02070                            UnicodeString& appendTo,
02071                            FieldPositionHandler& handler) const;
02072     UnicodeString& _format(double number,
02073                            UnicodeString& appendTo,
02074                            FieldPositionHandler& handler) const;
02075     UnicodeString& _format(const DigitList &number,
02076                            UnicodeString& appendTo,
02077                            FieldPositionHandler& handler,
02078                            UErrorCode &status) const;
02079 
02080     // currency sign count
02081     enum {
02082         fgCurrencySignCountZero,
02083         fgCurrencySignCountInSymbolFormat,
02084         fgCurrencySignCountInISOFormat,
02085         fgCurrencySignCountInPluralFormat
02086     } CurrencySignCount;
02087 
02092     UnicodeString           fPositivePrefix;
02093     UnicodeString           fPositiveSuffix;
02094     UnicodeString           fNegativePrefix;
02095     UnicodeString           fNegativeSuffix;
02096     UnicodeString*          fPosPrefixPattern;
02097     UnicodeString*          fPosSuffixPattern;
02098     UnicodeString*          fNegPrefixPattern;
02099     UnicodeString*          fNegSuffixPattern;
02100 
02106     ChoiceFormat*           fCurrencyChoice;
02107 
02108     DigitList *             fMultiplier;   // NULL for multiplier of one
02109     int32_t                 fGroupingSize;
02110     int32_t                 fGroupingSize2;
02111     UBool                   fDecimalSeparatorAlwaysShown;
02112     DecimalFormatSymbols*   fSymbols;
02113 
02114     UBool                   fUseSignificantDigits;
02115     int32_t                 fMinSignificantDigits;
02116     int32_t                 fMaxSignificantDigits;
02117 
02118     UBool                   fUseExponentialNotation;
02119     int8_t                  fMinExponentDigits;
02120     UBool                   fExponentSignAlwaysShown;
02121 
02122     DigitList*              fRoundingIncrement;  // NULL if no rounding increment specified.
02123     ERoundingMode           fRoundingMode;
02124 
02125     UChar32                 fPad;
02126     int32_t                 fFormatWidth;
02127     EPadPosition            fPadPosition;
02128 
02129     /*
02130      * Following are used for currency format
02131      */
02132     // pattern used in this formatter
02133     UnicodeString fFormatPattern;
02134     // style is only valid when decimal formatter is constructed by
02135     // DecimalFormat(pattern, decimalFormatSymbol, style)
02136     int fStyle;
02137     /*
02138      * Represents whether this is a currency format, and which
02139      * currency format style.
02140      * 0: not currency format type;
02141      * 1: currency style -- symbol name, such as "$" for US dollar.
02142      * 2: currency style -- ISO name, such as USD for US dollar.
02143      * 3: currency style -- plural long name, such as "US Dollar" for
02144      *                      "1.00 US Dollar", or "US Dollars" for
02145      *                      "3.00 US Dollars".
02146      */
02147     int fCurrencySignCount;
02148 
02149 
02150     /* For currency parsing purose,
02151      * Need to remember all prefix patterns and suffix patterns of
02152      * every currency format pattern,
02153      * including the pattern of default currecny style
02154      * and plural currency style. And the patterns are set through applyPattern.
02155      */
02156     // TODO: innerclass?
02157         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02158     struct AffixPatternsForCurrency : public UMemory {
02159         // negative prefix pattern
02160         UnicodeString negPrefixPatternForCurrency;
02161         // negative suffix pattern
02162         UnicodeString negSuffixPatternForCurrency;
02163         // positive prefix pattern
02164         UnicodeString posPrefixPatternForCurrency;
02165         // positive suffix pattern
02166         UnicodeString posSuffixPatternForCurrency;
02167         int8_t patternType;
02168 
02169         AffixPatternsForCurrency(const UnicodeString& negPrefix,
02170                                  const UnicodeString& negSuffix,
02171                                  const UnicodeString& posPrefix,
02172                                  const UnicodeString& posSuffix,
02173                                  int8_t type) {
02174             negPrefixPatternForCurrency = negPrefix;
02175             negSuffixPatternForCurrency = negSuffix;
02176             posPrefixPatternForCurrency = posPrefix;
02177             posSuffixPatternForCurrency = posSuffix;
02178             patternType = type;
02179         }
02180     };
02181     */
02182 
02183     /* affix for currency formatting when the currency sign in the pattern
02184      * equals to 3, such as the pattern contains 3 currency sign or
02185      * the formatter style is currency plural format style.
02186      */
02187         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02188     struct AffixesForCurrency : public UMemory {
02189         // negative prefix
02190         UnicodeString negPrefixForCurrency;
02191         // negative suffix
02192         UnicodeString negSuffixForCurrency;
02193         // positive prefix
02194         UnicodeString posPrefixForCurrency;
02195         // positive suffix
02196         UnicodeString posSuffixForCurrency;
02197 
02198         int32_t formatWidth;
02199 
02200         AffixesForCurrency(const UnicodeString& negPrefix,
02201                            const UnicodeString& negSuffix,
02202                            const UnicodeString& posPrefix,
02203                            const UnicodeString& posSuffix) {
02204             negPrefixForCurrency = negPrefix;
02205             negSuffixForCurrency = negSuffix;
02206             posPrefixForCurrency = posPrefix;
02207             posSuffixForCurrency = posSuffix;
02208         }
02209     };
02210     */
02211 
02212     // Affix pattern set for currency.
02213     // It is a set of AffixPatternsForCurrency,
02214     // each element of the set saves the negative prefix pattern,
02215     // negative suffix pattern, positive prefix pattern,
02216     // and positive suffix  pattern of a pattern.
02217     // It is used for currency mixed style parsing.
02218     // It is actually is a set.
02219     // The set contains the default currency pattern from the locale,
02220     // and the currency plural patterns.
02221     // Since it is a set, it does not contain duplicated items.
02222     // For example, if 2 currency plural patterns are the same, only one pattern
02223     // is included in the set. When parsing, we do not check whether the plural
02224     // count match or not.
02225     Hashtable* fAffixPatternsForCurrency;
02226 
02227     // Following 2 are affixes for currency.
02228     // It is a hash map from plural count to AffixesForCurrency.
02229     // AffixesForCurrency saves the negative prefix,
02230     // negative suffix, positive prefix, and positive suffix of a pattern.
02231     // It is used during currency formatting only when the currency sign count
02232     // is 3. In which case, the affixes are getting from here, not
02233     // from the fNegativePrefix etc.
02234     Hashtable* fAffixesForCurrency;  // for current pattern
02235     Hashtable* fPluralAffixesForCurrency;  // for plural pattern
02236 
02237     // Information needed for DecimalFormat to format/parse currency plural.
02238     CurrencyPluralInfo* fCurrencyPluralInfo;
02239 
02240 protected:
02241 
02250     virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
02251 
02255     static const int32_t  kDoubleIntegerDigits;
02259     static const int32_t  kDoubleFractionDigits;
02260 
02271     static const int32_t  kMaxScientificIntegerDigits;
02272 };
02273 
02274 inline UnicodeString&
02275 DecimalFormat::format(const Formattable& obj,
02276                       UnicodeString& appendTo,
02277                       UErrorCode& status) const {
02278     // Don't use Format:: - use immediate base class only,
02279     // in case immediate base modifies behavior later.
02280     return NumberFormat::format(obj, appendTo, status);
02281 }
02282 
02283 inline UnicodeString&
02284 DecimalFormat::format(double number,
02285                       UnicodeString& appendTo) const {
02286     FieldPosition pos(0);
02287     return format(number, appendTo, pos);
02288 }
02289 
02290 inline UnicodeString&
02291 DecimalFormat::format(int32_t number,
02292                       UnicodeString& appendTo) const {
02293     FieldPosition pos(0);
02294     return format((int64_t)number, appendTo, pos);
02295 }
02296 
02297 inline const UnicodeString &
02298 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
02299     return fSymbols->getConstSymbol(symbol);
02300 }
02301 
02302 U_NAMESPACE_END
02303 
02304 #endif /* #if !UCONFIG_NO_FORMATTING */
02305 
02306 #endif // _DECIMFMT
02307 //eof
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines