ICU 75.1 75.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
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:
icu::UMemory

Public Member Functions

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

Static Public Member Functions

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

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 194 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 263 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 279 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 246 of file simplenumberformatter.h.

◆ operator=()

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

SimpleNumberFormatter: Move assignment.

Stable:
ICU 73

Definition at line 294 of file simplenumberformatter.h.


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