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
 
std::optional< std::string > get_unicode_extension (std::string_view s) const
 
std::string language () const
 
diplomat::result< std::monostate, icu4x::LocaleParseErrorset_language (std::string_view s)
 
std::optional< std::string > region () const
 
diplomat::result< std::monostate, icu4x::LocaleParseErrorset_region (std::string_view s)
 
std::optional< std::string > script () const
 
diplomat::result< std::monostate, icu4x::LocaleParseErrorset_script (std::string_view s)
 
std::string to_string () 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 diplomat::result< std::unique_ptr< icu4x::Locale >, icu4x::LocaleParseErrorfrom_string (std::string_view name)
 
static std::unique_ptr< icu4x::Localeunknown ()
 
static diplomat::result< std::string, icu4x::LocaleParseErrornormalize (std::string_view s)
 
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

◆ 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.

◆ 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()

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.

◆ language()

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

Returns a string representation of Locale language.

See the Rust documentation for id for more information.

◆ normalize()

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.

◆ 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.

◆ 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.

◆ set_language()

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()

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()

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.

◆ 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.

◆ unknown()

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

Construct a unknown Locale "und".

See the Rust documentation for UNKNOWN for more information.


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