summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/DebugDump/Makefile.am6
-rw-r--r--lib/Utils/DebugDump.cpp (renamed from lib/DebugDump/DebugDump.cpp)0
-rw-r--r--lib/Utils/DebugDump.h (renamed from lib/DebugDump/DebugDump.h)0
-rw-r--r--lib/Utils/Settings.cpp64
-rw-r--r--lib/Utils/Settings.h13
5 files changed, 77 insertions, 6 deletions
diff --git a/lib/DebugDump/Makefile.am b/lib/DebugDump/Makefile.am
deleted file mode 100644
index 58faadc6..00000000
--- a/lib/DebugDump/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-lib_LTLIBRARIES = libDebugDump.la
-libDebugDump_la_SOURCES = DebugDump.cpp DebugDump.h Settings.cpp Settings.h
-libDebugDump_la_LDFLAGS = -version-info 0:1:0
-
-install-data-local:
- $(mkdir_p) '$(DEBUG_DUMPS_DIR)' \ No newline at end of file
diff --git a/lib/DebugDump/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index e35ec4dd..e35ec4dd 100644
--- a/lib/DebugDump/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
diff --git a/lib/DebugDump/DebugDump.h b/lib/Utils/DebugDump.h
index c8eef157..c8eef157 100644
--- a/lib/DebugDump/DebugDump.h
+++ b/lib/Utils/DebugDump.h
diff --git a/lib/Utils/Settings.cpp b/lib/Utils/Settings.cpp
new file mode 100644
index 00000000..866adc57
--- /dev/null
+++ b/lib/Utils/Settings.cpp
@@ -0,0 +1,64 @@
+
+#include "Settings.h"
+#include <fstream>
+
+
+void load_settings(const std::string& path, map_settings_t& settings)
+{
+ std::ifstream fIn;
+ fIn.open(path.c_str());
+ if (fIn.is_open())
+ {
+ std::string line;
+ while (!fIn.eof())
+ {
+ getline(fIn, line);
+
+ int ii;
+ bool is_value = false;
+ bool valid = false;
+ std::string key = "";
+ std::string value = "";
+ for (ii = 0; ii < line.length(); ii++)
+ {
+ if (isspace(line[ii]))
+ {
+ continue;
+ }
+ if (line[ii] == '#')
+ {
+ break;
+ }
+ else if (line[ii] == '=')
+ {
+ is_value = true;
+ }
+ else if (line[ii] == '=' && is_value)
+ {
+ key = "";
+ value = "";
+ break;
+ }
+ else if (!is_value)
+ {
+ key += line[ii];
+ }
+ else
+ {
+ valid = true;
+ value += line[ii];
+ }
+ }
+ if (valid)
+ {
+ settings[key] = value;
+ }
+ }
+ fIn.close();
+ }
+}
+
+void save_settings(const std::string& path, const map_settings_t& settings)
+{
+ //TODO: write this
+}
diff --git a/lib/Utils/Settings.h b/lib/Utils/Settings.h
new file mode 100644
index 00000000..ec30a27a
--- /dev/null
+++ b/lib/Utils/Settings.h
@@ -0,0 +1,13 @@
+#ifndef SETTINGSFUNC_H_
+#define SETTINGSFUNC_H_
+
+#include "Settings.h"
+#include <string>
+#include <map>
+
+typedef std::map<std::string, std::string> map_settings_t;
+
+void load_settings(const std::string& path, map_settings_t& settings);
+void save_settings(const std::string& path, const map_settings_t& settings);
+
+#endif /* SETTINGSFUNC_H_ */