libsdr
0.1.0
A simple SDR library
|
Convenience functions for command line arguments. More...
#include <options.hh>
Classes | |
struct | Definition |
Argument definition. More... | |
class | Value |
The argument value. More... | |
Public Types | |
enum | ArgType { FLAG, INTEGER, FLOAT, ANY } |
Possible argument types. More... | |
Public Member Functions | |
Options () | |
Empty constructor. More... | |
bool | has (const char *name) |
Returns true if the specified option was found (long name). More... | |
const Value & | get (const char *name) |
Returns the argument of the specified option (long name). More... | |
Static Public Member Functions | |
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 . More... | |
static void | print_help (std::ostream &stream, const Definition defs[]) |
Serializes a help text derived from given the definitions into stream . More... | |
Protected Attributes | |
std::map< std::string, Value > | _options |
The table of option names and argument values. More... | |
Convenience functions for command line arguments.
Options::Options | ( | ) |
Empty constructor.
const Options::Value & Options::get | ( | const char * | name | ) |
Returns the argument of the specified option (long name).
bool Options::has | ( | const char * | name | ) |
Returns true
if the specified option was found (long name).
|
static |
Parse the given arguments (argc
, argv
) using the definitions defs
and stores the results into options
.
Returns false
on error.
|
static |
Serializes a help text derived from given the definitions into stream
.
|
protected |
The table of option names and argument values.