ICU 70.1  70.1
decimfmt.h
Go to the documentation of this file.
1 // © 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"
31 
32 #if U_SHOW_CPLUSPLUS_API
33 
39 #if !UCONFIG_NO_FORMATTING
40 
41 #include "unicode/dcfmtsym.h"
42 #include "unicode/numfmt.h"
43 #include "unicode/locid.h"
44 #include "unicode/fpositer.h"
45 #include "unicode/stringpiece.h"
46 #include "unicode/curramt.h"
47 #include "unicode/enumset.h"
48 
49 U_NAMESPACE_BEGIN
50 
51 class CurrencyPluralInfo;
52 class CompactDecimalFormat;
53 
54 namespace number {
55 class LocalizedNumberFormatter;
56 namespace impl {
57 class DecimalQuantity;
58 struct DecimalFormatFields;
59 class UFormattedNumberData;
60 }
61 }
62 
63 namespace numparse {
64 namespace impl {
65 class NumberParserImpl;
66 }
67 }
68 
669  public:
675  kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix
676  };
677 
695 
713  DecimalFormat(const UnicodeString& pattern, UErrorCode& status);
714 
736  DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
737 
738 #ifndef U_HIDE_INTERNAL_API
739 
752  DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
753  UNumberFormatStyle style, UErrorCode& status);
754 
755 #if UCONFIG_HAVE_PARSEALLINPUT
756 
760  void setParseAllInput(UNumberFormatAttributeValue value);
761 
762 #endif
763 
764 #endif /* U_HIDE_INTERNAL_API */
765 
766  private:
767 
772  DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status);
773 
774  public:
775 
786  virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status);
787 
797  virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const;
798 
799 
807 
816 
825 
848  DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt,
849  UParseError& parseError, UErrorCode& status);
850 
871  DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status);
872 
879  DecimalFormat(const DecimalFormat& source);
880 
888 
894 
902  DecimalFormat* clone() const U_OVERRIDE;
903 
912  bool operator==(const Format& other) const U_OVERRIDE;
913 
914 
915  using NumberFormat::format;
916 
928  UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
929 
930 #ifndef U_HIDE_INTERNAL_API
943  UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos,
944  UErrorCode& status) const U_OVERRIDE;
945 #endif /* U_HIDE_INTERNAL_API */
946 
960  UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter,
961  UErrorCode& status) const U_OVERRIDE;
962 
974  UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
975 
976 #ifndef U_HIDE_INTERNAL_API
989  UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos,
990  UErrorCode& status) const U_OVERRIDE;
991 #endif /* U_HIDE_INTERNAL_API */
992 
1006  UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
1007  UErrorCode& status) const U_OVERRIDE;
1008 
1020  UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE;
1021 
1022 #ifndef U_HIDE_INTERNAL_API
1035  UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos,
1036  UErrorCode& status) const U_OVERRIDE;
1037 #endif /* U_HIDE_INTERNAL_API */
1038 
1052  UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter,
1053  UErrorCode& status) const U_OVERRIDE;
1054 
1072  UErrorCode& status) const U_OVERRIDE;
1073 
1074 #ifndef U_HIDE_INTERNAL_API
1075 
1091  UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
1092  FieldPositionIterator* posIter, UErrorCode& status) const U_OVERRIDE;
1093 
1109  UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo,
1110  FieldPosition& pos, UErrorCode& status) const U_OVERRIDE;
1111 
1112 #endif // U_HIDE_INTERNAL_API
1113 
1114  using NumberFormat::parse;
1115 
1135  void parse(const UnicodeString& text, Formattable& result,
1136  ParsePosition& parsePosition) const U_OVERRIDE;
1137 
1158 
1166  virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
1167 
1174  virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
1175 
1182  virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
1183 
1184 
1191  virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
1192 
1200 
1207  virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
1208 
1209 
1219 
1227  virtual void setPositivePrefix(const UnicodeString& newValue);
1228 
1238 
1246  virtual void setNegativePrefix(const UnicodeString& newValue);
1247 
1257 
1265  virtual void setPositiveSuffix(const UnicodeString& newValue);
1266 
1276 
1284  virtual void setNegativeSuffix(const UnicodeString& newValue);
1285 
1295 
1305 
1318  int32_t getMultiplier(void) const;
1319 
1333  virtual void setMultiplier(int32_t newValue);
1334 
1347  int32_t getMultiplierScale(void) const;
1348 
1368  void setMultiplierScale(int32_t newValue);
1369 
1379  virtual double getRoundingIncrement(void) const;
1380 
1392  virtual void setRoundingIncrement(double newValue);
1393 
1403 
1412  virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE;
1413 
1425  virtual int32_t getFormatWidth(void) const;
1426 
1441  virtual void setFormatWidth(int32_t width);
1442 
1456 
1471  virtual void setPadCharacter(const UnicodeString& padChar);
1472 
1488  virtual EPadPosition getPadPosition(void) const;
1489 
1506  virtual void setPadPosition(EPadPosition padPos);
1507 
1518  virtual UBool isScientificNotation(void) const;
1519 
1535  virtual void setScientificNotation(UBool useScientific);
1536 
1547  virtual int8_t getMinimumExponentDigits(void) const;
1548 
1561  virtual void setMinimumExponentDigits(int8_t minExpDig);
1562 
1575  virtual UBool isExponentSignAlwaysShown(void) const;
1576 
1590  virtual void setExponentSignAlwaysShown(UBool expSignAlways);
1591 
1603  int32_t getGroupingSize(void) const;
1604 
1616  virtual void setGroupingSize(int32_t newValue);
1617 
1636  int32_t getSecondaryGroupingSize(void) const;
1637 
1649  virtual void setSecondaryGroupingSize(int32_t newValue);
1650 
1674  int32_t getMinimumGroupingDigits() const;
1675 
1693  void setMinimumGroupingDigits(int32_t newValue);
1694 
1704 
1713  virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
1714 
1722 
1732  virtual void setDecimalPatternMatchRequired(UBool newValue);
1733 
1742 
1752 
1761 
1774 
1784 
1793 
1804  virtual UnicodeString& toPattern(UnicodeString& result) const;
1805 
1817 
1847  virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status);
1848 
1857  virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status);
1858 
1889  virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError,
1890  UErrorCode& status);
1891 
1901  virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status);
1902 
1903 
1913  void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE;
1914 
1924  void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE;
1925 
1935  void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE;
1936 
1946  void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE;
1947 
1956 
1965 
1977  void setMinimumSignificantDigits(int32_t min);
1978 
1990  void setMaximumSignificantDigits(int32_t max);
1991 
1999 
2007  void setSignificantDigitsUsed(UBool useSignificantDigits);
2008 
2021  void setCurrency(const char16_t* theCurrency, UErrorCode& ec) U_OVERRIDE;
2022 
2023 #ifndef U_FORCE_HIDE_DEPRECATED_API
2029  virtual void setCurrency(const char16_t* theCurrency);
2030 #endif // U_FORCE_HIDE_DEPRECATED_API
2031 
2041 
2047 
2048 #ifndef U_HIDE_INTERNAL_API
2049 
2055  void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output,
2056  UErrorCode& status) const;
2057 
2064  void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output,
2065  UErrorCode& status) const;
2066 
2067 #endif /* U_HIDE_INTERNAL_API */
2068 
2115 
2127  static UClassID U_EXPORT2 getStaticClassID(void);
2128 
2141 
2142  private:
2143 
2145  void touch(UErrorCode& status);
2146 
2148  void touchNoError();
2149 
2161  void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding,
2162  UErrorCode& status);
2163 
2164  const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const;
2165 
2166  const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const;
2167 
2168  static void fieldPositionHelper(
2169  const number::impl::UFormattedNumberData& formatted,
2170  FieldPosition& fieldPosition,
2171  int32_t offset,
2172  UErrorCode& status);
2173 
2174  static void fieldPositionIteratorHelper(
2175  const number::impl::UFormattedNumberData& formatted,
2176  FieldPositionIterator* fpi,
2177  int32_t offset,
2178  UErrorCode& status);
2179 
2180  void setupFastFormat();
2181 
2182  bool fastFormatDouble(double input, UnicodeString& output) const;
2183 
2184  bool fastFormatInt64(int64_t input, UnicodeString& output) const;
2185 
2186  void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const;
2187 
2188  //=====================================================================================//
2189  // INSTANCE FIELDS //
2190  //=====================================================================================//
2191 
2192 
2193  // One instance field for the implementation, keep all fields inside of an implementation
2194  // class defined in number_mapper.h
2195  number::impl::DecimalFormatFields* fields = nullptr;
2196 
2197  // Allow child class CompactDecimalFormat to access fProperties:
2198  friend class CompactDecimalFormat;
2199 
2200  // Allow MeasureFormat to use fieldPositionHelper:
2201  friend class MeasureFormat;
2202 
2203 };
2204 
2205 U_NAMESPACE_END
2206 
2207 #endif /* #if !UCONFIG_NO_FORMATTING */
2208 
2209 #endif /* U_SHOW_CPLUSPLUS_API */
2210 
2211 #endif // _DECIMFMT
2212 //eof
IMPORTANT: New users are strongly encouraged to see if numberformatter.h fits their use case.
A currency together with a numeric amount, such as 200 USD.
Definition: curramt.h:39
This class represents the information needed by DecimalFormat to format currency plural,...
Definition: currpinf.h:48
This class represents the set of symbols needed by DecimalFormat to format numbers.
Definition: dcfmtsym.h:86
IMPORTANT: New users are strongly encouraged to see if numberformatter.h fits their use case.
Definition: decimfmt.h:668
virtual const DecimalFormatSymbols * getDecimalFormatSymbols(void) const
Returns the decimal format symbols, which is generally not changed by the programmer or user.
void setLenient(UBool enable) U_OVERRIDE
Sets whether lenient parsing should be enabled (it is off by default).
void setMinimumSignificantDigits(int32_t min)
Sets the minimum number of significant digits that will be displayed.
void setParseCaseSensitive(UBool value)
Whether to pay attention to case when parsing; default is to ignore case (perform case-folding).
DecimalFormat(UErrorCode &status)
Create a DecimalFormat using the default pattern and symbols for the default locale.
int32_t getMultiplier(void) const
Get the multiplier for use in percent, permill, etc.
virtual void setSecondaryGroupingSize(int32_t newValue)
Set the secondary grouping size.
virtual UBool isExponentSignAlwaysShown(void) const
Return whether the exponent sign is always shown.
int32_t getMaximumSignificantDigits() const
Returns the maximum number of significant digits that will be displayed.
virtual void setDecimalPatternMatchRequired(UBool newValue)
Allows you to set the parse behavior of the pattern decimal mark.
virtual void applyLocalizedPattern(const UnicodeString &pattern, UErrorCode &status)
Apply the given pattern to this Format object.
virtual void setPositivePrefix(const UnicodeString &newValue)
Set the positive prefix.
UBool isDecimalPatternMatchRequired(void) const
Allows you to get the parse behavior of the pattern decimal mark.
virtual void setDecimalSeparatorAlwaysShown(UBool newValue)
Allows you to set the behavior of the decimal separator with integers.
virtual void applyPattern(const UnicodeString &pattern, UParseError &parseError, UErrorCode &status)
Apply the given pattern to this Format object.
void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const U_OVERRIDE
Parse the given string using this object's choices.
UBool isFormatFailIfMoreThanMaxDigits() const
Returns whether truncation of high-order integer digits should result in an error.
UnicodeString & format(int64_t number, UnicodeString &appendTo, FieldPosition &pos) const U_OVERRIDE
Format an int64 number using base-10 representation.
UnicodeString & getPositiveSuffix(UnicodeString &result) const
Get the positive suffix.
void setSignificantDigitsUsed(UBool useSignificantDigits)
Sets whether significant digits are in use, or integer and fraction digit counts are in use.
virtual UBool isScientificNotation(void) const
Return whether or not scientific notation is used.
UnicodeString & format(const number::impl::DecimalQuantity &number, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const U_OVERRIDE
Format a decimal number.
void setParseNoExponent(UBool value)
Specifies whether to stop parsing when an exponent separator is encountered.
void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE
Sets the maximum number of digits allowed in the integer portion of a number.
UnicodeString & format(double number, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const U_OVERRIDE
Format a double or long number using base-10 representation.
int32_t getMinimumSignificantDigits() const
Returns the minimum number of significant digits that will be displayed.
void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE
Sets the minimum number of digits allowed in the integer portion of a number.
static UClassID getStaticClassID(void)
Return the class ID for this class.
UnicodeString & format(double number, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const U_OVERRIDE
Format a double or long number using base-10 representation.
UnicodeString & format(int64_t number, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const U_OVERRIDE
Format an int64 number using base-10 representation.
virtual void setPadPosition(EPadPosition padPos)
Set the position at which padding will take place.
virtual void setNegativePrefix(const UnicodeString &newValue)
Set the negative prefix.
virtual void setRoundingIncrement(double newValue)
Set the rounding increment.
virtual void setCurrencyPluralInfo(const CurrencyPluralInfo &info)
Sets the currency plural format information, which is generally not changed by the programmer or user...
virtual void setDecimalFormatSymbols(const DecimalFormatSymbols &symbols)
Sets the decimal format symbols, which is generally not changed by the programmer or user.
void setMinimumGroupingDigits(int32_t newValue)
Sets the minimum grouping digits.
DecimalFormat(const UnicodeString &pattern, DecimalFormatSymbols *symbolsToAdopt, UErrorCode &status)
Create a DecimalFormat from the given pattern and symbols.
virtual void setCurrency(const char16_t *theCurrency)
Sets the currency used to display currency amounts.
void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE
Sets the maximum number of digits allowed in the fraction portion of a number.
virtual DecimalFormat & setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode &status)
Set an integer attribute on this DecimalFormat.
virtual UnicodeString & toPattern(UnicodeString &result) const
Synthesizes a pattern string that represents the current state of this Format object.
~DecimalFormat() U_OVERRIDE
Destructor.
int32_t getMinimumGroupingDigits() const
Returns the minimum number of grouping digits.
CurrencyAmount * parseCurrency(const UnicodeString &text, ParsePosition &pos) const U_OVERRIDE
Parses text from the given string as a currency amount.
void setMaximumSignificantDigits(int32_t max)
Sets the maximum number of significant digits that will be displayed.
virtual void setFormatWidth(int32_t width)
Set the width to which the output of format() is padded.
UnicodeString & format(int32_t number, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const U_OVERRIDE
Format a long number using base-10 representation.
void formatToDecimalQuantity(const Formattable &number, number::impl::DecimalQuantity &output, UErrorCode &status) const
Get a DecimalQuantity corresponding to a formattable as it would be formatted by this DecimalFormat.
void setSignAlwaysShown(UBool value)
Set whether to show the plus sign on positive (non-negative) numbers; for example,...
virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE
Set the rounding mode.
virtual int8_t getMinimumExponentDigits(void) const
Return the minimum exponent digits that will be shown.
UClassID getDynamicClassID(void) const U_OVERRIDE
Returns a unique class ID POLYMORPHICALLY.
virtual UnicodeString & toLocalizedPattern(UnicodeString &result) const
Synthesizes a localized pattern string that represents the current state of this Format object.
virtual void setExponentSignAlwaysShown(UBool expSignAlways)
Set whether the exponent sign is always shown.
UCurrencyUsage getCurrencyUsage() const
Returns the Currency Usage object used to display currency.
virtual EPadPosition getPadPosition(void) const
Get the position at which padding will take place.
void setCurrency(const char16_t *theCurrency, UErrorCode &ec) U_OVERRIDE
Sets the currency used to display currency amounts.
DecimalFormat(const UnicodeString &pattern, UErrorCode &status)
Create a DecimalFormat from the given pattern and the symbols for the default locale.
UBool isParseCaseSensitive() const
Returns whether parsing is sensitive to case (lowercase/uppercase).
virtual void setNegativeSuffix(const UnicodeString &newValue)
Set the negative suffix.
virtual int32_t getFormatWidth(void) const
Get the width to which the output of format() is padded.
void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE
Sets the minimum number of digits allowed in the fraction portion of a number.
UnicodeString & format(const number::impl::DecimalQuantity &number, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const U_OVERRIDE
Format a decimal number.
UnicodeString & getNegativePrefix(UnicodeString &result) const
Get the negative prefix.
virtual void setScientificNotation(UBool useScientific)
Set whether or not scientific notation is used.
DecimalFormat(const DecimalFormat &source)
Copy constructor.
void formatToDecimalQuantity(double number, number::impl::DecimalQuantity &output, UErrorCode &status) const
Format a number and save it into the given DecimalQuantity.
int32_t getGroupingSize(void) const
Return the grouping size.
UBool isSignAlwaysShown() const
Whether to show the plus sign on positive (non-negative) numbers; for example, "+12".
void setFormatFailIfMoreThanMaxDigits(UBool value)
Sets whether truncation of high-order integer digits should result in an error.
virtual void setPositiveSuffix(const UnicodeString &newValue)
Set the positive suffix.
const number::LocalizedNumberFormatter * toNumberFormatter(UErrorCode &status) const
Converts this DecimalFormat to a (Localized)NumberFormatter.
virtual void setGroupingSize(int32_t newValue)
Set the grouping size.
UnicodeString & getPositivePrefix(UnicodeString &result) const
Get the positive prefix.
void setParseIntegerOnly(UBool value) U_OVERRIDE
Sets whether or not numbers should be parsed as integers only.
UBool areSignificantDigitsUsed() const
Returns true if significant digits are in use, or false if integer and fraction digit counts are in u...
UnicodeString & format(StringPiece number, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const U_OVERRIDE
Format a decimal number.
void setMultiplierScale(int32_t newValue)
Sets a power of ten by which number should be multiplied before formatting, which can be combined wit...
DecimalFormat(const UnicodeString &pattern, DecimalFormatSymbols *symbolsToAdopt, UParseError &parseError, UErrorCode &status)
Create a DecimalFormat from the given pattern and symbols.
UnicodeString & format(int32_t number, UnicodeString &appendTo, FieldPositionIterator *posIter, UErrorCode &status) const U_OVERRIDE
Format a long number using base-10 representation.
void setGroupingUsed(UBool newValue) U_OVERRIDE
Set whether or not grouping will be used in this format.
virtual void setMinimumExponentDigits(int8_t minExpDig)
Set the minimum exponent digits that will be shown.
virtual void applyPattern(const UnicodeString &pattern, UErrorCode &status)
Sets the pattern.
UnicodeString & format(int64_t number, UnicodeString &appendTo, FieldPosition &pos, UErrorCode &status) const U_OVERRIDE
Format an int64 number using base-10 representation.
void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode *ec)
Sets the Currency Usage object used to display currency.
virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode &status) const
Get an integer May return U_UNSUPPORTED_ERROR if this instance does not support the specified attribu...
UnicodeString & getNegativeSuffix(UnicodeString &result) const
Get the negative suffix.
virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols *symbolsToAdopt)
Sets the decimal format symbols, which is generally not changed by the programmer or user.
virtual UnicodeString getPadCharacterString() const
Get the pad character used to pad to the format width.
UnicodeString & format(int32_t number, UnicodeString &appendTo, FieldPosition &pos) const U_OVERRIDE
Format a long number using base-10 representation.
DecimalFormat & operator=(const DecimalFormat &rhs)
Assignment operator.
int32_t getSecondaryGroupingSize(void) const
Return the secondary grouping size.
virtual void setMultiplier(int32_t newValue)
Set the multiplier for use in percent, permill, etc.
virtual void applyLocalizedPattern(const UnicodeString &pattern, UParseError &parseError, UErrorCode &status)
Apply the given pattern to this Format object.
EPadPosition
Pad position.
Definition: decimfmt.h:674
virtual ERoundingMode getRoundingMode(void) const U_OVERRIDE
Get the rounding mode.
virtual double getRoundingIncrement(void) const
Get the rounding increment.
UBool isParseNoExponent() const
Returns whether to ignore exponents when parsing.
UBool isDecimalSeparatorAlwaysShown(void) const
Allows you to get the behavior of the decimal separator with integers.
virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo *toAdopt)
Sets the currency plural format information, which is generally not changed by the programmer or user...
virtual void setPadCharacter(const UnicodeString &padChar)
Set the character used to pad to the format width.
DecimalFormat(const UnicodeString &pattern, const DecimalFormatSymbols &symbols, UErrorCode &status)
Create a DecimalFormat from the given pattern and symbols.
DecimalFormat(const UnicodeString &pattern, DecimalFormatSymbols *symbolsToAdopt, UNumberFormatStyle style, UErrorCode &status)
This API is for ICU use only.
int32_t getMultiplierScale(void) const
Gets the power of ten by which number should be multiplied before formatting, which can be combined w...
virtual const CurrencyPluralInfo * getCurrencyPluralInfo(void) const
Returns the currency plural format information, which is generally not changed by the programmer or u...
FieldPositionIterator returns the field ids and their start/limit positions generated by a call to Fo...
Definition: fpositer.h:58
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:110
Base class for all formats.
Definition: format.h:98
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:64
ERoundingMode
Rounding mode.
Definition: numfmt.h:186
virtual void parse(const UnicodeString &text, Formattable &result, ParsePosition &parsePosition) const =0
Return a long if possible (e.g.
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:52
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:60
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
A NumberFormatter that has a locale associated with it; this means .format() methods are available.
C++ API: Currency Amount Object.
C++ API: Symbols for formatting numbers.
C++: internal template EnumSet<>
C++ API: FieldPosition Iterator.
C++ API: Locale ID object.
C++ API: Compatibility APIs for number formatting.
C++ API: StringPiece: Read-only byte string wrapper class.
A UParseError struct is used to returned detailed information about parsing errors.
Definition: parseerr.h:58
UCurrencyUsage
Currency Usage used for Decimal Format.
Definition: ucurr.h:41
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
#define U_OVERRIDE
Defined to the C++11 "override" keyword if available.
Definition: umachine.h:130
UNumberFormatAttribute
The possible UNumberFormat numeric attributes.
Definition: unum.h:1015
UNumberFormatStyle
The possible number format styles.
Definition: unum.h:149
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301