ICU 4.6  4.6
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 
00643 class U_I18N_API DecimalFormat: public NumberFormat {
00644 public:
00649     enum ERoundingMode {
00650         kRoundCeiling,  
00651         kRoundFloor,    
00652         kRoundDown,     
00653         kRoundUp,       
00654         kRoundHalfEven, 
00656         kRoundHalfDown, 
00658         kRoundHalfUp    
00660         // We don't support ROUND_UNNECESSARY
00661     };
00662 
00667     enum EPadPosition {
00668         kPadBeforePrefix,
00669         kPadAfterPrefix,
00670         kPadBeforeSuffix,
00671         kPadAfterSuffix
00672     };
00673 
00687     DecimalFormat(UErrorCode& status);
00688 
00703     DecimalFormat(const UnicodeString& pattern,
00704                   UErrorCode& status);
00705 
00724     DecimalFormat(  const UnicodeString& pattern,
00725                     DecimalFormatSymbols* symbolsToAdopt,
00726                     UErrorCode& status);
00727 
00740     DecimalFormat(  const UnicodeString& pattern,
00741                     DecimalFormatSymbols* symbolsToAdopt,
00742                     NumberFormat::EStyles style,
00743                     UErrorCode& status);
00744 
00764     DecimalFormat(  const UnicodeString& pattern,
00765                     DecimalFormatSymbols* symbolsToAdopt,
00766                     UParseError& parseError,
00767                     UErrorCode& status);
00785     DecimalFormat(  const UnicodeString& pattern,
00786                     const DecimalFormatSymbols& symbols,
00787                     UErrorCode& status);
00788 
00795     DecimalFormat(const DecimalFormat& source);
00796 
00803     DecimalFormat& operator=(const DecimalFormat& rhs);
00804 
00809     virtual ~DecimalFormat();
00810 
00818     virtual Format* clone(void) const;
00819 
00828     virtual UBool operator==(const Format& other) const;
00829 
00830 
00831     using NumberFormat::format;
00832 
00844     virtual UnicodeString& format(double number,
00845                                   UnicodeString& appendTo,
00846                                   FieldPosition& pos) const;
00847 
00861     virtual UnicodeString& format(double number,
00862                                   UnicodeString& appendTo,
00863                                   FieldPositionIterator* posIter,
00864                                   UErrorCode& status) const;
00865 
00877     virtual UnicodeString& format(int32_t number,
00878                                   UnicodeString& appendTo,
00879                                   FieldPosition& pos) const;
00880 
00894     virtual UnicodeString& format(int32_t number,
00895                                   UnicodeString& appendTo,
00896                                   FieldPositionIterator* posIter,
00897                                   UErrorCode& status) const;
00898 
00910     virtual UnicodeString& format(int64_t number,
00911                                   UnicodeString& appendTo,
00912                                   FieldPosition& pos) const;
00913 
00927     virtual UnicodeString& format(int64_t number,
00928                                   UnicodeString& appendTo,
00929                                   FieldPositionIterator* posIter,
00930                                   UErrorCode& status) const;
00931 
00948     virtual UnicodeString& format(const StringPiece &number,
00949                                   UnicodeString& appendTo,
00950                                   FieldPositionIterator* posIter,
00951                                   UErrorCode& status) const;
00952 
00953 
00969     virtual UnicodeString& format(const DigitList &number,
00970                                   UnicodeString& appendTo,
00971                                   FieldPositionIterator* posIter,
00972                                   UErrorCode& status) const;
00973 
00989     virtual UnicodeString& format(const DigitList &number,
00990                                   UnicodeString& appendTo,
00991                                   FieldPosition& pos,
00992                                   UErrorCode& status) const;
00993 
00994 
01007     virtual UnicodeString& format(const Formattable& obj,
01008                                   UnicodeString& appendTo,
01009                                   FieldPosition& pos,
01010                                   UErrorCode& status) const;
01011 
01023     UnicodeString& format(const Formattable& obj,
01024                           UnicodeString& appendTo,
01025                           UErrorCode& status) const;
01026 
01037     UnicodeString& format(double number,
01038                           UnicodeString& appendTo) const;
01039 
01051     UnicodeString& format(int32_t number,
01052                           UnicodeString& appendTo) const;
01053 
01065     UnicodeString& format(int64_t number,
01066                           UnicodeString& appendTo) const;
01086     virtual void parse(const UnicodeString& text,
01087                        Formattable& result,
01088                        ParsePosition& parsePosition) const;
01089 
01090     // Declare here again to get rid of function hiding problems.
01099     virtual void parse(const UnicodeString& text,
01100                        Formattable& result,
01101                        UErrorCode& status) const;
01102 
01122     virtual Formattable& parseCurrency(const UnicodeString& text,
01123                                        Formattable& result,
01124                                        ParsePosition& pos) const;
01125 
01133     virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
01134 
01141     virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
01142 
01149     virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
01150 
01151 
01158     virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
01159 
01166     virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
01167 
01174     virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
01175 
01176 
01185     UnicodeString& getPositivePrefix(UnicodeString& result) const;
01186 
01194     virtual void setPositivePrefix(const UnicodeString& newValue);
01195 
01204     UnicodeString& getNegativePrefix(UnicodeString& result) const;
01205 
01213     virtual void setNegativePrefix(const UnicodeString& newValue);
01214 
01223     UnicodeString& getPositiveSuffix(UnicodeString& result) const;
01224 
01232     virtual void setPositiveSuffix(const UnicodeString& newValue);
01233 
01242     UnicodeString& getNegativeSuffix(UnicodeString& result) const;
01243 
01251     virtual void setNegativeSuffix(const UnicodeString& newValue);
01252 
01263     int32_t getMultiplier(void) const;
01264 
01275     virtual void setMultiplier(int32_t newValue);
01276 
01286     virtual double getRoundingIncrement(void) const;
01287 
01298     virtual void setRoundingIncrement(double newValue);
01299 
01308     virtual ERoundingMode getRoundingMode(void) const;
01309 
01318     virtual void setRoundingMode(ERoundingMode roundingMode);
01319 
01331     virtual int32_t getFormatWidth(void) const;
01332 
01347     virtual void setFormatWidth(int32_t width);
01348 
01361     virtual UnicodeString getPadCharacterString() const;
01362 
01377     virtual void setPadCharacter(const UnicodeString &padChar);
01378 
01394     virtual EPadPosition getPadPosition(void) const;
01395 
01412     virtual void setPadPosition(EPadPosition padPos);
01413 
01424     virtual UBool isScientificNotation(void);
01425 
01441     virtual void setScientificNotation(UBool useScientific);
01442 
01453     virtual int8_t getMinimumExponentDigits(void) const;
01454 
01467     virtual void setMinimumExponentDigits(int8_t minExpDig);
01468 
01481     virtual UBool isExponentSignAlwaysShown(void);
01482 
01496     virtual void setExponentSignAlwaysShown(UBool expSignAlways);
01497 
01509     int32_t getGroupingSize(void) const;
01510 
01522     virtual void setGroupingSize(int32_t newValue);
01523 
01542     int32_t getSecondaryGroupingSize(void) const;
01543 
01555     virtual void setSecondaryGroupingSize(int32_t newValue);
01556 
01565     UBool isDecimalSeparatorAlwaysShown(void) const;
01566 
01575     virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
01576 
01587     virtual UnicodeString& toPattern(UnicodeString& result) const;
01588 
01599     virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
01600 
01630     virtual void applyPattern(const UnicodeString& pattern,
01631                              UParseError& parseError,
01632                              UErrorCode& status);
01641     virtual void applyPattern(const UnicodeString& pattern,
01642                              UErrorCode& status);
01643 
01674     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01675                                        UParseError& parseError,
01676                                        UErrorCode& status);
01677 
01687     virtual void applyLocalizedPattern(const UnicodeString& pattern,
01688                                        UErrorCode& status);
01689 
01690 
01700     virtual void setMaximumIntegerDigits(int32_t newValue);
01701 
01711     virtual void setMinimumIntegerDigits(int32_t newValue);
01712 
01722     virtual void setMaximumFractionDigits(int32_t newValue);
01723 
01733     virtual void setMinimumFractionDigits(int32_t newValue);
01734 
01742     int32_t getMinimumSignificantDigits() const;
01743 
01751     int32_t getMaximumSignificantDigits() const;
01752 
01762     void setMinimumSignificantDigits(int32_t min);
01763 
01774     void setMaximumSignificantDigits(int32_t max);
01775 
01782     UBool areSignificantDigitsUsed() const;
01783 
01791     void setSignificantDigitsUsed(UBool useSignificantDigits);
01792 
01793  public:
01806     virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
01807 
01813     virtual void setCurrency(const UChar* theCurrency);
01814 
01820     static const char fgNumberPatterns[];
01821 
01822 public:
01823 
01835     static UClassID U_EXPORT2 getStaticClassID(void);
01836 
01848     virtual UClassID getDynamicClassID(void) const;
01849 
01850 private:
01851 
01852     DecimalFormat(); // default constructor not implemented
01853 
01854     int32_t precision() const;
01855 
01860     void init();
01861 
01865     void construct(UErrorCode&               status,
01866                    UParseError&             parseErr,
01867                    const UnicodeString*     pattern = 0,
01868                    DecimalFormatSymbols*    symbolsToAdopt = 0
01869                    );
01870 
01879     UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
01880 
01891     void applyPattern(const UnicodeString& pattern,
01892                             UBool localized,
01893                             UParseError& parseError,
01894                             UErrorCode& status);
01895 
01896     /*
01897      * similar to applyPattern, but without re-gen affix for currency
01898      */
01899     void applyPatternInternally(const UnicodeString& pluralCount,
01900                                 const UnicodeString& pattern,
01901                                 UBool localized,
01902                                 UParseError& parseError,
01903                                 UErrorCode& status);
01904 
01905     /*
01906      * only apply pattern without expand affixes
01907      */
01908     void applyPatternWithoutExpandAffix(const UnicodeString& pattern,
01909                                         UBool localized,
01910                                         UParseError& parseError,
01911                                         UErrorCode& status);
01912 
01913 
01914     /*
01915      * expand affixes (after apply patter) and re-compute fFormatWidth
01916      */
01917     void expandAffixAdjustWidth(const UnicodeString* pluralCount);
01918 
01919 
01930     UnicodeString& subformat(UnicodeString& appendTo,
01931                              FieldPositionHandler& handler,
01932                              DigitList&     digits,
01933                              UBool          isInteger) const;
01934 
01935 
01936     void parse(const UnicodeString& text,
01937                Formattable& result,
01938                ParsePosition& pos,
01939                UBool parseCurrency) const;
01940 
01941     enum {
01942         fgStatusInfinite,
01943         fgStatusLength      // Leave last in list.
01944     } StatusFlags;
01945 
01946     UBool subparse(const UnicodeString& text,
01947                    const UnicodeString* negPrefix,
01948                    const UnicodeString* negSuffix,
01949                    const UnicodeString* posPrefix,
01950                    const UnicodeString* posSuffix,
01951                    UBool currencyParsing,
01952                    int8_t type,
01953                    ParsePosition& parsePosition,
01954                    DigitList& digits, UBool* status,
01955                    UChar* currency) const;
01956 
01957     // Mixed style parsing for currency.
01958     // It parses against the current currency pattern
01959     // using complex affix comparison
01960     // parses against the currency plural patterns using complex affix comparison,
01961     // and parses against the current pattern using simple affix comparison.
01962     UBool parseForCurrency(const UnicodeString& text,
01963                            ParsePosition& parsePosition,
01964                            DigitList& digits,
01965                            UBool* status,
01966                            UChar* currency) const;
01967 
01968     int32_t skipPadding(const UnicodeString& text, int32_t position) const;
01969 
01970     int32_t compareAffix(const UnicodeString& input,
01971                          int32_t pos,
01972                          UBool isNegative,
01973                          UBool isPrefix,
01974                          const UnicodeString* affixPat,
01975                          UBool currencyParsing,
01976                          int8_t type,
01977                          UChar* currency) const;
01978 
01979     static int32_t compareSimpleAffix(const UnicodeString& affix,
01980                                       const UnicodeString& input,
01981                                       int32_t pos);
01982 
01983     static int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t pos);
01984 
01985     static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
01986 
01987     int32_t compareComplexAffix(const UnicodeString& affixPat,
01988                                 const UnicodeString& input,
01989                                 int32_t pos,
01990                                 int8_t type,
01991                                 UChar* currency) const;
01992 
01993     static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
01994 
01995     static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
01996 
02002     inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
02003 
02004     int32_t appendAffix(UnicodeString& buf,
02005                         double number,
02006                         FieldPositionHandler& handler,
02007                         UBool isNegative,
02008                         UBool isPrefix) const;
02009 
02015     void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
02016                             UBool localized) const;
02017 
02018     void appendAffixPattern(UnicodeString& appendTo,
02019                             const UnicodeString* affixPattern,
02020                             const UnicodeString& expAffix, UBool localized) const;
02021 
02022     void expandAffix(const UnicodeString& pattern,
02023                      UnicodeString& affix,
02024                      double number,
02025                      FieldPositionHandler& handler,
02026                      UBool doFormat,
02027                      const UnicodeString* pluralCount) const;
02028 
02029     void expandAffixes(const UnicodeString* pluralCount);
02030 
02031     void addPadding(UnicodeString& appendTo,
02032                     FieldPositionHandler& handler,
02033                     int32_t prefixLen, int32_t suffixLen) const;
02034 
02035     UBool isGroupingPosition(int32_t pos) const;
02036 
02037     void setCurrencyForSymbols();
02038 
02039     // similar to setCurrency without re-compute the affixes for currency.
02040     // If currency changes, the affix pattern for currency is not changed,
02041     // but the affix will be changed. So, affixes need to be
02042     // re-computed in setCurrency(), but not in setCurrencyInternally().
02043     virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
02044 
02045     // set up currency affix patterns for mix parsing.
02046     // The patterns saved here are the affix patterns of default currency
02047     // pattern and the unique affix patterns of the plural currency patterns.
02048     // Those patterns are used by parseForCurrency().
02049     void setupCurrencyAffixPatterns(UErrorCode& status);
02050 
02051     // set up the currency affixes used in currency plural formatting.
02052     // It sets up both fAffixesForCurrency for currency pattern if the current
02053     // pattern contains 3 currency signs,
02054     // and it sets up fPluralAffixesForCurrency for currency plural patterns.
02055     void setupCurrencyAffixes(const UnicodeString& pattern,
02056                               UBool setupForCurrentPattern,
02057                               UBool setupForPluralPattern,
02058                               UErrorCode& status);
02059 
02060     // hashtable operations
02061     Hashtable* initHashForAffixPattern(UErrorCode& status);
02062     Hashtable* initHashForAffix(UErrorCode& status);
02063 
02064     void deleteHashForAffixPattern();
02065     void deleteHashForAffix(Hashtable*& table);
02066 
02067     void copyHashForAffixPattern(const Hashtable* source,
02068                                  Hashtable* target, UErrorCode& status);
02069     void copyHashForAffix(const Hashtable* source,
02070                           Hashtable* target, UErrorCode& status);
02071 
02072     UnicodeString& _format(int64_t number,
02073                            UnicodeString& appendTo,
02074                            FieldPositionHandler& handler) const;
02075     UnicodeString& _format(double number,
02076                            UnicodeString& appendTo,
02077                            FieldPositionHandler& handler) const;
02078     UnicodeString& _format(const DigitList &number,
02079                            UnicodeString& appendTo,
02080                            FieldPositionHandler& handler,
02081                            UErrorCode &status) const;
02082 
02083     // currency sign count
02084     enum {
02085         fgCurrencySignCountZero,
02086         fgCurrencySignCountInSymbolFormat,
02087         fgCurrencySignCountInISOFormat,
02088         fgCurrencySignCountInPluralFormat
02089     } CurrencySignCount;
02090 
02095     UnicodeString           fPositivePrefix;
02096     UnicodeString           fPositiveSuffix;
02097     UnicodeString           fNegativePrefix;
02098     UnicodeString           fNegativeSuffix;
02099     UnicodeString*          fPosPrefixPattern;
02100     UnicodeString*          fPosSuffixPattern;
02101     UnicodeString*          fNegPrefixPattern;
02102     UnicodeString*          fNegSuffixPattern;
02103 
02109     ChoiceFormat*           fCurrencyChoice;
02110 
02111     DigitList *             fMultiplier;   // NULL for multiplier of one
02112     int32_t                 fGroupingSize;
02113     int32_t                 fGroupingSize2;
02114     UBool                   fDecimalSeparatorAlwaysShown;
02115     DecimalFormatSymbols*   fSymbols;
02116 
02117     UBool                   fUseSignificantDigits;
02118     int32_t                 fMinSignificantDigits;
02119     int32_t                 fMaxSignificantDigits;
02120 
02121     UBool                   fUseExponentialNotation;
02122     int8_t                  fMinExponentDigits;
02123     UBool                   fExponentSignAlwaysShown;
02124 
02125     DigitList*              fRoundingIncrement;  // NULL if no rounding increment specified.
02126     ERoundingMode           fRoundingMode;
02127 
02128     UChar32                 fPad;
02129     int32_t                 fFormatWidth;
02130     EPadPosition            fPadPosition;
02131 
02132     /*
02133      * Following are used for currency format
02134      */
02135     // pattern used in this formatter
02136     UnicodeString fFormatPattern;
02137     // style is only valid when decimal formatter is constructed by
02138     // DecimalFormat(pattern, decimalFormatSymbol, style)
02139     int fStyle;
02140     /*
02141      * Represents whether this is a currency format, and which
02142      * currency format style.
02143      * 0: not currency format type;
02144      * 1: currency style -- symbol name, such as "$" for US dollar.
02145      * 2: currency style -- ISO name, such as USD for US dollar.
02146      * 3: currency style -- plural long name, such as "US Dollar" for
02147      *                      "1.00 US Dollar", or "US Dollars" for
02148      *                      "3.00 US Dollars".
02149      */
02150     int fCurrencySignCount;
02151 
02152 
02153     /* For currency parsing purose,
02154      * Need to remember all prefix patterns and suffix patterns of
02155      * every currency format pattern,
02156      * including the pattern of default currecny style
02157      * and plural currency style. And the patterns are set through applyPattern.
02158      */
02159     // TODO: innerclass?
02160         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02161     struct AffixPatternsForCurrency : public UMemory {
02162         // negative prefix pattern
02163         UnicodeString negPrefixPatternForCurrency;
02164         // negative suffix pattern
02165         UnicodeString negSuffixPatternForCurrency;
02166         // positive prefix pattern
02167         UnicodeString posPrefixPatternForCurrency;
02168         // positive suffix pattern
02169         UnicodeString posSuffixPatternForCurrency;
02170         int8_t patternType;
02171 
02172         AffixPatternsForCurrency(const UnicodeString& negPrefix,
02173                                  const UnicodeString& negSuffix,
02174                                  const UnicodeString& posPrefix,
02175                                  const UnicodeString& posSuffix,
02176                                  int8_t type) {
02177             negPrefixPatternForCurrency = negPrefix;
02178             negSuffixPatternForCurrency = negSuffix;
02179             posPrefixPatternForCurrency = posPrefix;
02180             posSuffixPatternForCurrency = posSuffix;
02181             patternType = type;
02182         }
02183     };
02184     */
02185 
02186     /* affix for currency formatting when the currency sign in the pattern
02187      * equals to 3, such as the pattern contains 3 currency sign or
02188      * the formatter style is currency plural format style.
02189      */
02190         /* This is not needed in the class declaration, so it is moved into decimfmp.cpp
02191     struct AffixesForCurrency : public UMemory {
02192         // negative prefix
02193         UnicodeString negPrefixForCurrency;
02194         // negative suffix
02195         UnicodeString negSuffixForCurrency;
02196         // positive prefix
02197         UnicodeString posPrefixForCurrency;
02198         // positive suffix
02199         UnicodeString posSuffixForCurrency;
02200 
02201         int32_t formatWidth;
02202 
02203         AffixesForCurrency(const UnicodeString& negPrefix,
02204                            const UnicodeString& negSuffix,
02205                            const UnicodeString& posPrefix,
02206                            const UnicodeString& posSuffix) {
02207             negPrefixForCurrency = negPrefix;
02208             negSuffixForCurrency = negSuffix;
02209             posPrefixForCurrency = posPrefix;
02210             posSuffixForCurrency = posSuffix;
02211         }
02212     };
02213     */
02214 
02215     // Affix pattern set for currency.
02216     // It is a set of AffixPatternsForCurrency,
02217     // each element of the set saves the negative prefix pattern,
02218     // negative suffix pattern, positive prefix pattern,
02219     // and positive suffix  pattern of a pattern.
02220     // It is used for currency mixed style parsing.
02221     // It is actually is a set.
02222     // The set contains the default currency pattern from the locale,
02223     // and the currency plural patterns.
02224     // Since it is a set, it does not contain duplicated items.
02225     // For example, if 2 currency plural patterns are the same, only one pattern
02226     // is included in the set. When parsing, we do not check whether the plural
02227     // count match or not.
02228     Hashtable* fAffixPatternsForCurrency;
02229 
02230     // Following 2 are affixes for currency.
02231     // It is a hash map from plural count to AffixesForCurrency.
02232     // AffixesForCurrency saves the negative prefix,
02233     // negative suffix, positive prefix, and positive suffix of a pattern.
02234     // It is used during currency formatting only when the currency sign count
02235     // is 3. In which case, the affixes are getting from here, not
02236     // from the fNegativePrefix etc.
02237     Hashtable* fAffixesForCurrency;  // for current pattern
02238     Hashtable* fPluralAffixesForCurrency;  // for plural pattern
02239 
02240     // Information needed for DecimalFormat to format/parse currency plural.
02241     CurrencyPluralInfo* fCurrencyPluralInfo;
02242 
02243 protected:
02244 
02253     virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
02254 
02258     static const int32_t  kDoubleIntegerDigits;
02262     static const int32_t  kDoubleFractionDigits;
02263 
02274     static const int32_t  kMaxScientificIntegerDigits;
02275 };
02276 
02277 inline UnicodeString&
02278 DecimalFormat::format(const Formattable& obj,
02279                       UnicodeString& appendTo,
02280                       UErrorCode& status) const {
02281     // Don't use Format:: - use immediate base class only,
02282     // in case immediate base modifies behavior later.
02283     return NumberFormat::format(obj, appendTo, status);
02284 }
02285 
02286 inline UnicodeString&
02287 DecimalFormat::format(double number,
02288                       UnicodeString& appendTo) const {
02289     FieldPosition pos(0);
02290     return format(number, appendTo, pos);
02291 }
02292 
02293 inline UnicodeString&
02294 DecimalFormat::format(int32_t number,
02295                       UnicodeString& appendTo) const {
02296     FieldPosition pos(0);
02297     return format((int64_t)number, appendTo, pos);
02298 }
02299 
02300 inline const UnicodeString &
02301 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
02302     return fSymbols->getConstSymbol(symbol);
02303 }
02304 
02305 U_NAMESPACE_END
02306 
02307 #endif /* #if !UCONFIG_NO_FORMATTING */
02308 
02309 #endif // _DECIMFMT
02310 //eof
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines