ICU 56.1: decimfmt.h Source File

ICU 56.1 56.1

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

- File List
- Globals

decimfmt.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 1997-2015, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
6 *
7 * File DECIMFMT.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 02/19/97 aliu Converted from java.
13 * 03/20/97 clhuang Updated per C++ implementation.
14 * 04/03/97 aliu Rewrote parsing and formatting completely, and
15 * cleaned up and debugged. Actually works now.
16 * 04/17/97 aliu Changed DigitCount to int per code review.
17 * 07/10/97 helena Made ParsePosition a class and get rid of the function
18 * hiding problems.
19 * 09/09/97 aliu Ported over support for exponential formats.
20 * 07/20/98 stephen Changed documentation
21 * 01/30/13 emmons Added Scaling methods
22 ********************************************************************************
23 */
24
25 #ifndef DECIMFMT_H
26 #define DECIMFMT_H
27
28 #include "unicode/utypes.h"
34 #if !UCONFIG_NO_FORMATTING
35
36 #include "unicode/dcfmtsym.h"
37 #include "unicode/numfmt.h"
38 #include "unicode/locid.h"
39 #include "unicode/fpositer.h"
40 #include "unicode/stringpiece.h"
41 #include "unicode/curramt.h"
42 #include "unicode/enumset.h"
43
44 #ifndef U_HIDE_INTERNAL_API
45
49 #if UCONFIG_FORMAT_FASTPATHS_49
50 #define UNUM_DECIMALFORMAT_INTERNAL_SIZE 16
51 #endif
52 #endif /* U_HIDE_INTERNAL_API */
53
54 U_NAMESPACE_BEGIN
55
56 class DigitList;
57 class ChoiceFormat;
58 class CurrencyPluralInfo;
59 class Hashtable;
60 class UnicodeSet;
61 class FieldPositionHandler;
62 class DecimalFormatStaticSets;
63 class FixedDecimal;
64 class DecimalFormatImpl;
65 class PluralRules;
66 class VisibleDigitsWithExponent;
67
68 // explicit template instantiation. see digitlst.h
69 #if defined (_MSC_VER)
70 template class U_I18N_API EnumSet<UNumberFormatAttribute,
71 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
72 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>;
73 #endif
74
668 class U_I18N_API DecimalFormat: public NumberFormat {
669 public:
674 enum ERoundingMode {
675 kRoundCeiling,
676 kRoundFloor,
677 kRoundDown,
678 kRoundUp,
679 kRoundHalfEven,
681 kRoundHalfDown,
683 kRoundHalfUp,
689 kRoundUnnecessary
690 };
691
696 enum EPadPosition {
697 kPadBeforePrefix,
698 kPadAfterPrefix,
699 kPadBeforeSuffix,
700 kPadAfterSuffix
701 };
702
716 DecimalFormat(UErrorCode& status);
717
732 DecimalFormat(const UnicodeString& pattern,
733 UErrorCode& status);
734
753 DecimalFormat( const UnicodeString& pattern,
754 DecimalFormatSymbols* symbolsToAdopt,
755 UErrorCode& status);
756
757 #ifndef U_HIDE_INTERNAL_API
758
770 DecimalFormat( const UnicodeString& pattern,
771 DecimalFormatSymbols* symbolsToAdopt,
772 UNumberFormatStyle style,
773 UErrorCode& status);
774
775 #if UCONFIG_HAVE_PARSEALLINPUT
776
779 void setParseAllInput(UNumberFormatAttributeValue value);
780 #endif
781
782 #endif /* U_HIDE_INTERNAL_API */
783
784
795 virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr,
796 int32_t newvalue,
797 UErrorCode &status);
798
808 virtual int32_t getAttribute( UNumberFormatAttribute attr,
809 UErrorCode &status) const;
810
811
818 virtual void setGroupingUsed(UBool newValue);
819
827 virtual void setParseIntegerOnly(UBool value);
828
838 virtual void setContext(UDisplayContext value, UErrorCode& status);
839
859 DecimalFormat( const UnicodeString& pattern,
860 DecimalFormatSymbols* symbolsToAdopt,
861 UParseError& parseError,
862 UErrorCode& status);
880 DecimalFormat( const UnicodeString& pattern,
881 const DecimalFormatSymbols& symbols,
882 UErrorCode& status);
883
890 DecimalFormat(const DecimalFormat& source);
891
898 DecimalFormat& operator=(const DecimalFormat& rhs);
899
904 virtual ~DecimalFormat();
905
913 virtual Format* clone(void) const;
914
923 virtual UBool operator==(const Format& other) const;
924
925
926 using NumberFormat::format;
927
939 virtual UnicodeString& format(double number,
940 UnicodeString& appendTo,
941 FieldPosition& pos) const;
942
943
956 virtual UnicodeString& format(double number,
957 UnicodeString& appendTo,
958 FieldPosition& pos,
959 UErrorCode &status) const;
960
974 virtual UnicodeString& format(double number,
975 UnicodeString& appendTo,
976 FieldPositionIterator* posIter,
977 UErrorCode& status) const;
978
990 virtual UnicodeString& format(int32_t number,
991 UnicodeString& appendTo,
992 FieldPosition& pos) const;
993
1005 virtual UnicodeString& format(int32_t number,
1006 UnicodeString& appendTo,
1007 FieldPosition& pos,
1008 UErrorCode &status) const;
1009
1023 virtual UnicodeString& format(int32_t number,
1024 UnicodeString& appendTo,
1025 FieldPositionIterator* posIter,
1026 UErrorCode& status) const;
1027
1039 virtual UnicodeString& format(int64_t number,
1040 UnicodeString& appendTo,
1041 FieldPosition& pos) const;
1042
1054 virtual UnicodeString& format(int64_t number,
1055 UnicodeString& appendTo,
1056 FieldPosition& pos,
1057 UErrorCode &status) const;
1058
1072 virtual UnicodeString& format(int64_t number,
1073 UnicodeString& appendTo,
1074 FieldPositionIterator* posIter,
1075 UErrorCode& status) const;
1076
1093 virtual UnicodeString& format(const StringPiece &number,
1094 UnicodeString& appendTo,
1095 FieldPositionIterator* posIter,
1096 UErrorCode& status) const;
1097
1098
1114 virtual UnicodeString& format(const DigitList &number,
1115 UnicodeString& appendTo,
1116 FieldPositionIterator* posIter,
1117 UErrorCode& status) const;
1118
1130 virtual UnicodeString& format(
1131 const VisibleDigitsWithExponent &number,
1132 UnicodeString& appendTo,
1133 FieldPosition& pos,
1134 UErrorCode& status) const;
1135
1147 virtual UnicodeString& format(
1148 const VisibleDigitsWithExponent &number,
1149 UnicodeString& appendTo,
1150 FieldPositionIterator* posIter,
1151 UErrorCode& status) const;
1152
1168 virtual UnicodeString& format(const DigitList &number,
1169 UnicodeString& appendTo,
1170 FieldPosition& pos,
1171 UErrorCode& status) const;
1172
1173 using NumberFormat::parse;
1174
1194 virtual void parse(const UnicodeString& text,
1195 Formattable& result,
1196 ParsePosition& parsePosition) const;
1197
1217 virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
1218 ParsePosition& pos) const;
1219
1227 virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1228
1235 virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1236
1243 virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1244
1245
1252 virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
1253
1260 virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
1261
1268 virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
1269
1270
1279 UnicodeString& getPositivePrefix(UnicodeString& result) const;
1280
1288 virtual void setPositivePrefix(const UnicodeString& newValue);
1289
1298 UnicodeString& getNegativePrefix(UnicodeString& result) const;
1299
1307 virtual void setNegativePrefix(const UnicodeString& newValue);
1308
1317 UnicodeString& getPositiveSuffix(UnicodeString& result) const;
1318
1326 virtual void setPositiveSuffix(const UnicodeString& newValue);
1327
1336 UnicodeString& getNegativeSuffix(UnicodeString& result) const;
1337
1345 virtual void setNegativeSuffix(const UnicodeString& newValue);
1346
1357 int32_t getMultiplier(void) const;
1358
1369 virtual void setMultiplier(int32_t newValue);
1370
1380 virtual double getRoundingIncrement(void) const;
1381
1393 virtual void setRoundingIncrement(double newValue);
1394
1403 virtual ERoundingMode getRoundingMode(void) const;
1404
1413 virtual void setRoundingMode(ERoundingMode roundingMode);
1414
1426 virtual int32_t getFormatWidth(void) const;
1427
1442 virtual void setFormatWidth(int32_t width);
1443
1456 virtual UnicodeString getPadCharacterString() const;
1457
1472 virtual void setPadCharacter(const UnicodeString &padChar);
1473
1489 virtual EPadPosition getPadPosition(void) const;
1490
1507 virtual void setPadPosition(EPadPosition padPos);
1508
1519 virtual UBool isScientificNotation(void) const;
1520
1536 virtual void setScientificNotation(UBool useScientific);
1537
1548 virtual int8_t getMinimumExponentDigits(void) const;
1549
1562 virtual void setMinimumExponentDigits(int8_t minExpDig);
1563
1576 virtual UBool isExponentSignAlwaysShown(void) const;
1577
1591 virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1592
1604 int32_t getGroupingSize(void) const;
1605
1617 virtual void setGroupingSize(int32_t newValue);
1618
1637 int32_t getSecondaryGroupingSize(void) const;
1638
1650 virtual void setSecondaryGroupingSize(int32_t newValue);
1651
1652 #ifndef U_HIDE_INTERNAL_API
1653
1675 int32_t getMinimumGroupingDigits() const;
1676
1685 virtual void setMinimumGroupingDigits(int32_t newValue);
1686
1687 #endif /* U_HIDE_INTERNAL_API */
1688
1697 UBool isDecimalSeparatorAlwaysShown(void) const;
1698
1707 virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1708
1715 UBool isDecimalPatternMatchRequired(void) const;
1716
1726 virtual void setDecimalPatternMatchRequired(UBool newValue);
1727
1728
1739 virtual UnicodeString& toPattern(UnicodeString& result) const;
1740
1751 virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
1752
1782 virtual void applyPattern(const UnicodeString& pattern,
1783 UParseError& parseError,
1784 UErrorCode& status);
1793 virtual void applyPattern(const UnicodeString& pattern,
1794 UErrorCode& status);
1795
1826 virtual void applyLocalizedPattern(const UnicodeString& pattern,
1827 UParseError& parseError,
1828 UErrorCode& status);
1829
1839 virtual void applyLocalizedPattern(const UnicodeString& pattern,
1840 UErrorCode& status);
1841
1842
1852 virtual void setMaximumIntegerDigits(int32_t newValue);
1853
1863 virtual void setMinimumIntegerDigits(int32_t newValue);
1864
1874 virtual void setMaximumFractionDigits(int32_t newValue);
1875
1885 virtual void setMinimumFractionDigits(int32_t newValue);
1886
1894 int32_t getMinimumSignificantDigits() const;
1895
1903 int32_t getMaximumSignificantDigits() const;
1904
1916 void setMinimumSignificantDigits(int32_t min);
1917
1929 void setMaximumSignificantDigits(int32_t max);
1930
1937 UBool areSignificantDigitsUsed() const;
1938
1946 void setSignificantDigitsUsed(UBool useSignificantDigits);
1947
1948 public:
1961 virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
1962
1968 virtual void setCurrency(const UChar* theCurrency);
1969
1977 void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec);
1978
1983 UCurrencyUsage getCurrencyUsage() const;
1984
1985
1986 #ifndef U_HIDE_DEPRECATED_API
1987
1992 static const char fgNumberPatterns[];
1993 #endif /* U_HIDE_DEPRECATED_API */
1994
1995 #ifndef U_HIDE_INTERNAL_API
1996
2002 FixedDecimal getFixedDecimal(double number, UErrorCode &status) const;
2003
2010 FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const;
2011
2018 FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const;
2019
2026 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2027 double number,
2028 VisibleDigitsWithExponent &digits,
2029 UErrorCode &status) const;
2030
2037 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2038 const Formattable &number,
2039 VisibleDigitsWithExponent &digits,
2040 UErrorCode &status) const;
2041
2049 VisibleDigitsWithExponent &initVisibleDigitsWithExponent(
2050 DigitList &number,
2051 VisibleDigitsWithExponent &digits,
2052 UErrorCode &status) const;
2053
2054 #endif /* U_HIDE_INTERNAL_API */
2055
2056 public:
2057
2069 static UClassID U_EXPORT2 getStaticClassID(void);
2070
2082 virtual UClassID getDynamicClassID(void) const;
2083
2084 private:
2085
2086 DecimalFormat(); // default constructor not implemented
2087
2092 void init();
2093
2097 void construct(UErrorCode& status,
2098 UParseError& parseErr,
2099 const UnicodeString* pattern = 0,
2100 DecimalFormatSymbols* symbolsToAdopt = 0
2101 );
2102
2103 void parse(const UnicodeString& text,
2104 Formattable& result,
2105 ParsePosition& pos,
2106 UChar* currency) const;
2107
2108 enum {
2109 fgStatusInfinite,
2110 fgStatusLength // Leave last in list.
2111 } StatusFlags;
2112
2113 UBool subparse(const UnicodeString& text,
2114 const UnicodeString* negPrefix,
2115 const UnicodeString* negSuffix,
2116 const UnicodeString* posPrefix,
2117 const UnicodeString* posSuffix,
2118 UBool complexCurrencyParsing,
2119 int8_t type,
2120 ParsePosition& parsePosition,
2121 DigitList& digits, UBool* status,
2122 UChar* currency) const;
2123
2124 // Mixed style parsing for currency.
2125 // It parses against the current currency pattern
2126 // using complex affix comparison
2127 // parses against the currency plural patterns using complex affix comparison,
2128 // and parses against the current pattern using simple affix comparison.
2129 UBool parseForCurrency(const UnicodeString& text,
2130 ParsePosition& parsePosition,
2131 DigitList& digits,
2132 UBool* status,
2133 UChar* currency) const;
2134
2135 int32_t skipPadding(const UnicodeString& text, int32_t position) const;
2136
2137 int32_t compareAffix(const UnicodeString& input,
2138 int32_t pos,
2139 UBool isNegative,
2140 UBool isPrefix,
2141 const UnicodeString* affixPat,
2142 UBool complexCurrencyParsing,
2143 int8_t type,
2144 UChar* currency) const;
2145
2146 static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix);
2147
2148 UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const;
2149
2150 int32_t compareSimpleAffix(const UnicodeString& affix,
2151 const UnicodeString& input,
2152 int32_t pos,
2153 UBool lenient) const;
2154
2155 static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos);
2156
2157 static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
2158
2159 static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos);
2160
2161 static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos);
2162
2163 int32_t compareComplexAffix(const UnicodeString& affixPat,
2164 const UnicodeString& input,
2165 int32_t pos,
2166 int8_t type,
2167 UChar* currency) const;
2168
2169 static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
2170
2171 static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
2172
2173 static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol,
2174 UnicodeSet *sset, UChar32 schar);
2175
2176 static UBool matchDecimal(UChar32 symbolChar,
2177 UBool sawDecimal, UChar32 sawDecimalChar,
2178 const UnicodeSet *sset, UChar32 schar);
2179
2180 static UBool matchGrouping(UChar32 groupingChar,
2181 UBool sawGrouping, UChar32 sawGroupingChar,
2182 const UnicodeSet *sset,
2183 UChar32 decimalChar, const UnicodeSet *decimalSet,
2184 UChar32 schar);
2185
2186 // set up currency affix patterns for mix parsing.
2187 // The patterns saved here are the affix patterns of default currency
2188 // pattern and the unique affix patterns of the plural currency patterns.
2189 // Those patterns are used by parseForCurrency().
2190 void setupCurrencyAffixPatterns(UErrorCode& status);
2191
2192 // get the currency rounding with respect to currency usage
2193 double getCurrencyRounding(const UChar* currency,
2194 UErrorCode* ec) const;
2195
2196 // get the currency fraction with respect to currency usage
2197 int getCurrencyFractionDigits(const UChar* currency,
2198 UErrorCode* ec) const;
2199
2200 // hashtable operations
2201 Hashtable* initHashForAffixPattern(UErrorCode& status);
2202
2203 void deleteHashForAffixPattern();
2204
2205 void copyHashForAffixPattern(const Hashtable* source,
2206 Hashtable* target, UErrorCode& status);
2207
2208 DecimalFormatImpl *fImpl;
2209
2215 EnumSet<UNumberFormatAttribute,
2216 UNUM_MAX_NONBOOLEAN_ATTRIBUTE+1,
2217 UNUM_LIMIT_BOOLEAN_ATTRIBUTE>
2218 fBoolFlags;
2219
2220
2221 // style is only valid when decimal formatter is constructed by
2222 // DecimalFormat(pattern, decimalFormatSymbol, style)
2223 int fStyle;
2224
2225
2226 // Affix pattern set for currency.
2227 // It is a set of AffixPatternsForCurrency,
2228 // each element of the set saves the negative prefix pattern,
2229 // negative suffix pattern, positive prefix pattern,
2230 // and positive suffix pattern of a pattern.
2231 // It is used for currency mixed style parsing.
2232 // It is actually is a set.
2233 // The set contains the default currency pattern from the locale,
2234 // and the currency plural patterns.
2235 // Since it is a set, it does not contain duplicated items.
2236 // For example, if 2 currency plural patterns are the same, only one pattern
2237 // is included in the set. When parsing, we do not check whether the plural
2238 // count match or not.
2239 Hashtable* fAffixPatternsForCurrency;
2240
2241 // Information needed for DecimalFormat to format/parse currency plural.
2242 CurrencyPluralInfo* fCurrencyPluralInfo;
2243
2244 #if UCONFIG_HAVE_PARSEALLINPUT
2245 UNumberFormatAttributeValue fParseAllInput;
2246 #endif
2247
2248 // Decimal Format Static Sets singleton.
2249 const DecimalFormatStaticSets *fStaticSets;
2250
2251 protected:
2252
2253 #ifndef U_HIDE_INTERNAL_API
2254
2258 DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const;
2259 #endif /* U_HIDE_INTERNAL_API */
2260
2269 virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
2270
2274 static const int32_t kDoubleIntegerDigits;
2278 static const int32_t kDoubleFractionDigits;
2279
2290 static const int32_t kMaxScientificIntegerDigits;
2291
2292 };
2293
2294 U_NAMESPACE_END
2295
2296 #endif /* #if !UCONFIG_NO_FORMATTING */
2297
2298 #endif // _DECIMFMT
2299 //eof
icu::Format
Base class for all formats.
Definition: format.h:94
icu::DecimalFormatSymbols
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:84
icu::DecimalFormat
DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers.
Definition: decimfmt.h:668
icu::EnumSet
enum bitset for boolean fields.
Definition: enumset.h:31
icu::NumberFormat
Abstract base class for all number formats.
Definition: numfmt.h:172
fpositer.h
C++ API: FieldPosition Iterator.
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:56
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:2290
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's RTTI.
Definition: uobject.h:91
UNUM_LIMIT_BOOLEAN_ATTRIBUTE
Limit of boolean attributes.
Definition: unum.h:997
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:358
stringpiece.h
C++ API: StringPiece: Read-only byte string wrapper class.
curramt.h
C++ API: Currency Amount Object.
icu::NumberFormat::getDynamicClassID
virtual UClassID getDynamicClassID(void) const =0
Returns a unique class ID POLYMORPHICALLY.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
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:139
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:53
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:24
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
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:696
icu::UnicodeSet
A mutable set of Unicode characters and multicharacter strings.
Definition: uniset.h:276
UNUM_MAX_NONBOOLEAN_ATTRIBUTE
One below the first bitfield-boolean item.
Definition: unum.h:968
icu::DecimalFormat::ERoundingMode
ERoundingMode
Rounding mode.
Definition: decimfmt.h:674
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:312
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::DecimalFormat::kRoundUp
Round away from zero.
Definition: decimfmt.h:678
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:476
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:106
icu::DecimalFormat::kRoundFloor
Round towards negative infinity.
Definition: decimfmt.h:676
icu::NumberFormat::parse
virtual void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const =0
Return a long if possible (e.g.
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:47
locid.h
C++ API: Locale ID object.
icu::DecimalFormat::kRoundDown
Round towards zero.
Definition: decimfmt.h:677
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:44
UParseError
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:56
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:293
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
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:882
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:52
icu::DecimalFormat::kRoundCeiling
Round towards positive infinity.
Definition: decimfmt.h:675
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:2274
icu::CurrencyAmount
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:35
icu::DecimalFormat::kDoubleFractionDigits
static const int32_t kDoubleFractionDigits
number of fraction digits
Definition: decimfmt.h:2278
icu::Format::clone
virtual Format * clone() const =0
Clone this object polymorphically.
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234