|
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/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
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. |
|
13 * |
|
14 * @version 1.0 |
|
15 */ |
|
16 |
|
17 [scriptable, uuid(D1899240-F9D2-11D2-BDD6-000064657374)] |
|
18 interface nsISimpleEnumerator : nsISupports { |
|
19 /** |
|
20 * Called to determine whether or not the enumerator has |
|
21 * any elements that can be returned via getNext(). This method |
|
22 * is generally used to determine whether or not to initiate or |
|
23 * continue iteration over the enumerator, though it can be |
|
24 * called without subsequent getNext() calls. Does not affect |
|
25 * internal state of enumerator. |
|
26 * |
|
27 * @see getNext() |
|
28 * @return true if there are remaining elements in the enumerator. |
|
29 * false if there are no more elements in the enumerator. |
|
30 */ |
|
31 boolean hasMoreElements(); |
|
32 |
|
33 /** |
|
34 * Called to retrieve the next element in the enumerator. The "next" |
|
35 * element is the first element upon the first call. Must be |
|
36 * pre-ceeded by a call to hasMoreElements() which returns PR_TRUE. |
|
37 * This method is generally called within a loop to iterate over |
|
38 * the elements in the enumerator. |
|
39 * |
|
40 * @see hasMoreElements() |
|
41 * @throws NS_ERROR_FAILURE if there are no more elements |
|
42 * to enumerate. |
|
43 * @return the next element in the enumeration. |
|
44 */ |
|
45 nsISupports getNext(); |
|
46 }; |