#include <modules.h>
Inheritance diagram for ConfigReader:
Public Member Functions | |
ConfigReader () | |
Default constructor. | |
ConfigReader (std::string filename) | |
Overloaded constructor. | |
~ConfigReader () | |
Default destructor. | |
std::string | ReadValue (std::string tag, std::string name, int index) |
Retrieves a value from the config file. | |
int | Enumerate (std::string tag) |
Counts the number of times a given tag appears in the config file. | |
bool | Verify () |
Returns true if a config file is valid. | |
int | EnumerateValues (std::string tag, int index) |
Returns the number of items within a tag. | |
Protected Attributes | |
std::stringstream * | cache |
The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). | |
bool | error |
Used to store errors. |
It may either be instantiated with one parameter or none. Constructing the class using one parameter allows you to specify a path to your own configuration file, otherwise, inspircd.conf is read.
Definition at line 516 of file modules.h.
|
Default constructor. This constructor initialises the ConfigReader class to read the inspircd.conf file as specified when running ./configure. Definition at line 343 of file modules.cpp.
|
|
Overloaded constructor. This constructor initialises the ConfigReader class to read a user-specified config file Definition at line 357 of file modules.cpp.
|
|
Default destructor. This method destroys the ConfigReader class. Definition at line 350 of file modules.cpp. References cache.
|
|
Counts the number of times a given tag appears in the config file. This method counts the number of times a tag appears in a config file, for use where there are several tags of the same kind, e.g. with opers and connect types. It can be used with the index value of ConfigReader::ReadValue to loop through all copies of a multiple instance tag. Definition at line 375 of file modules.cpp.
00376 {
00377 return EnumConf(cache,tag.c_str());
00378 }
|
|
Returns the number of items within a tag. For example if the tag was <test tag="blah" data="foo"> then this function would return 2. Spaces and newlines both qualify as valid seperators between values. Definition at line 380 of file modules.cpp.
00381 {
00382 return EnumValues(cache, tag.c_str(), index);
00383 }
|
|
Retrieves a value from the config file. This method retrieves a value from the config file. Where multiple copies of the tag exist in the config file, index indicates which of the values to retrieve. Definition at line 363 of file modules.cpp.
00364 { 00365 char val[MAXBUF]; 00366 char t[MAXBUF]; 00367 char n[MAXBUF]; 00368 strncpy(t,tag.c_str(),MAXBUF); 00369 strncpy(n,name.c_str(),MAXBUF); 00370 ReadConf(cache,t,n,index,val); 00371 return std::string(val); 00372 } |
|
Returns true if a config file is valid. This method is partially implemented and will only return false if the config file does not exist or could not be opened. Definition at line 385 of file modules.cpp. References error.
00386 { 00387 return this->error; 00388 } |
|
The contents of the configuration file This protected member should never be accessed by a module (and cannot be accessed unless the core is changed). It will contain a pointer to the configuration file data with unneeded data (such as comments) stripped from it. Definition at line 524 of file modules.h. Referenced by ConfigReader(), and ~ConfigReader(). |
|
Used to store errors.
Definition at line 527 of file modules.h. Referenced by ConfigReader(), and Verify(). |