sdr::Options Class Reference

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...

## Detailed Description

Convenience functions for command line arguments.

## Member Enumeration Documentation

enum sdr::Options::ArgType

Possible argument types.

Enumerator
FLAG | No argument (flag).
INTEGER | Integer argument.
FLOAT | Floating point argument.
ANY | Any argument (string).

## Constructor & Destructor Documentation

Options::Options | ( |  | ) |

Empty constructor.

## Member Function Documentation

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).

bool Options::parse | ( | const Definition | defs[],
|  | int | argc,
|  | char * | argv[],
|  | Options & | options
| ) |  |

static

Parse the given arguments (`argc`, `argv`) using the definitions `defs` and stores the results into `options`.

Returns `false` on error.

void Options::print_help | ( | std::ostream & | stream,
|  | const Definition | defs[]
| ) |  |

static

Serializes a help text derived from given the definitions into `stream`.

## Member Data Documentation

std::map<std::string, Value> sdr::Options::_options

protected

The table of option names and argument values.

The documentation for this class was generated from the following files:

- /Users/hannes/Uni/Elektronik/sdr/libsdr/src/options.hh
- /Users/hannes/Uni/Elektronik/sdr/libsdr/src/options.cc