content/base/public/nsINodeList.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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: 2; 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 nsINodeList_h___
michael@0 7 #define nsINodeList_h___
michael@0 8
michael@0 9 #include "nsIDOMNodeList.h"
michael@0 10 #include "nsWrapperCache.h"
michael@0 11 #include "nsIContent.h"
michael@0 12
michael@0 13 // IID for the nsINodeList interface
michael@0 14 #define NS_INODELIST_IID \
michael@0 15 { 0xadb5e54c, 0x6e96, 0x4102, \
michael@0 16 { 0x8d, 0x40, 0xe0, 0x12, 0x3d, 0xcf, 0x48, 0x7a } }
michael@0 17
michael@0 18 /**
michael@0 19 * An internal interface for a reasonably fast indexOf.
michael@0 20 */
michael@0 21 class nsINodeList : public nsIDOMNodeList,
michael@0 22 public nsWrapperCache
michael@0 23 {
michael@0 24 public:
michael@0 25 NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
michael@0 26
michael@0 27 /**
michael@0 28 * Get the index of the given node in the list. Will return -1 if the node
michael@0 29 * is not in the list.
michael@0 30 */
michael@0 31 virtual int32_t IndexOf(nsIContent* aContent) = 0;
michael@0 32
michael@0 33 /**
michael@0 34 * Get the root node for this nodelist.
michael@0 35 */
michael@0 36 virtual nsINode* GetParentObject() = 0;
michael@0 37
michael@0 38 using nsIDOMNodeList::Item;
michael@0 39
michael@0 40 uint32_t Length()
michael@0 41 {
michael@0 42 uint32_t length;
michael@0 43 GetLength(&length);
michael@0 44 return length;
michael@0 45 }
michael@0 46 virtual nsIContent* Item(uint32_t aIndex) = 0;
michael@0 47 nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
michael@0 48 {
michael@0 49 nsIContent* item = Item(aIndex);
michael@0 50 aFound = !!item;
michael@0 51 return item;
michael@0 52 }
michael@0 53 };
michael@0 54
michael@0 55 #define NS_NODELIST_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
michael@0 56 NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINodeList)
michael@0 57
michael@0 58 NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
michael@0 59
michael@0 60 #endif /* nsINodeList_h___ */

mercurial