ICU 76.1 76.1
Loading...
Searching...
No Matches
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) noexcept
 Move constructor; might modify the source.
 
 ~Result ()
 Destructor.
 
Resultoperator= (Result &&src) noexcept
 Move assignment; might modify the source.
 
const LocalegetDesiredLocale () const
 Returns the best-matching desired locale.
 
const LocalegetSupportedLocale () const
 Returns the best-matching supported locale.
 
int32_t getDesiredIndex () const
 Returns the index of the best-matching desired locale in the input Iterable order.
 
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).
 
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.
 

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 194 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
srcResult 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 248 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 228 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 260 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 239 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
srcResult to move contents from.
Stable:
ICU 65

Friends And Related Symbol Documentation

◆ LocaleMatcher

Definition at line 292 of file localematcher.h.


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