| 40 | } |
| 41 | |
| 42 | std::vector<NodeID> nodes_below(const tree::NodeTree &nt, NodeID nid) |
| 43 | { |
| 44 | |
| 45 | if (nid == NodeID::NoNode) |
| 46 | { |
| 47 | throw std::exception(); |
| 48 | } |
| 49 | |
| 50 | std::vector<NodeID> nodes; |
| 51 | |
| 52 | std::stack<NodeID> stk; |
| 53 | |
| 54 | stk.push(nid); |
| 55 | |
| 56 | while (!stk.empty()) |
| 57 | { |
| 58 | const auto n = stk.top(); |
| 59 | stk.pop(); |
| 60 | nodes.push_back(n); |
| 61 | |
| 62 | const auto kids = nt.childrenCount(n); |
| 63 | for (auto alt = 0; alt < kids; ++alt) |
| 64 | { |
| 65 | stk.push(nt.getChild(n, alt)); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return nodes; |
| 70 | } |
| 71 | |
| 72 | void apply_below(const NodeTree &nt, NodeID nid, const NodeAction &action) |
| 73 | { |
no test coverage detected