"Fossies" - the Fresh Open Source Software Archive

Member "classicu_1_1LocaleMatcher_1_1Builder.html" (3 Oct 2019, 40014 Bytes) of package /linux/misc/icu4c-65_1-docs.zip:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

ICU 65.1  65.1
Public Member Functions | Friends
icu::LocaleMatcher::Builder Class Reference

LocaleMatcher builder. More...

#include <localematcher.h>

Inheritance diagram for icu::LocaleMatcher::Builder:
icu::UMemory

Public Member Functions

 Builder ()
 Constructs a builder used in chaining parameters for building a LocaleMatcher. More...
 
 Builder (Builder &&src) U_NOEXCEPT
 Move constructor; might modify the source. More...
 
 ~Builder ()
 Destructor. More...
 
Builderoperator= (Builder &&src) U_NOEXCEPT
 Move assignment; might modify the source. More...
 
BuildersetSupportedLocalesFromListString (StringPiece locales)
 Parses an Accept-Language string (RFC 2616 Section 14.4), such as "af, en, fr;q=0.9", and sets the supported locales accordingly. More...
 
BuildersetSupportedLocales (Locale::Iterator &locales)
 Copies the supported locales, preserving iteration order. More...
 
template<typename Iter >
BuildersetSupportedLocales (Iter begin, Iter end)
 Copies the supported locales from the begin/end range, preserving iteration order. More...
 
template<typename Iter , typename Conv >
BuildersetSupportedLocalesViaConverter (Iter begin, Iter end, Conv converter)
 Copies the supported locales from the begin/end range, preserving iteration order. More...
 
BuilderaddSupportedLocale (const Locale &locale)
 Adds another supported locale. More...
 
BuildersetDefaultLocale (const Locale *defaultLocale)
 Sets the default locale; if nullptr, or if it is not set explicitly, then the first supported locale is used as the default locale. More...
 
BuildersetFavorSubtag (ULocMatchFavorSubtag subtag)
 If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script differences. More...
 
BuildersetDemotionPerDesiredLocale (ULocMatchDemotion demotion)
 Option for whether all desired locales are treated equally or earlier ones are preferred (this is the default). More...
 
UBool copyErrorTo (UErrorCode &outErrorCode) const
 Sets the UErrorCode if an error occurred while setting parameters. More...
 
LocaleMatcher build (UErrorCode &errorCode) const
 Builds and returns a new locale matcher. More...
 

Friends

class LocaleMatcher
 

Detailed Description

LocaleMatcher builder.

Movable but not copyable.

See also
LocaleMatcher::builder()
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 266 of file localematcher.h.

Constructor & Destructor Documentation

◆ Builder() [1/2]

icu::LocaleMatcher::Builder::Builder ( )
inline

Constructs a builder used in chaining parameters for building a LocaleMatcher.

Returns
a new Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 274 of file localematcher.h.

References U_NOEXCEPT.

◆ Builder() [2/2]

icu::LocaleMatcher::Builder::Builder ( Builder &&  src)

Move constructor; might modify the source.

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

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

◆ ~Builder()

icu::LocaleMatcher::Builder::~Builder ( )

Destructor.

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

Member Function Documentation

◆ addSupportedLocale()

Builder& icu::LocaleMatcher::Builder::addSupportedLocale ( const Locale locale)

Adds another supported locale.

Duplicates are allowed, and are not removed.

Parameters
localeanother locale
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ build()

LocaleMatcher icu::LocaleMatcher::Builder::build ( UErrorCode errorCode) const

Builds and returns a new locale matcher.

This builder can continue to be used.

Parameters
errorCodeICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.)
Returns
new LocaleMatcher.
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ copyErrorTo()

UBool icu::LocaleMatcher::Builder::copyErrorTo ( UErrorCode outErrorCode) const

Sets the UErrorCode if an error occurred while setting parameters.

Preserves older error codes in the outErrorCode.

Parameters
outErrorCodeSet to an error code if it does not contain one already and an error occurred while setting parameters. Otherwise unchanged.
Returns
TRUE if U_FAILURE(outErrorCode)
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ operator=()

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

Move assignment; might modify the source.

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

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

◆ setDefaultLocale()

Builder& icu::LocaleMatcher::Builder::setDefaultLocale ( const Locale defaultLocale)

Sets the default locale; if nullptr, or if it is not set explicitly, then the first supported locale is used as the default locale.

Parameters
defaultLocalethe default locale (will be copied)
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ setDemotionPerDesiredLocale()

Builder& icu::LocaleMatcher::Builder::setDemotionPerDesiredLocale ( ULocMatchDemotion  demotion)

Option for whether all desired locales are treated equally or earlier ones are preferred (this is the default).

Parameters
demotionthe demotion per desired locale to set.
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ setFavorSubtag()

Builder& icu::LocaleMatcher::Builder::setFavorSubtag ( ULocMatchFavorSubtag  subtag)

If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script differences.

This is used in situations (such as maps) where it is better to fall back to the same script than a similar language.

Parameters
subtagthe subtag to favor
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ setSupportedLocales() [1/2]

Builder& icu::LocaleMatcher::Builder::setSupportedLocales ( Locale::Iterator locales)

Copies the supported locales, preserving iteration order.

Clears any previously set/added supported locales first. Duplicates are allowed, and are not removed.

Parameters
localesthe list of locale
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ setSupportedLocales() [2/2]

template<typename Iter >
Builder& icu::LocaleMatcher::Builder::setSupportedLocales ( Iter  begin,
Iter  end 
)
inline

Copies the supported locales from the begin/end range, preserving iteration order.

Clears any previously set/added supported locales first. Duplicates are allowed, and are not removed.

Each of the iterator parameter values must be an input iterator whose value is convertible to const Locale &.

Parameters
beginStart of range.
endExclusive end of range.
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 339 of file localematcher.h.

References U_FAILURE.

◆ setSupportedLocalesFromListString()

Builder& icu::LocaleMatcher::Builder::setSupportedLocalesFromListString ( StringPiece  locales)

Parses an Accept-Language string (RFC 2616 Section 14.4), such as "af, en, fr;q=0.9", and sets the supported locales accordingly.

Allows whitespace in more places but does not allow "*". Clears any previously set/added supported locales first.

Parameters
localesthe Accept-Language string of locales to set
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

◆ setSupportedLocalesViaConverter()

template<typename Iter , typename Conv >
Builder& icu::LocaleMatcher::Builder::setSupportedLocalesViaConverter ( Iter  begin,
Iter  end,
Conv  converter 
)
inline

Copies the supported locales from the begin/end range, preserving iteration order.

Calls the converter to convert each *begin to a Locale or const Locale &. Clears any previously set/added supported locales first. Duplicates are allowed, and are not removed.

Each of the iterator parameter values must be an input iterator whose value is convertible to const Locale &.

Parameters
beginStart of range.
endExclusive end of range.
converterConverter from *begin to const Locale & or compatible.
Returns
this Builder object
Draft:
This API may be changed in the future versions and was introduced in ICU 65

Definition at line 364 of file localematcher.h.

References U_FAILURE, U_NOEXCEPT, U_ZERO_ERROR, ULOCMATCH_DEMOTION_REGION, and ULOCMATCH_FAVOR_LANGUAGE.


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