26#include <fmt/format.h>
27#include <toml++/toml.h>
44inline auto require_value(const ::toml::table& table, std::string_view path,
45 std::string_view config_name, std::string_view type_name) -> T {
46 const auto child_node = table.at_path(path);
49 fmt::format(
"Configuration {} is required.", config_name));
51 const std::optional<T> value = child_node.value<T>();
54 "Configuration {} must be {}.", config_name, type_name));
71 std::string_view path, std::string_view config_name,
72 std::string_view type_name) {
73 const auto child_node = table.at_path(path);
77 const std::optional<T> value = child_node.value<T>();
80 "Configuration {} must be {}.", config_name, type_name));
Class of exception on invalid arguments.
Definition of exceptions.
Namespace of logging configuration in TOML files.
auto require_value(const ::toml::table &table, std::string_view path, std::string_view config_name, std::string_view type_name) -> T
Get a value or throw exceptions.
void read_optional_value_to(T &output, const ::toml::table &table, std::string_view path, std::string_view config_name, std::string_view type_name)
Read a value to a variable.