#include <Parser.h>
Public Member Functions | |
Parser (char *) | |
Constructor. | |
Parser () | |
~Parser () | |
Destructor. | |
int | setConfigFile (char *) |
Set (new) configuration file. | |
char * | getConfigFile (void) |
Returns the currently used filename. | |
bool | findValue (Glib::ustring &, Glib::ustring &) |
Find the value of a given property. | |
Private Member Functions | |
int | initParser (void) |
Initialize the parser. | |
Private Attributes | |
char * | m_cfgFile |
Name of configuration file. | |
Glib::ustring * | m_cfgProperties |
List of properties in config file. | |
Glib::ustring * | m_cfgValues |
List of according values. | |
unsigned int | m_cfgSize |
Number of entries in both lists. |
This class is responsible to load and parse a configuration file. It stores all properties and values internally and returns a correspondig value of a given property
Parser::Parser | ( | char * | cfgFileName | ) |
Constructor.
Sets up the class
[in] | cfgFileName | Configuration file to parse |
Parser::Parser | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Parser::~Parser | ( | ) |
Destructor.
The destructor disposes the memory used by the class
int Parser::initParser | ( | void | ) | [private] |
Initialize the parser.
NO_ERROR | Initialization successful |
int Parser::setConfigFile | ( | char * | newFile | ) |
Set (new) configuration file.
This method accepts a filename for a (new) configuration file to parse. It discards all old data and opens and parses the new file
[in] | newFile | Filename of (new) configuration file |
NO_ERROR | New configuration file successfully parsed | |
COULD_NOT_OPEN_FILE | The given file could not be opened | |
NO_VALID_ENTRIES | No valid entries were found in the given file |
char * Parser::getConfigFile | ( | void | ) |
Returns the currently used filename.
bool Parser::findValue | ( | Glib::ustring & | prop, | |
Glib::ustring & | val | |||
) |
Find the value of a given property.
This method returns the value of the given property or NULL if the given property could not be found in the list of all properties
[in] | prop | Property |
[out] | val | Return value |
true | Requested value found | |
false | There is no such property |
char* Parser::m_cfgFile [private] |
Name of configuration file.
Glib::ustring* Parser::m_cfgProperties [private] |
List of properties in config file.
Glib::ustring* Parser::m_cfgValues [private] |
List of according values.
unsigned int Parser::m_cfgSize [private] |
Number of entries in both lists.