summaryrefslogtreecommitdiff
path: root/src/domhelpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/domhelpers.h')
-rw-r--r--src/domhelpers.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/domhelpers.h b/src/domhelpers.h
index d125f80..fd386f8 100644
--- a/src/domhelpers.h
+++ b/src/domhelpers.h
@@ -113,11 +113,11 @@ class ElementIterator
{
public:
ElementIterator()
- { m_current = NULL; }
+ { m_flags = AFTER_LAST; }
ElementIterator(const DOM::Element& top)
- { m_top = top; m_current = top; next(); }
+ { m_top = top; m_flags = BEFORE_FIRST; next(); }
ElementIterator(const ElementIterator& x)
- { m_top = x.m_top; m_current = x.m_current; }
+ { m_top = x.m_top; m_current = x.m_current; m_flags = x.m_flags; }
const DOM::Element& operator*() const
{ return m_current; }
@@ -144,14 +144,21 @@ protected:
// Data
protected:
+ enum
+ {
+ ITERATING,
+ BEFORE_FIRST,
+ AFTER_LAST
+ };
+
DOM::Element m_top;
DOM::Element m_current;
- bool m_done;
+ int m_flags;
};
// friend functions
inline bool operator==(const ElementIterator& x, const ElementIterator& y)
- { return y.m_current == x.m_current && y.m_top == x.m_top; }
+ { return y.m_current == x.m_current && y.m_flags == x.m_flags; }
inline bool operator!=(const ElementIterator& x, const ElementIterator& y)
{ return (!(x == y)); }