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. More... | |
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. More... | |
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. More... | |
Public Attributes | |
const char * | arg |
Argument parsed for this single option. If no argument was parsed this will be set to nullptr. More... | |
Represents a single option parse result.
You can check if this has an argument by using the implicit boolean conversion.
Definition at line 178 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 653 of file argagg.hpp.
T argagg::option_result::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.
Definition at line 664 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 684 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 185 of file argagg.hpp.