LocaleDistance;
140 classLocaleLsrIterator;
278int32_t desIndex, int32_t suppIndex,
UBoolowned) :
279desiredLocale(desired), supportedLocale(supported),
280desiredIndex(desIndex), supportedIndex(suppIndex),
281desiredIsOwned(owned) {}
286 const Locale*desiredLocale;
287 const Locale*supportedLocale;
288int32_t desiredIndex;
289int32_t supportedIndex;
290 UBooldesiredIsOwned;
373 template<
typenameIter>
375 if(
U_FAILURE(errorCode_)) {
return*
this; }
376clearSupportedLocales();
377 while(begin != end) {
378addSupportedLocale(*begin++);
398 template<
typenameIter,
typenameConv>
400 if(
U_FAILURE(errorCode_)) {
return*
this; }
401clearSupportedLocales();
402 while(begin != end) {
403addSupportedLocale(converter(*begin++));
472direction_ = matchDirection;
530 voidclearSupportedLocales();
531 boolensureSupportedLocaleVector();
534UVector *supportedLocales_ =
nullptr;
535int32_t thresholdDistance_ = -1;
537 Locale*defaultLocale_ =
nullptr;
538 boolwithDefault_ =
true;
541 Locale*maxDistanceDesired_ =
nullptr;
542 Locale*maxDistanceSupported_ =
nullptr;
654 #ifndef U_HIDE_INTERNAL_API 681int32_t putIfAbsent(
constLSR &lsr, int32_t i, int32_t suppLength,
UErrorCode&errorCode);
683std::optional<int32_t> getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter,
UErrorCode&errorCode)
const;
685 constLikelySubtags &likelySubtags;
686 constLocaleDistance &localeDistance;
687int32_t thresholdDistance;
688int32_t demotionPerDesiredLocale;
693 const Locale** supportedLocales;
695int32_t supportedLocalesLength;
700 constLSR **supportedLSRs;
701int32_t *supportedIndexes;
702int32_t supportedLSRsLength;
703 Locale*ownedDefaultLocale;
704 const Locale*defaultLocale;
Builder & setFavorSubtag(ULocMatchFavorSubtag subtag)
If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script differences.
Builder & addSupportedLocale(const Locale &locale)
Adds another supported locale.
Builder(Builder &&src) noexcept
Move constructor; might modify the source.
Builder & setSupportedLocales(Locale::Iterator &locales)
Copies the supported locales, preserving iteration order.
Builder & setSupportedLocales(Iter begin, Iter end)
Copies the supported locales from the begin/end range, preserving iteration order.
Builder & setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter)
Copies the supported locales from the begin/end range, preserving iteration order.
LocaleMatcher build(UErrorCode &errorCode) const
Builds and returns a new locale matcher.
Builder & setSupportedLocalesFromListString(StringPiece locales)
Parses an Accept-Language string (RFC 2616 Section 14.4), such as "af, en, fr;q=0....
Builder & setDirection(ULocMatchDirection matchDirection)
Option for whether to include or ignore one-way (fallback) match data.
Builder & setMaxDistance(const Locale &desired, const Locale &supported)
Sets the maximum distance for an acceptable match.
Builder & setNoDefaultLocale()
Sets no default locale.
Builder & setDefaultLocale(const Locale *defaultLocale)
Sets the default locale; if nullptr, or if it is not set explicitly, then the first supported locale ...
Builder & setDemotionPerDesiredLocale(ULocMatchDemotion demotion)
Option for whether all desired locales are treated equally or earlier ones are preferred (this is the...
Builder & operator=(Builder &&src) noexcept
Move assignment; might modify the source.
UBool copyErrorTo(UErrorCode &outErrorCode) const
Sets the UErrorCode if an error occurred while setting parameters.
Builder()
Constructs a builder used in chaining parameters for building a LocaleMatcher.
Data for the best-matching pair of a desired and a supported locale.
int32_t getSupportedIndex() const
Returns the index of the best-matching supported locale in the constructor’s or builder’s input order...
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.
Locale makeResolvedLocale(UErrorCode &errorCode) const
Takes the best-matching supported locale and adds relevant fields of the best-matching desired locale...
Result & operator=(Result &&src) noexcept
Move assignment; might modify the source.
const Locale * getDesiredLocale() const
Returns the best-matching desired locale.
Result(Result &&src) noexcept
Move constructor; might modify the source.
Immutable class that picks the best match between a user's desired locales and an application's suppo...
const Locale * getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const
Returns the supported locale which best matches the desired locale.
LocaleMatcher(LocaleMatcher &&src) noexcept
Move copy constructor; might modify the source.
UBool isMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const
Returns true if the pair of locales matches acceptably.
Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const
Returns the best match between the desired locale and the supported locales.
Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const
Returns the best match between the desired and supported locales.
double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const
Returns a fraction between 0 and 1, where 1 means that the languages are a perfect match,...
const Locale * getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const
Parses an Accept-Language string (RFC 2616 Section 14.4), such as "af, en, fr;q=0....
~LocaleMatcher()
Destructor.
const Locale * getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const
Returns the supported locale which best matches one of the desired locales.
LocaleMatcher & operator=(LocaleMatcher &&src) noexcept
Move assignment operator; might modify the source.
A Locale iterator interface similar to a Java Iterator<Locale>.
A Locale object represents a specific geographical, political, or cultural region.
A string-like object that points to a sized piece of memory.
UMemory is the common ICU base class.
ULocMatchDemotion
Builder option for whether all desired locales are treated equally or earlier ones are preferred.
@ ULOCMATCH_DEMOTION_REGION
Earlier desired locales are preferred.
@ ULOCMATCH_DEMOTION_NONE
All desired locales are treated equally.
ULocMatchDirection
Builder option for whether to include or ignore one-way (fallback) match data.
@ ULOCMATCH_DIRECTION_ONLY_TWO_WAY
Locale matching limited to two-way matches including e.g.
@ ULOCMATCH_DIRECTION_WITH_ONE_WAY
Locale matching includes one-way matches such as Breton→French.
ULocMatchFavorSubtag
Builder option for whether the language subtag or the script subtag is most important.
@ ULOCMATCH_FAVOR_SCRIPT
Makes script differences matter relatively more than language differences.
@ ULOCMATCH_FAVOR_LANGUAGE
Language differences are most important, then script differences, then region differences.
C++ API: Locale ID object.
struct UHashtable UHashtable
C++ API: StringPiece: Read-only byte string wrapper class.
int8_t UBool
The ICU boolean type, a signed-byte integer.
C++ API: Common ICU base class UObject.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
@ U_ZERO_ERROR
No error, no warning.
#define U_FAILURE(x)
Does the error code indicate a failure?
#define U_SUCCESS(x)
Does the error code indicate success?
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4