add support for a nsISimpleEnumerator implementation for nsCOMArray<T> and nsIArray, and update existing interfaces to support that:

- move nsCOMArray_base's ObjectAt/[]/Count() methods into the public so that nsCOMArrayEnumerator can get to it
- tweak NS_NewArray() to match the existing enumerator NS_New* API
- hook up NS_NewArrayEnumerator to nsArray::Enumerate
Not part of the build, for bug 162115


git-svn-id: svn://10.0.0.236/trunk@130891 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2002-10-01 17:34:25 +00:00
parent 454204cd9e
commit 7a97110e41
5 changed files with 336 additions and 27 deletions

View File

@@ -50,9 +50,23 @@
{ 0x35c66fd1, 0x95e9, 0x4e0a, \
{ 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } }
// create a new, empty array
nsresult NS_COM
NS_NewArray(nsIArray** aResult);
// The resulting array will hold an owning reference to every element
// in the original nsCOMArray<T>. This also means that any further
// changes to the original nsCOMArray<T> will not affect the new
// array, and that the original array can go away and the new array
// will still hold valid elements.
nsresult NS_COM
NS_NewArray(nsIArray** aResult, const nsCOMArray_base& base);
// adapter class to map nsIArray->nsCOMArray
// do NOT declare this as a stack or member variable, use
// nsCOMArray instead
// nsCOMArray instead!
// if you need to convert a nsCOMArray->nsIArray, see NS_NewArray above
class nsArray : public nsIMutableArray
{
public:
@@ -71,13 +85,4 @@ private:
};
// create a new, empty array
nsresult NS_COM
NS_NewArray(nsIArray** aResult);
// makes a copy of an nsCOMArray<T> - any further changes to the base
// array will not affect the new array
nsresult NS_COM
NS_NewArray(const nsCOMArray_base& base, nsIArray** aResult);
#endif