ICU 71.1 71.1

Public Member Functions | Friends
icu::number::NumberRangeFormatterSettings< Derived > Class Template Reference

An abstract base class for specifying settings related to number formatting. More...

`#include <numberrangeformatter.h>`

Inheritance diagram for icu::number::NumberRangeFormatterSettings< Derived >:

## Public Member Functions
Derived | numberFormatterBoth (const UnlocalizedNumberFormatter &formatter) const &
| Sets the NumberFormatter instance to use for the numbers in the range. More...
Derived | numberFormatterBoth (const UnlocalizedNumberFormatter &formatter) &&
| Overload of numberFormatterBoth() for use on an rvalue reference. More...
Derived | numberFormatterBoth (UnlocalizedNumberFormatter &&formatter) const &
| Overload of numberFormatterBoth() for use on an rvalue reference. More...
Derived | numberFormatterBoth (UnlocalizedNumberFormatter &&formatter) &&
| Overload of numberFormatterBoth() for use on an rvalue reference. More...
Derived | numberFormatterFirst (const UnlocalizedNumberFormatter &formatterFirst) const &
| Sets the NumberFormatter instance to use for the first number in the range. More...
Derived | numberFormatterFirst (const UnlocalizedNumberFormatter &formatterFirst) &&
| Overload of numberFormatterFirst() for use on an rvalue reference. More...
Derived | numberFormatterFirst (UnlocalizedNumberFormatter &&formatterFirst) const &
| Overload of numberFormatterFirst() for use on an rvalue reference. More...
Derived | numberFormatterFirst (UnlocalizedNumberFormatter &&formatterFirst) &&
| Overload of numberFormatterFirst() for use on an rvalue reference. More...
Derived | numberFormatterSecond (const UnlocalizedNumberFormatter &formatterSecond) const &
| Sets the NumberFormatter instance to use for the second number in the range. More...
Derived | numberFormatterSecond (const UnlocalizedNumberFormatter &formatterSecond) &&
| Overload of numberFormatterSecond() for use on an rvalue reference. More...
Derived | numberFormatterSecond (UnlocalizedNumberFormatter &&formatterSecond) const &
| Overload of numberFormatterSecond() for use on an rvalue reference. More...
Derived | numberFormatterSecond (UnlocalizedNumberFormatter &&formatterSecond) &&
| Overload of numberFormatterSecond() for use on an rvalue reference. More...
Derived | collapse (UNumberRangeCollapse collapse) const &
| Sets the aggressiveness of "collapsing" fields across the range separator. More...
Derived | collapse (UNumberRangeCollapse collapse) &&
| Overload of collapse() for use on an rvalue reference. More...
Derived | identityFallback (UNumberRangeIdentityFallback identityFallback) const &
| Sets the behavior when the two sides of the range are the same. More...
Derived | identityFallback (UNumberRangeIdentityFallback identityFallback) &&
| Overload of identityFallback() for use on an rvalue reference. More...
LocalPointer< Derived > | clone () const &
| Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer wrapping a heap-allocated copy of the current object. More...
LocalPointer< Derived > | clone () &&
| Overload of clone for use on an rvalue reference. More...
UBool | copyErrorTo (UErrorCode &outErrorCode) const
| Sets the UErrorCode if an error occurred in the fluent chain. More...

## Friends
class | LocalizedNumberRangeFormatter
class | UnlocalizedNumberRangeFormatter

## Detailed Description

### template<typename Derived>
class icu::number::NumberRangeFormatterSettings< Derived >

An abstract base class for specifying settings related to number formatting.

This class is implemented by UnlocalizedNumberRangeFormatter and LocalizedNumberRangeFormatter. This class is not intended for public subclassing.

Definition at line 131 of file numberrangeformatter.h.

## Member Function Documentation

## ◆ clone() [1/2]

template<typename Derived >

LocalPointer<Derived> icu::number::NumberRangeFormatterSettings< Derived >::clone | ( |  | ) | &&

Overload of clone for use on an rvalue reference.

Returns
  A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped nullptr on failure.

Stable:
  ICU 64

## ◆ clone() [2/2]

template<typename Derived >

LocalPointer<Derived> icu::number::NumberRangeFormatterSettings< Derived >::clone | ( |  | ) | const &

Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer wrapping a heap-allocated copy of the current object.

This is equivalent to new-ing the move constructor with a value object as the argument.

Returns
  A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped nullptr on failure.

Stable:
  ICU 64

## ◆ collapse() [1/2]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::collapse | ( | UNumberRangeCollapse | collapse | ) | &&

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

Parameters

  collapse | The collapsing strategy to use for this range.

Returns
  The fluent chain.

See also
  collapse

Stable:
  ICU 63

## ◆ collapse() [2/2]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::collapse | ( | UNumberRangeCollapse | collapse | ) | const &

Sets the aggressiveness of "collapsing" fields across the range separator.

Possible values:

- ALL: "3-5K miles"
- UNIT: "3K - 5K miles"
- NONE: "3K miles - 5K miles"
- AUTO: usually UNIT or NONE, depending on the locale and formatter settings

The default value is AUTO.

Parameters

  collapse | The collapsing strategy to use for this range.

Returns
  The fluent chain.

Stable:
  ICU 63

## ◆ copyErrorTo()

template<typename Derived >

UBool icu::number::NumberRangeFormatterSettings< Derived >::copyErrorTo | ( | UErrorCode & | outErrorCode | ) | const
| inline

