22#include "util/newconfig/ConfigFileInterface.hpp"
23#include "util/newconfig/Error.hpp"
24#include "util/newconfig/Types.hpp"
26#include <boost/json/object.hpp>
34namespace util::config {
38 boost::json::object jsonObject_;
56 getValue(std::string_view key)
const override;
64 [[nodiscard]] std::vector<Value>
65 getArray(std::string_view key)
const override;
83 [[nodiscard]]
static std::expected<ConfigFileJson, Error>
92 [[nodiscard]] boost::json::object
const&
105 flattenJson(boost::json::object
const& jsonRootObject);
The interface for configuration files.
Definition ConfigFileInterface.hpp:35
Json representation of config.
Definition ConfigFileJson.hpp:37
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:91
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:85
boost::json::object const & inner() const
Get the inner representation of json file.
Definition ConfigFileJson.cpp:145
Value getValue(std::string_view key) const override
Retrieves a configuration value by its key.
Definition ConfigFileJson.cpp:113
bool containsKey(std::string_view key) const override
Checks if the configuration contains a specific key.
Definition ConfigFileJson.cpp:139
std::vector< Value > getArray(std::string_view key) const override
Retrieves an array of configuration values by its key.
Definition ConfigFileJson.cpp:123