#include <ConfigFile.h>
Public Member Functions | |
ConfigFile () | |
Default constructor. | |
ConfigFile (const string &f_name) | |
Constructor. Collects parameters and their values from a configuration file. | |
void | setVariable (const char *p_name, const Value &p_value) |
Set a value of a parameter. | |
const Value & | getValue (const char *p_name) |
Get a value of a parameter. | |
Private Member Functions | |
void | readFrom (istream &istr) |
void | printOn (ostream &ostr) const |
void | rtrim (char *ch) |
Private Attributes | |
ParameterType | parameters |
Friends | |
ostream & | operator<< (ostream &ostr, const ConfigFile &C) |
Output operator. |
This class generates a list of parameters and their values from a given configuration file. The format of the configuration file is follows:
ParameterName1 : ParameterValue1
ParameterName2 : ParameterValue2
. . .
ParameterNameN : ParameterValueN
Parameter names are identifiers containing letters and numbers. Parameter values can be an integer or float point numbers and strings.
It is possible to add comments. Everything after a symbol # and until the end of a line is considered to be a comment.
Definition at line 110 of file ConfigFile.h.
|
Default constructor.
|
|
Constructor. Collects parameters and their values from a configuration file. Will scan the file whose name is given as a parameter and create a list of parameters together with the corresponding values.
|
|
Get a value of a parameter.
Returns a value of the parameter with the name p_name. int v = configFile.getValue("THENAME"); string v = string(configFile.getValue("THENAME"));
|
|
|
|
|
|
|
|
Set a value of a parameter. Sets a value of a parameter with the given name. Will create the parameter if not in the list.
|
|
Output operator. Prints a list of parameters together with their values. Definition at line 178 of file ConfigFile.h. |
|
Definition at line 205 of file ConfigFile.h. |