diff options
Diffstat (limited to 'src/tasktree.cc')
-rw-r--r-- | src/tasktree.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tasktree.cc b/src/tasktree.cc index e44efee..6e36974 100644 --- a/src/tasktree.cc +++ b/src/tasktree.cc @@ -182,6 +182,23 @@ void TaskTree::insertChild(node_t* parent, node_t* child) { child->parent = parent; } +static void printNode(node_t* node, std::string prefix) { + if(!node) return; + task_t t = node->data; + printf("%s/%u - %s\n", prefix.c_str(), t.id, t.title.c_str()); + char buf[4096]; + sprintf(buf, "%s/%u - %s", prefix.c_str(), t.id, t.title.c_str()); + + NodeList::iterator it; + for(it = node->children.begin(); it != node->children.end(); it++) { + node_t* child = *it; + printNode(child, buf); + } +} + +void TaskTree::toStdOut() { + printNode(root, "/"); +} #ifdef TEST_TASKTREE |