A NumberFormatter that has a locale associated with it; this means .format() methods are available. More...
#include <numberformatter.h>
Public Member Functions | |
| FormattedNumber | formatInt (int64_t value, UErrorCode &status) const |
| Format the given integer number to a string using the settings specified in the NumberFormatter fluent setting chain. | |
| FormattedNumber | formatDouble (double value, UErrorCode &status) const |
| Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting chain. | |
| FormattedNumber | formatDecimal (StringPiece value, UErrorCode &status) const |
| Format the given decimal number to a string using the settings specified in the NumberFormatter fluent setting chain. | |
| FormattedNumber | formatDecimalQuantity (const impl::DecimalQuantity &dq, UErrorCode &status) const |
| Internal method. | |
| void | getAffixImpl (bool isPrefix, bool isNegative, UnicodeString &result, UErrorCode &status) const |
| Internal method for DecimalFormat compatibility. | |
| const impl::NumberFormatterImpl * | getCompiled () const |
| Internal method for testing. | |
| int32_t | getCallCount () const |
| Internal method for testing. | |
| Format * | toFormat (UErrorCode &status) const |
| Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use of this number formatter with APIs that need an object of that type, such as MessageFormat. | |
| LocalizedNumberFormatter () | |
| Default constructor: puts the formatter into a valid but undefined state. | |
| LocalizedNumberFormatter (const LocalizedNumberFormatter &other) | |
| Returns a copy of this LocalizedNumberFormatter. | |
| LocalizedNumberFormatter (LocalizedNumberFormatter &&src) U_NOEXCEPT | |
| Move constructor: The source LocalizedNumberFormatter will be left in a valid but undefined state. | |
| LocalizedNumberFormatter & | operator= (const LocalizedNumberFormatter &other) |
| Copy assignment operator. | |
| LocalizedNumberFormatter & | operator= (LocalizedNumberFormatter &&src) U_NOEXCEPT |
| Move assignment operator: The source LocalizedNumberFormatter will be left in a valid but undefined state. | |
| void | formatImpl (impl::UFormattedNumberData *results, UErrorCode &status) const |
| This is the core entrypoint to the number formatting pipeline. | |
| ~LocalizedNumberFormatter () | |
| Destruct this LocalizedNumberFormatter, cleaning up any memory it might own. | |
Friends | |
| class | NumberFormatterSettings< UnlocalizedNumberFormatter > |
| class | NumberFormatterSettings< LocalizedNumberFormatter > |
| class | UnlocalizedNumberFormatter |
A NumberFormatter that has a locale associated with it; this means .format() methods are available.
Instances of this class are immutable and thread-safe.
Definition at line 2224 of file numberformatter.h.
| icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter | ( | ) |
Default constructor: puts the formatter into a valid but undefined state.
| icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter | ( | const LocalizedNumberFormatter & | other | ) |
Returns a copy of this LocalizedNumberFormatter.
| icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter | ( | LocalizedNumberFormatter && | src | ) |
Move constructor: The source LocalizedNumberFormatter will be left in a valid but undefined state.
| icu::number::LocalizedNumberFormatter::~LocalizedNumberFormatter | ( | ) |
Destruct this LocalizedNumberFormatter, cleaning up any memory it might own.
| FormattedNumber icu::number::LocalizedNumberFormatter::formatDecimal | ( | StringPiece | value, | |
| UErrorCode & | status | |||
| ) | const |
Format the given decimal number to a string using the settings specified in the NumberFormatter fluent setting chain.
The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic Specification, available at http://speleotrove.com/decimal
| value | The number to format. | |
| status | Set to an ErrorCode if one occurred in the setter chain or during formatting. |
| FormattedNumber icu::number::LocalizedNumberFormatter::formatDecimalQuantity | ( | const impl::DecimalQuantity & | dq, | |
| UErrorCode & | status | |||
| ) | const |
Internal method.
| FormattedNumber icu::number::LocalizedNumberFormatter::formatDouble | ( | double | value, | |
| UErrorCode & | status | |||
| ) | const |
Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting chain.
| value | The number to format. | |
| status | Set to an ErrorCode if one occurred in the setter chain or during formatting. |
| void icu::number::LocalizedNumberFormatter::formatImpl | ( | impl::UFormattedNumberData * | results, | |
| UErrorCode & | status | |||
| ) | const |
This is the core entrypoint to the number formatting pipeline.
It performs self-regulation: a static code path for the first few calls, and compiling a more efficient data structure if called repeatedly.
This function is very hot, being called in every call to the number formatting pipeline.
| results | The results object. This method will mutate it to save the results. | |
| status |
| FormattedNumber icu::number::LocalizedNumberFormatter::formatInt | ( | int64_t | value, | |
| UErrorCode & | status | |||
| ) | const |
Format the given integer number to a string using the settings specified in the NumberFormatter fluent setting chain.
| value | The number to format. | |
| status | Set to an ErrorCode if one occurred in the setter chain or during formatting. |
| void icu::number::LocalizedNumberFormatter::getAffixImpl | ( | bool | isPrefix, | |
| bool | isNegative, | |||
| UnicodeString & | result, | |||
| UErrorCode & | status | |||
| ) | const |
Internal method for DecimalFormat compatibility.
| int32_t icu::number::LocalizedNumberFormatter::getCallCount | ( | ) | const |
Internal method for testing.
| const impl::NumberFormatterImpl* icu::number::LocalizedNumberFormatter::getCompiled | ( | ) | const |
Internal method for testing.
| LocalizedNumberFormatter& icu::number::LocalizedNumberFormatter::operator= | ( | LocalizedNumberFormatter && | src | ) |
Move assignment operator: The source LocalizedNumberFormatter will be left in a valid but undefined state.
| LocalizedNumberFormatter& icu::number::LocalizedNumberFormatter::operator= | ( | const LocalizedNumberFormatter & | other | ) |
Copy assignment operator.
| Format* icu::number::LocalizedNumberFormatter::toFormat | ( | UErrorCode & | status | ) | const |
Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use of this number formatter with APIs that need an object of that type, such as MessageFormat.
This API is not intended to be used other than for enabling API compatibility. The formatDouble, formatInt, and formatDecimal methods should normally be used when formatting numbers, not the Format object returned by this method.
The caller owns the returned object and must delete it when finished.
1.6.1