21 #ifndef G_OPTION_VALUE_H
22 #define G_OPTION_VALUE_H
66 std::string
value()
const ;
72 unsigned int number(
unsigned int default_ = 0U )
const ;
84 m_value(G::
Str::positive())
A simple structure encapsulating the value of a command-line option.
static std::string positive()
Returns a default positive string. See isPositive().
static bool isPositive(const std::string &)
Returns true if the string has a positive meaning, such as "1", "true", "yes".
bool numeric() const
Returns true if value() is an unsigned integer.
bool is_on() const
Returns true if an unvalued enabled option.
static OptionValue on()
A factory function for an unvalued option-enabled option.
static OptionValue off()
A factory function for an unvalued option-disabled option.
static unsigned int toUInt(const std::string &s)
Converts string 's' to an unsigned int.
OptionValue()
Default constructor for a valueless value.
bool valued() const
Returns true if constructed with the string overload, or false if constructed by on() or off() or the...
static bool isNegative(const std::string &)
Returns true if the string has a negative meaning, such as "0", "false", "no".
std::string value() const
Returns the value as a string.
bool is_off() const
Returns true if an unvalued disabled option.
unsigned int number(unsigned int default_=0U) const
Returns value() as an unsigned integer.
A static class which provides string helper functions.
static std::string negative()
Returns a default negative string. See isNegative().
static bool isUInt(const std::string &s)
Returns true if the string can be converted into an unsigned integer without throwing an exception...