Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef __nsIContentIterator_h___
7 #define __nsIContentIterator_h___
9 #include "nsISupports.h"
10 #include "nsCOMPtr.h"
12 class nsINode;
13 class nsIDOMRange;
15 #define NS_ICONTENTITERATOR_IID \
16 { 0x2550078e, 0xae87, 0x4914, \
17 { 0xb3, 0x04, 0xe4, 0xd1, 0x46, 0x19, 0x3d, 0x5f } }
19 class nsIContentIterator : public nsISupports
20 {
21 public:
22 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTITERATOR_IID)
24 /* Initializes an iterator for the subtree rooted by the node aRoot
25 */
26 virtual nsresult Init(nsINode* aRoot) = 0;
28 /* Initializes an iterator for the subtree defined by the range aRange
29 Subclasses should make sure they implement both of these!
30 */
31 virtual nsresult Init(nsIDOMRange* aRange) = 0;
33 /** First will reset the list.
34 */
35 virtual void First() = 0;
37 /** Last will reset the list to the end.
38 */
39 virtual void Last() = 0;
41 /** Next will advance the list.
42 */
43 virtual void Next() = 0;
45 /** Prev will decrement the list.
46 */
47 virtual void Prev() = 0;
49 /** CurrentItem will return the current item, or null if the list is empty
50 * @return the current node
51 */
52 virtual nsINode *GetCurrentNode() = 0;
54 /** return if the collection is at the end. that is the beginning following a call to Prev
55 * and it is the end of the list following a call to next
56 * @return if the iterator is done.
57 */
58 virtual bool IsDone() = 0;
60 /** PositionAt will position the iterator to the supplied node
61 */
62 virtual nsresult PositionAt(nsINode* aCurNode) = 0;
63 };
65 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentIterator, NS_ICONTENTITERATOR_IID)
67 already_AddRefed<nsIContentIterator> NS_NewContentIterator();
68 already_AddRefed<nsIContentIterator> NS_NewPreContentIterator();
69 already_AddRefed<nsIContentIterator> NS_NewContentSubtreeIterator();
71 #endif // __nsIContentIterator_h___