49 std::shared_ptr<DBNode>
parse(
const std::string& input)
const override;
62 void writeToFile(
const std::string& filename,
const std::shared_ptr<DBNode>& root)
const override;
74 std::shared_ptr<DBNode>
readFromFile(
const std::string& filename)
const override;
88 bool parseLine(
const std::string& line, std::string& key, std::string& value)
const;
100 void adjustIndentation(
size_t indent, std::vector<std::shared_ptr<DBNode>>& nodeStack, std::vector<int>& indentStack)
const;
114 static std::shared_ptr<DBNode> parseYAMLDBNode(std::istringstream& stream,
int indentLevel);
128 static void processKeyValue(
const std::string& line, std::shared_ptr<DBNode>& node, std::istringstream& stream,
int indentLevel);
145 static void processList(std::shared_ptr<DBNode>& node, std::istringstream& stream,
int indentLevel, std::string firstLine =
"");
154 static std::string trim(
const std::string& str);
164 static int countLeadingSpaces(
const std::string& str);
176 bool isListDBNode(
const std::shared_ptr<DBNode>& node)
const;
186 double parseNumber(
const std::string& value)
const;
222 static bool isDouble(
const std::string& str);
233 static bool isInteger(
const std::string& str);
Hierarchical key–value tree with JSON/YAML serialization.
Abstract interface for (de)serializing data as DBNode trees.
std::variant< BlockName, int, double, bool, std::shared_ptr< DBNode >, std::vector< std::shared_ptr< DBNode > > > Value
Variant type used to store values in the tree.
Abstract base class for data parsers.
YAML implementation of the IParser interface.
std::shared_ptr< DBNode > readFromFile(const std::string &filename) const override
Reads and parses YAML data from a file.
std::shared_ptr< DBNode > parse(const std::string &input) const override
Parses a YAML string into a DBNode hierarchy.
void writeToFile(const std::string &filename, const std::shared_ptr< DBNode > &root) const override
Writes a DBNode hierarchy to a YAML file.