#include <options.h>
Inherits _optionbase.
Inheritance diagram for _option< T >:
Public Member Functions | |
_option (std::string init_name, T &variable) | |
Standard constructor: creates a new _option with name init_name , linked to variable . | |
_option (const _option &other) | |
Copy constructor: creates a new option with the same name and variable reference as other . | |
void | SetValue (std::string value) |
Sets the value of the linked variable to whatever value parses out to be. | |
std::string & | GetValue (std::string &value) |
Fills value with a string describing the value of the linked variable, and returns a reference. | |
std::string | TypeName () |
Returns a string describing the C/C++ type of this variable. | |
Public Attributes | |
T * | ptr |
Pointer to the variable that this option affects. | |
std::string | name |
The name of this parameter. |
An _option<T> links a variable of type T with a command line option that's identified by a name (string). The variable name (known only to the programmer and to the C++ compiler) and the option name (known only to the programmer and to the user) may coincide, but need not. Objects of type _option<T> are not usually created directly by the programmer, but rather by the Options::Add() method.
_option<T> inherits an interface from _optionbase, and provides storage for a pointer to its variable. The SetValue() and GetValue() members affect the variable that the _option<T> object refers to.