1 #ifndef __SDR_OPTIONS_HH__
2 #define __SDR_OPTIONS_HH__
32 Value(
const std::string &value);
91 bool has(
const char *name);
93 const Value &
get(
const char *name);
102 #endif // __SDR_OPTIONS_HH__
std::map< std::string, Value > _options
The table of option names and argument values.
Definition: options.hh:97
bool isInteger() const
Returns true if the value is an integer.
Definition: options.cc:181
Value()
Empty constructor.
Definition: options.cc:130
~Value()
Destructor.
Definition: options.cc:154
Definition: autocast.hh:8
Argument definition.
Definition: options.hh:74
union sdr::Options::Value::@0 _value
Values.
bool isNone() const
Returns true if the value is empty.
Definition: options.cc:176
bool has(const char *name)
Returns true if the specified option was found (long name).
Definition: options.cc:22
static void print_help(std::ostream &stream, const Definition defs[])
Serializes a help text derived from given the definitions into stream.
Definition: options.cc:99
Empty or invalid value.
Definition: options.hh:18
long toInteger() const
Turns the value into an integer.
Definition: options.cc:196
A floating point number (double).
Definition: options.hh:20
bool isFloat() const
Returns true if the value is a floating point number.
Definition: options.cc:186
Any argument (string).
Definition: options.hh:70
std::string toString() const
Turns the value into a string.
Definition: options.cc:206
double toFloat() const
Turns the value into a floating point number.
Definition: options.cc:201
ArgType
Possible argument types.
Definition: options.hh:66
Floating point argument.
Definition: options.hh:69
An integer (long int).
Definition: options.hh:19
const Value & operator=(const Value &other)
Assignment.
Definition: options.cc:165
No argument (flag).
Definition: options.hh:67
char short_name
Argument name (short).
Definition: options.hh:76
Integer argument.
Definition: options.hh:68
An ASCII string.
Definition: options.hh:21
const char * name
Argument name (long).
Definition: options.hh:75
static bool parse(const Definition defs[], int argc, char *argv[], Options &options)
Parse the given arguments (argc, argv) using the definitions defs and stores the results into options...
Definition: options.cc:32
const char * help
Help string.
Definition: options.hh:78
The argument value.
Definition: options.hh:14
Convenience functions for command line arguments.
Definition: options.hh:10
Options()
Empty constructor.
Definition: options.cc:15
bool isString() const
Returns true if the value is a string.
Definition: options.cc:191
ArgType type
Argument type.
Definition: options.hh:77
Type
Value type.
Definition: options.hh:17
Type _type
The type of the value.
Definition: options.hh:56