Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/base/nsINodeList.h
Line
Count
Source (jump to first uncovered line)
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 "nsWrapperCache.h"
11
#include "nsIContent.h"
12
13
// IID for the nsINodeList interface
14
#define NS_INODELIST_IID \
15
{ 0xadb5e54c, 0x6e96, 0x4102, \
16
 { 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,
25
                    public nsWrapperCache
26
{
27
public:
28
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODELIST_IID)
29
30
  /**
31
   * Get the index of the given node in the list.  Will return -1 if the node
32
   * is not in the list.
33
   */
34
  virtual int32_t IndexOf(nsIContent* aContent) = 0;
35
36
  /**
37
   * Get the root node for this nodelist.
38
   */
39
  virtual nsINode* GetParentObject() = 0;
40
41
  virtual uint32_t Length() = 0;
42
  virtual nsIContent* Item(uint32_t aIndex) = 0;
43
  nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound)
44
0
  {
45
0
    nsIContent* item = Item(aIndex);
46
0
    aFound = !!item;
47
0
    return item;
48
0
  }
49
50
};
51
52
NS_DEFINE_STATIC_IID_ACCESSOR(nsINodeList, NS_INODELIST_IID)
53
54
#endif /* nsINodeList_h___ */