summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/configuration.cpp14
-rw-r--r--src/configuration.h5
2 files changed, 19 insertions, 0 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 011e8787..4c67a9f4 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -22,6 +22,10 @@
#include "configuration.h"
+/**
+ \brief read INI file and parse all options into memory
+ \param filename full path to INI file (~/.manaworld/tmw.ini)
+*/
void Configuration::Init(std::string filename) {
inFile.open(filename.c_str(), std::ifstream::in);
std::string inBuffer;
@@ -63,6 +67,11 @@ bool Configuration::setValue(std::string, std::string) {
return true;
}
+/**
+ \brief get a value as string
+ \param key option identifier
+ \param deflt default option if not there or error
+*/
std::string Configuration::getValue(std::string key, std::string deflt) {
INI_OPTION optionTmp;
for (iter = iniOptions.begin(); iter != iniOptions.end(); iter++) {
@@ -74,6 +83,11 @@ std::string Configuration::getValue(std::string key, std::string deflt) {
return deflt;
}
+/**
+ \brief get a value as numeric value (float)
+ \param key option identifier
+ \param deflt default option if not there or error
+*/
float Configuration::getValue(std::string key, float deflt) {
INI_OPTION optionTmp;
for (iter = iniOptions.begin(); iter != iniOptions.end(); iter++) {
diff --git a/src/configuration.h b/src/configuration.h
index 98c17be9..e3e5b9aa 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -30,6 +30,11 @@
#include <iostream>
#include <fstream>
+/**
+ * INI configuration handler for reading (and writing)
+ *
+ * \ingroup CORE
+ */
class Configuration {
public:
void Init(std::string);