Class Config#
Defined in File Config.h
Class Documentation#
-
class Config#
Public Functions
-
constexpr Config() noexcept = default#
Constructor.
-
constexpr ~Config() = default#
Destructor.
-
bool LoadFromFile(const std::filesystem::path &file)#
Load a config file from disk.
- Parameters:
file – File path to load.
- Returns:
True if loading was successful, false otherwise.
-
bool SaveToFile(const std::filesystem::path &file)#
Save a config file to disk.
- Parameters:
file – File path to save to.
- Returns:
True if saving was successful, false otherwise.
-
constexpr bool HasChanged() const noexcept#
Check if config has changed after last load/save.
- Returns:
True if config has changed, false otherwise.
-
template<typename T>
std::optional<T> Get(std::string_view key) const# Retrieve the value of a specific key in the config.
- Template Parameters:
T – Output variable.
- Parameters:
key – Key to get value from.
- Returns:
Found value or std::nullopt.
-
template<typename T>
std::optional<std::vector<T>> GetVector(std::string_view key) const# Retrieve the values of a specific key in the config.
- Template Parameters:
T – Output variable.
- Parameters:
key – Key to get values from.
- Returns:
Found values or std::nullopt.
-
template<typename T>
void Set(const std::string &key, T value)# Set a value in the config.
- Template Parameters:
T – Value type.
- Parameters:
key – Key for the new or updated value.
value – Value.
-
template<typename T>
void Set(const std::string &key, const std::vector<T> &value)# Set values in the config.
- Template Parameters:
T – Value type.
- Parameters:
key – Key for the new or updated values.
value – Values.
-
void Print() const#
Print all stored values to the console.
-
constexpr Config() noexcept = default#