1 #ifndef OOKII_LOCALIZED_STRING_PROVIDER_H_
4 #define OOKII_LOCALIZED_STRING_PROVIDER_H_
28 template<
typename CharType,
typename Traits = std::
char_traits<CharType>,
typename Alloc = std::allocator<CharType>>
33 using string_type = std::basic_string<CharType, Traits, Alloc>;
41 return default_string_provider;
48 return OOKII_FMT_NS format(defaults::invalid_value_format.data(), argument_name);
55 return OOKII_FMT_NS format(defaults::unknown_argument_format.data(), argument_name);
62 return OOKII_FMT_NS format(defaults::missing_value_format.data(), argument_name);
69 return OOKII_FMT_NS format(defaults::duplicate_argument_format.data(), argument_name);
75 return defaults::too_many_arguments.data();
82 return OOKII_FMT_NS format(defaults::missing_required_argument_format.data(), argument_name);
89 return OOKII_FMT_NS format(defaults::combined_short_name_non_switch.data(), argument_name);
95 return defaults::unknown.data();
102 return defaults::automatic_help_name.data();
116 return defaults::automatic_help_short_name;
123 return defaults::automatic_help_description.data();
130 return defaults::automatic_version_name.data();
137 return defaults::automatic_version_command_name.data();
144 return defaults::automatic_version_description.data();
150 static constexpr
auto invalid_value_format = literal_cast<CharType>(
"The value provided for the argument '{}' was invalid.");
151 static constexpr
auto unknown_argument_format = literal_cast<CharType>(
"Unknown argument name '{}'.");
152 static constexpr
auto missing_value_format = literal_cast<CharType>(
"No value was supplied for the argument '{}'.");
153 static constexpr
auto duplicate_argument_format = literal_cast<CharType>(
"The argument '{}' was supplied more than once.");
154 static constexpr
auto too_many_arguments = literal_cast<CharType>(
"Too many arguments were supplied.");
155 static constexpr
auto missing_required_argument_format = literal_cast<CharType>(
"The required argument '{}' was not supplied.");
156 static constexpr
auto combined_short_name_non_switch = literal_cast<CharType>(
"The combined short argument '{}' contains an argument that is not a switch.");
157 static constexpr
auto unknown = literal_cast<CharType>(
"An unknown error has occurred.");
Provides custom localized strings.
Definition: localized_string_provider.h:30
virtual string_type duplicate_argument(string_view_type argument_name) const
Gets the error message for parse_error::duplicate_argument.
Definition: localized_string_provider.h:67
virtual string_type combined_short_name_non_switch(string_view_type argument_name) const
Gets the error message for parse_error::combined_short_name_non_switch.
Definition: localized_string_provider.h:87
virtual string_type automatic_help_description() const
Gets the description of the help argument created if basic_parser_builder::automatic_help_argument() ...
Definition: localized_string_provider.h:121
virtual string_type too_many_arguments() const
Gets the error message for parse_error::too_many_arguments.
Definition: localized_string_provider.h:73
virtual string_type unknown_error() const
Gets the error message for parse_error::unknown.
Definition: localized_string_provider.h:93
virtual string_type automatic_version_name() const
Gets the name of the version argument created by basic_parser_builder::add_version_argument().
Definition: localized_string_provider.h:128
std::basic_string< CharType, Traits, Alloc > string_type
The concrete string type used.
Definition: localized_string_provider.h:33
static basic_localized_string_provider & get_default() noexcept
Gets a default instance of the basic_localized_string_provider.
Definition: localized_string_provider.h:38
virtual CharType automatic_help_short_name() const
Gets the short name of the help argument created if basic_parser_builder::automatic_help_argument() w...
Definition: localized_string_provider.h:114
virtual string_type automatic_help_name() const
Gets the name of the help argument created if basic_parser_builder::automatic_help_argument() was not...
Definition: localized_string_provider.h:100
virtual string_type automatic_version_command_name() const
Gets the name of the version command created by basic_command_manager::add_version_command().
Definition: localized_string_provider.h:135
virtual string_type invalid_value(string_view_type argument_name) const
Gets the error message for parse_error::invalid_value.
Definition: localized_string_provider.h:46
virtual string_type unknown_argument(string_view_type argument_name) const
Gets the error message for parse_error::unknown_argument.
Definition: localized_string_provider.h:53
std::basic_string_view< CharType, Traits > string_view_type
The concrete string_view type used.
Definition: localized_string_provider.h:35
virtual string_type missing_value(string_view_type argument_name) const
Gets the error message for parse_error::missing_value.
Definition: localized_string_provider.h:60
virtual string_type automatic_version_description() const
Gets the description of the version argument created by basic_parser_builder::add_version_argument().
Definition: localized_string_provider.h:142
virtual string_type missing_required_argument(string_view_type argument_name) const
Gets the error message for parse_error::missing_required_argument.
Definition: localized_string_provider.h:80
Namespace containing the core Ookii.CommandLine.Cpp types.
Definition: command_line_argument.h:16