summaryrefslogtreecommitdiff
path: root/src/config.hh
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-02-28 21:50:44 +0100
committerJoel Klinghed <the_jk@yahoo.com>2017-02-28 21:50:44 +0100
commitc029d90d1975e124d237605f1edb2be16bd05b5d (patch)
tree9df87ffb365354bdb74a969440b32c8304bdbcb7 /src/config.hh
Initial commit
Diffstat (limited to 'src/config.hh')
-rw-r--r--src/config.hh33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/config.hh b/src/config.hh
new file mode 100644
index 0000000..5262e91
--- /dev/null
+++ b/src/config.hh
@@ -0,0 +1,33 @@
+// -*- mode: c++; c-basic-offset: 2; -*-
+
+#ifndef CONFIG_HH
+#define CONFIG_HH
+
+#include <string>
+
+class Config {
+public:
+ virtual ~Config() { }
+
+ static Config* create();
+
+ virtual bool load_name(std::string const& name) = 0;
+ virtual bool load_file(std::string const& filename) = 0;
+
+ virtual bool good() const = 0;
+ virtual std::string const& last_error() const = 0;
+
+ virtual std::string const& get(std::string const& key,
+ std::string const& fallback) = 0;
+ virtual char const* get(std::string const& key, char const* fallback) = 0;
+ virtual bool get(std::string const& key, bool fallback) = 0;
+ virtual bool is_set(std::string const& key) = 0;
+
+ virtual void set(std::string const& key, std::string const& value) = 0;
+
+protected:
+ Config() { }
+ Config(Config const&) = delete;
+};
+
+#endif // CONFIG_HH