HikoGUI
A low latency retained GUI
|
#include <hikogui/i18n/language_tag_intf.hpp>
Public Member Functions | |
constexpr | language_tag (language_tag const &) noexcept=default |
constexpr | language_tag (language_tag &&) noexcept=default |
constexpr language_tag & | operator= (language_tag const &) noexcept=default |
constexpr language_tag & | operator= (language_tag &&) noexcept=default |
constexpr | language_tag (iso_639 const &language, iso_15924 const &script={}, iso_3166 const ®ion={}) noexcept |
constexpr | language_tag (iso_639 const &language, iso_3166 const ®ion) noexcept |
language_tag (std::string_view str) | |
Parse a language tag. | |
bool | empty () const noexcept |
Check if the language tag is empty. | |
operator bool () const noexcept | |
Check if the language tag is used. | |
generator< language_tag > | variants () const noexcept |
Get variants of the language_tag. | |
generator< language_tag > | canonical_variants () const noexcept |
Get variants of the language_tag. | |
std::vector< language_tag > | all_variants () const noexcept |
Creates variants of a language tag, including those by expanding the normal variants. | |
language_tag | expand () const noexcept |
Expand the language tag to include script and language. | |
language_tag | shrink () const noexcept |
Get a tag with only the language. | |
iso_15924 | default_script () const noexcept |
Get the default-script for this language. | |
bool | left_to_right () const noexcept |
The language direction for this language-tag. | |
Static Public Member Functions | |
static language_tag | parse (std::string_view str) |
Parse the language, script and region raw from the string. | |
Data Fields | |
iso_639 | language |
iso_15924 | script |
iso_3166 | region |
uint16_t | _reserved = 0 |
Friends | |
constexpr friend std::string | to_string (language_tag const &rhs) noexcept |
constexpr friend bool | matches (language_tag const &lhs, language_tag const &rhs) noexcept |
Check if two language_tags match for their non-empty fields. | |
constexpr friend bool | operator== (language_tag const &, language_tag const &) noexcept=default |
The IETF BCP 47 language tag.
This class stores the language tag in 64 bits; in its individual components of the: ISO-639 language (16 bit), ISO-15924 script (16 bit) and ISO-3166 region (16 bit). In the future another 16 bits can be used to store the variants and extensions.
|
inline |
Parse a language tag.
This will construct a language tag with the language, script and region set as complete as possible. It does this by expanding the language tags using default script, region and grandfathering tables.
This function will ignore upper/lower case of the sub-tags, and allow for both underscores '_' and dashes '-' to separate the sub-tags.
str | The language tag to parse |
parse_error |
|
inlinenoexcept |
Creates variants of a language tag, including those by expanding the normal variants.
|
inlinenoexcept |
Get variants of the language_tag.
This function will create language_tags that may include this tag and tags with strictly less information (no script, no region), which still canonically expands into this tag.
|
inlinenoexcept |
Get the default-script for this language.
This will expand the language-tag if necessary to get the script.
|
inlinenoexcept |
Check if the language tag is empty.
|
inlinenoexcept |
Expand the language tag to include script and language.
Expansion is done by querying default script, default language and grandfathering tables.
|
inlinenoexcept |
The language direction for this language-tag.
|
inlineexplicitnoexcept |
Check if the language tag is used.
|
inlinestatic |
Parse the language, script and region raw from the string.
No automatic expansion of the script or region will be done.
|
inlinenoexcept |
Get a tag with only the language.
|
inlinenoexcept |
Get variants of the language_tag.
This function will create language_tags that includes this tag and tags with strictly less information (no script, no region).
|
friend |
Check if two language_tags match for their non-empty fields.