21#ifndef G_OPTION_VALUE_H
22#define G_OPTION_VALUE_H
60 std::string
value()
const ;
66 unsigned int number(
unsigned int default_ = 0U )
const ;
70 size_t count()
const ;
77 bool m_on_off{
false} ;
78 std::size_t m_count{1U} ;
85 m_value(
G::
Str::positive())
A simple structure encapsulating the value of a command-line option.
size_t count() const
Returns an instance count that is one by default.
OptionValue()
Default constructor for a valueless value.
bool numeric() const
Returns true if value() is an unsigned integer.
static OptionValue on()
A factory function for an unvalued option-enabled option.
static OptionValue off()
A factory function for an unvalued option-disabled option.
void increment()
Increments the instance count().
std::string value() const
Returns the value as a string.
bool isOff() const
Returns true if off().
unsigned int number(unsigned int default_=0U) const
Returns value() as an unsigned integer.
bool isOn() const
Returns true if on().
A static class which provides string helper functions.
static bool isNegative(const std::string &)
Returns true if the string has a negative meaning, such as "0", "false", "no".
static bool isPositive(const std::string &)
Returns true if the string has a positive meaning, such as "1", "true", "yes".
static std::string negative()
Returns a default negative string. See isNegative().
static unsigned int toUInt(const std::string &s)
Converts string 's' to an unsigned int.
static bool isUInt(const std::string &s)
Returns true if the string can be converted into an unsigned integer without throwing an exception.