diff options
Diffstat (limited to 'src/expr/node.h')
-rw-r--r-- | src/expr/node.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/expr/node.h b/src/expr/node.h index 222185e8c..1fc583118 100644 --- a/src/expr/node.h +++ b/src/expr/node.h @@ -468,6 +468,34 @@ public: } /** + * Returns the iterator pointing to the first child. + * @return the iterator + */ + template <Kind kind> + inline iterator begin() { + if(!ref_count) { + Assert( d_nv->d_rc > 0, "TNode pointing to an expired NodeValue" ); + } + + return d_nv->begin< NodeTemplate<ref_count>, kind >(); + } + + /** + * Returns the iterator pointing to the end of the children (one beyond the + * last one. + * @return the end of the children iterator. + */ + template <Kind kind> + inline iterator end() { + if(!ref_count) { + Assert( d_nv->d_rc > 0, "TNode pointing to an expired NodeValue" ); + } + + return d_nv->end< NodeTemplate<ref_count>, kind >(); + } + + + /** * Returns the const_iterator pointing to the first child. * @return the const_iterator */ @@ -493,6 +521,33 @@ public: } /** + * Returns the const_iterator pointing to the first child. + * @return the const_iterator + */ + template <Kind kind> + inline const_iterator begin() const { + if(!ref_count) { + Assert( d_nv->d_rc > 0, "TNode pointing to an expired NodeValue" ); + } + + return d_nv->begin< NodeTemplate<ref_count>, kind >(); + } + + /** + * Returns the const_iterator pointing to the end of the children (one + * beyond the last one. + * @return the end of the children const_iterator. + */ + template <Kind kind> + inline const_iterator end() const { + if(!ref_count) { + Assert( d_nv->d_rc > 0, "TNode pointing to an expired NodeValue" ); + } + + return d_nv->end< NodeTemplate<ref_count>, kind >(); + } + + /** * Converts this node into a string representation. * @return the string representation of this node. */ |