12 #include "PDFxTMDLib/external/rapidyaml/rapidyaml-0.9.0.hpp"
16 #include <type_traits>
24 struct is_vector<std::vector<U>> : std::true_type {};
47 std::pair<std::optional<T>,
ErrorType>
get(
const std::string &key)
const {
49 ryml::ConstNodeRef root = data.tree.rootref();
53 ryml::csubstr ckey(key.data(), key.size());
54 if (!root.has_child(ckey)) {
58 ryml::ConstNodeRef node = root[ckey];
63 using U =
typename T::value_type;
65 for (
const auto& child : node) {
68 values.push_back(val);
80 }
catch (
const std::exception &) {
86 template <
typename T>
bool set(
const std::string &key,
const T &value)
90 if (!data.tree.rootref().is_map())
96 ryml::csubstr ckey(key.data(), key.size());
101 data.tree[ckey] << value;
103 catch (
const std::exception &e)
107 throw std::runtime_error(e.what());
119 data.tree.rootref() |= ryml::MAP;
Definition: ConfigWrapper.h:29
ConfigWrapper()
Definition: ConfigWrapper.h:37
void initializeEmptyYAML()
Definition: ConfigWrapper.h:116
bool saveToFile(const std::string &filename) const
std::pair< std::optional< T >, ErrorType > get(const std::string &key) const
Definition: ConfigWrapper.h:47
bool loadFromString(const std::string &data_string, Format format)
Format
Definition: ConfigWrapper.h:32
bool set(const std::string &key, const T &value)
Definition: ConfigWrapper.h:86
bool loadFromFile(const std::filesystem::path &filepath, Format format)
Definition: AllFlavorsShape.h:14
ErrorType
Definition: PartonUtils.h:42
@ CONFIG_ConversionFailed
Definition: ConfigWrapper.h:20