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

An option received the wrong number of values. More...

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

Public Member Functions

 argument_mismatch_t (std::string msg)
 Constructs the error with the default exit code.
 argument_mismatch_t (const std::string &name, int expected, std::size_t received)
 An option received a count other than the one it expects.
Public Member Functions inherited from cli::detail::error_mixin_t< argument_mismatch_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 at_least (const std::string &name, int num, std::size_t received) -> argument_mismatch_t
 Fewer values arrived than the minimum.
static auto at_most (const std::string &name, int num, std::size_t received) -> argument_mismatch_t
 More values arrived than the maximum.
static auto typed_at_least (const std::string &name, int num, const std::string &type) -> argument_mismatch_t
 Too few values arrived to fill one element of a typed option.
static auto flag_override (const std::string &name) -> argument_mismatch_t
 A flag override was supplied where none is allowed.
static auto partial_type (const std::string &name, int num, const std::string &type) -> argument_mismatch_t
 A compound element was only partially supplied.

Static Public Attributes

static constexpr std::string_view error_type_name = "argument_mismatch"
 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< argument_mismatch_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

An option received the wrong number of values.

Constructor & Destructor Documentation

◆ argument_mismatch_t() [1/2]

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

Constructs the error with the default exit code.

Parameters
msgHuman-readable description.

◆ argument_mismatch_t() [2/2]

cli::argument_mismatch_t::argument_mismatch_t ( const std::string & name,
int expected,
std::size_t received )
inline

An option received a count other than the one it expects.

Parameters
nameThe offending option.
expectedExpected count; negative means "at least this many".
receivedHow many values arrived.

Member Function Documentation

◆ at_least()

auto cli::argument_mismatch_t::at_least ( const std::string & name,
int num,
std::size_t received ) -> argument_mismatch_t
inlinestaticnodiscard

Fewer values arrived than the minimum.

Parameters
nameThe offending option.
numThe minimum required.
receivedHow many values arrived.
Returns
The constructed error.

◆ at_most()

auto cli::argument_mismatch_t::at_most ( const std::string & name,
int num,
std::size_t received ) -> argument_mismatch_t
inlinestaticnodiscard

More values arrived than the maximum.

Parameters
nameThe offending option.
numThe maximum permitted.
receivedHow many values arrived.
Returns
The constructed error.

◆ flag_override()

auto cli::argument_mismatch_t::flag_override ( const std::string & name) -> argument_mismatch_t
inlinestaticnodiscard

A flag override was supplied where none is allowed.

Parameters
nameThe offending flag.
Returns
The constructed error.

◆ partial_type()

auto cli::argument_mismatch_t::partial_type ( const std::string & name,
int num,
const std::string & type ) -> argument_mismatch_t
inlinestaticnodiscard

A compound element was only partially supplied.

Parameters
nameThe offending option.
numValues required per element.
typeName of the element type.
Returns
The constructed error.

◆ typed_at_least()

auto cli::argument_mismatch_t::typed_at_least ( const std::string & name,
int num,
const std::string & type ) -> argument_mismatch_t
inlinestaticnodiscard

Too few values arrived to fill one element of a typed option.

Parameters
nameThe offending option.
numThe number required.
typeName of the element type.
Returns
The constructed error.

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