From 737b1aee54da9ff45a4fb6eb7e636eff9019128e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 21 Nov 2006 05:17:23 +0000 Subject: 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. --- src/confpair.cpp | 2 ++ src/confpair.h | 35 +++++++++++++++++++++++++++++++++++ src/conftree.cpp | 9 +++++++++ src/conftree.h | 19 +++++++++++++++++++ src/tests/confpair.cpp | 14 ++++++++++++++ 5 files changed, 79 insertions(+) create mode 100644 src/confpair.cpp create mode 100644 src/confpair.h create mode 100644 src/conftree.cpp create mode 100644 src/conftree.h create mode 100644 src/tests/confpair.cpp (limited to 'src') 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 @@ +#include "confpair.h" + 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 @@ +#ifndef CONF_PAIR_H +#define CONF_PAIR_H + +#include +#include +/** + * + */ +template +class ConfPair +{ +public: + ConfPair( const std::string &sName ) : + sName( sName ) + { } + + virtual ~ConfPair() + { } + + T &value() + { + return tValue; + } + + const std::string &name() + { + return sName; + } + +private: + std::string sName; + T tValue; +}; + +#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 @@ +#include "conftree.h" + +ConfTree::ConfTree() +{ +} + +ConfTree::~ConfTree() +{ +} 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 @@ +#ifndef CONF_TREE_H +#define CONF_TREE_H + +#include + +/** + * + */ +class ConfTree +{ +public: + ConfTree(); + virtual ~ConfTree(); + +private: + +}; + +#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 @@ +#include "confpair.h" +#include + +using namespace std; + +int main() +{ + ConfPair p1("DebugMode"); + p1.value() = true; + cout << p1.value() << "\n"; + p1.value() = false; + cout << p1.value() << "\n"; +} + -- cgit v1.2.3