| 222 | |
| 223 | template <typename Data> |
| 224 | void Print(types::Ptr<Data> const & node, std::ostream & stream, std::string prefix = "", bool isTail = true) |
| 225 | { |
| 226 | stream << prefix; |
| 227 | if (isTail) |
| 228 | { |
| 229 | stream << "└───"; |
| 230 | prefix += " "; |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | stream << "├───"; |
| 235 | prefix += "│ "; |
| 236 | } |
| 237 | auto str = DebugPrint(node->GetData()); |
| 238 | std::replace(std::begin(str), std::end(str), '\n', '|'); |
| 239 | stream << str << '\n'; |
| 240 | auto const & children = node->GetChildren(); |
| 241 | size_t size = children.size(); |
| 242 | for (size_t i = 0; i < size; ++i) |
| 243 | Print(children[i], stream, prefix, i == size - 1 /* isTail */); |
| 244 | } |
| 245 | |
| 246 | template <typename Data> |
| 247 | std::string DebugPrint(types::Ptr<Data> const & node) |
no test coverage detected