Sets the UErrorCode if an error occurred in the fluent chain.

Preserves older error codes in the outErrorCode.

Returns
  true if U_FAILURE(outErrorCode)

Stable:
  ICU 63

Definition at line 363 of file numberrangeformatter.h.

## ◆ identityFallback() [1/2]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::identityFallback | ( | UNumberRangeIdentityFallback | identityFallback | ) | &&

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

Parameters

  identityFallback | The strategy to use when formatting two numbers that end up being the same.

Returns
  The fluent chain.

See also
  identityFallback

Stable:
  ICU 63

## ◆ identityFallback() [2/2]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::identityFallback | ( | UNumberRangeIdentityFallback | identityFallback | ) | const &

Sets the behavior when the two sides of the range are the same.

This could happen if the same two numbers are passed to the formatFormattableRange function, or if different numbers are passed to the function but they become the same after rounding rules are applied. Possible values:

- SINGLE_VALUE: "5 miles"
- APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before rounding was applied
- APPROXIMATELY: "~5 miles"
- RANGE: "5-5 miles" (with collapse=UNIT)

The default value is APPROXIMATELY.

Parameters

  identityFallback | The strategy to use when formatting two numbers that end up being the same.

Returns
  The fluent chain.

Stable:
  ICU 63

## ◆ numberFormatterBoth() [1/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterBoth | ( | const UnlocalizedNumberFormatter & | formatter | ) | &&

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

Parameters

  formatter | The formatter to use for both numbers in the range.

Returns
  The fluent chain.

See also
  numberFormatterBoth

Stable:
  ICU 63

## ◆ numberFormatterBoth() [2/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterBoth | ( | const UnlocalizedNumberFormatter & | formatter | ) | const &

Sets the NumberFormatter instance to use for the numbers in the range.

The same formatter is applied to both sides of the range.

The NumberFormatter instances must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.

Parameters

  formatter | The formatter to use for both numbers in the range.

Returns
  The fluent chain.

Stable:
  ICU 63

## ◆ numberFormatterBoth() [3/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterBoth | ( | UnlocalizedNumberFormatter && | formatter | ) | &&

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

Parameters

  formatter | The formatter to use for both numbers in the range.

Returns
  The fluent chain.

See also
  numberFormatterBoth

Stable:
  ICU 63

## ◆ numberFormatterBoth() [4/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterBoth | ( | UnlocalizedNumberFormatter && | formatter | ) | const &

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

Parameters

  formatter | The formatter to use for both numbers in the range.

Returns
  The fluent chain.

See also
  numberFormatterBoth

Stable:
  ICU 63

## ◆ numberFormatterFirst() [1/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterFirst | ( | const UnlocalizedNumberFormatter & | formatterFirst | ) | &&

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

Parameters

  formatterFirst | The formatter to use for the first number in the range.

Returns
  The fluent chain.

See also
  numberFormatterFirst

Stable:
  ICU 63

## ◆ numberFormatterFirst() [2/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterFirst | ( | const UnlocalizedNumberFormatter & | formatterFirst | ) | const &

Sets the NumberFormatter instance to use for the first number in the range.

The NumberFormatter instances must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.

Parameters

  formatterFirst | The formatter to use for the first number in the range.

Returns
  The fluent chain.

Stable:
  ICU 63

## ◆ numberFormatterFirst() [3/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterFirst | ( | UnlocalizedNumberFormatter && | formatterFirst | ) | &&

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

Parameters

  formatterFirst | The formatter to use for the first number in the range.

Returns
  The fluent chain.

See also
  numberFormatterFirst

Stable:
  ICU 63

## ◆ numberFormatterFirst() [4/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterFirst | ( | UnlocalizedNumberFormatter && | formatterFirst | ) | const &

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

Parameters

  formatterFirst | The formatter to use for the first number in the range.

Returns
  The fluent chain.

See also
  numberFormatterFirst

Stable:
  ICU 63

## ◆ numberFormatterSecond() [1/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterSecond | ( | const UnlocalizedNumberFormatter & | formatterSecond | ) | &&

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

Parameters

  formatterSecond | The formatter to use for the second number in the range.

Returns
  The fluent chain.

See also
  numberFormatterSecond

Stable:
  ICU 63

## ◆ numberFormatterSecond() [2/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterSecond | ( | const UnlocalizedNumberFormatter & | formatterSecond | ) | const &

Sets the NumberFormatter instance to use for the second number in the range.

The NumberFormatter instances must not have a locale applied yet; the locale specified on the NumberRangeFormatter will be used.

Parameters

  formatterSecond | The formatter to use for the second number in the range.

Returns
  The fluent chain.

Stable:
  ICU 63

## ◆ numberFormatterSecond() [3/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterSecond | ( | UnlocalizedNumberFormatter && | formatterSecond | ) | &&

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

Parameters

  formatterSecond | The formatter to use for the second number in the range.

Returns
  The fluent chain.

See also
  numberFormatterSecond

Stable:
  ICU 63

## ◆ numberFormatterSecond() [4/4]

template<typename Derived >

Derived icu::number::NumberRangeFormatterSettings< Derived >::numberFormatterSecond | ( | UnlocalizedNumberFormatter && | formatterSecond | ) | const &

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

Parameters

  formatterSecond | The formatter to use for the second number in the range.

Returns
  The fluent chain.

See also
  numberFormatterSecond

Stable:
  ICU 63

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

- numberrangeformatter.h