arg_router
1.4.0
C++ command line argument parsing and routing
|
Classes | |
class | root_t |
class | root_wrapper_t |
class | translation |
Typedefs | |
template<std::size_t I, typename... S> | |
using | string_selector = std::tuple_element_t< I, std::tuple< S... > > |
Functions | |
string | iso_locale (std::string_view locale_name) |
template<typename DefaultLanguageID , typename... SupportedLanguageIDs, typename RootFactory > | |
auto | root (std::string_view language_id, const RootFactory &f) |
template<typename... SupportedISOLanguageCodes, typename Fn > | |
auto | root_wrapper (std::string_view iso_language, Fn &&f) |
Namespace for types and functions relating to runtime multi-language support.
using arg_router::multi_lang::string_selector = typedef std::tuple_element_t<I, std::tuple<S...> > |
A compile time string container that acts a drop-in replacement for compile_time_string by compile-time selection of an element.
I | String index to use |
S | Strings to contain |
Definition at line 25 of file string_selector.hpp.
|
inline |
Converts a locale name (i.e. a string returned by std::locale
) into a standardised language code format.
The most common locale formats are:
This function will strip off the encoding if present, and change the dividing character to an underscore. For example:
An empty string in yields an empty string out.
Typically locale_name is under the SSO string size, so allocation doesn't occur.
locale_name | Local name to standardise |
Definition at line 35 of file iso_locale.hpp.
auto arg_router::multi_lang::root | ( | std::string_view | language_id, |
const RootFactory & | f | ||
) |
Convenience function that returns a root_t.
Allows the user to define the supported languages IDs in the template parameters but has Fn deduced from the input.
DefaultLanguageID | The default language ID as a compile time string, this is used if the runtime input code does not match this or any of SupportedLanguageIDs |
SupportedLanguageIDs | The supported language IDs as compile time strings |
RootFactory | Function object type that accepts a multi_lang::translation specialisation and returns a root instance |
language_id | The runtime language selection, if it doesn't match any of the SupportedLanguageIDs, then DefaultLanguageID is used |
f | Function object that returns the root instance for a given supported language |
auto arg_router::multi_lang::root_wrapper | ( | std::string_view | iso_language, |
Fn && | f | ||
) |
Convenience function that returns a root_wrapper_t.
Allows the user to define the supported ISO languages in the template parameters but has Fn deduced from the input.
iso_language | The runtime language selection, if it doesn't match any of SupportedISOLanguageCodes, then the first language in SupportedISOLanguageCodes is used |
f | Function object that returns the root instance for a given supported language index |
Definition at line 153 of file root_wrapper.hpp.