#include <optionvar.h>
Collaboration diagram for OptionVar:

Public Member Functions | |
| OptionVar () | |
| Default constructor. | |
| OptionVar (const char *n, unsigned int &var) | |
Constructor: creates a new option called n and referring to an unsigned int. | |
| OptionVar (const char *n, int &var) | |
Constructor: creates a new option called n and referring to a signed int. | |
| OptionVar (const char *n, double &var) | |
Constructor: creates a new option called n and referring to a double. | |
| OptionVar (const char *n, char *var) | |
Constructor: creates a new option called n and referring to an C string. | |
| OptionVar (const char *n, bool &var) | |
Constructor: creates a new option called n and referring to an boolean. | |
| ~OptionVar () | |
| Destructor. | |
| OptionVar * | tail () |
| Returns a pointer to the last node in the list. | |
| OptionVar * | GetOptionPtr (const char *n) |
Searches the list for the first node named n and returns its address, or NULL if not found. | |
| OptionVar * | AddOption (const char *n, unsigned int &var) |
Append a new node to the list, called n and referring to an unsigned int. | |
| OptionVar * | AddOption (const char *n, int &var) |
Append a new node to the list, called n and referring to a signed int. | |
| OptionVar * | AddOption (const char *n, double &var) |
Append a new node to the list, called n and referring to a double. | |
| OptionVar * | AddOption (const char *n, bool &var) |
Append a new node to the list, called n and referring to a boolean. | |
| OptionVar * | AddOption (const char *n, char *var) |
Append a new node to the list, called n and referring to a C string. | |
| OptionVar * | SetOption (const char *n, char *var) |
Searches the list for the first node named n and assigns it a value parsed from var. Returns a pointer to the changed node, or NULL if not found. | |
| OptionVar * | SetOption (const char *n, double var) |
Searches the list for the first node named n, and assigns the value var. Returns a pointer to the changed node, or NULL if not found. | |
| OptionVar * | ParseOption (char *str) |
| Parses a C string of the form "name=value", finds a node with the parsed name, assigns it the parsed value, and returns a pointer to it. | |
| int | ParseOptionList (char **str, int n) |
Parses an array of n strings, using ParseOption(). | |
| int | ParseOptionStream (std::istream &is) |
| Parses a sequence of "name=value" tokens from an istream, using ParseOption(). | |
| void * | GetOption (char *n, void *var=NULL, int maxl=0) |
Seaches the list for the first node named n, and returns a void* pointer to the variable to which it refers. Not sure what optional parameters do (6/06). | |
| void | Print (std::ostream &os=std::cout, bool chain=0) |
Prints this node to a stream. If chain is set, then all succeeding nodes are printed as well. | |
Public Attributes | |
| VarType | type |
| What type of variable this option refers to. | |
| void * | ptr |
| A pointer to the variable. | |
| char * | name |
| The variable's name. | |
| OptionVar * | next |
| Pointer to the next node in the list. | |
To use the OptionVar class, declare a variable of type OptionVar, with an optional constructor.
1.4.4