]> git.decadent.org.uk Git - videolink.git/blobdiff - link_iterator.hpp
Renamed various types to fit lower_case_with_underscores convention.
[videolink.git] / link_iterator.hpp
diff --git a/link_iterator.hpp b/link_iterator.hpp
new file mode 100644 (file)
index 0000000..d2b7a1a
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2005 Ben Hutchings <ben@decadentplace.org.uk>.
+// See the file "COPYING" for licence details.
+
+#ifndef INC_LINK_ITERATOR_HPP
+#define INC_LINK_ITERATOR_HPP
+
+#include <iterator>
+
+#include <nsCOMPtr.h>
+#include <nsIDOMHTMLCollection.h>
+#include <nsIDOMNode.h>
+
+class nsIDOMDocument;
+
+class link_iterator
+    : public std::iterator<std::input_iterator_tag, nsCOMPtr<nsIDOMNode>,
+                          void, void, void>
+{
+public:
+    link_iterator();
+    explicit link_iterator(nsIDOMDocument * document);
+
+    already_AddRefed<nsIDOMNode> operator*() const;
+    link_iterator & operator++();
+    bool operator==(const link_iterator &) const;
+    bool operator!=(const link_iterator & other) const
+       {
+           return !(*this == other);
+       }
+
+private:
+    nsCOMPtr<nsIDOMHTMLCollection> collection_;
+    unsigned int index_, length_;
+};
+
+#endif // !INC_LINK_ITERATOR_HPP