]> git.decadent.org.uk Git - videolink.git/blob - link_iterator.hpp
Release versions 1.2.11 and 1.2.11-1
[videolink.git] / link_iterator.hpp
1 // Copyright 2005 Ben Hutchings <ben@decadent.org.uk>.
2 // See the file "COPYING" for licence details.
3
4 #ifndef INC_LINK_ITERATOR_HPP
5 #define INC_LINK_ITERATOR_HPP
6
7 #include <iterator>
8
9 #include "wchar_t_short.h"
10 #include <nsCOMPtr.h>
11 #include <nsIDOMHTMLCollection.h>
12 #include <nsIDOMNode.h>
13 #include "wchar_t_default.h"
14
15 class nsIDOMDocument;
16
17 class link_iterator
18     : public std::iterator<std::input_iterator_tag, nsCOMPtr<nsIDOMNode>,
19                            void, void, void>
20 {
21 public:
22     link_iterator();
23     explicit link_iterator(nsIDOMDocument * document);
24
25     already_AddRefed<nsIDOMNode> operator*() const;
26     link_iterator & operator++();
27     bool operator==(const link_iterator &) const;
28     bool operator!=(const link_iterator & other) const
29         {
30             return !(*this == other);
31         }
32
33 private:
34     nsCOMPtr<nsIDOMHTMLCollection> collection_;
35     unsigned int index_, length_;
36 };
37
38 #endif // !INC_LINK_ITERATOR_HPP