E-MailRelay
|
A simple structure encapsulating the value of a command-line option. More...
#include <goptionvalue.h>
Public Member Functions | |
OptionValue () | |
Default constructor for a valueless value. More... | |
OptionValue (const std::string &s, std::size_t count=1U) | |
Constructor for a valued value. More... | |
bool | isOn () const |
Returns true if on(). More... | |
bool | isOff () const |
Returns true if off(). More... | |
std::string | value () const |
Returns the value as a string. More... | |
bool | numeric () const |
Returns true if value() is an unsigned integer. More... | |
unsigned int | number (unsigned int default_=0U) const |
Returns value() as an unsigned integer. More... | |
size_t | count () const |
Returns an instance count that is one by default. More... | |
void | increment () |
Increments the instance count(). More... | |
Static Public Member Functions | |
static OptionValue | on () |
A factory function for an unvalued option-enabled option. More... | |
static OptionValue | off () |
A factory function for an unvalued option-disabled option. More... | |
A simple structure encapsulating the value of a command-line option.
Unvalued options (eg. "--debug") can be be explicitly on (eg. "--debug=yes") or off ("--debug=no"); the latter are typically ignored.
Definition at line 38 of file goptionvalue.h.
|
inline |
Default constructor for a valueless value.
Definition at line 83 of file goptionvalue.h.
|
inlineexplicit |
Constructor for a valued value.
Precondition: !s.empty()
Definition at line 90 of file goptionvalue.h.
|
inline |
Returns an instance count that is one by default.
Definition at line 141 of file goptionvalue.h.
|
inline |
Increments the instance count().
Definition at line 147 of file goptionvalue.h.
|
inline |
Returns true if off().
Definition at line 117 of file goptionvalue.h.
|
inline |
Returns true if on().
Definition at line 111 of file goptionvalue.h.
|
inline |
Returns value() as an unsigned integer.
Returns the default if not numeric().
Definition at line 135 of file goptionvalue.h.
|
inline |
Returns true if value() is an unsigned integer.
Definition at line 129 of file goptionvalue.h.
|
inlinestatic |
A factory function for an unvalued option-disabled option.
Definition at line 103 of file goptionvalue.h.
|
inlinestatic |
A factory function for an unvalued option-enabled option.
Definition at line 97 of file goptionvalue.h.
|
inline |
Returns the value as a string.
Definition at line 123 of file goptionvalue.h.