nsINodeList.h (1342B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsINodeList_h___ 8 #define nsINodeList_h___ 9 10 #include "nsIContent.h" 11 #include "nsISupports.h" 12 #include "nsWrapperCache.h" 13 14 // IID for the nsINodeList interface 15 #define NS_INODELIST_IID \ 16 {0xadb5e54c, 0x6e96, 0x4102, {0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a}} 17 18 class nsIContent; 19 class nsINode; 20 21 /** 22 * An internal interface for a reasonably fast indexOf. 23 */ 24 class nsINodeList : public nsISupports, public nsWrapperCache { 25 public: 26 NS_INLINE_DECL_STATIC_IID(NS_INODELIST_IID) 27 28 /** 29 * Get the index of the given node in the list. Will return -1 if the node 30 * is not in the list. 31 */ 32 virtual int32_t IndexOf(nsIContent* aContent) = 0; 33 34 /** 35 * Get the root node for this nodelist. 36 */ 37 virtual nsINode* GetParentObject() = 0; 38 39 virtual uint32_t Length() = 0; 40 virtual nsIContent* Item(uint32_t aIndex) = 0; 41 nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound) { 42 nsIContent* item = Item(aIndex); 43 aFound = !!item; 44 return item; 45 } 46 }; 47 48 #endif /* nsINodeList_h___ */