icu::number::SimpleNumberFormatter Class Reference

A special NumberFormatter focused on smaller binary size and memory use. More...

`#include <simplenumberformatter.h>`

Inheritance diagram for icu::number::SimpleNumberFormatter:

## Public Member Functions

FormattedNumber | format (SimpleNumber value, UErrorCode &status) const
| Formats a value using this SimpleNumberFormatter. More...
FormattedNumber | formatInt64 (int64_t value, UErrorCode &status) const
| Formats an integer using this SimpleNumberFormatter. More...
void | formatImpl (impl::UFormattedNumberData *data, USimpleNumberSign sign, UErrorCode &status) const
| Run the formatter with the internal types. More...
| ~SimpleNumberFormatter ()
| Destruct this SimpleNumberFormatter, cleaning up any memory it might own. More...
| SimpleNumberFormatter ()=default
| Creates a shell, initialized but non-functional SimpleNumberFormatter. More...
| SimpleNumberFormatter (SimpleNumberFormatter &&other) noexcept
| SimpleNumberFormatter: Move constructor. More...
SimpleNumberFormatter & | operator= (SimpleNumberFormatter &&other) noexcept
| SimpleNumberFormatter: Move assignment. More...

## Static Public Member Functions

static SimpleNumberFormatter | forLocale (const icu::Locale &locale, UErrorCode &status)
| Creates a new SimpleNumberFormatter with all locale defaults. More...
static SimpleNumberFormatter | forLocaleAndGroupingStrategy (const icu::Locale &locale, UNumberGroupingStrategy groupingStrategy, UErrorCode &status)
| Creates a new SimpleNumberFormatter, overriding the grouping strategy. More...
static SimpleNumberFormatter | forLocaleAndSymbolsAndGroupingStrategy (const icu::Locale &locale, const DecimalFormatSymbols &symbols, UNumberGroupingStrategy groupingStrategy, UErrorCode &status)
| Creates a new SimpleNumberFormatter, overriding the grouping strategy and symbols. More...

## Detailed Description

A special NumberFormatter focused on smaller binary size and memory use.

SimpleNumberFormatter is capable of basic number formatting, including grouping separators, sign display, and rounding. It is not capable of currencies, compact notation, or units.

This class is immutable and not intended for public subclassing. This class is movable but not copyable.

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

Definition at line 185 of file simplenumberformatter.h.

## Constructor & Destructor Documentation

## ~SimpleNumberFormatter()

icu::number::SimpleNumberFormatter::~SimpleNumberFormatter | ( |  | ) |

inline

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

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

Definition at line 254 of file simplenumberformatter.h.

## SimpleNumberFormatter() [1/2]

icu::number::SimpleNumberFormatter::SimpleNumberFormatter | ( |  | ) |

default

Creates a shell, initialized but non-functional SimpleNumberFormatter.

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

## SimpleNumberFormatter() [2/2]

icu::number::SimpleNumberFormatter::SimpleNumberFormatter | ( | SimpleNumberFormatter && | other | ) |

inline noexcept

SimpleNumberFormatter: Move constructor.

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

Definition at line 270 of file simplenumberformatter.h.

## Member Function Documentation

## forLocale()

static SimpleNumberFormatter icu::number::SimpleNumberFormatter::forLocale | ( | const icu::Locale & | locale,
|  | UErrorCode & | status
| ) |  |

static

Creates a new SimpleNumberFormatter with all locale defaults.

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

## forLocaleAndGroupingStrategy()

static SimpleNumberFormatter icu::number::SimpleNumberFormatter::forLocaleAndGroupingStrategy | ( | const icu::Locale & | locale,
|  | UNumberGroupingStrategy | groupingStrategy,
|  | UErrorCode & | status
| ) |  |

static

Creates a new SimpleNumberFormatter, overriding the grouping strategy.

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

## forLocaleAndSymbolsAndGroupingStrategy()

static SimpleNumberFormatter icu::number::SimpleNumberFormatter::forLocaleAndSymbolsAndGroupingStrategy | ( | const icu::Locale & | locale,
|  | const DecimalFormatSymbols & | symbols,
|  | UNumberGroupingStrategy | groupingStrategy,
|  | UErrorCode & | status
| ) |  |

static

Creates a new SimpleNumberFormatter, overriding the grouping strategy and symbols.

IMPORTANT: For efficiency, this function borrows the symbols. The symbols MUST remain valid for the lifetime of the SimpleNumberFormatter.

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

## format()

FormattedNumber icu::number::SimpleNumberFormatter::format | ( | SimpleNumber | value,
|  | UErrorCode & | status
| ) |  | const

Formats a value using this SimpleNumberFormatter.

The SimpleNumber argument is "consumed". A new SimpleNumber object should be created for every formatting operation.

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

## formatImpl()

void icu::number::SimpleNumberFormatter::formatImpl | ( | impl::UFormattedNumberData * | data,
|  | USimpleNumberSign | sign,
|  | UErrorCode & | status
| ) |  | const

Run the formatter with the internal types.

Internal:
  Do not use. This API is for internal use only.

## formatInt64()

FormattedNumber icu::number::SimpleNumberFormatter::formatInt64 | ( | int64_t | value,
|  | UErrorCode & | status
| ) |  | const

inline

Formats an integer using this SimpleNumberFormatter.

For more control over the formatting, use SimpleNumber.

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

Definition at line 237 of file simplenumberformatter.h.

## operator=()

SimpleNumberFormatter& icu::number::SimpleNumberFormatter::operator= | ( | SimpleNumberFormatter && | other | ) |

inline noexcept

SimpleNumberFormatter: Move assignment.

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

Definition at line 285 of file simplenumberformatter.h.

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

- i18n/unicode/simplenumberformatter.h