ICU 4.8.1.1
4.8.1.1
|
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 02007 static UBool matchDecimal(UChar32 symbolChar, 02008 UBool sawDecimal, UChar32 sawDecimalChar, 02009 const UnicodeSet *sset, UChar32 schar); 02010 02011 static UBool matchGrouping(UChar32 groupingChar, 02012 UBool sawGrouping, UChar32 sawGroupingChar, 02013 const UnicodeSet *sset, 02014 UChar32 decimalChar, const UnicodeSet *decimalSet, 02015 UChar32 schar); 02016 02022 inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const; 02023 02024 int32_t appendAffix(UnicodeString& buf, 02025 double number, 02026 FieldPositionHandler& handler, 02027 UBool isNegative, 02028 UBool isPrefix) const; 02029 02035 void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix, 02036 UBool localized) const; 02037 02038 void appendAffixPattern(UnicodeString& appendTo, 02039 const UnicodeString* affixPattern, 02040 const UnicodeString& expAffix, UBool localized) const; 02041 02042 void expandAffix(const UnicodeString& pattern, 02043 UnicodeString& affix, 02044 double number, 02045 FieldPositionHandler& handler, 02046 UBool doFormat, 02047 const UnicodeString* pluralCount) const; 02048 02049 void expandAffixes(const UnicodeString* pluralCount); 02050 02051 void addPadding(UnicodeString& appendTo, 02052 FieldPositionHandler& handler, 02053 int32_t prefixLen, int32_t suffixLen) const; 02054 02055 UBool isGroupingPosition(int32_t pos) const; 02056 02057 void setCurrencyForSymbols(); 02058 02059 // similar to setCurrency without re-compute the affixes for currency. 02060 // If currency changes, the affix pattern for currency is not changed, 02061 // but the affix will be changed. So, affixes need to be 02062 // re-computed in setCurrency(), but not in setCurrencyInternally(). 02063 virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec); 02064 02065 // set up currency affix patterns for mix parsing. 02066 // The patterns saved here are the affix patterns of default currency 02067 // pattern and the unique affix patterns of the plural currency patterns. 02068 // Those patterns are used by parseForCurrency(). 02069 void setupCurrencyAffixPatterns(UErrorCode& status); 02070 02071 // set up the currency affixes used in currency plural formatting. 02072 // It sets up both fAffixesForCurrency for currency pattern if the current 02073 // pattern contains 3 currency signs, 02074 // and it sets up fPluralAffixesForCurrency for currency plural patterns. 02075 void setupCurrencyAffixes(const UnicodeString& pattern, 02076 UBool setupForCurrentPattern, 02077 UBool setupForPluralPattern, 02078 UErrorCode& status); 02079 02080 // hashtable operations 02081 Hashtable* initHashForAffixPattern(UErrorCode& status); 02082 Hashtable* initHashForAffix(UErrorCode& status); 02083 02084 void deleteHashForAffixPattern(); 02085 void deleteHashForAffix(Hashtable*& table); 02086 02087 void copyHashForAffixPattern(const Hashtable* source, 02088 Hashtable* target, UErrorCode& status); 02089 void copyHashForAffix(const Hashtable* source, 02090 Hashtable* target, UErrorCode& status); 02091 02092 UnicodeString& _format(int64_t number, 02093 UnicodeString& appendTo, 02094 FieldPositionHandler& handler) const; 02095 UnicodeString& _format(double number, 02096 UnicodeString& appendTo, 02097 FieldPositionHandler& handler) const; 02098 UnicodeString& _format(const DigitList &number, 02099 UnicodeString& appendTo, 02100 FieldPositionHandler& handler, 02101 UErrorCode &status) const; 02102 02103 // currency sign count 02104 enum { 02105 fgCurrencySignCountZero, 02106 fgCurrencySignCountInSymbolFormat, 02107 fgCurrencySignCountInISOFormat, 02108 fgCurrencySignCountInPluralFormat 02109 } CurrencySignCount; 02110 02115 UnicodeString fPositivePrefix; 02116 UnicodeString fPositiveSuffix; 02117 UnicodeString fNegativePrefix; 02118 UnicodeString fNegativeSuffix; 02119 UnicodeString* fPosPrefixPattern; 02120 UnicodeString* fPosSuffixPattern; 02121 UnicodeString* fNegPrefixPattern; 02122 UnicodeString* fNegSuffixPattern; 02123 02129 ChoiceFormat* fCurrencyChoice; 02130 02131 DigitList * fMultiplier; // NULL for multiplier of one 02132 int32_t fGroupingSize; 02133 int32_t fGroupingSize2; 02134 UBool fDecimalSeparatorAlwaysShown; 02135 DecimalFormatSymbols* fSymbols; 02136 02137 UBool fUseSignificantDigits; 02138 int32_t fMinSignificantDigits; 02139 int32_t fMaxSignificantDigits; 02140 02141 UBool fUseExponentialNotation; 02142 int8_t fMinExponentDigits; 02143 UBool fExponentSignAlwaysShown; 02144 02145 DigitList* fRoundingIncrement; // NULL if no rounding increment specified. 02146 ERoundingMode fRoundingMode; 02147 02148 UChar32 fPad; 02149 int32_t fFormatWidth; 02150 EPadPosition fPadPosition; 02151 02152 /* 02153 * Following are used for currency format 02154 */ 02155 // pattern used in this formatter 02156 UnicodeString fFormatPattern; 02157 // style is only valid when decimal formatter is constructed by 02158 // DecimalFormat(pattern, decimalFormatSymbol, style) 02159 int fStyle; 02160 /* 02161 * Represents whether this is a currency format, and which 02162 * currency format style. 02163 * 0: not currency format type; 02164 * 1: currency style -- symbol name, such as "$" for US dollar. 02165 * 2: currency style -- ISO name, such as USD for US dollar. 02166 * 3: currency style -- plural long name, such as "US Dollar" for 02167 * "1.00 US Dollar", or "US Dollars" for 02168 * "3.00 US Dollars". 02169 */ 02170 int fCurrencySignCount; 02171 02172 02173 /* For currency parsing purose, 02174 * Need to remember all prefix patterns and suffix patterns of 02175 * every currency format pattern, 02176 * including the pattern of default currecny style 02177 * and plural currency style. And the patterns are set through applyPattern. 02178 */ 02179 // TODO: innerclass? 02180 /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 02181 struct AffixPatternsForCurrency : public UMemory { 02182 // negative prefix pattern 02183 UnicodeString negPrefixPatternForCurrency; 02184 // negative suffix pattern 02185 UnicodeString negSuffixPatternForCurrency; 02186 // positive prefix pattern 02187 UnicodeString posPrefixPatternForCurrency; 02188 // positive suffix pattern 02189 UnicodeString posSuffixPatternForCurrency; 02190 int8_t patternType; 02191 02192 AffixPatternsForCurrency(const UnicodeString& negPrefix, 02193 const UnicodeString& negSuffix, 02194 const UnicodeString& posPrefix, 02195 const UnicodeString& posSuffix, 02196 int8_t type) { 02197 negPrefixPatternForCurrency = negPrefix; 02198 negSuffixPatternForCurrency = negSuffix; 02199 posPrefixPatternForCurrency = posPrefix; 02200 posSuffixPatternForCurrency = posSuffix; 02201 patternType = type; 02202 } 02203 }; 02204 */ 02205 02206 /* affix for currency formatting when the currency sign in the pattern 02207 * equals to 3, such as the pattern contains 3 currency sign or 02208 * the formatter style is currency plural format style. 02209 */ 02210 /* This is not needed in the class declaration, so it is moved into decimfmp.cpp 02211 struct AffixesForCurrency : public UMemory { 02212 // negative prefix 02213 UnicodeString negPrefixForCurrency; 02214 // negative suffix 02215 UnicodeString negSuffixForCurrency; 02216 // positive prefix 02217 UnicodeString posPrefixForCurrency; 02218 // positive suffix 02219 UnicodeString posSuffixForCurrency; 02220 02221 int32_t formatWidth; 02222 02223 AffixesForCurrency(const UnicodeString& negPrefix, 02224 const UnicodeString& negSuffix, 02225 const UnicodeString& posPrefix, 02226 const UnicodeString& posSuffix) { 02227 negPrefixForCurrency = negPrefix; 02228 negSuffixForCurrency = negSuffix; 02229 posPrefixForCurrency = posPrefix; 02230 posSuffixForCurrency = posSuffix; 02231 } 02232 }; 02233 */ 02234 02235 // Affix pattern set for currency. 02236 // It is a set of AffixPatternsForCurrency, 02237 // each element of the set saves the negative prefix pattern, 02238 // negative suffix pattern, positive prefix pattern, 02239 // and positive suffix pattern of a pattern. 02240 // It is used for currency mixed style parsing. 02241 // It is actually is a set. 02242 // The set contains the default currency pattern from the locale, 02243 // and the currency plural patterns. 02244 // Since it is a set, it does not contain duplicated items. 02245 // For example, if 2 currency plural patterns are the same, only one pattern 02246 // is included in the set. When parsing, we do not check whether the plural 02247 // count match or not. 02248 Hashtable* fAffixPatternsForCurrency; 02249 02250 // Following 2 are affixes for currency. 02251 // It is a hash map from plural count to AffixesForCurrency. 02252 // AffixesForCurrency saves the negative prefix, 02253 // negative suffix, positive prefix, and positive suffix of a pattern. 02254 // It is used during currency formatting only when the currency sign count 02255 // is 3. In which case, the affixes are getting from here, not 02256 // from the fNegativePrefix etc. 02257 Hashtable* fAffixesForCurrency; // for current pattern 02258 Hashtable* fPluralAffixesForCurrency; // for plural pattern 02259 02260 // Information needed for DecimalFormat to format/parse currency plural. 02261 CurrencyPluralInfo* fCurrencyPluralInfo; 02262 02263 protected: 02264 02273 virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; 02274 02278 static const int32_t kDoubleIntegerDigits; 02282 static const int32_t kDoubleFractionDigits; 02283 02294 static const int32_t kMaxScientificIntegerDigits; 02295 }; 02296 02297 inline UnicodeString& 02298 DecimalFormat::format(const Formattable& obj, 02299 UnicodeString& appendTo, 02300 UErrorCode& status) const { 02301 // Don't use Format:: - use immediate base class only, 02302 // in case immediate base modifies behavior later. 02303 return NumberFormat::format(obj, appendTo, status); 02304 } 02305 02306 inline UnicodeString& 02307 DecimalFormat::format(double number, 02308 UnicodeString& appendTo) const { 02309 FieldPosition pos(0); 02310 return format(number, appendTo, pos); 02311 } 02312 02313 inline UnicodeString& 02314 DecimalFormat::format(int32_t number, 02315 UnicodeString& appendTo) const { 02316 FieldPosition pos(0); 02317 return format((int64_t)number, appendTo, pos); 02318 } 02319 02320 inline const UnicodeString & 02321 DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const { 02322 return fSymbols->getConstSymbol(symbol); 02323 } 02324 02325 U_NAMESPACE_END 02326 02327 #endif /* #if !UCONFIG_NO_FORMATTING */ 02328 02329 #endif // _DECIMFMT 02330 //eof