argagg
|
Represents a single option parse result. More...
#include <argagg.hpp>
Public Member Functions | |
template<typename T > | |
T | as () const |
Converts the argument parsed for this single option instance into the given type using the type matched conversion function argagg::convert::arg(). If there was not an argument parsed for this single option instance then a argagg::option_lacks_argument_error exception is thrown. The specific conversion function may throw other exceptions. | |
template<typename T > | |
T | as (const T &t) const |
Converts the argument parsed for this single option instance into the given type using the type matched conversion function argagg::convert::arg(). If there was not an argument parsed for this single option instance then the provided default value is returned instead. If the conversion function throws an exception then it is ignored and the default value is returned. | |
template<typename T > | |
operator T () const | |
Since we have the argagg::option_result::as() API we might as well alias it as an implicit conversion operator. This performs implicit conversion using the argagg::option_result::as() method. | |
bool | operator! () const |
Explicitly define a unary not operator that wraps the implicit boolean conversion specialization in case the compiler can't do it automatically. | |
Public Attributes | |
const char * | arg |
Argument parsed for this single option. If no argument was parsed this will be set to nullptr. | |
Represents a single option parse result.
You can check if this has an argument by using the implicit boolean conversion.
Definition at line 264 of file argagg.hpp.
T argagg::option_result::as | ( | ) | const |
Converts the argument parsed for this single option instance into the given type using the type matched conversion function argagg::convert::arg(). If there was not an argument parsed for this single option instance then a argagg::option_lacks_argument_error exception is thrown. The specific conversion function may throw other exceptions.
Definition at line 736 of file argagg.hpp.
Converts the argument parsed for this single option instance into the given type using the type matched conversion function argagg::convert::arg(). If there was not an argument parsed for this single option instance then the provided default value is returned instead. If the conversion function throws an exception then it is ignored and the default value is returned.
Definition at line 747 of file argagg.hpp.
argagg::option_result::operator T | ( | ) | const |
Since we have the argagg::option_result::as() API we might as well alias it as an implicit conversion operator. This performs implicit conversion using the argagg::option_result::as() method.
Definition at line 767 of file argagg.hpp.
|
inline |
Explicitly define a unary not operator that wraps the implicit boolean conversion specialization in case the compiler can't do it automatically.
Definition at line 781 of file argagg.hpp.
const char* argagg::option_result::arg |
Argument parsed for this single option. If no argument was parsed this will be set to nullptr.
Definition at line 271 of file argagg.hpp.