18#include <c4/std/string.hpp>
22#include <unordered_map>
25namespace entropic::config {
35bool extract(ryml::ConstNodeRef node, c4::csubstr key, std::string& out);
45bool extract(ryml::ConstNodeRef node, c4::csubstr key,
int& out);
55bool extract(ryml::ConstNodeRef node, c4::csubstr key,
float& out);
65bool extract(ryml::ConstNodeRef node, c4::csubstr key,
double& out);
75bool extract(ryml::ConstNodeRef node, c4::csubstr key,
bool& out);
85bool extract_path(ryml::ConstNodeRef node, c4::csubstr key,
86 std::filesystem::path& out);
104 ryml::ConstNodeRef node, c4::csubstr key,
105 std::optional<std::filesystem::path>& out,
bool& disabled);
116 std::vector<std::string>& out);
132 std::optional<std::vector<std::string>>& out);
143 std::unordered_map<std::string, std::string>& out);
154 ryml::ConstNodeRef node, c4::csubstr key,
155 std::unordered_map<std::string, std::vector<std::string>>& out);
163std::filesystem::path
expand_home(
const std::filesystem::path& p);
179std::string
read_file(
const std::filesystem::path& path);
std::filesystem::path expand_home(const std::filesystem::path &p)
Expand ~ to home directory in a path.
bool extract_string_list_map(ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::vector< std::string > > &out)
Extract a map of string to list of strings from a YAML mapping.
std::string read_file(const std::filesystem::path &path)
Read a file into a string.
bool extract_path(ryml::ConstNodeRef node, c4::csubstr key, std::filesystem::path &out)
Extract a filesystem path with ~ expansion.
bool extract_string_list(ryml::ConstNodeRef node, c4::csubstr key, std::vector< std::string > &out)
Extract a vector of strings from a YAML sequence node.
bool extract_string_map(ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::string > &out)
Extract a map of string to string from a YAML mapping node.
bool extract_string_list_opt(ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::vector< std::string > > &out)
Extract an optional vector of strings.
bool extract_tri_state_path(ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::filesystem::path > &out, bool &disabled)
Extract a tri-state path (null = default, false = disabled, string = path).
std::string to_string(c4::csubstr s)
Convert ryml csubstr to std::string.
bool extract(ryml::ConstNodeRef node, c4::csubstr key, std::string &out)
Extract a string value from a YAML node.