@@ -46,7 +46,7 @@ struct PrintingTree {
4646};
4747
4848/* *
49- * @brief Print the given tree node.
49+ * @brief Recursively print the given tree node.
5050 *
5151 * @param node
5252 * The node to print.
@@ -55,9 +55,9 @@ struct PrintingTree {
5555 * @param prefix
5656 * The prefix that all children of this node will print before their names.
5757 */
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) {
6161 // Print the name of the node here and start a new line.
6262 os << node.name << " \n " ;
6363
@@ -71,14 +71,14 @@ void print_tree_node(const PrintingTreeNode& node,
7171 os << prefix << " ├── " ;
7272 // Print the child node and update the prefix for any of its children.
7373 // 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 + " │ " );
7575 } else {
7676 // If this is the last child, we print an L shape to signify that
7777 // there are no further children.
7878 os << prefix << " └── " ;
7979 // Print the child node, and set the prefix to basically just be
8080 // an indent.
81- print_tree_node (node.children [child_idx], os, prefix + " " );
81+ print_tree_node_recur (node.children [child_idx], os, prefix + " " );
8282 }
8383 }
8484}
@@ -94,7 +94,7 @@ void print_tree_node(const PrintingTreeNode& node,
9494 * The output file stream to print to.
9595 */
9696void print_tree (const PrintingTree& tree, std::ofstream& os) {
97- print_tree_node (tree.root , os, " " );
97+ print_tree_node_recur (tree.root , os, " " );
9898}
9999
100100/* *
0 commit comments