ChainCLI
A modern C++20 command-line interface library
Loading...
Searching...
No Matches
cli::parsing::TypeParseException Class Reference

Exception thrown when the input string cannot be parsed to the needed type for an argument. More...

#include <parse_exception.h>

Inheritance diagram for cli::parsing::TypeParseException:

Public Member Functions

 TypeParseException (const std::string &message, const std::string &input, const std::type_info &targetType)
 Construct a TypeParseException with a message, input string, and target type.
 
 TypeParseException (const std::string &input, const std::type_info &targetType)
 Construct a TypeParseException with default message, input string, and target type.
 
const std::string & getInput () const noexcept
 Gets the input string that failed to parse.
 
const std::type_info & getTargetType () const noexcept
 Gets the target type that the input couldn't be parsed to.
 

Detailed Description

Exception thrown when the input string cannot be parsed to the needed type for an argument.

Constructor & Destructor Documentation

◆ TypeParseException() [1/2]

cli::parsing::TypeParseException::TypeParseException ( const std::string &  message,
const std::string &  input,
const std::type_info &  targetType 
)
inline

Construct a TypeParseException with a message, input string, and target type.

Parameters
messageThe error message
inputThe input string that couldn't be parsed
targetTypeThe type it couldn't be parsed to

◆ TypeParseException() [2/2]

cli::parsing::TypeParseException::TypeParseException ( const std::string &  input,
const std::type_info &  targetType 
)
inline

Construct a TypeParseException with default message, input string, and target type.

Parameters
inputThe input string that couldn't be parsed
targetTypeThe type it couldn't be parsed to

Member Function Documentation

◆ getInput()

const std::string & cli::parsing::TypeParseException::getInput ( ) const
inlinenoexcept

Gets the input string that failed to parse.

Returns
the input string

◆ getTargetType()

const std::type_info & cli::parsing::TypeParseException::getTargetType ( ) const
inlinenoexcept

Gets the target type that the input couldn't be parsed to.

Returns
reference to the target type info

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