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 nsArrayEnumerator_h__
8 #define nsArrayEnumerator_h__
9 
10 // enumerator implementation for nsIArray
11 
12 #include "nscore.h"
13 
14 class nsISimpleEnumerator;
15 class nsIArray;
16 class nsCOMArray_base;
17 
18 // Create an enumerator for an existing nsIArray implementation
19 // The enumerator holds an owning reference to the array.
20 nsresult
21 NS_NewArrayEnumerator(nsISimpleEnumerator** aResult,
22                       nsIArray* aArray);
23 
24 // create an enumerator for an existing nsCOMArray<T> implementation
25 // The enumerator will hold an owning reference to each ELEMENT in
26 // the array. This means that the nsCOMArray<T> can safely go away
27 // without its objects going away.
28 nsresult
29 NS_NewArrayEnumerator(nsISimpleEnumerator** aResult,
30                       const nsCOMArray_base& aArray);
31 
32 #endif
33