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.

Stable:
  ICU 73

Definition at line 184 of file simplenumberformatter.h.

## Constructor & Destructor Documentation

## ~SimpleNumberFormatter()

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

inline

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

Stable:
  ICU 73

Definition at line 253 of file simplenumberformatter.h.

## SimpleNumberFormatter() [1/2]

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

default

Creates a shell, initialized but non-functional SimpleNumberFormatter.

Stable:
  ICU 73

## SimpleNumberFormatter() [2/2]

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

inlinenoexcept

SimpleNumberFormatter: Move constructor.

Stable:
  ICU 73

Definition at line 269 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.

Stable:
  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.

Stable:
  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.

Stable:
  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.

Stable:
  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.

Stable:
  ICU 73

Definition at line 236 of file simplenumberformatter.h.

## operator=()

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

inlinenoexcept

SimpleNumberFormatter: Move assignment.

Stable:
  ICU 73

Definition at line 284 of file simplenumberformatter.h.

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

- i18n/unicode/simplenumberformatter.h