| 49 | } |
| 50 | |
| 51 | void Trie::Dump(const Node* node, const std::string& indent) const { |
| 52 | std::cerr << "[\"" << node->substring_ << "\"]"; |
| 53 | if (node->found_index_ >= 0) { |
| 54 | std::cerr << " *"; |
| 55 | } |
| 56 | std::cerr << "\n"; |
| 57 | if (node->child_lookup_ >= 0) { |
| 58 | auto child_indent = indent + " "; |
| 59 | std::cerr << child_indent << "|\n"; |
| 60 | for (fast_index_type i = 0; i < 256; ++i) { |
| 61 | auto child_index = lookup_table_[node->child_lookup_ * 256 + i]; |
| 62 | if (child_index >= 0) { |
| 63 | const Node* child = &nodes_[child_index]; |
| 64 | std::cerr << child_indent << "|-> '" << static_cast<char>(i) << "' (" << i |
| 65 | << ") -> "; |
| 66 | Dump(child, child_indent); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void Trie::Dump() const { Dump(&nodes_[0], ""); } |
| 73 |
nothing calls this directly
no outgoing calls
no test coverage detected