@@ -46,7 +46,7 @@ struct PrintingTree {
46
46
};
47
47
48
48
/* *
49
- * @brief Print the given tree node.
49
+ * @brief Recursively print the given tree node.
50
50
*
51
51
* @param node
52
52
* The node to print.
@@ -55,9 +55,9 @@ struct PrintingTree {
55
55
* @param prefix
56
56
* The prefix that all children of this node will print before their names.
57
57
*/
58
- void print_tree_node (const PrintingTreeNode& node,
59
- std::ofstream& os,
60
- const std::string& prefix) {
58
+ void print_tree_node_recur (const PrintingTreeNode& node,
59
+ std::ofstream& os,
60
+ const std::string& prefix) {
61
61
// Print the name of the node here and start a new line.
62
62
os << node.name << " \n " ;
63
63
@@ -71,14 +71,14 @@ void print_tree_node(const PrintingTreeNode& node,
71
71
os << prefix << " ├── " ;
72
72
// Print the child node and update the prefix for any of its children.
73
73
// This prefix will connect the lines in a good looking way.
74
- print_tree_node (node.children [child_idx], os, prefix + " │ " );
74
+ print_tree_node_recur (node.children [child_idx], os, prefix + " │ " );
75
75
} else {
76
76
// If this is the last child, we print an L shape to signify that
77
77
// there are no further children.
78
78
os << prefix << " └── " ;
79
79
// Print the child node, and set the prefix to basically just be
80
80
// an indent.
81
- print_tree_node (node.children [child_idx], os, prefix + " " );
81
+ print_tree_node_recur (node.children [child_idx], os, prefix + " " );
82
82
}
83
83
}
84
84
}
@@ -94,7 +94,7 @@ void print_tree_node(const PrintingTreeNode& node,
94
94
* The output file stream to print to.
95
95
*/
96
96
void print_tree (const PrintingTree& tree, std::ofstream& os) {
97
- print_tree_node (tree.root , os, " " );
97
+ print_tree_node_recur (tree.root , os, " " );
98
98
}
99
99
100
100
/* *
0 commit comments