icu::LocaleMatcher::Result Class Reference

Data for the best-matching pair of a desired and a supported locale. More...

`#include <localematcher.h>`

Inheritance diagram for icu::LocaleMatcher::Result:

## Public Member Functions

| Result (Result &&src) noexcept
| Move constructor; might modify the source. More...
| ~Result ()
| Destructor. More...
Result & | operator= (Result &&src) noexcept
| Move assignment; might modify the source. More...
const Locale * | getDesiredLocale () const
| Returns the best-matching desired locale. More...
const Locale * | getSupportedLocale () const
| Returns the best-matching supported locale. More...
int32_t | getDesiredIndex () const
| Returns the index of the best-matching desired locale in the input Iterable order. More...
int32_t | getSupportedIndex () const
| Returns the index of the best-matching supported locale in the constructor’s or builder’s input order (“set” Collection plus “added” locales). More...
Locale | makeResolvedLocale (UErrorCode &errorCode) const
| Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions. More...

## Friends

class | LocaleMatcher

## Detailed Description

Data for the best-matching pair of a desired and a supported locale.

Movable but not copyable.

Stable:
  ICU 65

Definition at line 192 of file localematcher.h.

## Constructor & Destructor Documentation

## Result()

icu::LocaleMatcher::Result::Result | ( | Result && | src | ) |

noexcept

Move constructor; might modify the source.

This object will have the same contents that the source object had.

Parameters

  src | Result to move contents from.

Stable:
  ICU 65

## ~Result()

icu::LocaleMatcher::Result::~Result | ( |  | ) |

Destructor.

Stable:
  ICU 65

## Member Function Documentation

## getDesiredIndex()

int32_t icu::LocaleMatcher::Result::getDesiredIndex | ( |  | ) | const

inline

Returns the index of the best-matching desired locale in the input Iterable order.

-1 if the list of desired locales is empty or if none matched well enough.

Returns
  the index of the best-matching desired locale, or -1.

Stable:
  ICU 65

Definition at line 246 of file localematcher.h.

## getDesiredLocale()

const Locale* icu::LocaleMatcher::Result::getDesiredLocale | ( |  | ) | const

inline

Returns the best-matching desired locale.

nullptr if the list of desired locales is empty or if none matched well enough.

Returns
  the best-matching desired locale, or nullptr.

Stable:
  ICU 65

Definition at line 226 of file localematcher.h.

## getSupportedIndex()

int32_t icu::LocaleMatcher::Result::getSupportedIndex | ( |  | ) | const

inline

Returns the index of the best-matching supported locale in the constructor’s or builder’s input order (“set” Collection plus “added” locales).

If the matcher was built from a locale list string, then the iteration order is that of a LocalePriorityList built from the same string. -1 if the list of supported locales is empty or if none matched well enough.

Returns
  the index of the best-matching supported locale, or -1.

Stable:
  ICU 65

Definition at line 258 of file localematcher.h.

## getSupportedLocale()

const Locale* icu::LocaleMatcher::Result::getSupportedLocale | ( |  | ) | const

inline

Returns the best-matching supported locale.

If none matched well enough, this is the default locale. The default locale is nullptr if Builder::setNoDefaultLocale() was called, or if the list of supported locales is empty and no explicit default locale is set.

Returns
  the best-matching supported locale, or nullptr.

Stable:
  ICU 65

Definition at line 237 of file localematcher.h.

## makeResolvedLocale()

Locale icu::LocaleMatcher::Result::makeResolvedLocale | ( | UErrorCode & | errorCode | ) | const

Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale, such as the -t- and -u- extensions.

May replace some fields of the supported locale. The result is the locale that should be used for date and number formatting, collation, etc. Returns the root locale if getSupportedLocale() returns nullptr.

Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn

Returns
  a locale combining the best-matching desired and supported locales.

Stable:
  ICU 65

## operator=()

Result& icu::LocaleMatcher::Result::operator= | ( | Result && | src | ) |

noexcept

Move assignment; might modify the source.

This object will have the same contents that the source object had.

Parameters

  src | Result to move contents from.

Stable:
  ICU 65

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

- common/unicode/localematcher.h