ICU 76.1 76.1
|
Data for the best-matching pair of a desired and a supported locale. More...
#include <localematcher.h>
Public Member Functions | |
Result (Result &&src) noexcept | |
Move constructor; might modify the source. | |
~Result () | |
Destructor. | |
Result & | operator= (Result &&src) noexcept |
Move assignment; might modify the source. | |
const Locale * | getDesiredLocale () const |
Returns the best-matching desired locale. | |
const Locale * | getSupportedLocale () 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 |
Data for the best-matching pair of a desired and a supported locale.
Movable but not copyable.
Definition at line 194 of file localematcher.h.
|
noexcept |
icu::LocaleMatcher::Result::~Result | ( | ) |
Destructor.
|
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.
Definition at line 248 of file localematcher.h.
Returns the best-matching desired locale.
nullptr if the list of desired locales is empty or if none matched well enough.
Definition at line 228 of file localematcher.h.
|
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.
Definition at line 260 of file localematcher.h.
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.
Definition at line 239 of file localematcher.h.
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
|
friend |
Definition at line 292 of file localematcher.h.