ICU 65.1  65.1
Public Member Functions | Friends
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:
icu::UMemory

Public Member Functions

 Result (Result &&src) U_NOEXCEPT
 Move constructor; might modify the source. More...
 
 ~Result ()
 Destructor. More...
 
Resultoperator= (Result &&src) U_NOEXCEPT
 Move assignment; might modify the source. More...
 
const LocalegetDesiredLocale () const
 Returns the best-matching desired locale. More...
 
const LocalegetSupportedLocale () 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.

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

Definition at line 158 of file localematcher.h.

Constructor & Destructor Documentation

◆ Result()

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

Move constructor; might modify the source.

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

Parameters
srcResult to move contents from.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ ~Result()

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

Destructor.

Draft:
This API may be changed in the future versions and was introduced in 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.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 212 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.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 192 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.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 224 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 the list of supported locales is empty and no explicit default locale is set.

Returns
the best-matching supported locale, or nullptr.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 203 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.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ operator=()

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

Move assignment; might modify the source.

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

Parameters
srcResult to move contents from.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

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