ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

decimfmt.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File DECIMFMT.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 02/19/97 aliu Converted from java.
15 * 03/20/97 clhuang Updated per C++ implementation.
16 * 04/03/97 aliu Rewrote parsing and formatting completely, and
17 * cleaned up and debugged. Actually works now.
18 * 04/17/97 aliu Changed DigitCount to int per code review.
19 * 07/10/97 helena Made ParsePosition a class and get rid of the function
20 * hiding problems.
21 * 09/09/97 aliu Ported over support for exponential formats.
22 * 07/20/98 stephen Changed documentation
23 * 01/30/13 emmons Added Scaling methods
24 ********************************************************************************
25 */
26
27 #ifndef DECIMFMT_H
28 #define DECIMFMT_H
29
30 #include "unicode/utypes.h"
36 #if !UCONFIG_NO_FORMATTING
37
38 #include "unicode/dcfmtsym.h"
39 #include "unicode/numfmt.h"
40 #include "unicode/locid.h"
41 #include "unicode/fpositer.h"
42 #include "unicode/stringpiece.h"
43 #include "unicode/curramt.h"
44 #include "unicode/enumset.h"
45
46 #ifndef U_HIDE_INTERNAL_API
47
51 #if UCONFIG_FORMAT_FASTPATHS_49
52 #define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16
53 #endif
54 #endif /* U_HIDE_INTERNAL_API */
55
56 U_NAMESPACE_BEGIN
57
58 class DigitList;
59 class CurrencyPluralInfo;
60 class Hashtable;
61 class UnicodeSet;
62 class FieldPositionHandler;
63 class DecimalFormatStaticSets;
64 class FixedDecimal;
65 class DecimalFormatImpl;
66 class PluralRules;
67 class VisibleDigitsWithExponent;
68
69 // explicit template instantiation. see digitlst.h
70 #if defined (_MSC_VER)
71 template class U_I18N_API EnumSet<UNumberFormatAttribute,
72 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
73 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>;
74 #endif
75
669 class U_I18N_API DecimalFormat: public NumberFormat {
670 public:
675 enum ERoundingMode {
676 kRoundCeiling,
677 kRoundFloor,
678 kRoundDown,
679 kRoundUp,
680 kRoundHalfEven,
682 kRoundHalfDown,
684 kRoundHalfUp,
690 kRoundUnnecessary
691 };
692
697 enum EPadPosition {
698 kPadBeforePrefix,
699 kPadAfterPrefix,
700 kPadBeforeSuffix,
701 kPadAfterSuffix
702 };
703
717 DecimalFormat(UErrorCode& status);
718
733 DecimalFormat(const UnicodeString& pattern,
734 UErrorCode& status);
735
754 DecimalFormat( const UnicodeString& pattern,
755 DecimalFormatSymbols* symbolsToAdopt,
756 UErrorCode& status);
757
758 #ifndef U_HIDE_INTERNAL_API
759
771 DecimalFormat( const UnicodeString& pattern,
772 DecimalFormatSymbols* symbolsToAdopt,
773 UNumberFormatStyle style,
774 UErrorCode& status);
775
776 #if UCONFIG_HAVE_PARSEALLINPUT
777
780 void setParseAllInput(UNumberFormatAttributeValue value);
781 #endif
782
783 #endif /* U_HIDE_INTERNAL_API */
784
785
796 virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr,
797 int32_t newvalue,
798 UErrorCode &status);
799
809 virtual int32_t getAttribute( UNumberFormatAttribute attr,
810 UErrorCode &status) const;
811
812
819 virtual void setGroupingUsed(UBool newValue);
820
828 virtual void setParseIntegerOnly(UBool value);
829
839 virtual void setContext(UDisplayContext value, UErrorCode& status);
840
860 DecimalFormat( const UnicodeString& pattern,
861 DecimalFormatSymbols* symbolsToAdopt,
862 UParseError& parseError,
863 UErrorCode& status);
881 DecimalFormat( const UnicodeString& pattern,
882 const DecimalFormatSymbols& symbols,
883 UErrorCode& status);
884
891 DecimalFormat(const DecimalFormat& source);
892
899 DecimalFormat& operator=(const DecimalFormat& rhs);
900
905 virtual ~DecimalFormat();
906
914 virtual Format* clone(void) const;
915
924 virtual UBool operator==(const Format& other) const;
925
926
927 using NumberFormat::format;
928
940 virtual UnicodeString& format(double number,
941 UnicodeString& appendTo,
942 FieldPosition& pos) const;
943
944
957 virtual UnicodeString& format(double number,
958 UnicodeString& appendTo,
959 FieldPosition& pos,
960 UErrorCode &status) const;
961
975 virtual UnicodeString& format(double number,
976 UnicodeString& appendTo,
977 FieldPositionIterator* posIter,
978 UErrorCode& status) const;
979
991 virtual UnicodeString& format(int32_t number,
992 UnicodeString& appendTo,
993 FieldPosition& pos) const;
994
1006 virtual UnicodeString& format(int32_t number,
1007 UnicodeString& appendTo,
1008 FieldPosition& pos,
1009 UErrorCode &status) const;
1010
1024 virtual UnicodeString& format(int32_t number,
1025 UnicodeString& appendTo,
1026 FieldPositionIterator* posIter,
1027 UErrorCode& status) const;
1028
1040 virtual UnicodeString& format(int64_t number,
1041 UnicodeString& appendTo,
1042 FieldPosition& pos) const;
1043
1055 virtual UnicodeString& format(int64_t number,
1056 UnicodeString& appendTo,
1057 FieldPosition& pos,
1058 UErrorCode &status) const;
1059
1073 virtual UnicodeString& format(int64_t number,
1074 UnicodeString& appendTo,
1075 FieldPositionIterator* posIter,
1076 UErrorCode& status) const;
1077
1094 virtual UnicodeString& format(StringPiece number,
1095 UnicodeString& appendTo,
1096 FieldPositionIterator* posIter,
1097 UErrorCode& status) const;
1098
1099
1115 virtual UnicodeString& format(const DigitList &number,
1116 UnicodeString& appendTo,
1117 FieldPositionIterator* posIter,
1118 UErrorCode& status) const;
1119
1131 virtual UnicodeString& format(
1132 const VisibleDigitsWithExponent &number,
1133 UnicodeString& appendTo,
1134 FieldPosition& pos,
1135 UErrorCode& status) const;
1136
1148 virtual UnicodeString& format(
1149 const VisibleDigitsWithExponent &number,
1150 UnicodeString& appendTo,
1151 FieldPositionIterator* posIter,
1152 UErrorCode& status) const;
1153
1169 virtual UnicodeString& format(const DigitList &number,
1170 UnicodeString& appendTo,
1171 FieldPosition& pos,
1172 UErrorCode& status) const;
1173
1174 using NumberFormat::parse;
1175
1195 virtual void parse(const UnicodeString& text,
1196 Formattable& result,
1197 ParsePosition& parsePosition) const;
1198
1218 virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
1219 ParsePosition& pos) const;
1220
1228 virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1229
1236 virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1237
1244 virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1245
1246
1253 virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
1254
1261 virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
1262
1269 virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
1270
1271
1280 UnicodeString& getPositivePrefix(UnicodeString& result) const;
1281
1289 virtual void setPositivePrefix(const UnicodeString& newValue);
1290
1299 UnicodeString& getNegativePrefix(UnicodeString& result) const;
1300
1308 virtual void setNegativePrefix(const UnicodeString& newValue);
1309
1318 UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1319
1327 virtual void setPositiveSuffix(const UnicodeString& newValue);
1328
1337 UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1338
1346 virtual void setNegativeSuffix(const UnicodeString& newValue);
1347
1358 int32_t getMultiplier(void) const;
1359
1370 virtual void setMultiplier(int32_t newValue);
1371
1381 virtual double getRoundingIncrement(void) const;
1382
1394 virtual void setRoundingIncrement(double newValue);
1395
1404 virtual ERoundingMode getRoundingMode(void) const;
1405
1414 virtual void setRoundingMode(ERoundingMode roundingMode);
1415
1427 virtual int32_t getFormatWidth(void) const;
1428
1443 virtual void setFormatWidth(int32_t width);
1444
1457 virtual UnicodeString getPadCharacterString() const;
1458
1473 virtual void setPadCharacter(const UnicodeString &padChar);
1474
1490 virtual EPadPosition getPadPosition(void) const;
1491
1508 virtual void setPadPosition(EPadPosition padPos);
1509
1520 virtual UBool isScientificNotation(void) const;
1521
1537 virtual void setScientificNotation(UBool useScientific);
1538
1549 virtual int8_t getMinimumExponentDigits(void) const;
1550
1563 virtual void setMinimumExponentDigits(int8_t minExpDig);
1564
1577 virtual UBool isExponentSignAlwaysShown(void) const;
1578
1592 virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1593
1605 int32_t getGroupingSize(void) const;
1606
1618 virtual void setGroupingSize(int32_t newValue);
1619
1638 int32_t getSecondaryGroupingSize(void) const;
1639
1651 virtual void setSecondaryGroupingSize(int32_t newValue);
1652
1653 #ifndef U_HIDE_INTERNAL_API
1654
1676 int32_t getMinimumGroupingDigits() const;
1677
1678 #endif /* U_HIDE_INTERNAL_API */
1679
1680 /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following draft method since it is virtual. */
1689 virtual void setMinimumGroupingDigits(int32_t newValue);
1690
1691
1700 UBool isDecimalSeparatorAlwaysShown(void) const;
1701
1710 virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1711
1718 UBool isDecimalPatternMatchRequired(void) const;
1719
1729 virtual void setDecimalPatternMatchRequired(UBool newValue);
1730
1731
1742 virtual UnicodeString& toPattern(UnicodeString& result) const;
1743
1754 virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
1755
1785 virtual void applyPattern(const UnicodeString& pattern,
1786 UParseError& parseError,
1787 UErrorCode& status);
1796 virtual void applyPattern(const UnicodeString& pattern,
1797 UErrorCode& status);
1798
1829 virtual void applyLocalizedPattern(const UnicodeString& pattern,
1830 UParseError& parseError,
1831 UErrorCode& status);
1832
1842 virtual void applyLocalizedPattern(const UnicodeString& pattern,
1843 UErrorCode& status);
1844
1845
1855 virtual void setMaximumIntegerDigits(int32_t newValue);
1856
1866 virtual void setMinimumIntegerDigits(int32_t newValue);
1867
1877 virtual void setMaximumFractionDigits(int32_t newValue);
1878
1888 virtual void setMinimumFractionDigits(int32_t newValue);
1889
1897 int32_t getMinimumSignificantDigits() const;
1898
1906 int32_t getMaximumSignificantDigits() const;
1907
1919 void setMinimumSignificantDigits(int32_t min);
1920
1932 void setMaximumSignificantDigits(int32_t max);
1933
1940 UBool areSignificantDigitsUsed() const;
1941
1949 void setSignificantDigitsUsed(UBool useSignificantDigits);
1950
1951 public:
1964 virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
1965
1971 virtual void setCurrency(const UChar* theCurrency);
1972
1980 void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
1981
1986 UCurrencyUsage getCurrencyUsage() const;
1987
1988
1989 #ifndef U_HIDE_DEPRECATED_API
1990
1995 static const char fgNumberPatterns[];
1996 #endif /* U_HIDE_DEPRECATED_API */
1997
1998 #ifndef U_HIDE_INTERNAL_API
1999
2005 FixedDecimal getFixedDecimal(double number, UErrorCode &status) const;
2006
2013 FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const;
2014
2021 FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const;
2022
2029 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2030 double number,
2031 VisibleDigitsWithExponent &digits,
2032 UErrorCode &status) const;
2033
2040 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2041 const Formattable &number,
2042 VisibleDigitsWithExponent &digits,
2043 UErrorCode &status) const;
2044
2052 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2053 DigitList &number,
2054 VisibleDigitsWithExponent &digits,
2055 UErrorCode &status) const;
2056
2057 #endif /* U_HIDE_INTERNAL_API */
2058
2059 public:
2060
2072 static UClassID U_EXPORT2 getStaticClassID(void);
2073
2085 virtual UClassID getDynamicClassID(void) const;
2086
2087 private:
2088
2089 DecimalFormat(); // default constructor not implemented
2090
2095 void init();
2096
2100 void construct(UErrorCode& status,
2101 UParseError& parseErr,
2102 const UnicodeString* pattern = 0,
2103 DecimalFormatSymbols* symbolsToAdopt = 0
2104 );
2105
2106 void handleCurrencySignInPattern(UErrorCode& status);
2107
2108 void parse(const UnicodeString& text,
2109 Formattable& result,
2110 ParsePosition& pos,
2111 UChar* currency) const;
2112
2113 enum {
2114 fgStatusInfinite,
2115 fgStatusLength // Leave last in list.
2116 } StatusFlags;
2117
2118 UBool subparse(const UnicodeString& text,
2119 const UnicodeString* negPrefix,
2120 const UnicodeString* negSuffix,
2121 const UnicodeString* posPrefix,
2122 const UnicodeString* posSuffix,
2123 UBool complexCurrencyParsing,
2124 int8_t type,
2125 ParsePosition& parsePosition,
2126 DigitList& digits, UBool* status,
2127 UChar* currency) const;
2128
2129 // Mixed style parsing for currency.
2130 // It parses against the current currency pattern
2131 // using complex affix comparison
2132 // parses against the currency plural patterns using complex affix comparison,
2133 // and parses against the current pattern using simple affix comparison.
2134 UBool parseForCurrency(const UnicodeString& text,
2135 ParsePosition& parsePosition,
2136 DigitList& digits,
2137 UBool* status,
2138 UChar* currency) const;
2139
2140 int32_t skipPadding(const UnicodeString& text, int32_t position) const;
2141
2142 int32_t compareAffix(const UnicodeString& input,
2143 int32_t pos,
2144 UBool isNegative,
2145 UBool isPrefix,
2146 const UnicodeString* affixPat,
2147 UBool complexCurrencyParsing,
2148 int8_t type,
2149 UChar* currency) const;
2150
2151 static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix);
2152
2153 UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const;
2154
2155 int32_t compareSimpleAffix(const UnicodeString& affix,
2156 const UnicodeString& input,
2157 int32_t pos,
2158 UBool lenient) const;
2159
2160 static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
2161
2162 static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
2163
2164 static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos);
2165
2166 static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
2167
2168 int32_t compareComplexAffix(const UnicodeString& affixPat,
2169 const UnicodeString& input,
2170 int32_t pos,
2171 int8_t type,
2172 UChar* currency) const;
2173
2174 static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
2175
2176 static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
2177
2178 static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
2179 UnicodeSet *sset, UChar32 schar);
2180
2181 static UBool matchDecimal(UChar32 symbolChar,
2182 UBool sawDecimal, UChar32 sawDecimalChar,
2183 const UnicodeSet *sset, UChar32 schar);
2184
2185 static UBool matchGrouping(UChar32 groupingChar,
2186 UBool sawGrouping, UChar32 sawGroupingChar,
2187 const UnicodeSet *sset,
2188 UChar32 decimalChar, const UnicodeSet *decimalSet,
2189 UChar32 schar);
2190
2191 // set up currency affix patterns for mix parsing.
2192 // The patterns saved here are the affix patterns of default currency
2193 // pattern and the unique affix patterns of the plural currency patterns.
2194 // Those patterns are used by parseForCurrency().
2195 void setupCurrencyAffixPatterns(UErrorCode& status);
2196
2197 // get the currency rounding with respect to currency usage
2198 double getCurrencyRounding(const UChar* currency,
2199 UErrorCode* ec) const;
2200
2201 // get the currency fraction with respect to currency usage
2202 int getCurrencyFractionDigits(const UChar* currency,
2203 UErrorCode* ec) const;
2204
2205 // hashtable operations
2206 Hashtable* initHashForAffixPattern(UErrorCode& status);
2207
2208 void deleteHashForAffixPattern();
2209
2210 void copyHashForAffixPattern(const Hashtable* source,
2211 Hashtable* target, UErrorCode& status);
2212
2213 DecimalFormatImpl *fImpl;
2214
2220 EnumSet<UNumberFormatAttribute,
2221 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
2222 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
2223 fBoolFlags;
2224
2225
2226 // style is only valid when decimal formatter is constructed by
2227 // DecimalFormat(pattern, decimalFormatSymbol, style)
2228 int fStyle;
2229
2230
2231 // Affix pattern set for currency.
2232 // It is a set of AffixPatternsForCurrency,
2233 // each element of the set saves the negative prefix pattern,
2234 // negative suffix pattern, positive prefix pattern,
2235 // and positive suffix pattern of a pattern.
2236 // It is used for currency mixed style parsing.
2237 // It is actually is a set.
2238 // The set contains the default currency pattern from the locale,
2239 // and the currency plural patterns.
2240 // Since it is a set, it does not contain duplicated items.
2241 // For example, if 2 currency plural patterns are the same, only one pattern
2242 // is included in the set. When parsing, we do not check whether the plural
2243 // count match or not.
2244 Hashtable* fAffixPatternsForCurrency;
2245
2246 // Information needed for DecimalFormat to format/parse currency plural.
2247 CurrencyPluralInfo* fCurrencyPluralInfo;
2248
2249 #if UCONFIG_HAVE_PARSEALLINPUT
2250 UNumberFormatAttributeValue fParseAllInput;
2251 #endif
2252
2253 // Decimal Format Static Sets singleton.
2254 const DecimalFormatStaticSets *fStaticSets;
2255
2256 protected:
2257
2258 #ifndef U_HIDE_INTERNAL_API
2259
2263 DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const;
2264 #endif /* U_HIDE_INTERNAL_API */
2265
2274 virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
2275
2279 static const int32_t kDoubleIntegerDigits;
2283 static const int32_t kDoubleFractionDigits;
2284
2295 static const int32_t kMaxScientificIntegerDigits;
2296
2297 };
2298
2299 U_NAMESPACE_END
2300
2301 #endif /* #if !UCONFIG_NO_FORMATTING */
2302
2303 #endif // _DECIMFMT
2304 //eof
icu::Format
Base class for all formats.
Definition: format.h:96
icu::DecimalFormatSymbols
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:86
icu::NumberFormat::getDynamicClassID
virtual UClassID getDynamicClassID(void) const =0
Returns a unique class ID POLYMORPHICALLY.
icu::DecimalFormat
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Definition: decimfmt.h:669
icu::EnumSet
enum bitset for boolean fields.
Definition: enumset.h:33
icu::NumberFormat
Abstract base class for all number formats.
Definition: numfmt.h:169
icu::NumberFormat::parse
virtual void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const =0
Return a long if possible (e.g.
fpositer.h
C++ API: FieldPosition Iterator.
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:66
icu::DecimalFormat::kMaxScientificIntegerDigits
static const int32_t kMaxScientificIntegerDigits
When someone turns on scientific mode, we assume that more than this number of digits is due to flipp...
Definition: decimfmt.h:2295
icu::NumberFormat::setMinimumIntegerDigits
virtual void setMinimumIntegerDigits(int32_t newValue)
Sets the minimum number of digits allowed in the integer portion of a number.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
icu::Format::clone
virtual Format * clone() const =0
Clone this object polymorphically.
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:1010
icu::NumberFormat::setMinimumFractionDigits
virtual void setMinimumFractionDigits(int32_t newValue)
Sets the minimum number of digits allowed in the fraction portion of a number.
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:360
stringpiece.h
C++ API: StringPiece: Read-only byte string wrapper class.
curramt.h
C++ API: Currency Amount Object.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::NumberFormat::getEffectiveCurrency
virtual void getEffectiveCurrency(UChar *result, UErrorCode &ec) const
Returns the currency in effect for this formatter.
UNumberFormatStyle
UNumberFormatStyle
The possible number format styles.
Definition: unum.h:141
icu::NumberFormat::setCurrency
virtual void setCurrency(const UChar *theCurrency, UErrorCode &ec)
Sets the currency used to display currency amounts.
icu::FieldPositionIterator
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition: fpositer.h:55
icu::NumberFormat::setGroupingUsed
virtual void setGroupingUsed(UBool newValue)
Set whether or not grouping will be used in this format.
UCurrencyUsage
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:357
icu::NumberFormat::setParseIntegerOnly
virtual void setParseIntegerOnly(UBool value)
Sets whether or not numbers should be parsed as integers only.
icu::NumberFormat::parseCurrency
virtual CurrencyAmount * parseCurrency(const UnicodeString &text, ParsePosition &pos) const
Parses text from the given string as a currency amount.
icu::DecimalFormat::EPadPosition
EPadPosition
Pad position.
Definition: decimfmt.h:697
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:278
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:981
icu::DecimalFormat::ERoundingMode
ERoundingMode
Rounding mode.
Definition: decimfmt.h:675
icu::NumberFormat::operator==
virtual UBool operator==(const Format &other) const
Return true if the given Format objects are semantically equal.
icu::NumberFormat::setMaximumIntegerDigits
virtual void setMaximumIntegerDigits(int32_t newValue)
Sets the maximum number of digits allowed in the integer portion of a number.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
icu::DecimalFormat::kRoundUp
Round away from zero.
Definition: decimfmt.h:679
icu::NumberFormat::setContext
virtual void setContext(UDisplayContext value, UErrorCode &status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
icu::NumberFormat::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:108
icu::DecimalFormat::kRoundFloor
Round towards negative infinity.
Definition: decimfmt.h:677
dcfmtsym.h
C++ API: Symbols for formatting numbers.
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
locid.h
C++ API: Locale ID object.
icu::DecimalFormat::kRoundDown
Round towards zero.
Definition: decimfmt.h:678
icu::CurrencyPluralInfo
This class represents the information needed by DecimalFormat to format currency plural, such as "3.00 US dollars" or "1.00 US dollar".
Definition: currpinf.h:46
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:68
icu::NumberFormat::format
virtual UnicodeString & format(const Formattable &obj, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const
Format an object to produce a string.
enumset.h
C++: internal template EnumSet<>
numfmt.h
C++ API: Abstract base class for all number formats.
UNumberFormatAttribute
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:895
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:54
icu::DecimalFormat::kRoundCeiling
Round towards positive infinity.
Definition: decimfmt.h:676
icu::NumberFormat::setMaximumFractionDigits
virtual void setMaximumFractionDigits(int32_t newValue)
Sets the maximum number of digits allowed in the fraction portion of a number.
icu::NumberFormat::operator=
NumberFormat & operator=(const NumberFormat &)
Assignment operator.
icu::DecimalFormat::kDoubleIntegerDigits
static const int32_t kDoubleIntegerDigits
number of integer digits
Definition: decimfmt.h:2279
icu::CurrencyAmount
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:37
icu::DecimalFormat::kDoubleFractionDigits
static const int32_t kDoubleFractionDigits
number of fraction digits
Definition: decimfmt.h:2283
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259