feat: saving entities (WIP)
This commit is contained in:
@@ -30,8 +30,8 @@ static void get_all_nodes(std::vector<RigNode*>& nodes, RigNode* node) {
|
||||
}
|
||||
}
|
||||
|
||||
RigConfig::RigConfig(std::unique_ptr<RigNode> root, size_t nodesCount)
|
||||
: root(std::move(root)), nodes(nodesCount) {
|
||||
RigConfig::RigConfig(const std::string& name, std::unique_ptr<RigNode> root, size_t nodesCount)
|
||||
: name(name), root(std::move(root)), nodes(nodesCount) {
|
||||
get_all_nodes(nodes, this->root.get());
|
||||
}
|
||||
|
||||
@@ -106,7 +106,8 @@ static std::tuple<size_t, std::unique_ptr<RigNode>> read_node(
|
||||
|
||||
std::unique_ptr<RigConfig> RigConfig::parse(
|
||||
std::string_view src,
|
||||
std::string_view file
|
||||
std::string_view file,
|
||||
std::string_view name
|
||||
) {
|
||||
auto root = json::parse(file, src);
|
||||
auto rootNodeMap = root->map("root");
|
||||
@@ -114,5 +115,5 @@ std::unique_ptr<RigConfig> RigConfig::parse(
|
||||
throw std::runtime_error("missing 'root' element");
|
||||
}
|
||||
auto [count, rootNode] = read_node(rootNodeMap, 0);
|
||||
return std::make_unique<RigConfig>(std::move(rootNode), count);
|
||||
return std::make_unique<RigConfig>(std::string(name), std::move(rootNode), count);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user