icu::number::LocalizedNumberFormatter Class Reference

A NumberFormatter that has a locale associated with it; this means .format() methods are available. More...

#include <numberformatter.h>

Inheritance diagram for icu::number::LocalizedNumberFormatter:
icu::number::NumberFormatterSettings< LocalizedNumberFormatter > icu::UMemory

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.
FormattoFormat (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.
LocalizedNumberFormatteroperator= (const LocalizedNumberFormatter &other)
 Copy assignment operator.
LocalizedNumberFormatteroperator= (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

Detailed Description

A NumberFormatter that has a locale associated with it; this means .format() methods are available.

See also:
NumberFormatter
Draft:
This API may be changed in the future versions and was introduced in ICU 60

Definition at line 2258 of file numberformatter.h.


Constructor & Destructor Documentation

icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter (  ) 

Default constructor: puts the formatter into a valid but undefined state.

Draft:
This API may be changed in the future versions and was introduced in ICU 62
icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter ( const LocalizedNumberFormatter other  ) 

Returns a copy of this LocalizedNumberFormatter.

Draft:
This API may be changed in the future versions and was introduced in ICU 60
icu::number::LocalizedNumberFormatter::LocalizedNumberFormatter ( LocalizedNumberFormatter &&  src  ) 

Move constructor: The source LocalizedNumberFormatter will be left in a valid but undefined state.

Draft:
This API may be changed in the future versions and was introduced in ICU 62
icu::number::LocalizedNumberFormatter::~LocalizedNumberFormatter (  ) 

Destruct this LocalizedNumberFormatter, cleaning up any memory it might own.

Draft:
This API may be changed in the future versions and was introduced in ICU 60

Member Function Documentation

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

Parameters:
value The number to format.
status Set to an ErrorCode if one occurred in the setter chain or during formatting.
Returns:
A FormattedNumber object; call .toString() to get the string.
Draft:
This API may be changed in the future versions and was introduced in ICU 60
FormattedNumber icu::number::LocalizedNumberFormatter::formatDecimalQuantity ( const impl::DecimalQuantity &  dq,
UErrorCode status 
) const

Internal method.

Internal:
Do not use. This API is for internal use only.
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.

Parameters:
value The number to format.
status Set to an ErrorCode if one occurred in the setter chain or during formatting.
Returns:
A FormattedNumber object; call .toString() to get the string.
Draft:
This API may be changed in the future versions and was introduced in ICU 60
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.

Parameters:
results The results object. This method will mutate it to save the results.
status 
Internal:
Do not use. This API is for internal use only.
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.

Parameters:
value The number to format.
status Set to an ErrorCode if one occurred in the setter chain or during formatting.
Returns:
A FormattedNumber object; call .toString() to get the string.
Draft:
This API may be changed in the future versions and was introduced in ICU 60
void icu::number::LocalizedNumberFormatter::getAffixImpl ( bool  isPrefix,
bool  isNegative,
UnicodeString result,
UErrorCode status 
) const

Internal method for DecimalFormat compatibility.

Internal:
Do not use. This API is for internal use only.
int32_t icu::number::LocalizedNumberFormatter::getCallCount (  )  const

Internal method for testing.

Internal:
Do not use. This API is for internal use only.
const impl::NumberFormatterImpl* icu::number::LocalizedNumberFormatter::getCompiled (  )  const

Internal method for testing.

Internal:
Do not use. This API is for internal use only.
LocalizedNumberFormatter& icu::number::LocalizedNumberFormatter::operator= ( LocalizedNumberFormatter &&  src  ) 

Move assignment operator: The source LocalizedNumberFormatter will be left in a valid but undefined state.

Draft:
This API may be changed in the future versions and was introduced in ICU 62
LocalizedNumberFormatter& icu::number::LocalizedNumberFormatter::operator= ( const LocalizedNumberFormatter other  ) 

Copy assignment operator.

Draft:
This API may be changed in the future versions and was introduced in ICU 62
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.

Returns:
A Format wrapping this LocalizedNumberFormatter.
Draft:
This API may be changed in the future versions and was introduced in ICU 62

The documentation for this class was generated from the following file:

Generated on 12 Nov 2018 for ICU 63.1 by  doxygen 1.6.1