Class representing a full locale of the form [language[_territory][.codeset][@modifier]]
.
More...
#include <Locale.h>
|
| CLocale () |
|
| CLocale (const std::string &language) |
|
| CLocale (const std::string &language, const std::string &territory) |
|
| CLocale (const std::string &language, const std::string &territory, const std::string &codeset) |
|
| CLocale (const std::string &language, const std::string &territory, const std::string &codeset, const std::string &modifier) |
|
| ~CLocale () |
|
bool | operator== (const CLocale &other) const |
|
bool | operator!= (const CLocale &other) const |
|
bool | IsValid () const |
| Whether the locale is valid or not.
|
|
const std::string & | GetLanguageCode () const |
| Returns the (lower-case) ISO 639-1 language code of the locale.
|
|
const std::string & | GetTerritoryCode () const |
| Returns the (upper-case) ISO 3166-1 Alpha-2 territory code of the locale.
|
|
const std::string & | GetCodeset () const |
| Returns the codeset of the locale.
|
|
const std::string & | GetModifier () const |
| Returns the modifier of the locale.
|
|
std::string | ToString () const |
| Returns the full string representation of the locale.
|
|
std::string | ToStringLC () const |
| Returns the full string representation of the locale in lowercase.
|
|
std::string | ToShortString () const |
| Returns the short string representation of the locale.
|
|
std::string | ToShortStringLC () const |
| Returns the short string representation of the locale in lowercase.
|
|
bool | Equals (const std::string &locale) const |
| Checks if the given string representation of a locale exactly matches the locale.
|
|
bool | Matches (const std::string &locale) const |
| Checks if the given string representation of a locale partly matches the locale.
|
|
std::string | FindBestMatch (const std::set< std::string > &locales) const |
| Tries to find the locale in the given list that matches this locale best.
|
|
std::string | FindBestMatch (const std::unordered_map< std::string, std::string > &locales) const |
| Tries to find the locale in the given list that matches this locale best.
|
|
|
static CLocale | FromString (const std::string &locale) |
| Parses the given string representation and turns it into a locale.
|
|
Class representing a full locale of the form [language[_territory][.codeset][@modifier]]
.
◆ CLocale() [1/5]
◆ CLocale() [2/5]
CLocale::CLocale |
( |
const std::string & | language | ) |
|
|
explicit |
◆ CLocale() [3/5]
CLocale::CLocale |
( |
const std::string & | language, |
|
|
const std::string & | territory ) |
◆ CLocale() [4/5]
CLocale::CLocale |
( |
const std::string & | language, |
|
|
const std::string & | territory, |
|
|
const std::string & | codeset ) |
◆ CLocale() [5/5]
CLocale::CLocale |
( |
const std::string & | language, |
|
|
const std::string & | territory, |
|
|
const std::string & | codeset, |
|
|
const std::string & | modifier ) |
◆ ~CLocale()
◆ Equals()
bool CLocale::Equals |
( |
const std::string & | locale | ) |
const |
Checks if the given string representation of a locale exactly matches the locale.
- Parameters
-
locale | String representation of a locale |
- Returns
- True if the string representation matches the locale, false otherwise.
◆ FindBestMatch() [1/2]
std::string CLocale::FindBestMatch |
( |
const std::set< std::string > & | locales | ) |
const |
Tries to find the locale in the given list that matches this locale best.
- Parameters
-
locales | List of string representations of locales |
- Returns
- Best matching locale from the given list or empty string.
◆ FindBestMatch() [2/2]
std::string CLocale::FindBestMatch |
( |
const std::unordered_map< std::string, std::string > & | locales | ) |
const |
Tries to find the locale in the given list that matches this locale best.
- Parameters
-
locales | Map list of string representations of locales with first as locale identifier |
- Returns
- Best matching locale from the given list or empty string.
◆ FromString()
CLocale CLocale::FromString |
( |
const std::string & | locale | ) |
|
|
static |
Parses the given string representation and turns it into a locale.
- Parameters
-
locale | String representation of a locale |
◆ GetCodeset()
const std::string & CLocale::GetCodeset |
( |
| ) |
const |
|
inline |
Returns the codeset of the locale.
◆ GetLanguageCode()
const std::string & CLocale::GetLanguageCode |
( |
| ) |
const |
|
inline |
Returns the (lower-case) ISO 639-1 language code of the locale.
◆ GetModifier()
const std::string & CLocale::GetModifier |
( |
| ) |
const |
|
inline |
Returns the modifier of the locale.
◆ GetTerritoryCode()
const std::string & CLocale::GetTerritoryCode |
( |
| ) |
const |
|
inline |
Returns the (upper-case) ISO 3166-1 Alpha-2 territory code of the locale.
◆ IsValid()
bool CLocale::IsValid |
( |
| ) |
const |
|
inline |
Whether the locale is valid or not.
A locale is considered valid if at least the language code is set.
◆ Matches()
bool CLocale::Matches |
( |
const std::string & | locale | ) |
const |
Checks if the given string representation of a locale partly matches the locale.
Partial matching means that every available locale part needs to match the same locale part of the other locale if present.
- Parameters
-
locale | String representation of a locale |
- Returns
- True if the string representation matches the locale, false otherwise.
◆ operator!=()
bool CLocale::operator!= |
( |
const CLocale & | other | ) |
const |
|
inline |
◆ operator==()
bool CLocale::operator== |
( |
const CLocale & | other | ) |
const |
◆ ToShortString()
std::string CLocale::ToShortString |
( |
| ) |
const |
Returns the short string representation of the locale.
The format of the short string representation is [language[_territory]
where the language is represented as a (lower-case) two character ISO 639-1 code and the territory is represented as a (upper-case) two character ISO 3166-1 Alpha-2 code.
◆ ToShortStringLC()
std::string CLocale::ToShortStringLC |
( |
| ) |
const |
Returns the short string representation of the locale in lowercase.
The format of the short string representation is [language[_territory]
where the language is represented as a two character ISO 639-1 code and the territory is represented as a two character ISO 3166-1 Alpha-2 code.
◆ ToString()
std::string CLocale::ToString |
( |
| ) |
const |
Returns the full string representation of the locale.
The format of the string representation is [language[_territory][.codeset][@modifier]]
where the language is represented as a (lower-case) two character ISO 639-1 code and the territory is represented as a (upper-case) two character ISO 3166-1 Alpha-2 code.
◆ ToStringLC()
std::string CLocale::ToStringLC |
( |
| ) |
const |
Returns the full string representation of the locale in lowercase.
The format of the string representation is language[_territory][.codeset][@modifier]]
where the language is represented as a two character ISO 639-1 code and the territory is represented as a two character ISO 3166-1 Alpha-2 code.
◆ Empty
Empty (and invalid) CLocale instance.
The documentation for this class was generated from the following files: