Json representation of config.
More...
#include <ConfigFileJson.hpp>
|
| | ConfigFileJson (boost::json::object jsonObj) |
| | Construct a new ConfigJson object and stores the values from user's config into a json object.
|
| Value | getValue (std::string_view key) const override |
| | Retrieves a configuration value by its key.
|
| std::vector< std::optional< Value > > | getArray (std::string_view key) const override |
| | Retrieves an array of configuration values by its key.
|
| bool | containsKey (std::string_view key) const override |
| | Checks if the configuration contains a specific key.
|
| std::vector< std::string > | getAllKeys () const override |
| | Retrieves all keys in the configuration file.
|
| boost::json::object const & | inner () const |
| | Get the inner representation of json file.
|
Json representation of config.
◆ ConfigFileJson()
| util::config::ConfigFileJson::ConfigFileJson |
( |
boost::json::object | jsonObj | ) |
|
Construct a new ConfigJson object and stores the values from user's config into a json object.
- Parameters
-
| jsonObj | the Json object to parse; represents user's config |
◆ containsKey()
| bool util::config::ConfigFileJson::containsKey |
( |
std::string_view | key | ) |
const |
|
nodiscardoverridevirtual |
◆ getAllKeys()
| std::vector< std::string > util::config::ConfigFileJson::getAllKeys |
( |
| ) |
const |
|
nodiscardoverridevirtual |
◆ getArray()
| std::vector< std::optional< Value > > util::config::ConfigFileJson::getArray |
( |
std::string_view | key | ) |
const |
|
nodiscardoverridevirtual |
Retrieves an array of configuration values by its key.
- Parameters
-
| key | The key of the configuration array to retrieve. |
- Returns
- A vector of variants holding the config values specified by user.
Implements util::config::ConfigFileInterface.
◆ getValue()
| Value util::config::ConfigFileJson::getValue |
( |
std::string_view | key | ) |
const |
|
nodiscardoverridevirtual |
Retrieves a configuration value by its key.
- Parameters
-
| key | The key of the configuration value to retrieve. |
- Returns
- A variant containing the same type corresponding to the extracted value.
Implements util::config::ConfigFileInterface.
◆ inner()
| boost::json::object const & util::config::ConfigFileJson::inner |
( |
| ) |
const |
|
nodiscard |
Get the inner representation of json file.
- Note
- This method is mostly used for testing purposes.
- Returns
- The inner representation of json file.
◆ makeConfigFileJson()
| std::expected< ConfigFileJson, Error > util::config::ConfigFileJson::makeConfigFileJson |
( |
std::filesystem::path const & | configFilePath | ) |
|
|
staticnodiscard |
Creates a new ConfigFileJson by parsing the provided JSON file and stores the values in the object.
- Parameters
-
| configFilePath | The path to the JSON file to be parsed. |
- Returns
- A ConfigFileJson object if parsing user file is successful. Error otherwise
The documentation for this class was generated from the following files:
- /__w/clio/clio/src/util/config/ConfigFileJson.hpp
- /__w/clio/clio/src/util/config/ConfigFileJson.cpp