ICU4X
International Components for Unicode
Loading...
Searching...
No Matches
icu4x::Locale Class Reference

#include <Locale.d.hpp>

Public Member Functions

std::unique_ptr< icu4x::Localeclone () const
 
std::string basename () const
 
template<typename W>
void basename_write (W &writeable_output) const
 
std::optional< std::string > get_unicode_extension (std::string_view s) const
 
template<typename W>
std::optional< std::monostate > get_unicode_extension_write (std::string_view s, W &writeable_output) const
 
std::optional< std::monostate > set_unicode_extension (std::string_view k, std::string_view v)
 
std::string language () const
 
template<typename W>
void language_write (W &writeable_output) const
 
icu4x::diplomat::result< std::monostate, icu4x::LocaleParseErrorset_language (std::string_view s)
 
std::optional< std::string > region () const
 
template<typename W>
std::optional< std::monostate > region_write (W &writeable_output) const
 
icu4x::diplomat::result< std::monostate, icu4x::LocaleParseErrorset_region (std::string_view s)
 
std::optional< std::string > script () const
 
template<typename W>
std::optional< std::monostate > script_write (W &writeable_output) const
 
icu4x::diplomat::result< std::monostate, icu4x::LocaleParseErrorset_script (std::string_view s)
 
std::string variants () const
 
template<typename W>
void variants_write (W &writeable_output) const
 
size_t variant_count () const
 
std::optional< std::string > variant_at (size_t index) const
 
template<typename W>
std::optional< std::monostate > variant_at_write (size_t index, W &writeable_output) const
 
bool has_variant (std::string_view s) const
 
icu4x::diplomat::result< bool, icu4x::LocaleParseErroradd_variant (std::string_view s)
 
bool remove_variant (std::string_view s)
 
void clear_variants ()
 
std::string to_string () const
 
template<typename W>
void to_string_write (W &writeable_output) const
 
bool normalizing_eq (std::string_view other) const
 
int8_t compare_to_string (std::string_view other) const
 
int8_t compare_to (const icu4x::Locale &other) const
 
bool operator== (const icu4x::Locale &other) const
 
bool operator!= (const icu4x::Locale &other) const
 
bool operator<= (const icu4x::Locale &other) const
 
bool operator>= (const icu4x::Locale &other) const
 
bool operator< (const icu4x::Locale &other) const
 
bool operator> (const icu4x::Locale &other) const
 

Static Public Member Functions

static icu4x::diplomat::result< std::unique_ptr< icu4x::Locale >, icu4x::LocaleParseErrorfrom_string (std::string_view name)
 
static std::unique_ptr< icu4x::Localeunknown ()
 
static const icu4x::Localeunknown_ref ()
 
static icu4x::diplomat::result< std::string, icu4x::LocaleParseErrornormalize (std::string_view s)
 
template<typename W>
static icu4x::diplomat::result< std::monostate, icu4x::LocaleParseErrornormalize_write (std::string_view s, W &writeable_output)
 
static void operator delete (void *ptr)
 

Detailed Description

An ICU4X Locale, capable of representing strings like "en-US".

See the Rust documentation for Locale for more information.

Member Function Documentation

◆ add_variant()

icu4x::diplomat::result< bool, icu4x::LocaleParseError > icu4x::Locale::add_variant ( std::string_view s)
inline

Adds a variant to the Locale.

Returns an error if the variant string is invalid. Returns true if the variant was added, false if already present.

See the Rust documentation for push for more information.

◆ basename()

std::string icu4x::Locale::basename ( ) const
inline

Returns a string representation of the LanguageIdentifier part of Locale.

See the Rust documentation for id for more information.

◆ basename_write()

template<typename W>
void icu4x::Locale::basename_write ( W & writeable_output) const
inline

◆ clear_variants()

void icu4x::Locale::clear_variants ( )
inline

Clears all variants from the Locale.

See the Rust documentation for clear for more information.

◆ clone()

std::unique_ptr< icu4x::Locale > icu4x::Locale::clone ( ) const
inline

Clones the Locale.

See the Rust documentation for Locale for more information.

◆ compare_to()

int8_t icu4x::Locale::compare_to ( const icu4x::Locale & other) const
inline

See the Rust documentation for total_cmp for more information.

◆ compare_to_string()

int8_t icu4x::Locale::compare_to_string ( std::string_view other) const
inline

See the Rust documentation for strict_cmp for more information.

◆ from_string()

icu4x::diplomat::result< std::unique_ptr< icu4x::Locale >, icu4x::LocaleParseError > icu4x::Locale::from_string ( std::string_view name)
inlinestatic

Construct an Locale from an locale identifier.

This will run the complete locale parsing algorithm. If code size and performance are critical and the locale is of a known shape (such as aa-BB) use create_und, set_language, set_script, and set_region.

See the Rust documentation for try_from_str for more information.

◆ get_unicode_extension()

std::optional< std::string > icu4x::Locale::get_unicode_extension ( std::string_view s) const
inline

Returns a string representation of the unicode extension.

See the Rust documentation for extensions for more information.

◆ get_unicode_extension_write()

template<typename W>
std::optional< std::monostate > icu4x::Locale::get_unicode_extension_write ( std::string_view s,
W & writeable_output ) const
inline

