Configuration file.
More...
#include <ConfigFile.hpp>
|
| std::vector< std::pair< std::string, std::string > > | entries |
| |
|
| bool | getValue (const std::string &name, std::string &to) const |
| | Gets the string value of a configuration entry. More...
|
| |
| template<typename T > |
| bool | getValue (const std::string &name, T &to) const |
| | Gets the converted value of a configuration entry. More...
|
| |
Configuration file.
In this text file, each line represents one entry and consists of a key=value pair.
◆ ConfigFile()
| crawlservpp::Main::ConfigFile::ConfigFile |
( |
const std::string & |
name | ) |
|
|
inlineexplicit |
Constructor reading the file.
- Parameters
-
| name | Const reference to a string containing the name of the configuration file to read. |
- Exceptions
-
References entries.
◆ getValue() [1/2]
| bool crawlservpp::Main::ConfigFile::getValue |
( |
const std::string & |
name, |
|
|
std::string & |
to |
|
) |
| const |
|
inline |
Gets the string value of a configuration entry.
- Parameters
-
| name | Constant reference to a string containing the name of the configuration entry to be retrieved. |
| to | Reference to a string to which the value of the entry should be written. Will not be changed, if the given configuration entry does not exist. |
- Returns
- True, if the given configuration entry exists. False otherwise.
References entries.
Referenced by getValue(), and crawlservpp::Main::App::run().
◆ getValue() [2/2]
template<typename T >
| bool crawlservpp::Main::ConfigFile::getValue |
( |
const std::string & |
name, |
|
|
T & |
to |
|
) |
| const |
|
inline |
Gets the converted value of a configuration entry.
- Parameters
-
| name | Constant reference to a string containing the name of the configuration entry to be retrieved. |
| to | Reference to a variable to which the converted value of the entry should be written. Will not be changed, if the given configuration entry does not exist or its value is empty. |
- Returns
- True, if the given configuration entry exists and is not empty. False otherwise.
- Exceptions
-
References getValue().
◆ entries
| std::vector<std::pair<std::string, std::string> > crawlservpp::Main::ConfigFile::entries |
|
protected |
The documentation for this class was generated from the following file: