3#include "util/config/ConfigFileInterface.hpp"
4#include "util/config/Error.hpp"
5#include "util/config/Types.hpp"
7#include <boost/json/object.hpp>
16namespace util::config {
20 boost::json::object jsonObject_;
38 getValue(std::string_view key)
const override;
46 [[nodiscard]] std::vector<std::optional<Value>>
47 getArray(std::string_view key)
const override;
63 [[nodiscard]] std::vector<std::string>
73 [[nodiscard]]
static std::expected<ConfigFileJson, Error>
82 [[nodiscard]] boost::json::object
const&
95 flattenJson(boost::json::object
const& jsonRootObject);
The interface for configuration files.
Definition ConfigFileInterface.hpp:18
static std::expected< ConfigFileJson, Error > makeConfigFileJson(std::filesystem::path const &configFilePath)
Creates a new ConfigFileJson by parsing the provided JSON file and stores the values in the object.
Definition ConfigFileJson.cpp:69
std::vector< std::optional< Value > > getArray(std::string_view key) const override
Retrieves an array of configuration values by its key.
Definition ConfigFileJson.cpp:104
ConfigFileJson(boost::json::object jsonObj)
Construct a new ConfigJson object and stores the values from user's config into a json object.
Definition ConfigFileJson.cpp:63
boost::json::object const & inner() const
Get the inner representation of json file.
Definition ConfigFileJson.cpp:140
Value getValue(std::string_view key) const override
Retrieves a configuration value by its key.
Definition ConfigFileJson.cpp:94
bool containsKey(std::string_view key) const override
Checks if the configuration contains a specific key.
Definition ConfigFileJson.cpp:124
std::vector< std::string > getAllKeys() const override
Retrieves all keys in the configuration file.
Definition ConfigFileJson.cpp:130