◆ has_variant()

bool icu4x::Locale::has_variant ( std::string_view s) const
inline

Returns whether the Locale has a specific variant.

See the Rust documentation for Variants for more information.

◆ language()

std::string icu4x::Locale::language ( ) const
inline

Returns a string representation of Locale language.

See the Rust documentation for id for more information.

◆ language_write()

template<typename W>
void icu4x::Locale::language_write ( W & writeable_output) const
inline

◆ normalize()

icu4x::diplomat::result< std::string, icu4x::LocaleParseError > icu4x::Locale::normalize ( std::string_view s)
inlinestatic

Normalizes a locale string.

See the Rust documentation for normalize for more information.

◆ normalize_write()

template<typename W>
icu4x::diplomat::result< std::monostate, icu4x::LocaleParseError > icu4x::Locale::normalize_write ( std::string_view s,
W & writeable_output )
inlinestatic

◆ normalizing_eq()

bool icu4x::Locale::normalizing_eq ( std::string_view other) const
inline

See the Rust documentation for normalizing_eq for more information.

◆ operator delete()

void icu4x::Locale::operator delete ( void * ptr)
inlinestatic

◆ operator!=()

bool icu4x::Locale::operator!= ( const icu4x::Locale & other) const
inline

◆ operator<()

bool icu4x::Locale::operator< ( const icu4x::Locale & other) const
inline

◆ operator<=()

bool icu4x::Locale::operator<= ( const icu4x::Locale & other) const
inline

◆ operator==()

bool icu4x::Locale::operator== ( const icu4x::Locale & other) const
inline

◆ operator>()

bool icu4x::Locale::operator> ( const icu4x::Locale & other) const
inline

◆ operator>=()

bool icu4x::Locale::operator>= ( const icu4x::Locale & other) const
inline

◆ region()

std::optional< std::string > icu4x::Locale::region ( ) const
inline

Returns a string representation of Locale region.

See the Rust documentation for id for more information.

◆ region_write()

template<typename W>
std::optional< std::monostate > icu4x::Locale::region_write ( W & writeable_output) const
inline

◆ remove_variant()

bool icu4x::Locale::remove_variant ( std::string_view s)
inline

Removes a variant from the Locale.

Returns true if the variant was removed, false if not present. Returns false for invalid variant strings (they cannot exist in the locale).

See the Rust documentation for remove for more information.

◆ script()

std::optional< std::string > icu4x::Locale::script ( ) const
inline

Returns a string representation of Locale script.

See the Rust documentation for id for more information.

◆ script_write()

template<typename W>
std::optional< std::monostate > icu4x::Locale::script_write ( W & writeable_output) const
inline

◆ set_language()

icu4x::diplomat::result< std::monostate, icu4x::LocaleParseError > icu4x::Locale::set_language ( std::string_view s)
inline

Set the language part of the Locale.

See the Rust documentation for try_from_str for more information.

◆ set_region()

icu4x::diplomat::result< std::monostate, icu4x::LocaleParseError > icu4x::Locale::set_region ( std::string_view s)
inline

Set the region part of the Locale.

See the Rust documentation for try_from_str for more information.

◆ set_script()

icu4x::diplomat::result< std::monostate, icu4x::LocaleParseError > icu4x::Locale::set_script ( std::string_view s)
inline

Set the script part of the Locale. Pass an empty string to remove the script.

See the Rust documentation for try_from_str for more information.

◆ set_unicode_extension()

std::optional< std::monostate > icu4x::Locale::set_unicode_extension ( std::string_view k,
std::string_view v )
inline

Set a Unicode extension.

See the Rust documentation for extensions for more information.

◆ to_string()

std::string icu4x::Locale::to_string ( ) const
inline

Returns a string representation of Locale.

See the Rust documentation for write_to for more information.

◆ to_string_write()

template<typename W>
void icu4x::Locale::to_string_write ( W & writeable_output) const
inline

◆ unknown()

std::unique_ptr< icu4x::Locale > icu4x::Locale::unknown ( )
inlinestatic

Construct a unknown Locale "und".

See the Rust documentation for UNKNOWN for more information.

◆ unknown_ref()

const icu4x::Locale & icu4x::Locale::unknown_ref ( )
inlinestatic

Returns a borrowed unknown ("und") Locale, without allocating.

See the Rust documentation for UNKNOWN for more information.

◆ variant_at()

std::optional< std::string > icu4x::Locale::variant_at ( size_t index) const
inline

Returns the variant at the given index, or nothing if the index is out of bounds.

See the Rust documentation for Variants for more information.

◆ variant_at_write()

template<typename W>
std::optional< std::monostate > icu4x::Locale::variant_at_write ( size_t index,
W & writeable_output ) const
inline

◆ variant_count()

size_t icu4x::Locale::variant_count ( ) const
inline

Returns the number of variants in this Locale.

See the Rust documentation for Variants for more information.

◆ variants()

std::string icu4x::Locale::variants ( ) const
inline

Returns a string representation of the Locale variants.

See the Rust documentation for Variants for more information.

◆ variants_write()

template<typename W>
void icu4x::Locale::variants_write ( W & writeable_output) const
inline

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