diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-26 18:31:37 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-26 18:31:37 (GMT) |
commit | 6535b16a31cf23d65f9c4c44a2e97dfdcdd69419 (patch) | |
tree | ecca4e1f641cdd5d75716b3ef41ba5ce282b6209 /src/node.cc | |
parent | 6bac08c33a6c5111efe1f322ae8f6628403b3467 (diff) |
enable root-modifier (! character) on gui-cmdline output. reduce duplicate code.
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index e61174f..4baf29a 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,13 @@ std::ostream &operator<<(std::ostream &stream, const AbstractNode &node) stream << node.toString(); return stream; } + +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; +} + |