/* * This source code is released into the public domain. */ module; /* * The configuration store. There should only be one of these. */ #include #include #include #include export module nihil.config:store; import nihil.generator; import :option; namespace nihil::config { struct store final { /* * Get the global config store. */ [[nodiscard]] static auto get() -> store &; /* * Register a new value with the config store. */ [[nodiscard]] auto register_option(this store &, option *object) -> std::expected; /* * Remove a value from the config store. */ [[nodiscard]] auto unregister_option(this store &, option *object) -> std::expected; /* * Fetch an existing value in the config store. */ [[nodiscard]] auto fetch(this store const &, std::string_view name) -> std::expected