------------------------------------------------------------------------------------------------ Find a node with a specific name in the import hierarchy
| 554 | // ------------------------------------------------------------------------------------------------ |
| 555 | // Find a node with a specific name in the import hierarchy |
| 556 | Node *FindNode(Node *root, const std::string &name) { |
| 557 | if (root->mName == name) { |
| 558 | return root; |
| 559 | } |
| 560 | |
| 561 | for (auto it = root->mChildren.begin(); it != root->mChildren.end(); ++it) { |
| 562 | if (auto *nd = FindNode(*it, name); nullptr != nd) { |
| 563 | return nd; |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | return nullptr; |
| 568 | } |
| 569 | |
| 570 | // ------------------------------------------------------------------------------------------------ |
| 571 | // Binary predicate for std::unique() |
no test coverage detected