cli11
Loading...
Searching...
No Matches
cli::conversion_error_t Class Referenceexport
module cli11

A value could not be converted to the option's target type. More...

Inheritance diagram for cli::conversion_error_t:
cli::detail::error_mixin_t< conversion_error_t, parse_error_t > cli::parse_error_t cli::detail::error_mixin_t< parse_error_t, error_t > cli::error_t

Public Member Functions

 conversion_error_t (std::string msg)
 Constructs the error with the default exit code.
 conversion_error_t (const std::string &member, const std::string &name)
 A value was rejected for a named option.
 conversion_error_t (const std::string &name, const std::vector< std::string > &results)
 A set of values could not be converted.
Public Member Functions inherited from cli::detail::error_mixin_t< conversion_error_t, parse_error_t >
 error_mixin_t (std::string msg, exit_codes_t exit_code)
 Constructs the error, naming it from derived_t.
 error_mixin_t (std::string msg, int exit_code)
 Constructs the error, naming it from derived_t.
Public Member Functions inherited from cli::detail::error_mixin_t< parse_error_t, error_t >
 error_mixin_t (std::string msg, exit_codes_t exit_code)
 Constructs the error, naming it from derived_t.
 error_mixin_t (std::string msg, int exit_code)
 Constructs the error, naming it from derived_t.
Public Member Functions inherited from cli::error_t
auto get_exit_code () const -> int
 Returns the process exit code associated with this error.
auto get_name () const -> std::string
 Returns the short name of this error type.
 error_t (std::string name, std::string msg, int exit_code=static_cast< int >(exit_codes_t::base_class))
 Constructs an error with an explicit numeric exit code.
 error_t (std::string name, std::string msg, exit_codes_t exit_code)
 Constructs an error with an exit code drawn from exit_codes_t.

Static Public Member Functions

static auto too_many_inputs_flag (const std::string &name) -> conversion_error_t
 A flag was given more than one value.
static auto true_false (const std::string &name) -> conversion_error_t
 A boolean value was neither true, false, nor numeric.

Static Public Attributes

static constexpr std::string_view error_type_name = "conversion_error"
 Short name reported by error_t::get_name.
Static Public Attributes inherited from cli::parse_error_t
static constexpr std::string_view error_type_name = "parse_error"
 Short name reported by error_t::get_name.

Additional Inherited Members

Protected Member Functions inherited from cli::detail::error_mixin_t< conversion_error_t, parse_error_t >
 error_mixin_t (std::string ename, std::string msg, int exit_code)
 Forwards an explicit type name, for further derivation.
 error_mixin_t (std::string ename, std::string msg, exit_codes_t exit_code)
 Forwards an explicit type name, for further derivation.
Protected Member Functions inherited from cli::detail::error_mixin_t< parse_error_t, error_t >
 error_mixin_t (std::string ename, std::string msg, int exit_code)
 Forwards an explicit type name, for further derivation.
 error_mixin_t (std::string ename, std::string msg, exit_codes_t exit_code)
 Forwards an explicit type name, for further derivation.

Detailed Description

A value could not be converted to the option's target type.

Constructor & Destructor Documentation

◆ conversion_error_t() [1/3]

cli::conversion_error_t::conversion_error_t ( std::string msg)
inlineexplicit

Constructs the error with the default exit code.

Parameters
msgHuman-readable description.

◆ conversion_error_t() [2/3]

cli::conversion_error_t::conversion_error_t ( const std::string & member,
const std::string & name )
inline

A value was rejected for a named option.

Parameters
memberThe offending value.
nameThe option that rejected it.

◆ conversion_error_t() [3/3]

cli::conversion_error_t::conversion_error_t ( const std::string & name,
const std::vector< std::string > & results )
inline

A set of values could not be converted.

Parameters
nameThe option being filled.
resultsThe values that could not be converted.

Member Function Documentation

◆ too_many_inputs_flag()

auto cli::conversion_error_t::too_many_inputs_flag ( const std::string & name) -> conversion_error_t
inlinestaticnodiscard

A flag was given more than one value.

Parameters
nameThe offending flag.
Returns
The constructed error.

◆ true_false()

auto cli::conversion_error_t::true_false ( const std::string & name) -> conversion_error_t
inlinestaticnodiscard

A boolean value was neither true, false, nor numeric.

Parameters
nameThe offending option.
Returns
The constructed error.

The documentation for this class was generated from the following file:
  • /home/mccakit/desktop/repositories/cli11/src/error.cpp