diff options
Diffstat (limited to 'src/libnix/aterm.hh')
-rw-r--r-- | src/libnix/aterm.hh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libnix/aterm.hh b/src/libnix/aterm.hh index 1e4ee80eeab5..16d8d6bb6dfd 100644 --- a/src/libnix/aterm.hh +++ b/src/libnix/aterm.hh @@ -14,6 +14,28 @@ string atPrint(ATerm t); /* Write an ATerm to an output stream. */ ostream & operator << (ostream & stream, ATerm e); +class ATermIterator +{ + ATermList t; + +public: + ATermIterator(ATermList _t) : t(_t) { } + ATermIterator & operator ++ () + { + t = ATgetNext(t); + return *this; + } + ATerm operator * () + { + return ATgetFirst(t); + } + operator bool () + { + return t != ATempty; + } +}; + + /* Type-safe matching. */ struct ATMatcher |