Offline Transaction Signing (OTS) 0.1.0
|
Manages seed phrase languages and their properties. More...
#include <ots.hpp>
Public Member Functions | |
const std::string & | name () const |
Retrieves the native name of the seed language. | |
const std::string & | englishName () const |
Retrieves the English name of the seed language. | |
const std::string & | code () const |
Retrieves the two-letter language code, which could be extended by a dash with a variation. | |
bool | supported (SeedType type=SeedType::Monero) const |
Checks if the language is supported for a specific seed type. | |
bool | isDefault (SeedType type=SeedType::Monero) const |
Checks if this is the default language for a given seed type. | |
int | index (SeedType type=SeedType::Monero) const noexcept |
The native language index. | |
bool | operator== (const SeedLanguage &other) const |
Compares two SeedLanguage objects for equality. | |
bool | operator== (SeedLanguage &other) const |
Compares two SeedLanguage objects for equality. | |
bool | operator== (const std::string &code) const |
Compares SeedLanguage to a language code. | |
operator const std::string & () const | |
returns the english name as string | |
Static Public Member Functions | |
static const SeedLanguage & | fromName (const std::string &name) |
Retrieves a SeedLanguage by its native name. | |
static const SeedLanguage & | fromEnglishName (const std::string &name) |
Retrieves a SeedLanguage by its English name. | |
static const SeedLanguage & | fromCode (const std::string &code) |
Retrieves a SeedLanguage by its language code. | |
static const std::vector< std::reference_wrapper< const SeedLanguage > > | list () |
Retrieves the complete list of available seed languages. | |
static const std::vector< std::reference_wrapper< const SeedLanguage > > | listFor (SeedType type) |
Retrieves languages supported for a specific seed type. | |
static const SeedLanguage & | defaultLanguage (SeedType type=SeedType::Monero) |
Gets the default language for a given seed type. | |
static void | setDefaultLanguage (SeedType type, const SeedLanguage &language) |
Sets the default language for a given seed type. | |
Manages seed phrase languages and their properties.
Provides methods to retrieve, validate, and manage seed phrase languages
const std::string & ots::SeedLanguage::code | ( | ) | const |
Retrieves the two-letter language code, which could be extended by a dash with a variation.
|
static |
Gets the default language for a given seed type.
type | SeedType to find default language (default: Monero), alternative Polyseed |
const std::string & ots::SeedLanguage::englishName | ( | ) | const |
Retrieves the English name of the seed language.
|
static |
Retrieves a SeedLanguage by its language code.
code | Language code |
std::runtime_error | If language not found |
|
static |
Retrieves a SeedLanguage by its English name.
name | English language name |
std::runtime_error | if language not found |
|
static |
Retrieves a SeedLanguage by its native name.
name | Native language name |
std::runtime_error | If language not found |
|
noexcept |
The native language index.
type | SeedType to check support for (default: Monero), alternative Polyseed |
bool ots::SeedLanguage::isDefault | ( | SeedType | type = SeedType::Monero | ) | const |
Checks if this is the default language for a given seed type.
type | SeedType to check (default: Monero), alternative Polyseed |
|
static |
Retrieves the complete list of available seed languages.
Map of language names to language codes serves also as a list of supported languages, and harmonize spelling differences
|
static |
Retrieves languages supported for a specific seed type.
type | SeedType to filter languages: (default: Monero), alternative Polyseed |
const std::string & ots::SeedLanguage::name | ( | ) | const |
Retrieves the native name of the seed language.
ots::SeedLanguage::operator const std::string & | ( | ) | const |
returns the english name as string
bool ots::SeedLanguage::operator== | ( | const SeedLanguage & | other | ) | const |
Compares two SeedLanguage objects for equality.
other | SeedLanguage to compare against |
bool ots::SeedLanguage::operator== | ( | const std::string & | code | ) | const |
Compares SeedLanguage to a language code.
code | language code to compare against |
bool ots::SeedLanguage::operator== | ( | SeedLanguage & | other | ) | const |
Compares two SeedLanguage objects for equality.
other | SeedLanguage to compare against |
|
static |
Sets the default language for a given seed type.
type | SeedType to set default language for |
language | SeedLanguage to set as default |
ots::exception::language::LanguageNotFound | If the language is not supported |
bool ots::SeedLanguage::supported | ( | SeedType | type = SeedType::Monero | ) | const |
Checks if the language is supported for a specific seed type.
type | SeedType to check support for (default: Monero), alternative Polyseed |