ICU 4.8 4.8
decimfmt.h
Go to the documentation of this file.
00001 /*
00002 ********************************************************************************
00003 *   Copyright (C) 1997-2011, 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 UnicodeSet;
00050 class FieldPositionHandler;
00051 
00645 class U_I18N_API DecimalFormat: public NumberFormat {
00646 public:
00651     enum ERoundingMode {
00652         kRoundCeiling,  
00653         kRoundFloor,    
00654         kRoundDown,     
00655         kRoundUp,       
00656         kRoundHalfEven, 
00658         kRoundHalfDown, 
00660         kRoundHalfUp,   
00666         kRoundUnnecessary 
00667     };
00668 
00673     enum EPadPosition {
00674         kPadBeforePrefix,
00675         kPadAfterPrefix,
00676         kPadBeforeSuffix,
00677         kPadAfterSuffix
00678     };
00679 
00693     DecimalFormat(UErrorCode& status);
00694 
00709     DecimalFormat(const UnicodeString& pattern,
00710                   UErrorCode& status);
00711 
00730     DecimalFormat(  const UnicodeString& pattern,
00731                     DecimalFormatSymbols* symbolsToAdopt,
00732                     UErrorCode& status);
00733 
00746     DecimalFormat(  const UnicodeString& pattern,
00747                     DecimalFormatSymbols* symbolsToAdopt,
00748                     UNumberFormatStyle style,
00749                     UErrorCode& status);
00750 
00770     DecimalFormat(  const UnicodeString& pattern,
00771                     DecimalFormatSymbols* symbolsToAdopt,
00772                     UParseError& parseError,
00773                     UErrorCode& status);
00791     DecimalFormat(  const UnicodeString& pattern,
00792                     const DecimalFormatSymbols& symbols,
00793                     UErrorCode& status);
00794 
00801     DecimalFormat(const DecimalFormat& source);
00802 
00809     DecimalFormat& operator=(const DecimalFormat& rhs);
00810 
00815     virtual ~DecimalFormat();
00816 
00824     virtual Format* clone(void) const;
00825 
00834     virtual UBool operator==(const Format& other) const;
00835 
00836 
00837     using NumberFormat::format;
00838 
00850     virtual UnicodeString& format(double number,
00851                                   UnicodeString& appendTo,
00852                                   FieldPosition& pos) const;
00853 
00867     virtual UnicodeString& format(double number,
00868                                   UnicodeString& appendTo,
00869                                   FieldPositionIterator* posIter,
00870                                   UErrorCode& status) const;
00871 
00883     virtual UnicodeString& format(int32_t number,
00884                                   UnicodeString& appendTo,
00885                                   FieldPosition& pos) const;
00886 
00900     virtual UnicodeString& format(int32_t number,
00901                                   UnicodeString& appendTo,
00902                                   FieldPositionIterator* posIter,
00903                                   UErrorCode& status) const;
00904 
00916     virtual UnicodeString& format(int64_t number,
00917                                   UnicodeString& appendTo,
00918                                   FieldPosition& pos) const;
00919 
00933     virtual UnicodeString& format(int64_t number,
00934                                   UnicodeString& appendTo,
00935                                   FieldPositionIterator* posIter,
00936                                   UErrorCode& status) const;
00937 
00954     virtual UnicodeString& format(const StringPiece &number,
00955                                   UnicodeString& appendTo,
00956                                   FieldPositionIterator* posIter,
00957                                   UErrorCode& status) const;
00958 
00959 
00975     virtual UnicodeString& format(const DigitList &number,
00976                                   UnicodeString& appendTo,
00977                                   FieldPositionIterator* posIter,
00978                                   UErrorCode& status) const;
00979 
00995     virtual UnicodeString& format(const DigitList &number,
00996                                   UnicodeString& appendTo,
00997                                   FieldPosition& pos,
00998                                   UErrorCode& status) const;
00999 
01000 
01013     virtual UnicodeString& format(const Formattable& obj,
01014                                   UnicodeString& appendTo,
01015                                   FieldPosition& pos,
01016                                   UErrorCode& status) const;
01017 
01029     UnicodeString& format(const Formattable& obj,
01030                           UnicodeString& appendTo,
01031                           UErrorCode& status) const;
01032 
01043     UnicodeString& format(double number,
01044                           UnicodeString& appendTo) const;
01045 
01057     UnicodeString& format(int32_t number,
01058                           UnicodeString& appendTo) const;
01059 
01071     UnicodeString& format(int64_t number,
01072                           UnicodeString& appendTo) const;
01092     virtual void parse(const UnicodeString& text,
01093                        Formattable& result,
01094                        ParsePosition& parsePosition) const;
01095 
01096     // Declare here again to get rid of function hiding problems.
01105     virtual void parse(const UnicodeString& text,
01106                        Formattable& result,
01107                        UErrorCode& status) const;
01108 
01128     virtual Formattable& parseCurrency(const UnicodeString& text,
01129                                        Formattable& result,
01130                                        ParsePosition& pos) const;
01131 
01139     virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
01140 
01147     virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
01148 
01155     virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
01156 
01157 
01164     virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
01165 
01172     virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
01173 
01180     virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
01181 
01182 
01191     UnicodeString& getPositivePrefix(UnicodeString& result) const;
01192 
01200     virtual void setPositivePrefix(const UnicodeString& newValue);
01201 
01210     UnicodeString& getNegativePrefix(UnicodeString& result) const;
01211 
01219     virtual void setNegativePrefix(const UnicodeString& newValue);
01220 
01229     UnicodeString& getPositiveSuffix(UnicodeString& result) const;
01230 
01238     virtual void setPositiveSuffix(const UnicodeString& newValue);
01239 
01248     UnicodeString& getNegativeSuffix(UnicodeString& result) const;
01249 
01257     virtual void setNegativeSuffix(const UnicodeString& newValue);
01258 
01269     int32_t getMultiplier(void) const;
01270 
01281     virtual void setMultiplier(int32_t newValue);
01282 
01292     virtual double getRoundingIncrement(void) const;
01293 
01304     virtual void setRoundingIncrement(double newValue);
01305 
01314     virtual ERoundingMode getRoundingMode(void) const;
01315 
01324     virtual void setRoundingMode(ERoundingMode roundingMode);
01325 
01337     virtual int32_t getFormatWidth(void) const;
01338 
01353     virtual void setFormatWidth(int32_t width);
01354 
01367     virtual UnicodeString getPadCharacterString() const;
01368 
01383     virtual void setPadCharacter(const UnicodeString &padChar);
01384 
01400     virtual EPadPosition getPadPosition(void) const;
01401 
01418     virtual void setPadPosition(EPadPosition padPos);
01419 
01430     virtual UBool isScientificNotation(void);
01431 
01447     virtual void setScientificNotation(UBool useScientific);
01448 
01459     virtual int8_t getMinimumExponentDigits(void) const;
01460 
01473     virtual void setMinimumExponentDigits(int8_t minExpDig);
01474 
01487     virtual UBool isExponentSignAlwaysShown(void);
01488 
01502     virtual void setExponentSignAlwaysShown(UBool expSignAlways);
01503 
01515     int32_t getGroupingSize(void) const;
01516 
01528     virtual void setGroupingSize(int32_t newValue);
01529 
01548     int32_t getSecondaryGroupingSize(void) const;
01549 
01561     virtual void setSecondaryGroupingSize(int32_t newValue);
01562 
01571     UBool isDecimalSeparatorAlwaysShown(void) const;
01572 
01581     virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
01582 
01593     virtual UnicodeString& toPattern(UnicodeString& result) const;
01594 
01605     virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
01606 
01636     virtual void applyPattern(const UnicodeString& pattern,
01637                              UParseError& parseError,
01638                              UErrorCode& status);
01647     virtual void applyPattern(const UnicodeString& pattern,
01648                              UErrorCode& status);
01649 
01680     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01681                                        UParseError& parseError,
01682                                        UErrorCode& status);
01683 
01693     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01694                                        UErrorCode& status);
01695 
01696 
01706     virtual void setMaximumIntegerDigits(int32_t newValue);
01707 
01717     virtual void setMinimumIntegerDigits(int32_t newValue);
01718 
01728     virtual void setMaximumFractionDigits(int32_t newValue);
01729 
01739     virtual void setMinimumFractionDigits(int32_t newValue);
01740 
01748     int32_t getMinimumSignificantDigits() const;
01749 
01757     int32_t getMaximumSignificantDigits() const;
01758 
01768     void setMinimumSignificantDigits(int32_t min);
01769 
01780     void setMaximumSignificantDigits(int32_t max);
01781 
01788     UBool areSignificantDigitsUsed() const;
01789 
01797     void setSignificantDigitsUsed(UBool useSignificantDigits);
01798 
01799  public:
01812     virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
01813 
01819     virtual void setCurrency(const UChar* theCurrency);
01820 
01826     static const char fgNumberPatterns[];
01827 
01828 public:
01829 
01841     static UClassID U_EXPORT2 getStaticClassID(void);
01842 
01854     virtual UClassID getDynamicClassID(void) const;
01855 
01856 private:
01857 
01858     DecimalFormat(); // default constructor not implemented
01859 
01860     int32_t precision() const;
01861 
01866     void init();
01867 
01871     void construct(UErrorCode&               status,
01872                    UParseError&             parseErr,
01873                    const UnicodeString*     pattern = 0,
01874                    DecimalFormatSymbols*    symbolsToAdopt = 0
01875                    );
01876 
01885     UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
01886 
01897     void applyPattern(const UnicodeString& pattern,
01898                             UBool localized,
01899                             UParseError& parseError,
01900                             UErrorCode& status);
01901 
01902     /*
01903      * similar to applyPattern, but without re-gen affix for currency
01904      */
01905     void applyPatternInternally(const UnicodeString& pluralCount,
01906                                 const UnicodeString& pattern,
01907                                 UBool localized,
01908                                 UParseError& parseError,
01909                                 UErrorCode& status);
01910 
01911     /*
01912      * only apply pattern without expand affixes
01913      */
01914     void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
01915                                         UBool localized,
01916                                         UParseError& parseError,
01917                                         UErrorCode& status);
01918 
01919 
01920     /*
01921      * expand affixes (after apply patter) and re-compute fFormatWidth
01922      */
01923     void expandAffixAdjustWidth(const UnicodeString* pluralCount);
01924 
01925 
01936     UnicodeString& subformat(UnicodeString& appendTo,
01937                              FieldPositionHandler& handler,
01938                              DigitList&     digits,
01939                              UBool          isInteger) const;
01940 
01941 
01942     void parse(const UnicodeString& text,
01943                Formattable& result,
01944                ParsePosition& pos,
01945                UBool parseCurrency) const;
01946 
01947     enum {
01948         fgStatusInfinite,
01949         fgStatusLength      // Leave last in list.
01950     } StatusFlags;
01951 
01952     UBool subparse(const UnicodeString& text,
01953                    const UnicodeString* negPrefix,
01954                    const UnicodeString* negSuffix,
01955                    const UnicodeString* posPrefix,
01956                    const UnicodeString* posSuffix,
01957                    UBool currencyParsing,
01958                    int8_t type,
01959                    ParsePosition& parsePosition,
01960                    DigitList& digits, UBool* status,
01961                    UChar* currency) const;
01962 
01963     // Mixed style parsing for currency.
01964     // It parses against the current currency pattern
01965     // using complex affix comparison
01966     // parses against the currency plural patterns using complex affix comparison,
01967     // and parses against the current pattern using simple affix comparison.
01968     UBool parseForCurrency(const UnicodeString& text,
01969                            ParsePosition& parsePosition,
01970                            DigitList& digits,
01971                            UBool* status,
01972                            UChar* currency) const;
01973 
01974     int32_t skipPadding(const UnicodeString& text, int32_t position) const;
01975 
01976     int32_t compareAffix(const UnicodeString& input,
01977                          int32_t pos,
01978                          UBool isNegative,
01979                          UBool isPrefix,
01980                          const UnicodeString* affixPat,
01981                          UBool currencyParsing,
01982                          int8_t type,
01983                          UChar* currency) const;
01984 
01985     static int32_t compareSimpleAffix(const UnicodeString& affix,
01986                                       const UnicodeString& input,
01987                                       int32_t pos,
01988                                       UBool lenient);
01989 
01990     static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
01991 
01992     static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
01993 
01994     int32_t compareComplexAffix(const UnicodeString& affixPat,
01995                                 const UnicodeString& input,
01996                                 int32_t pos,
01997                                 int8_t type,
01998                                 UChar* currency) const;
01999 
02000     static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
02001 
02002     static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
02003 
02004     static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
02005                              UnicodeSet *sset, UChar32 schar);
02006 
02012     inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
02013 
02014     int32_t appendAffix(UnicodeString& buf,
02015                         double number,
02016                         FieldPositionHandler& handler,
02017                         UBool isNegative,
02018                         UBool isPrefix) const;
02019 
02025     void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
02026                             UBool localized) const;
02027 
02028     void appendAffixPattern(UnicodeString& appendTo,
02029                             const UnicodeString* affixPattern,
02030                             const UnicodeString& expAffix, UBool localized) const;
02031 
02032     void expandAffix(const UnicodeString& pattern,
02033                      UnicodeString& affix,
02034                      double number,
02035                      FieldPositionHandler& handler,
02036                      UBool doFormat,
02037                      const UnicodeString* pluralCount) const;
02038 
02039     void expandAffixes(const UnicodeString* pluralCount);
02040 
02041     void addPadding(UnicodeString& appendTo,
02042                     FieldPositionHandler& handler,
02043                     int32_t prefixLen, int32_t suffixLen) const;
02044 
02045     UBool isGroupingPosition(int32_t pos) const;
02046 
02047     void setCurrencyForSymbols();
02048 
02049     // similar to setCurrency without re-compute the affixes for currency.
02050     // If currency changes, the affix pattern for currency is not changed,
02051     // but the affix will be changed. So, affixes need to be
02052     // re-computed in setCurrency(), but not in setCurrencyInternally().
02053     virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
02054 
02055     // set up currency affix patterns for mix parsing.
02056     // The patterns saved here are the affix patterns of default currency
02057     // pattern and the unique affix patterns of the plural currency patterns.
02058     // Those patterns are used by parseForCurrency().
02059     void setupCurrencyAffixPatterns(UErrorCode& status);
02060 
02061     // set up the currency affixes used in currency plural formatting.
02062     // It sets up both fAffixesForCurrency for currency pattern if the current
02063     // pattern contains 3 currency signs,
02064     // and it sets up fPluralAffixesForCurrency for currency plural patterns.
02065     void setupCurrencyAffixes(const UnicodeString& pattern,
02066                               UBool setupForCurrentPattern,
02067                               UBool setupForPluralPattern,
02068                               UErrorCode& status);
02069 
02070     // hashtable operations
02071     Hashtable* initHashForAffixPattern(UErrorCode& status);
02072     Hashtable* initHashForAffix(UErrorCode& status);
02073 
02074     void deleteHashForAffixPattern();
02075     void deleteHashForAffix(Hashtable*& table);
02076 
02077     void copyHashForAffixPattern(const Hashtable* source,
02078                                  Hashtable* target, UErrorCode& status);
02079     void copyHashForAffix(const Hashtable* source,
02080                           Hashtable* target, UErrorCode& status);
02081 
02082     UnicodeString& _format(int64_t number,
02083                            UnicodeString& appendTo,
02084                            FieldPositionHandler& handler) const;
02085     UnicodeString& _format(double number,
02086                            UnicodeString& appendTo,
02087                            FieldPositionHandler& handler) const;
02088     UnicodeString& _format(const DigitList &number,
02089                            UnicodeString& appendTo,
02090                            FieldPositionHandler& handler,
02091                            UErrorCode &status) const;
02092 
02093     // currency sign count
02094     enum {
02095         fgCurrencySignCountZero,
02096         fgCurrencySignCountInSymbolFormat,
02097         fgCurrencySignCountInISOFormat,
02098         fgCurrencySignCountInPluralFormat
02099     } CurrencySignCount;
02100 
02105     UnicodeString           fPositivePrefix;
02106     UnicodeString           fPositiveSuffix;
02107     UnicodeString           fNegativePrefix;
02108     UnicodeString           fNegativeSuffix;
02109     UnicodeString*          fPosPrefixPattern;
02110     UnicodeString*          fPosSuffixPattern;
02111     UnicodeString*          fNegPrefixPattern;
02112     UnicodeString*          fNegSuffixPattern;
02113 
02119     ChoiceFormat*           fCurrencyChoice;
02120 
02121     DigitList *             fMultiplier;   // NULL for multiplier of one
02122     int32_t                 fGroupingSize;
02123     int32_t                 fGroupingSize2;
02124     UBool                   fDecimalSeparatorAlwaysShown;
02125     DecimalFormatSymbols*   fSymbols;
02126 
02127     UBool                   fUseSignificantDigits;
02128     int32_t                 fMinSignificantDigits;
02129     int32_t                 fMaxSignificantDigits;
02130 
02131     UBool                   fUseExponentialNotation;
02132     int8_t                  fMinExponentDigits;
02133     UBool                   fExponentSignAlwaysShown;
02134 
02135     DigitList*              fRoundingIncrement;  // NULL if no rounding increment specified.
02136     ERoundingMode           fRoundingMode;
02137 
02138     UChar32                 fPad;
02139     int32_t                 fFormatWidth;
02140     EPadPosition            fPadPosition;
02141 
02142     /*
02143      * Following are used for currency format
02144      */
02145     // pattern used in this formatter
02146     UnicodeString fFormatPattern;
02147     // style is only valid when decimal formatter is constructed by
02148     // DecimalFormat(pattern, decimalFormatSymbol, style)
02149     int fStyle;
02150     /*
02151      * Represents whether this is a currency format, and which
02152      * currency format style.
02153      * 0: not currency format type;
02154      * 1: currency style -- symbol name, such as "$" for US dollar.
02155      * 2: currency style -- ISO name, such as USD for US dollar.
02156      * 3: currency style -- plural long name, such as "US Dollar" for
02157      *                      "1.00 US Dollar", or "US Dollars" for
02158      *                      "3.00 US Dollars".
02159      */
02160     int fCurrencySignCount;
02161 
02162 
02163     /* For currency parsing purose,
02164      * Need to remember all prefix patterns and suffix patterns of
02165      * every currency format pattern,
02166      * including the pattern of default currecny style
02167      * and plural currency style. And the patterns are set through applyPattern.
02168      */
02169     // TODO: innerclass?
02170         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02171     struct AffixPatternsForCurrency : public UMemory {
02172         // negative prefix pattern
02173         UnicodeString negPrefixPatternForCurrency;
02174         // negative suffix pattern
02175         UnicodeString negSuffixPatternForCurrency;
02176         // positive prefix pattern
02177         UnicodeString posPrefixPatternForCurrency;
02178         // positive suffix pattern
02179         UnicodeString posSuffixPatternForCurrency;
02180         int8_t patternType;
02181 
02182         AffixPatternsForCurrency(const UnicodeString& negPrefix,
02183                                  const UnicodeString& negSuffix,
02184                                  const UnicodeString& posPrefix,
02185                                  const UnicodeString& posSuffix,
02186                                  int8_t type) {
02187             negPrefixPatternForCurrency = negPrefix;
02188             negSuffixPatternForCurrency = negSuffix;
02189             posPrefixPatternForCurrency = posPrefix;
02190             posSuffixPatternForCurrency = posSuffix;
02191             patternType = type;
02192         }
02193     };
02194     */
02195 
02196     /* affix for currency formatting when the currency sign in the pattern
02197      * equals to 3, such as the pattern contains 3 currency sign or
02198      * the formatter style is currency plural format style.
02199      */
02200         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02201     struct AffixesForCurrency : public UMemory {
02202         // negative prefix
02203         UnicodeString negPrefixForCurrency;
02204         // negative suffix
02205         UnicodeString negSuffixForCurrency;
02206         // positive prefix
02207         UnicodeString posPrefixForCurrency;
02208         // positive suffix
02209         UnicodeString posSuffixForCurrency;
02210 
02211         int32_t formatWidth;
02212 
02213         AffixesForCurrency(const UnicodeString& negPrefix,
02214                            const UnicodeString& negSuffix,
02215                            const UnicodeString& posPrefix,
02216                            const UnicodeString& posSuffix) {
02217             negPrefixForCurrency = negPrefix;
02218             negSuffixForCurrency = negSuffix;
02219             posPrefixForCurrency = posPrefix;
02220             posSuffixForCurrency = posSuffix;
02221         }
02222     };
02223     */
02224 
02225     // Affix pattern set for currency.
02226     // It is a set of AffixPatternsForCurrency,
02227     // each element of the set saves the negative prefix pattern,
02228     // negative suffix pattern, positive prefix pattern,
02229     // and positive suffix  pattern of a pattern.
02230     // It is used for currency mixed style parsing.
02231     // It is actually is a set.
02232     // The set contains the default currency pattern from the locale,
02233     // and the currency plural patterns.
02234     // Since it is a set, it does not contain duplicated items.
02235     // For example, if 2 currency plural patterns are the same, only one pattern
02236     // is included in the set. When parsing, we do not check whether the plural
02237     // count match or not.
02238     Hashtable* fAffixPatternsForCurrency;
02239 
02240     // Following 2 are affixes for currency.
02241     // It is a hash map from plural count to AffixesForCurrency.
02242     // AffixesForCurrency saves the negative prefix,
02243     // negative suffix, positive prefix, and positive suffix of a pattern.
02244     // It is used during currency formatting only when the currency sign count
02245     // is 3. In which case, the affixes are getting from here, not
02246     // from the fNegativePrefix etc.
02247     Hashtable* fAffixesForCurrency;  // for current pattern
02248     Hashtable* fPluralAffixesForCurrency;  // for plural pattern
02249 
02250     // Information needed for DecimalFormat to format/parse currency plural.
02251     CurrencyPluralInfo* fCurrencyPluralInfo;
02252 
02253 protected:
02254 
02263     virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
02264 
02268     static const int32_t  kDoubleIntegerDigits;
02272     static const int32_t  kDoubleFractionDigits;
02273 
02284     static const int32_t  kMaxScientificIntegerDigits;
02285 };
02286 
02287 inline UnicodeString&
02288 DecimalFormat::format(const Formattable& obj,
02289                       UnicodeString& appendTo,
02290                       UErrorCode& status) const {
02291     // Don't use Format:: - use immediate base class only,
02292     // in case immediate base modifies behavior later.
02293     return NumberFormat::format(obj, appendTo, status);
02294 }
02295 
02296 inline UnicodeString&
02297 DecimalFormat::format(double number,
02298                       UnicodeString& appendTo) const {
02299     FieldPosition pos(0);
02300     return format(number, appendTo, pos);
02301 }
02302 
02303 inline UnicodeString&
02304 DecimalFormat::format(int32_t number,
02305                       UnicodeString& appendTo) const {
02306     FieldPosition pos(0);
02307     return format((int64_t)number, appendTo, pos);
02308 }
02309 
02310 inline const UnicodeString &
02311 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
02312     return fSymbols->getConstSymbol(symbol);
02313 }
02314 
02315 U_NAMESPACE_END
02316 
02317 #endif /* #if !UCONFIG_NO_FORMATTING */
02318 
02319 #endif // _DECIMFMT
02320 //eof
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines