/** * @file Config.h * @author apio (cloudapio.eu) * @brief Configuration file parsing. * * @copyright Copyright (c) 2024, the Luna authors. * */ #pragma once #include #include #include #include namespace os { class ConfigFile { public: static Result> open(os::Path path); Option read_string(StringView key); StringView read_string_or(StringView key, StringView default_value); Option read_number(StringView key); i64 read_number_or(StringView key, i64 default_value); Option read_boolean(StringView key); bool read_boolean_or(StringView key, bool default_value); Result write_string(StringView key, StringView value); Result write_number(StringView key, int value); Result write_boolean(StringView key, bool value); Result sync(); private: os::Path m_path { "" }; HashMap m_data; }; }