ICU 60.2 60.2

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

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

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

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

`#include <numberformatter.h>`

Inheritance diagram for icu::number::CurrencyRounder:

## Public Member Functions
Rounder | withCurrency (const CurrencyUnit &currency) const
| Associates a currency with this rounding strategy. More...
Public Member Functions inherited from icu::number::Rounder
Rounder | withMode (UNumberFormatRoundingMode roundingMode) const
| Sets the rounding mode to use when picking the direction to round (up or down). More...

## Friends
class | Rounder

## Additional Inherited Members
Static Public Member Functions inherited from icu::number::Rounder
static Rounder | unlimited ()
| Show all available digits to full precision. More...
static FractionRounder | integer ()
| Show numbers rounded if necessary to the nearest integer. More...
static FractionRounder | fixedFraction (int32_t minMaxFractionPlaces)
| Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). More...
static FractionRounder | minFraction (int32_t minFractionPlaces)
| Always show at least a certain number of fraction places after the decimal separator, padding with zeros if necessary. More...
static FractionRounder | maxFraction (int32_t maxFractionPlaces)
| Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). More...
static FractionRounder | 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. More...
static DigitRounder | fixedDigits (int32_t minMaxSignificantDigits)
| Show numbers rounded if necessary to a certain number of significant digits or significant figures. More...
static DigitRounder | minDigits (int32_t minSignificantDigits)
| Always show at least a certain number of significant digits/figures, padding with zeros if necessary. More...
static DigitRounder | maxDigits (int32_t maxSignificantDigits)
| Show numbers rounded if necessary to a certain number of significant digits/figures. More...
static DigitRounder | minMaxDigits (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. More...
static IncrementRounder | increment (double roundingIncrement)
| Show numbers rounded if necessary to the closest multiple of a certain rounding increment. More...
static CurrencyRounder | currency (UCurrencyUsage currencyUsage)
| Show numbers rounded and padded according to the rules for the currency unit. More...

## Detailed Description

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

To create a CurrencyRounder, use one of the factory methods on Rounder.

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

Definition at line 940 of file numberformatter.h.

## Member Function Documentation

Rounder icu::number::CurrencyRounder::withCurrency | ( | const CurrencyUnit & | currency | ) | const

Associates a currency with this rounding strategy.

Calling this method is not required, because the currency specified in unit() is automatically applied to currency rounding strategies. 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 strategy.

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

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

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

- numberformatter.h