Skip to content
Snippets Groups Projects
Commit 202e9b1c authored by Oliver Charles Schubert's avatar Oliver Charles Schubert
Browse files

bug fix in extractNodesFromPtree().

parent ba56bc9c
Branches
No related tags found
No related merge requests found
......@@ -37,11 +37,14 @@ boost::property_tree::ptree extractNodesFromPtree(const boost::property_tree::pt
for (const auto& parent_node : ptree) {
if (parent_node.first == target_node) {
reduced_ptree.add_child(parent_node.first, parent_node.second);
} else {
boost::property_tree::ptree myPtree{};
myPtree = extractNodesFromPtree(parent_node.second, target_node);
for (const auto& child_node : myPtree) {
reduced_ptree.add_child(child_node.first, child_node.second);
}
}
boost::property_tree::ptree myPtree{};
myPtree = extractNodesFromPtree(parent_node.second, target_node);
}
return reduced_ptree;
}
......@@ -132,19 +135,8 @@ int main () {
case State::ExtractingConfigTreeInforamtion:
std::cout << "Current State: " << state << std::endl;
// Iterate through the children of <ConfigFile.ProgramSettings.Parameters>
// for (const boost::property_tree::ptree::value_type& parent_nodes : config_tree.get_child("ConfigFile.ProgramSettings.Parameters")) {
// boost::property_tree::ptree temporary_tree{};
// // Iterate through the children of parent_node
// for (const auto &child_nodes : parent_nodes.second) {
// if (child_nodes.first == "SubPath") {
// temporary_tree.add_child(child_nodes.first, child_nodes.second);
// }
// }
// reduced_config_tree.add_child(parent_nodes.first, temporary_tree);
// }
reduced_config_tree = extractNodesFromPtree(config_tree, "SubPath");
// printNodeNames(reduced_config_tree);
printNodeNames(reduced_config_tree);
state = State::SubstractingNodeValues;
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment