ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************** 00003 * Copyright (C) 1997-2012, 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 #include "unicode/curramt.h" 00041 00042 U_NAMESPACE_BEGIN 00043 00044 class DigitList; 00045 class ChoiceFormat; 00046 class CurrencyPluralInfo; 00047 class Hashtable; 00048 class UnicodeSet; 00049 class FieldPositionHandler; 00050 00644 class U_I18N_API DecimalFormat: public NumberFormat { 00645 public: 00650 enum ERoundingMode { 00651 kRoundCeiling, 00652 kRoundFloor, 00653 kRoundDown, 00654 kRoundUp, 00655 kRoundHalfEven, 00657 kRoundHalfDown, 00659 kRoundHalfUp, 00665 kRoundUnnecessary 00666 }; 00667 00672 enum EPadPosition { 00673 kPadBeforePrefix, 00674 kPadAfterPrefix, 00675 kPadBeforeSuffix, 00676 kPadAfterSuffix 00677 }; 00678 00692 DecimalFormat(UErrorCode& status); 00693 00708 DecimalFormat(const UnicodeString& pattern, 00709 UErrorCode& status); 00710 00729 DecimalFormat( const UnicodeString& pattern, 00730 DecimalFormatSymbols* symbolsToAdopt, 00731 UErrorCode& status); 00732 00733 #ifndef U_HIDE_INTERNAL_API 00734 00746 DecimalFormat( const UnicodeString& pattern, 00747 DecimalFormatSymbols* symbolsToAdopt, 00748 UNumberFormatStyle style, 00749 UErrorCode& status); 00750 #endif /* U_HIDE_INTERNAL_API */ 00751 00771 DecimalFormat( const UnicodeString& pattern, 00772 DecimalFormatSymbols* symbolsToAdopt, 00773 UParseError& parseError, 00774 UErrorCode& status); 00792 DecimalFormat( const UnicodeString& pattern, 00793 const DecimalFormatSymbols& symbols, 00794 UErrorCode& status); 00795 00802 DecimalFormat(const DecimalFormat& source); 00803 00810 DecimalFormat& operator=(const DecimalFormat& rhs); 00811 00816 virtual ~DecimalFormat(); 00817 00825 virtual Format* clone(void) const; 00826 00835 virtual UBool operator==(const Format& other) const; 00836 00837 00838 using NumberFormat::format; 00839 00851 virtual UnicodeString& format(double number, 00852 UnicodeString& appendTo, 00853 FieldPosition& pos) const; 00854 00868 virtual UnicodeString& format(double number, 00869 UnicodeString& appendTo, 00870 FieldPositionIterator* posIter, 00871 UErrorCode& status) const; 00872 00884 virtual UnicodeString& format(int32_t number, 00885 UnicodeString& appendTo, 00886 FieldPosition& pos) const; 00887 00901 virtual UnicodeString& format(int32_t number, 00902 UnicodeString& appendTo, 00903 FieldPositionIterator* posIter, 00904 UErrorCode& status) const; 00905 00917 virtual UnicodeString& format(int64_t number, 00918 UnicodeString& appendTo, 00919 FieldPosition& pos) const; 00920 00934 virtual UnicodeString& format(int64_t number, 00935 UnicodeString& appendTo, 00936 FieldPositionIterator* posIter, 00937 UErrorCode& status) const; 00938 00955 virtual UnicodeString& format(const StringPiece &number, 00956 UnicodeString& appendTo, 00957 FieldPositionIterator* posIter, 00958 UErrorCode& status) const; 00959 00960 00976 virtual UnicodeString& format(const DigitList &number, 00977 UnicodeString& appendTo, 00978 FieldPositionIterator* posIter, 00979 UErrorCode& status) const; 00980 00996 virtual UnicodeString& format(const DigitList &number, 00997 UnicodeString& appendTo, 00998 FieldPosition& pos, 00999 UErrorCode& status) const; 01000 01001 01014 virtual UnicodeString& format(const Formattable& obj, 01015 UnicodeString& appendTo, 01016 FieldPosition& pos, 01017 UErrorCode& status) const; 01018 01030 UnicodeString& format(const Formattable& obj, 01031 UnicodeString& appendTo, 01032 UErrorCode& status) const; 01033 01044 UnicodeString& format(double number, 01045 UnicodeString& appendTo) const; 01046 01058 UnicodeString& format(int32_t number, 01059 UnicodeString& appendTo) const; 01060 01072 UnicodeString& format(int64_t number, 01073 UnicodeString& appendTo) const; 01093 virtual void parse(const UnicodeString& text, 01094 Formattable& result, 01095 ParsePosition& parsePosition) const; 01096 01097 // Declare here again to get rid of function hiding problems. 01106 virtual void parse(const UnicodeString& text, 01107 Formattable& result, 01108 UErrorCode& status) const; 01109 01110 /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */ 01130 virtual CurrencyAmount* parseCurrency(const UnicodeString& text, 01131 ParsePosition& pos) const; 01132 01140 virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const; 01141 01148 virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt); 01149 01156 virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols); 01157 01158 01165 virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const; 01166 01173 virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt); 01174 01181 virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); 01182 01183 01192 UnicodeString& getPositivePrefix(UnicodeString& result) const; 01193 01201 virtual void setPositivePrefix(const UnicodeString& newValue); 01202 01211 UnicodeString& getNegativePrefix(UnicodeString& result) const; 01212 01220 virtual void setNegativePrefix(const UnicodeString& newValue); 01221 01230 UnicodeString& getPositiveSuffix(UnicodeString& result) const; 01231 01239 virtual void setPositiveSuffix(const UnicodeString& newValue); 01240 01249 UnicodeString& getNegativeSuffix(UnicodeString& result) const; 01250 01258 virtual void setNegativeSuffix(const UnicodeString& newValue); 01259 01270 int32_t getMultiplier(void) const; 01271 01282 virtual void setMultiplier(int32_t newValue); 01283 01293 virtual double getRoundingIncrement(void) const; 01294 01305 virtual void setRoundingIncrement(double newValue); 01306 01315 virtual ERoundingMode getRoundingMode(void) const; 01316 01325 virtual void setRoundingMode(ERoundingMode roundingMode); 01326 01338 virtual int32_t getFormatWidth(void) const; 01339 01354 virtual void setFormatWidth(int32_t width); 01355 01368 virtual UnicodeString getPadCharacterString() const; 01369 01384 virtual void setPadCharacter(const UnicodeString &padChar); 01385 01401 virtual EPadPosition getPadPosition(void) const; 01402 01419 virtual void setPadPosition(EPadPosition padPos); 01420 01431 virtual UBool isScientificNotation(void); 01432 01448 virtual void setScientificNotation(UBool useScientific); 01449 01460 virtual int8_t getMinimumExponentDigits(void) const; 01461 01474 virtual void setMinimumExponentDigits(int8_t minExpDig); 01475 01488 virtual UBool isExponentSignAlwaysShown(void); 01489 01503 virtual void setExponentSignAlwaysShown(UBool expSignAlways); 01504 01516 int32_t getGroupingSize(void) const; 01517 01529 virtual void setGroupingSize(int32_t newValue); 01530 01549 int32_t getSecondaryGroupingSize(void) const; 01550 01562 virtual void setSecondaryGroupingSize(int32_t newValue); 01563 01572 UBool isDecimalSeparatorAlwaysShown(void) const; 01573 01582 virtual void setDecimalSeparatorAlwaysShown(UBool newValue); 01583 01594 virtual UnicodeString& toPattern(UnicodeString& result) const; 01595 01606 virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const; 01607 01637 virtual void applyPattern(const UnicodeString& pattern, 01638 UParseError& parseError, 01639 UErrorCode& status); 01648 virtual void applyPattern(const UnicodeString& pattern, 01649 UErrorCode& status); 01650 01681 virtual void applyLocalizedPattern(const UnicodeString& pattern, 01682 UParseError& parseError, 01683 UErrorCode& status); 01684 01694 virtual void applyLocalizedPattern(const UnicodeString& pattern, 01695 UErrorCode& status); 01696 01697 01707 virtual void setMaximumIntegerDigits(int32_t newValue); 01708 01718 virtual void setMinimumIntegerDigits(int32_t newValue); 01719 01729 virtual void setMaximumFractionDigits(int32_t newValue); 01730 01740 virtual void setMinimumFractionDigits(int32_t newValue); 01741 01749 int32_t getMinimumSignificantDigits() const; 01750 01758 int32_t getMaximumSignificantDigits() const; 01759 01769 void setMinimumSignificantDigits(int32_t min); 01770 01781 void setMaximumSignificantDigits(int32_t max); 01782 01789 UBool areSignificantDigitsUsed() const; 01790 01798 void setSignificantDigitsUsed(UBool useSignificantDigits); 01799 01800 public: 01813 virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec); 01814 01820 virtual void setCurrency(const UChar* theCurrency); 01821 01827 static const char fgNumberPatterns[]; 01828 01829 public: 01830 01842 static UClassID U_EXPORT2 getStaticClassID(void); 01843 01855 virtual UClassID getDynamicClassID(void) const; 01856 01857 private: 01858 01859 DecimalFormat(); // default constructor not implemented 01860 01861 int32_t precision() const; 01862 01867 void init(); 01868 01872 void construct(UErrorCode& status, 01873 UParseError& parseErr, 01874 const UnicodeString* pattern = 0, 01875 DecimalFormatSymbols* symbolsToAdopt = 0 01876 ); 01877 01886 UnicodeString& toPattern(UnicodeString& result, UBool localized) const; 01887 01898 void applyPattern(const UnicodeString& pattern, 01899 UBool localized, 01900 UParseError& parseError, 01901 UErrorCode& status); 01902 01903 /* 01904 * similar to applyPattern, but without re-gen affix for currency 01905 */ 01906 void applyPatternInternally(const UnicodeString& pluralCount, 01907 const UnicodeString& pattern, 01908 UBool localized, 01909 UParseError& parseError, 01910 UErrorCode& status); 01911 01912 /* 01913 * only apply pattern without expand affixes 01914 */ 01915 void applyPatternWithoutExpandAffix(const UnicodeString& pattern, 01916 UBool localized, 01917 UParseError& parseError, 01918 UErrorCode& status); 01919 01920 01921 /* 01922 * expand affixes (after apply patter) and re-compute fFormatWidth 01923 */ 01924 void expandAffixAdjustWidth(const UnicodeString* pluralCount); 01925 01926 01937 UnicodeString& subformat(UnicodeString& appendTo, 01938 FieldPositionHandler& handler, 01939 DigitList& digits, 01940 UBool isInteger) const; 01941 01942 01943 void parse(const UnicodeString& text, 01944 Formattable& result, 01945 ParsePosition& pos, 01946 UChar* currency) const; 01947 01948 enum { 01949 fgStatusInfinite, 01950 fgStatusLength // Leave last in list. 01951 } StatusFlags; 01952 01953 UBool subparse(const UnicodeString& text, 01954 const UnicodeString* negPrefix, 01955 const UnicodeString* negSuffix, 01956 const UnicodeString* posPrefix, 01957 const UnicodeString* posSuffix, 01958 UBool currencyParsing, 01959 int8_t type, 01960 ParsePosition& parsePosition, 01961 DigitList& digits, UBool* status, 01962 UChar* currency) const; 01963 01964 // Mixed style parsing for currency. 01965 // It parses against the current currency pattern 01966 // using complex affix comparison 01967 // parses against the currency plural patterns using complex affix comparison, 01968 // and parses against the current pattern using simple affix comparison. 01969 UBool parseForCurrency(const UnicodeString& text, 01970 ParsePosition& parsePosition, 01971 DigitList& digits, 01972 UBool* status, 01973 UChar* currency) const; 01974 01975 int32_t skipPadding(const UnicodeString& text, int32_t position) const; 01976 01977 int32_t compareAffix(const UnicodeString& input, 01978 int32_t pos, 01979 UBool isNegative, 01980 UBool isPrefix, 01981 const UnicodeString* affixPat, 01982 UBool currencyParsing, 01983 int8_t type, 01984 UChar* currency) const; 01985 01986 static int32_t compareSimpleAffix(const UnicodeString& affix, 01987 const UnicodeString& input, 01988 int32_t pos, 01989 UBool lenient); 01990 01991 static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos); 01992 01993 static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); 01994 01995 int32_t compareComplexAffix(const UnicodeString& affixPat, 01996 const UnicodeString& input, 01997 int32_t pos, 01998 int8_t type, 01999 UChar* currency) const; 02000 02001 static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch); 02002 02003 static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str); 02004 02005 static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol, 02006 UnicodeSet *sset, UChar32 schar); 02007 02008 static UBool matchDecimal(UChar32 symbolChar, 02009 UBool sawDecimal, UChar32 sawDecimalChar, 02010 const UnicodeSet *sset, UChar32 schar); 02011 02012 static UBool matchGrouping(UChar32 groupingChar, 02013 UBool sawGrouping, UChar32 sawGroupingChar, 02014 const UnicodeSet *sset, 02015 UChar32 decimalChar, const UnicodeSet *decimalSet, 02016 UChar32 schar); 02017 02023 inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const; 02024 02025 int32_t appendAffix(UnicodeString& buf, 02026 double number, 02027 FieldPositionHandler& handler, 02028 UBool isNegative, 02029 UBool isPrefix) const; 02030 02036 void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix, 02037 UBool localized) const; 02038 02039 void appendAffixPattern(UnicodeString& appendTo, 02040 const UnicodeString* affixPattern, 02041 const UnicodeString& expAffix, UBool localized) const; 02042 02043 void expandAffix(const UnicodeString& pattern, 02044 UnicodeString& affix, 02045 double number, 02046 FieldPositionHandler& handler, 02047 UBool doFormat, 02048 const UnicodeString* pluralCount) const; 02049 02050 void expandAffixes(const UnicodeString* pluralCount); 02051 02052 void addPadding(UnicodeString& appendTo, 02053 FieldPositionHandler& handler, 02054 int32_t prefixLen, int32_t suffixLen) const; 02055 02056 UBool isGroupingPosition(int32_t pos) const; 02057 02058 void setCurrencyForSymbols(); 02059 02060 // similar to setCurrency without re-compute the affixes for currency. 02061 // If currency changes, the affix pattern for currency is not changed, 02062 // but the affix will be changed. So, affixes need to be 02063 // re-computed in setCurrency(), but not in setCurrencyInternally(). 02064 virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec); 02065 02066 // set up currency affix patterns for mix parsing. 02067 // The patterns saved here are the affix patterns of default currency 02068 // pattern and the unique affix patterns of the plural currency patterns. 02069 // Those patterns are used by parseForCurrency(). 02070 void setupCurrencyAffixPatterns(UErrorCode& status); 02071 02072 // set up the currency affixes used in currency plural formatting. 02073 // It sets up both fAffixesForCurrency for currency pattern if the current 02074 // pattern contains 3 currency signs, 02075 // and it sets up fPluralAffixesForCurrency for currency plural patterns. 02076 void setupCurrencyAffixes(const UnicodeString& pattern, 02077 UBool setupForCurrentPattern, 02078 UBool setupForPluralPattern, 02079 UErrorCode& status); 02080 02081 // hashtable operations 02082 Hashtable* initHashForAffixPattern(UErrorCode& status); 02083 Hashtable* initHashForAffix(UErrorCode& status); 02084 02085 void deleteHashForAffixPattern(); 02086 void deleteHashForAffix(Hashtable*& table); 02087 02088 void copyHashForAffixPattern(const Hashtable* source, 02089 Hashtable* target, UErrorCode& status); 02090 void copyHashForAffix(const Hashtable* source, 02091 Hashtable* target, UErrorCode& status); 02092 02093 UnicodeString& _format(int64_t number, 02094 UnicodeString& appendTo, 02095 FieldPositionHandler& handler) const; 02096 UnicodeString& _format(double number, 02097 UnicodeString& appendTo, 02098 FieldPositionHandler& handler) const; 02099 UnicodeString& _format(const DigitList &number, 02100 UnicodeString& appendTo, 02101 FieldPositionHandler& handler, 02102 UErrorCode &status) const; 02103 02104 // currency sign count 02105 enum { 02106 fgCurrencySignCountZero, 02107 fgCurrencySignCountInSymbolFormat, 02108 fgCurrencySignCountInISOFormat, 02109 fgCurrencySignCountInPluralFormat 02110 } CurrencySignCount; 02111 02116 UnicodeString fPositivePrefix; 02117 UnicodeString fPositiveSuffix; 02118 UnicodeString fNegativePrefix; 02119 UnicodeString fNegativeSuffix; 02120 UnicodeString* fPosPrefixPattern; 02121 UnicodeString* fPosSuffixPattern; 02122 UnicodeString* fNegPrefixPattern; 02123 UnicodeString* fNegSuffixPattern; 02124 02130 ChoiceFormat* fCurrencyChoice; 02131 02132 DigitList * fMultiplier; // NULL for multiplier of one 02133 int32_t fGroupingSize; 02134 int32_t fGroupingSize2; 02135 UBool fDecimalSeparatorAlwaysShown; 02136 DecimalFormatSymbols* fSymbols; 02137 02138 UBool fUseSignificantDigits; 02139 int32_t fMinSignificantDigits; 02140 int32_t fMaxSignificantDigits; 02141 02142 UBool fUseExponentialNotation; 02143 int8_t fMinExponentDigits; 02144 UBool fExponentSignAlwaysShown; 02145 02146 DigitList* fRoundingIncrement; // NULL if no rounding increment specified. 02147 ERoundingMode fRoundingMode; 02148 02149 UChar32 fPad; 02150 int32_t fFormatWidth; 02151 EPadPosition fPadPosition; 02152 02153 /* 02154 * Following are used for currency format 02155 */ 02156 // pattern used in this formatter 02157 UnicodeString fFormatPattern; 02158 // style is only valid when decimal formatter is constructed by 02159 // DecimalFormat(pattern, decimalFormatSymbol, style) 02160 int fStyle; 02161 /* 02162 * Represents whether this is a currency format, and which 02163 * currency format style. 02164 * 0: not currency format type; 02165 * 1: currency style -- symbol name, such as "$" for US dollar. 02166 * 2: currency style -- ISO name, such as USD for US dollar. 02167 * 3: currency style -- plural long name, such as "US Dollar" for 02168 * "1.00 US Dollar", or "US Dollars" for 02169 * "3.00 US Dollars". 02170 */ 02171 int fCurrencySignCount; 02172 02173 02174 /* For currency parsing purose, 02175 * Need to remember all prefix patterns and suffix patterns of 02176 * every currency format pattern, 02177 * including the pattern of default currecny style 02178 * and plural currency style. And the patterns are set through applyPattern. 02179 */ 02180 // TODO: innerclass? 02181 /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 02182 struct AffixPatternsForCurrency : public UMemory { 02183 // negative prefix pattern 02184 UnicodeString negPrefixPatternForCurrency; 02185 // negative suffix pattern 02186 UnicodeString negSuffixPatternForCurrency; 02187 // positive prefix pattern 02188 UnicodeString posPrefixPatternForCurrency; 02189 // positive suffix pattern 02190 UnicodeString posSuffixPatternForCurrency; 02191 int8_t patternType; 02192 02193 AffixPatternsForCurrency(const UnicodeString& negPrefix, 02194 const UnicodeString& negSuffix, 02195 const UnicodeString& posPrefix, 02196 const UnicodeString& posSuffix, 02197 int8_t type) { 02198 negPrefixPatternForCurrency = negPrefix; 02199 negSuffixPatternForCurrency = negSuffix; 02200 posPrefixPatternForCurrency = posPrefix; 02201 posSuffixPatternForCurrency = posSuffix; 02202 patternType = type; 02203 } 02204 }; 02205 */ 02206 02207 /* affix for currency formatting when the currency sign in the pattern 02208 * equals to 3, such as the pattern contains 3 currency sign or 02209 * the formatter style is currency plural format style. 02210 */ 02211 /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 02212 struct AffixesForCurrency : public UMemory { 02213 // negative prefix 02214 UnicodeString negPrefixForCurrency; 02215 // negative suffix 02216 UnicodeString negSuffixForCurrency; 02217 // positive prefix 02218 UnicodeString posPrefixForCurrency; 02219 // positive suffix 02220 UnicodeString posSuffixForCurrency; 02221 02222 int32_t formatWidth; 02223 02224 AffixesForCurrency(const UnicodeString& negPrefix, 02225 const UnicodeString& negSuffix, 02226 const UnicodeString& posPrefix, 02227 const UnicodeString& posSuffix) { 02228 negPrefixForCurrency = negPrefix; 02229 negSuffixForCurrency = negSuffix; 02230 posPrefixForCurrency = posPrefix; 02231 posSuffixForCurrency = posSuffix; 02232 } 02233 }; 02234 */ 02235 02236 // Affix pattern set for currency. 02237 // It is a set of AffixPatternsForCurrency, 02238 // each element of the set saves the negative prefix pattern, 02239 // negative suffix pattern, positive prefix pattern, 02240 // and positive suffix pattern of a pattern. 02241 // It is used for currency mixed style parsing. 02242 // It is actually is a set. 02243 // The set contains the default currency pattern from the locale, 02244 // and the currency plural patterns. 02245 // Since it is a set, it does not contain duplicated items. 02246 // For example, if 2 currency plural patterns are the same, only one pattern 02247 // is included in the set. When parsing, we do not check whether the plural 02248 // count match or not. 02249 Hashtable* fAffixPatternsForCurrency; 02250 02251 // Following 2 are affixes for currency. 02252 // It is a hash map from plural count to AffixesForCurrency. 02253 // AffixesForCurrency saves the negative prefix, 02254 // negative suffix, positive prefix, and positive suffix of a pattern. 02255 // It is used during currency formatting only when the currency sign count 02256 // is 3. In which case, the affixes are getting from here, not 02257 // from the fNegativePrefix etc. 02258 Hashtable* fAffixesForCurrency; // for current pattern 02259 Hashtable* fPluralAffixesForCurrency; // for plural pattern 02260 02261 // Information needed for DecimalFormat to format/parse currency plural. 02262 CurrencyPluralInfo* fCurrencyPluralInfo; 02263 02264 protected: 02265 02274 virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; 02275 02279 static const int32_t kDoubleIntegerDigits; 02283 static const int32_t kDoubleFractionDigits; 02284 02295 static const int32_t kMaxScientificIntegerDigits; 02296 }; 02297 02298 inline UnicodeString& 02299 DecimalFormat::format(const Formattable& obj, 02300 UnicodeString& appendTo, 02301 UErrorCode& status) const { 02302 // Don't use Format:: - use immediate base class only, 02303 // in case immediate base modifies behavior later. 02304 return NumberFormat::format(obj, appendTo, status); 02305 } 02306 02307 inline UnicodeString& 02308 DecimalFormat::format(double number, 02309 UnicodeString& appendTo) const { 02310 FieldPosition pos(0); 02311 return format(number, appendTo, pos); 02312 } 02313 02314 inline UnicodeString& 02315 DecimalFormat::format(int32_t number, 02316 UnicodeString& appendTo) const { 02317 FieldPosition pos(0); 02318 return format((int64_t)number, appendTo, pos); 02319 } 02320 02321 #ifndef U_HIDE_INTERNAL_API 02322 inline const UnicodeString & 02323 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const { 02324 return fSymbols->getConstSymbol(symbol); 02325 } 02326 #endif 02327 02328 U_NAMESPACE_END 02329 02330 #endif /* #if !UCONFIG_NO_FORMATTING */ 02331 02332 #endif // _DECIMFMT 02333 //eof