icu::number::SimpleNumber Class Reference

An input type for SimpleNumberFormatter. More...

`#include <simplenumberformatter.h>`

Inheritance diagram for icu::number::SimpleNumber:

## Public Member Functions

void | multiplyByPowerOfTen (int32_t power, UErrorCode &status)
| Changes the value of the SimpleNumber by a power of 10. More...
void | roundTo (int32_t power, UNumberFormatRoundingMode roundingMode, UErrorCode &status)
| Rounds the value currently stored in the SimpleNumber to the given power of 10. More...
void | truncateStart (uint32_t maximumIntegerDigits, UErrorCode &status)
| Truncates the most significant digits to the given maximum number of integer digits. More...
void | setMinimumIntegerDigits (uint32_t minimumIntegerDigits, UErrorCode &status)
| Pads the beginning of the number with zeros up to the given minimum number of integer digits. More...
void | setMinimumFractionDigits (uint32_t minimumFractionDigits, UErrorCode &status)
| Pads the end of the number with zeros up to the given minimum number of fraction digits. More...
void | setSign (USimpleNumberSign sign, UErrorCode &status)
| Sets the sign of the number: an explicit plus sign, explicit minus sign, or no sign. More...
| SimpleNumber ()=default
| Creates a new, empty SimpleNumber that does not contain a value. More...
| ~SimpleNumber ()
| Destruct this SimpleNumber, cleaning up any memory it might own. More...
| SimpleNumber (SimpleNumber &&other) noexcept
| SimpleNumber move constructor. More...
SimpleNumber & | operator= (SimpleNumber &&other) noexcept
| SimpleNumber move assignment. More...

## Static Public Member Functions

static SimpleNumber | forInt64 (int64_t value, UErrorCode &status)
| Creates a SimpleNumber for an integer. More...

## Friends

class | SimpleNumberFormatter

## Detailed Description

An input type for SimpleNumberFormatter.

This class is mutable 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 54 of file simplenumberformatter.h.

## Constructor & Destructor Documentation

## SimpleNumber() [1/2]

icu::number::SimpleNumber::SimpleNumber | ( |  | ) |

default

Creates a new, empty SimpleNumber that does not contain a value.

NOTE: This number will fail to format; use forInt64() to create a SimpleNumber with a value.

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

## ~SimpleNumber()

icu::number::SimpleNumber::~SimpleNumber | ( |  | ) |

inline

Destruct this SimpleNumber, 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 133 of file simplenumberformatter.h.

## SimpleNumber() [2/2]

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

inline noexcept

SimpleNumber move constructor.

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

Definition at line 142 of file simplenumberformatter.h.

## Member Function Documentation

## forInt64()

static SimpleNumber icu::number::SimpleNumber::forInt64 | ( | int64_t | value,
|  | UErrorCode & | status
| ) |  |

static

Creates a SimpleNumber for an integer.

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

## multiplyByPowerOfTen()

void icu::number::SimpleNumber::multiplyByPowerOfTen | ( | int32_t | power,
|  | UErrorCode & | status
| ) |  |

Changes the value of the SimpleNumber by a power of 10.

This function immediately mutates the inner value.

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

## operator=()

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

inline noexcept

SimpleNumber move assignment.

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

Definition at line 153 of file simplenumberformatter.h.

## roundTo()

void icu::number::SimpleNumber::roundTo | ( | int32_t | power,
|  | UNumberFormatRoundingMode | roundingMode,
|  | UErrorCode & | status
| ) |  |

Rounds the value currently stored in the SimpleNumber to the given power of 10.

This function immediately mutates the inner value.

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

## setMinimumFractionDigits()

void icu::number::SimpleNumber::setMinimumFractionDigits | ( | uint32_t | minimumFractionDigits,
|  | UErrorCode & | status
| ) |  |

Pads the end of the number with zeros up to the given minimum number of fraction digits.

This setting is applied upon formatting the number.

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

## setMinimumIntegerDigits()

void icu::number::SimpleNumber::setMinimumIntegerDigits | ( | uint32_t | minimumIntegerDigits,
|  | UErrorCode & | status
| ) |  |

Pads the beginning of the number with zeros up to the given minimum number of integer digits.

This setting is applied upon formatting the number.

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

## setSign()

void icu::number::SimpleNumber::setSign | ( | USimpleNumberSign | sign,
|  | UErrorCode & | status
| ) |  |

Sets the sign of the number: an explicit plus sign, explicit minus sign, or no sign.

This setting is applied upon formatting the number.

NOTE: This does not support accounting sign notation.

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

## truncateStart()

void icu::number::SimpleNumber::truncateStart | ( | uint32_t | maximumIntegerDigits,
|  | UErrorCode & | status
| ) |  |

Truncates the most significant digits to the given maximum number of integer digits.

This function immediately mutates the inner value.

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

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

- i18n/unicode/simplenumberformatter.h