From 6232d13f5321b87ddf12a1aa36b4545da45f173d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 17 Nov 2021 22:34:57 +0100 Subject: Travel3: Simple image and video display site Reads the images and videos from filesystem and builds a site in memroy. --- src/config.hh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 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..fd0f067 --- /dev/null +++ b/src/config.hh @@ -0,0 +1,48 @@ +#ifndef CONFIG_HH +#define CONFIG_HH + +#include +#include +#include +#include +#include +#include +#include + +class Logger; + +class Config { +public: + virtual ~Config() = default; + + static std::unique_ptr create(Logger* logger, + std::filesystem::path const& filepath); + + static std::unique_ptr create( + std::unordered_map data, + std::filesystem::path root); + static std::unique_ptr create_empty(); + + virtual std::string_view get(std::string const& key, + std::string_view default_) const = 0; + virtual char const* get(std::string const& key, + char const* default_) const = 0; + virtual std::optional get(std::string const& key, + uint64_t default_) const = 0; + + virtual std::optional get_size(std::string const& key, + uint64_t default_) const = 0; + + virtual std::optional get_duration(std::string const& key, + double default_) const = 0; + + virtual std::filesystem::path get_path(std::string const& key, + std::string_view default_) const = 0; + +protected: + Config() = default; + Config(Config const&) = delete; + Config& operator=(Config const&) = delete; +}; + +#endif // CONFIG_HH -- cgit v1.2.3-70-g09d2