Thea
Public Member Functions | Private Attributes | List of all members
Options Class Reference

A set of options, specified as key-value pairs. More...

#include <Options.hpp>

Inheritance diagram for Options:
IOptions

Public Member Functions

template<typename 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

elements
 STL member. More...
 
keys
 STL member. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

~Options ( )

Destructor.

Definition at line 71 of file Options.hpp.

Member Function Documentation

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.

float64 getFloat ( char const *  option_name,
float64  default_value 
) const
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.

int64 getInteger ( char const *  option_name,
int64  default_value 
) const
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.

char const * getString ( char const *  option_name,
char const *  default_value 
) const
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.

int8 hasOption ( char const *  option_name) const
virtual

Check if an option has been set.

Implements IOptions.

Definition at line 74 of file Options.hpp.

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.

void setFloat ( char const *  option_name,
float64  value 
)
virtual

Set the value of a floating-point option.

Implements IOptions.

Definition at line 76 of file Options.hpp.

void setInteger ( char const *  option_name,
int64  value 
)
virtual

Set the value of an integer option.

Implements IOptions.

Definition at line 75 of file Options.hpp.

void setString ( char const *  option_name,
char const *  value 
)
virtual

Set the value of a string option.

Implements IOptions.

Definition at line 78 of file Options.hpp.


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