Tenncor
|
#include <tree.hpp>
Public Member Functions | |
PrettyTree (std::function< std::vector< T >(T &)> traverser, std::function< void(std::ostream &, T &)> to_stream) | |
void | print (std::ostream &out, T root) |
Public Attributes | |
size_t | branch_length_ = 2 |
Horizontal length of the branch, by default the branch looks like `–. More... | |
std::function< std::vector< T >T &)> | traverser_ |
Behavior of traversing through a structure. More... | |
std::function< void(std::ostream &, T &)> | to_stream_ |
Behavior of displaying a node in the structure. More... | |
Private Member Functions | |
void | print_helper (std::ostream &out, T root, std::string prefix) |
Generically draw a traversible structure Traversible structure is anything having a parent-children relationship Template argument T defines one node of the traversible structure
|
inline |
Traverser and streamer methods define behavior for traversing through and displaying elements of a generic structure
|
inline |
Given the output stream, and a root to start the traversal, wrap brackets around string representation of each node and connect each node with series of | and `– branches and stream to out
|
inlineprivate |
size_t PrettyTree< T >::branch_length_ = 2 |
Horizontal length of the branch, by default the branch looks like `–.
std::function<void(std::ostream&,T&)> PrettyTree< T >::to_stream_ |
Behavior of displaying a node in the structure.
std::function<std::vector<T>T&)> PrettyTree< T >::traverser_ |
Behavior of traversing through a structure.