aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-11-21 05:17:23 +0000
committerMike Buland <eichlan@xagasoft.com>2006-11-21 05:17:23 +0000
commit737b1aee54da9ff45a4fb6eb7e636eff9019128e (patch)
tree927462af3c8301f1ccac44ed7a5ee8c52dc77b29
parent76e04d54d648395ea5e9884882350f3e1a39a086 (diff)
downloadlibbu++-737b1aee54da9ff45a4fb6eb7e636eff9019128e.tar.gz
libbu++-737b1aee54da9ff45a4fb6eb7e636eff9019128e.tar.bz2
libbu++-737b1aee54da9ff45a4fb6eb7e636eff9019128e.tar.xz
libbu++-737b1aee54da9ff45a4fb6eb7e636eff9019128e.zip
Adding a new config-system that should be easy to make derive from xml. Or just
used in general. The base unit, the confpair is a template, so if things go right, you should be able to use this to store any kind of config data in a nice and easily accessable way.
Diffstat (limited to '')
-rw-r--r--src/confpair.cpp2
-rw-r--r--src/confpair.h35
-rw-r--r--src/conftree.cpp9
-rw-r--r--src/conftree.h19
-rw-r--r--src/tests/confpair.cpp14
5 files changed, 79 insertions, 0 deletions
diff --git a/src/confpair.cpp b/src/confpair.cpp
new file mode 100644
index 0000000..4741401
--- /dev/null
+++ b/src/confpair.cpp
@@ -0,0 +1,2 @@
1#include "confpair.h"
2
diff --git a/src/confpair.h b/src/confpair.h
new file mode 100644
index 0000000..5be33c8
--- /dev/null
+++ b/src/confpair.h
@@ -0,0 +1,35 @@
1#ifndef CONF_PAIR_H
2#define CONF_PAIR_H
3
4#include <stdint.h>
5#include <string>
6/**
7 *
8 */
9template<class T>
10class ConfPair
11{
12public:
13 ConfPair( const std::string &sName ) :
14 sName( sName )
15 { }
16
17 virtual ~ConfPair()
18 { }
19
20 T &value()
21 {
22 return tValue;
23 }
24
25 const std::string &name()
26 {
27 return sName;
28 }
29
30private:
31 std::string sName;
32 T tValue;
33};
34
35#endif
diff --git a/src/conftree.cpp b/src/conftree.cpp
new file mode 100644
index 0000000..d9a3a3f
--- /dev/null
+++ b/src/conftree.cpp
@@ -0,0 +1,9 @@
1#include "conftree.h"
2
3ConfTree::ConfTree()
4{
5}
6
7ConfTree::~ConfTree()
8{
9}
diff --git a/src/conftree.h b/src/conftree.h
new file mode 100644
index 0000000..197b1ef
--- /dev/null
+++ b/src/conftree.h
@@ -0,0 +1,19 @@
1#ifndef CONF_TREE_H
2#define CONF_TREE_H
3
4#include <stdint.h>
5
6/**
7 *
8 */
9class ConfTree
10{
11public:
12 ConfTree();
13 virtual ~ConfTree();
14
15private:
16
17};
18
19#endif
diff --git a/src/tests/confpair.cpp b/src/tests/confpair.cpp
new file mode 100644
index 0000000..8e03730
--- /dev/null
+++ b/src/tests/confpair.cpp
@@ -0,0 +1,14 @@
1#include "confpair.h"
2#include <iostream>
3
4using namespace std;
5
6int main()
7{
8 ConfPair<bool> p1("DebugMode");
9 p1.value() = true;
10 cout << p1.value() << "\n";
11 p1.value() = false;
12 cout << p1.value() << "\n";
13}
14