|
Mana
|
Configuration handler for reading (and writing). More...
#include <configuration.h>
Public Member Functions | |
| Configuration ()=default | |
| ~Configuration () override | |
| void | init (const std::string &filename, bool useResManager=false) |
| Reads config file and parse all options into memory. | |
| void | setDefaultValues (DefaultsData *defaultsData) |
| Set the default values for each keys. | |
| int | getIntValue (const std::string &key) const |
| returns a value corresponding to the given key. | |
| float | getFloatValue (const std::string &key) const |
| std::string | getStringValue (const std::string &key) const |
| bool | getBoolValue (const std::string &key) const |
| VariableData * | getDefault (const std::string &key, VariableData::DataType type) const |
Public Member Functions inherited from ConfigurationObject | |
| virtual | ~ConfigurationObject () |
| void | setValue (const std::string &key, const std::string &value) |
| Sets an option using a string value. | |
| std::string | getValue (const std::string &key, const std::string &deflt) const |
| Gets a value as string. | |
| int | getValue (const std::string &key, int deflt) const |
| unsigned | getValue (const std::string &key, unsigned deflt) const |
| double | getValue (const std::string &key, double deflt) const |
| void | clear () |
| Re-sets all data in the configuration. | |
Private Member Functions | |
| void | cleanDefaults () |
| Clean up the default values member. | |
Private Attributes | |
| std::string | mConfigPath |
| Location of config file. | |
| DefaultsData * | mDefaultsData = nullptr |
| Defaults of value for a given key. | |
Additional Inherited Members | |
Protected Member Functions inherited from ConfigurationObject | |
| void | initFromXML (XML::Node node) |
Protected Attributes inherited from ConfigurationObject | |
| std::map< std::string, std::string > | mOptions |
Configuration handler for reading (and writing).
Definition at line 91 of file configuration.h.
|
default |
|
override |
Definition at line 86 of file configuration.cpp.
|
private |
Clean up the default values member.
Definition at line 73 of file configuration.cpp.
| bool Configuration::getBoolValue | ( | const std::string & | key | ) | const |
Definition at line 171 of file configuration.cpp.
| VariableData * Configuration::getDefault | ( | const std::string & | key, |
| VariableData::DataType | type | ||
| ) | const |
Definition at line 97 of file configuration.cpp.
| float Configuration::getFloatValue | ( | const std::string & | key | ) | const |
Definition at line 154 of file configuration.cpp.
| int Configuration::getIntValue | ( | const std::string & | key | ) | const |
returns a value corresponding to the given key.
The default value returned in based on fallbacks registry.
Definition at line 118 of file configuration.cpp.
| std::string Configuration::getStringValue | ( | const std::string & | key | ) | const |
Definition at line 136 of file configuration.cpp.
| void Configuration::init | ( | const std::string & | filename, |
| bool | useResManager = false |
||
| ) |
Reads config file and parse all options into memory.
| filename | path to config file |
| useResManager | Make use of the resource manager. |
Definition at line 204 of file configuration.cpp.
| void Configuration::setDefaultValues | ( | DefaultsData * | defaultsData | ) |
Set the default values for each keys.
| defaultsData | data used as defaults. |
Definition at line 91 of file configuration.cpp.
|
private |
Location of config file.
Definition at line 134 of file configuration.h.
|
private |
Defaults of value for a given key.
Definition at line 135 of file configuration.h.