ICU 76.1 76.1
Loading...
Searching...
No Matches
Public Member Functions | Friends
icu::number::LocalizedNumberRangeFormatter Class Reference

A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available. More...

#include <numberrangeformatter.h>

Inheritance diagram for icu::number::LocalizedNumberRangeFormatter:
icu::number::NumberRangeFormatterSettings< LocalizedNumberRangeFormatter > icu::UMemory

Public Member Functions

FormattedNumberRange formatFormattableRange (const Formattable &first, const Formattable &second, UErrorCode &status) const
 Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting chain.
 
UnlocalizedNumberRangeFormatter withoutLocale () const &
 Disassociate the locale from this formatter.
 
UnlocalizedNumberRangeFormatter withoutLocale () &&
 Overload of withoutLocale() for use on an rvalue reference.
 
 LocalizedNumberRangeFormatter ()=default
 Default constructor: puts the formatter into a valid but undefined state.
 
 LocalizedNumberRangeFormatter (const LocalizedNumberRangeFormatter &other)
 Returns a copy of this LocalizedNumberRangeFormatter.
 
 LocalizedNumberRangeFormatter (LocalizedNumberRangeFormatter &&src) noexcept
 Move constructor: The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
 
LocalizedNumberRangeFormatteroperator= (const LocalizedNumberRangeFormatter &other)
 Copy assignment operator.
 
LocalizedNumberRangeFormatteroperator= (LocalizedNumberRangeFormatter &&src) noexcept
 Move assignment operator: The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.
 
void formatImpl (impl::UFormattedNumberRangeData &results, bool equalBeforeRounding, UErrorCode &status) const
 
 ~LocalizedNumberRangeFormatter ()
 Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own.
 
- Public Member Functions inherited from icu::number::NumberRangeFormatterSettings< LocalizedNumberRangeFormatter >
LocalizedNumberRangeFormatter numberFormatterBoth (const UnlocalizedNumberFormatter &formatter) const &
 Sets the NumberFormatter instance to use for the numbers in the range.
 
LocalizedNumberRangeFormatter numberFormatterBoth (const UnlocalizedNumberFormatter &formatter) &&
 Overload of numberFormatterBoth() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterBoth (UnlocalizedNumberFormatter &&formatter) const &
 Overload of numberFormatterBoth() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterBoth (UnlocalizedNumberFormatter &&formatter) &&
 Overload of numberFormatterBoth() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterFirst (const UnlocalizedNumberFormatter &formatterFirst) const &
 Sets the NumberFormatter instance to use for the first number in the range.
 
LocalizedNumberRangeFormatter numberFormatterFirst (const UnlocalizedNumberFormatter &formatterFirst) &&
 Overload of numberFormatterFirst() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterFirst (UnlocalizedNumberFormatter &&formatterFirst) const &
 Overload of numberFormatterFirst() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterFirst (UnlocalizedNumberFormatter &&formatterFirst) &&
 Overload of numberFormatterFirst() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterSecond (const UnlocalizedNumberFormatter &formatterSecond) const &
 Sets the NumberFormatter instance to use for the second number in the range.
 
LocalizedNumberRangeFormatter numberFormatterSecond (const UnlocalizedNumberFormatter &formatterSecond) &&
 Overload of numberFormatterSecond() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterSecond (UnlocalizedNumberFormatter &&formatterSecond) const &
 Overload of numberFormatterSecond() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter numberFormatterSecond (UnlocalizedNumberFormatter &&formatterSecond) &&
 Overload of numberFormatterSecond() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter collapse (UNumberRangeCollapse collapse) const &
 Sets the aggressiveness of "collapsing" fields across the range separator.
 
LocalizedNumberRangeFormatter collapse (UNumberRangeCollapse collapse) &&
 Overload of collapse() for use on an rvalue reference.
 
LocalizedNumberRangeFormatter identityFallback (UNumberRangeIdentityFallback identityFallback) const &
 Sets the behavior when the two sides of the range are the same.
 
LocalizedNumberRangeFormatter identityFallback (UNumberRangeIdentityFallback identityFallback) &&
 Overload of identityFallback() for use on an rvalue reference.
 
LocalPointer< LocalizedNumberRangeFormatterclone () const &
 Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer wrapping a heap-allocated copy of the current object.
 
LocalPointer< LocalizedNumberRangeFormatterclone () &&
 Overload of clone for use on an rvalue reference.
 
UBool copyErrorTo (UErrorCode &outErrorCode) const
 Sets the UErrorCode if an error occurred in the fluent chain.
 

Friends

class NumberRangeFormatterSettings< UnlocalizedNumberRangeFormatter >
 
class NumberRangeFormatterSettings< LocalizedNumberRangeFormatter >
 
class UnlocalizedNumberRangeFormatter
 

Detailed Description

A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.

Instances of this class are immutable and thread-safe.

See also
NumberFormatter
Stable:
ICU 63

Definition at line 487 of file numberrangeformatter.h.

Constructor & Destructor Documentation

◆ LocalizedNumberRangeFormatter() [1/3]

icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter ( )
default

Default constructor: puts the formatter into a valid but undefined state.

Stable:
ICU 63

◆ LocalizedNumberRangeFormatter() [2/3]

icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter ( const LocalizedNumberRangeFormatter other)

Returns a copy of this LocalizedNumberRangeFormatter.

Stable:
ICU 63

◆ LocalizedNumberRangeFormatter() [3/3]

icu::number::LocalizedNumberRangeFormatter::LocalizedNumberRangeFormatter ( LocalizedNumberRangeFormatter &&  src)
noexcept

Move constructor: The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.

Stable:
ICU 63

◆ ~LocalizedNumberRangeFormatter()

icu::number::LocalizedNumberRangeFormatter::~LocalizedNumberRangeFormatter ( )

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

Stable:
ICU 63

Member Function Documentation

◆ formatFormattableRange()

FormattedNumberRange icu::number::LocalizedNumberRangeFormatter::formatFormattableRange ( const Formattable first,
const Formattable second,
UErrorCode status 
) const

Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting chain.

Parameters
firstThe first number in the range, usually to the left in LTR locales.
secondThe second number in the range, usually to the right in LTR locales.
statusSet if an error occurs while formatting.
Returns
A FormattedNumberRange object; call .toString() to get the string.
Stable:
ICU 63

◆ formatImpl()

void icu::number::LocalizedNumberRangeFormatter::formatImpl ( impl::UFormattedNumberRangeData &  results,
bool  equalBeforeRounding,
UErrorCode status 
) const
Parameters
resultsThe results object. This method will mutate it to save the results.
equalBeforeRoundingWhether the number was equal before copying it into a DecimalQuantity. Used for determining the identity fallback behavior.
statusSet if an error occurs while formatting.
Internal:
Do not use. This API is for internal use only.

◆ operator=() [1/2]

LocalizedNumberRangeFormatter & icu::number::LocalizedNumberRangeFormatter::operator= ( const LocalizedNumberRangeFormatter other)

Copy assignment operator.

Stable:
ICU 63

◆ operator=() [2/2]

LocalizedNumberRangeFormatter & icu::number::LocalizedNumberRangeFormatter::operator= ( LocalizedNumberRangeFormatter &&  src)
noexcept

Move assignment operator: The source LocalizedNumberRangeFormatter will be left in a valid but undefined state.

Stable:
ICU 63

◆ withoutLocale() [1/2]

UnlocalizedNumberRangeFormatter icu::number::LocalizedNumberRangeFormatter::withoutLocale ( ) &&

Overload of withoutLocale() for use on an rvalue reference.

Returns
The fluent chain.
See also
withoutLocale
Draft:
This API may be changed in the future versions and was introduced in ICU 75

◆ withoutLocale() [2/2]

UnlocalizedNumberRangeFormatter icu::number::LocalizedNumberRangeFormatter::withoutLocale ( ) const &

Disassociate the locale from this formatter.

Returns
The fluent chain.
Draft:
This API may be changed in the future versions and was introduced in ICU 75

Friends And Related Symbol Documentation

◆ NumberRangeFormatterSettings< LocalizedNumberRangeFormatter >

Definition at line 594 of file numberrangeformatter.h.

◆ NumberRangeFormatterSettings< UnlocalizedNumberRangeFormatter >

Definition at line 594 of file numberrangeformatter.h.

◆ UnlocalizedNumberRangeFormatter

Definition at line 601 of file numberrangeformatter.h.


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