ICU 76.1: icu::number::CurrencyPrecision Class Reference

ICU 76.1 76.1

Public Member Functions | Friends
icu::number::CurrencyPrecision Class Reference

A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in NumberFormatter. More...

`#include <numberformatter.h>`

Inheritance diagram for icu::number::CurrencyPrecision:

## Public Member Functions
Precision | withCurrency (const CurrencyUnit &currency) const
| Associates a currency with this rounding precision.
Public Member Functions inherited from icu::number::Precision
Precision | trailingZeroDisplay (UNumberTrailingZeroDisplay trailingZeroDisplay) const
| Configure how trailing zeros are displayed on numbers.

## Friends
class | Precision

## Additional Inherited Members
Static Public Member Functions inherited from icu::number::Precision
static Precision | unlimited ()
| Show all available digits to full precision.
static FractionPrecision | integer ()
| Show numbers rounded if necessary to the nearest integer.
static FractionPrecision | fixedFraction (int32_t minMaxFractionPlaces)
| Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
static FractionPrecision | minFraction (int32_t minFractionPlaces)
| Always show at least a certain number of fraction places after the decimal separator, padding with zeros if necessary.
static FractionPrecision | maxFraction (int32_t maxFractionPlaces)
| Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).
static FractionPrecision | minMaxFraction (int32_t minFractionPlaces, int32_t maxFractionPlaces)
| Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); in addition, always show at least a certain number of places after the decimal separator, padding with zeros if necessary.
static SignificantDigitsPrecision | fixedSignificantDigits (int32_t minMaxSignificantDigits)
| Show numbers rounded if necessary to a certain number of significant digits or significant figures.
static SignificantDigitsPrecision | minSignificantDigits (int32_t minSignificantDigits)
| Always show at least a certain number of significant digits/figures, padding with zeros if necessary.
static SignificantDigitsPrecision | maxSignificantDigits (int32_t maxSignificantDigits)
| Show numbers rounded if necessary to a certain number of significant digits/figures.
static SignificantDigitsPrecision | minMaxSignificantDigits (int32_t minSignificantDigits, int32_t maxSignificantDigits)
| Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at least a certain number of significant digits, padding with zeros if necessary.
static IncrementPrecision | increment (double roundingIncrement)
| Show numbers rounded if necessary to the closest multiple of a certain rounding increment.
static IncrementPrecision | incrementExact (uint64_t mantissa, int16_t magnitude)
| Version of `Precision::increment()` that takes an integer at a particular power of 10.
static CurrencyPrecision | currency (UCurrencyUsage currencyUsage)
| Show numbers rounded and padded according to the rules for the currency unit.

## Detailed Description

A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in NumberFormatter.

To create a CurrencyPrecision, use one of the factory methods on Precision.

Stable
  ICU 60

Definition at line 915 of file numberformatter.h.

## Member Function Documentation

## ◆ withCurrency()

Precision icu::number::CurrencyPrecision::withCurrency | ( | const CurrencyUnit & | currency | ) | const

Associates a currency with this rounding precision.

Calling this method is not required, because the currency specified in unit() is automatically applied to currency rounding precisions. However, this method enables you to override that automatic association.

This method also enables numbers to be formatted using currency rounding rules without explicitly using a currency format.

Parameters

  currency | The currency to associate with this rounding precision.

Returns
  A precision for chaining or passing to the NumberFormatter precision() setter.

Stable
  ICU 60

## Friends And Related Symbol Documentation

## ◆ Precision

friend class Precision
| friend

Definition at line 941 of file numberformatter.h.

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

- i18n/unicode/numberformatter.h