Class Config
Defined in File config.hpp
-
class Config
Class to get the configuration of the application.
Public Functions
-
Config() = default
-
inline explicit Config(const std::string &config_file, const std::string &prefix = "")
Construct a new Config object.
- Parameters
config_file – The path to the configuration file.
prefix – The prefix string that is prepended to the key of the configuration. (not implemented yet)
- Throws
RuntimeError – if the config_file is non-empty and the file doesn’t exist.
-
virtual ~Config() = default
-
Config(const Config&) = delete
-
inline const std::string &config_file() const
Get the path to the configuration file.
- Returns
The path to the configuration file.
-
inline const std::string &prefix() const
Get the prefix string that is prepended to the key of the configuration.
- Returns
The prefix string that is prepended to the key of the configuration.
-
inline const std::vector<YAML::Node> &yaml_nodes() const
Get the YAML::Node objects that contains YAML document data.
- Returns
The reference to the vector of YAML::Node objects.
-
ArgList from_config(const std::string &key)
Get the value of a configuration key as an ArgList.
This method retrieves the value from the configuration for the given key. You can use ‘.’ (dot) to access nested fields.
- Parameters
key – The key of the configuration.
- Returns
The argument list of the configuration for the key.
-
std::unordered_set<std::string> config_keys()
Determine the set of keys present in the config.
Returns all keys including nested keys using dot notation (e.g., “parent.child”).
- Returns
The set of valid keys.
-
Config() = default