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