diff options
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index e61174f..a7a7630 100644 --- a/src/node.cc +++ b/src/node.cc @@ -32,6 +32,7 @@ #include <iostream> #include <algorithm> +#include <boost/foreach.hpp> size_t AbstractNode::idx_counter; @@ -101,3 +102,14 @@ std::ostream &operator<<(std::ostream &stream, const AbstractNode &node) stream << node.toString(); return stream; } + +// Do we have an explicit root node (! modifier)? +AbstractNode *find_root_tag(AbstractNode *n) +{ + BOOST_FOREACH(AbstractNode *v, n->children) { + if (v->modinst->tag_root) return v; + if (AbstractNode *vroot = find_root_tag(v)) return vroot; + } + return NULL; +} + |