From c029d90d1975e124d237605f1edb2be16bd05b5d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 28 Feb 2017 21:50:44 +0100 Subject: Initial commit --- src/config.hh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/config.hh (limited to 'src/config.hh') 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 + +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 -- cgit v1.2.3-70-g09d2