Thea
|
A set of options, specified as key-value pairs. More...
#include <Options.hpp>
Public Member Functions | |
template<typename T > | |
T | get (char const *option_name, T const &default_value) const |
Get the value of an option. More... | |
template<> | |
char const * | get (char const *option_name, char const *const &default_value) const |
Specialization of get() for C-style strings. More... | |
float64 | getFloat (char const *option_name, float64 default_value) const |
Get the value of a floating-point option. More... | |
int64 | getInteger (char const *option_name, int64 default_value) const |
Get the value of an integer option. More... | |
char const * | getString (char const *option_name, char const *default_value) const |
Get the value of a string option. More... | |
int8 | hasOption (char const *option_name) const |
Check if an option has been set. More... | |
template<typename T > | |
void | set (char const *option_name, T const &value) |
Set the value of an option. More... | |
void | set (char const *option_name, char const *value) |
Set the value of an option from a C-style string. More... | |
void | setFloat (char const *option_name, float64 value) |
Set the value of a floating-point option. More... | |
void | setInteger (char const *option_name, int64 value) |
Set the value of an integer option. More... | |
void | setString (char const *option_name, char const *value) |
Set the value of a string option. More... | |
~Options () | |
Destructor. More... | |
Private Attributes | |
T | elements |
STL member. More... | |
K | keys |
STL member. More... | |
A set of options, specified as key-value pairs.
Supports a much more general set of value types than the simpler abstract interface it implements.
Definition at line 67 of file Options.hpp.
~Options | ( | ) |
Destructor.
Definition at line 71 of file Options.hpp.
T get | ( | char const * | option_name, |
T const & | default_value | ||
) | const |
Get the value of an option.
If the option has not been set, the default value specified by the last parameter is returned.
Definition at line 99 of file Options.hpp.
char const* get | ( | char const * | option_name, |
char const *const & | default_value | ||
) | const |
Specialization of get() for C-style strings.
In this particular case, a pointer to the C array underlying the held std::string
is returned (which may be invalidated by further operations on this Options object). If the option has not been set, the default value specified by the last parameter is returned.
Definition at line 117 of file Options.hpp.
|
virtual |
Get the value of a floating-point option.
If the option has not been set, the default value specified by the last parameter is returned.
Implements IOptions.
Definition at line 84 of file Options.hpp.
|
virtual |
Get the value of an integer option.
If the option has not been set, the default value specified by the last parameter is returned.
Implements IOptions.
Definition at line 81 of file Options.hpp.
|
virtual |
Get the value of a string option.
If the option has not been set, the default value specified by the last parameter is returned.
Implements IOptions.
Definition at line 131 of file Options.hpp.
|
virtual |
void set | ( | char const * | option_name, |
T const & | value | ||
) |
Set the value of an option.
Definition at line 90 of file Options.hpp.
void set | ( | char const * | option_name, |
char const * | value | ||
) |
Set the value of an option from a C-style string.
It is stored and can be read back as a std::string
.
Definition at line 93 of file Options.hpp.
|
virtual |
Set the value of a floating-point option.
Implements IOptions.
Definition at line 76 of file Options.hpp.
|
virtual |
|
virtual |