Bug 1869043 assert that graph set access is main thread only r=padenot
[gecko.git] / xpcom / ds / nsISimpleEnumerator.idl
blob1a2b47705dbe109ed4175971f816ebdd472cf69b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include "nsISupports.idl"
8 /**
9 * Used to enumerate over elements defined by its implementor.
10 * Although hasMoreElements() can be called independently of getNext(),
11 * getNext() must be pre-ceeded by a call to hasMoreElements(). There is
12 * no way to "reset" an enumerator, once you obtain one.
14 * @version 1.0
17 /**
18 * A wrapper for an nsISimpleEnumerator instance which implements the
19 * JavaScript iteration protocol.
21 [scriptable, uuid(4432e8ae-d4d3-42a6-a4d1-829f1c29512b)]
22 interface nsIJSEnumerator : nsISupports {
23 [symbol]
24 nsIJSEnumerator iterator();
26 [implicit_jscontext]
27 jsval next();
30 [scriptable, uuid(796f340d-0a2a-490b-9c60-640765e99782)]
31 interface nsISimpleEnumeratorBase : nsISupports {
32 /**
33 * Returns a JavaScript iterator for all remaining entries in the enumerator.
34 * Each entry is typically queried to the appropriate interface for the
35 * enumerator.
37 [symbol]
38 nsIJSEnumerator iterator();
40 /**
41 * Returns JavaScript iterator for all remaining entries in the enumerator.
42 * Each entry is queried only to the supplied interface. If any element
43 * fails to query to that interface, the error is propagated to the caller.
45 nsIJSEnumerator entries(in nsIIDRef aIface);
48 [scriptable, uuid(D1899240-F9D2-11D2-BDD6-000064657374)]
49 interface nsISimpleEnumerator : nsISimpleEnumeratorBase {
50 /**
51 * Called to determine whether or not the enumerator has
52 * any elements that can be returned via getNext(). This method
53 * is generally used to determine whether or not to initiate or
54 * continue iteration over the enumerator, though it can be
55 * called without subsequent getNext() calls. Does not affect
56 * internal state of enumerator.
58 * @see getNext()
59 * @return true if there are remaining elements in the enumerator.
60 * false if there are no more elements in the enumerator.
62 boolean hasMoreElements();
64 /**
65 * Called to retrieve the next element in the enumerator. The "next"
66 * element is the first element upon the first call. Must be
67 * pre-ceeded by a call to hasMoreElements() which returns PR_TRUE.
68 * This method is generally called within a loop to iterate over
69 * the elements in the enumerator.
71 * @see hasMoreElements()
72 * @throws NS_ERROR_FAILURE if there are no more elements
73 * to enumerate.
74 * @return the next element in the enumeration.
76 nsISupports getNext();