Ookii.CommandLine for C++  2.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
ookii::basic_localized_string_provider< CharType, Traits, Alloc > Class Template Reference

Provides custom localized strings. More...

#include <ookii/localized_string_provider.h>

Public Types

using string_type = std::basic_string< CharType, Traits, Alloc >
 The concrete string type used.
 
using string_view_type = std::basic_string_view< CharType, Traits >
 The concrete string_view type used.
 

Public Member Functions

virtual string_type automatic_help_description () const
 Gets the description of the help argument created if basic_parser_builder::automatic_help_argument() was not set to false.
 
virtual string_type automatic_help_name () const
 Gets the name of the help argument created if basic_parser_builder::automatic_help_argument() was not set to false.
 
virtual CharType automatic_help_short_name () const
 Gets the short name of the help argument created if basic_parser_builder::automatic_help_argument() was not set to false. More...
 
virtual string_type automatic_version_command_name () const
 Gets the name of the version command created by basic_command_manager::add_version_command().
 
virtual string_type automatic_version_description () const
 Gets the description of the version argument created by basic_parser_builder::add_version_argument().
 
virtual string_type automatic_version_name () const
 Gets the name of the version argument created by basic_parser_builder::add_version_argument().
 
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. More...
 
virtual string_type duplicate_argument (string_view_type argument_name) const
 Gets the error message for parse_error::duplicate_argument. More...
 
virtual string_type invalid_value (string_view_type argument_name) const
 Gets the error message for parse_error::invalid_value. More...
 
virtual string_type missing_required_argument (string_view_type argument_name) const
 Gets the error message for parse_error::missing_required_argument. More...
 
virtual string_type missing_value (string_view_type argument_name) const
 Gets the error message for parse_error::missing_value. More...
 
virtual string_type too_many_arguments () const
 Gets the error message for parse_error::too_many_arguments.
 
virtual string_type unknown_argument (string_view_type argument_name) const
 Gets the error message for parse_error::unknown_argument. More...
 
virtual string_type unknown_error () const
 Gets the error message for parse_error::unknown.
 

Static Public Member Functions

static basic_localized_string_providerget_default () noexcept
 Gets a default instance of the basic_localized_string_provider.
 

Detailed Description

template<typename CharType, typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
class ookii::basic_localized_string_provider< CharType, Traits, Alloc >

Provides custom localized strings.

You can derive from this class and override its members to provide customized or localized strings. A custom string provider can be provided to the command_line_builder::command_line_builder() constructor.

Two typedefs for common character types are provided:

Type Definition
ookii::localized_string_provider ookii::basic_localized_string_provider<char>
ookii::wlocalized_string_provider ookii::basic_localized_string_provider<wchar_t>
Template Parameters
CharTypeThe character type used for strings.
TraitsThe character traits to use for strings. Defaults to std::char_traits<CharType>.
AllocThe allocator to use for strings. Defaults to std::allocator<CharType>.

Member Function Documentation

◆ automatic_help_short_name()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual CharType ookii::basic_localized_string_provider< CharType, Traits, Alloc >::automatic_help_short_name ( ) const
inlinevirtual

Gets the short name of the help argument created if basic_parser_builder::automatic_help_argument() was not set to false.

In addition to the short name, the help argument will automatically have a short alias that is the lower case first character of the value returned by automatic_help_name(). If the short name and short alias are equal, then no alias is added.

If you are not using parsing_mode::long_short, the short name and short alias will be used as regular aliases instead.

◆ combined_short_name_non_switch()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::combined_short_name_non_switch ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::combined_short_name_non_switch.

Parameters
argument_nameThe name of the argument.

◆ duplicate_argument()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::duplicate_argument ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::duplicate_argument.

Parameters
argument_nameThe name of the argument.

◆ invalid_value()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::invalid_value ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::invalid_value.

Parameters
argument_nameThe name of the argument.

◆ missing_required_argument()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::missing_required_argument ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::missing_required_argument.

Parameters
argument_nameThe name of the argument.

◆ missing_value()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::missing_value ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::missing_value.

Parameters
argument_nameThe name of the argument.

◆ unknown_argument()

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
virtual string_type ookii::basic_localized_string_provider< CharType, Traits, Alloc >::unknown_argument ( string_view_type  argument_name) const
inlinevirtual

Gets the error message for parse_error::unknown_argument.

Parameters
argument_nameThe name of the argument.

The documentation for this class was generated from the following file: