1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsISimpleEnumerator.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +/** 1.12 + * Used to enumerate over elements defined by its implementor. 1.13 + * Although hasMoreElements() can be called independently of getNext(), 1.14 + * getNext() must be pre-ceeded by a call to hasMoreElements(). There is 1.15 + * no way to "reset" an enumerator, once you obtain one. 1.16 + * 1.17 + * @version 1.0 1.18 + */ 1.19 + 1.20 +[scriptable, uuid(D1899240-F9D2-11D2-BDD6-000064657374)] 1.21 +interface nsISimpleEnumerator : nsISupports { 1.22 + /** 1.23 + * Called to determine whether or not the enumerator has 1.24 + * any elements that can be returned via getNext(). This method 1.25 + * is generally used to determine whether or not to initiate or 1.26 + * continue iteration over the enumerator, though it can be 1.27 + * called without subsequent getNext() calls. Does not affect 1.28 + * internal state of enumerator. 1.29 + * 1.30 + * @see getNext() 1.31 + * @return true if there are remaining elements in the enumerator. 1.32 + * false if there are no more elements in the enumerator. 1.33 + */ 1.34 + boolean hasMoreElements(); 1.35 + 1.36 + /** 1.37 + * Called to retrieve the next element in the enumerator. The "next" 1.38 + * element is the first element upon the first call. Must be 1.39 + * pre-ceeded by a call to hasMoreElements() which returns PR_TRUE. 1.40 + * This method is generally called within a loop to iterate over 1.41 + * the elements in the enumerator. 1.42 + * 1.43 + * @see hasMoreElements() 1.44 + * @throws NS_ERROR_FAILURE if there are no more elements 1.45 + * to enumerate. 1.46 + * @return the next element in the enumeration. 1.47 + */ 1.48 + nsISupports getNext(); 1.49 +};