From 6ed8f5151719fbc14ec0ac6d28a346d1f74cf2ca Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Fri, 2 Jan 2026 22:42:31 +0100 Subject: Initial commit --- src/cfg.hh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/cfg.hh (limited to 'src/cfg.hh') diff --git a/src/cfg.hh b/src/cfg.hh new file mode 100644 index 0000000..3be9a00 --- /dev/null +++ b/src/cfg.hh @@ -0,0 +1,45 @@ +#ifndef CFG_HH +#define CFG_HH + +#include +#include +#include +#include +#include + +namespace cfg { + +class Config { + public: + virtual ~Config() = default; + + [[nodiscard]] + virtual std::optional get(std::string_view name) const = 0; + + [[nodiscard]] + bool has(std::string_view name) const; + [[nodiscard]] + std::optional get_int64(std::string_view name) const; + [[nodiscard]] + std::optional get_uint64(std::string_view name) const; + [[nodiscard]] + std::optional get_bool(std::string_view name) const; + + protected: + Config() = default; + + Config(Config const&) = delete; + Config& operator=(Config const&) = delete; +}; + +[[nodiscard]] +std::unique_ptr load_all(std::string_view name, + std::vector& errors); + +[[nodiscard]] +std::unique_ptr load_one(std::filesystem::path const& path, + std::vector& errors); + +} // namespace cfg + +#endif // CFG_HH -- cgit v1.2.3-70-g09d2