Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Private Member Functions
nsCOMArrayEnumerator Class Reference
Inheritance diagram for nsCOMArrayEnumerator:
Inheritance graph
Collaboration diagram for nsCOMArrayEnumerator:
Collaboration graph

List of all members.

Public Member Functions

nsCOMArrayEnumerator ()
voidoperator new (size_t size, const nsCOMArray_base &aArray) CPP_THROW_NEW
void operator delete (void *ptr)
boolean hasMoreElements ()
 Called to determine whether or not the enumerator has any elements that can be returned via getNext().
nsISupports getNext ()
 Called to retrieve the next element in the enumerator.

Protected Attributes

PRUint32 mIndex
PRUint32 mArraySize
nsISupports * mValueArray [1]

Private Member Functions

 ~nsCOMArrayEnumerator (void)

Detailed Description

Definition at line 101 of file nsArrayEnumerator.cpp.

Constructor & Destructor Documentation

NS_DECL_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR nsCOMArrayEnumerator::nsCOMArrayEnumerator ( ) [inline]

Definition at line 111 of file nsArrayEnumerator.cpp.

                           : mIndex(0) {

Definition at line 133 of file nsArrayEnumerator.cpp.

    // only release the entries that we haven't visited yet
    for (; mIndex < mArraySize; ++mIndex) {

Member Function Documentation

nsISupports nsISimpleEnumerator::getNext ( ) [inherited]

Called to retrieve the next element in the enumerator.

The "next" element is the first element upon the first call. Must be pre-ceeded by a call to hasMoreElements() which returns PR_TRUE. This method is generally called within a loop to iterate over the elements in the enumerator.

See also:
NS_OK if the call succeeded in returning a non-null value through the out parameter. NS_ERROR_FAILURE if there are no more elements to enumerate.
the next element in the enumeration.

Here is the caller graph for this function:

Called to determine whether or not the enumerator has any elements that can be returned via getNext().

This method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getNext() calls. Does not affect internal state of enumerator.

See also:
PR_TRUE if there are remaining elements in the enumerator. PR_FALSE if there are no more elements in the enumerator.

Here is the caller graph for this function:

void nsCOMArrayEnumerator::operator delete ( void ptr) [inline]

Definition at line 116 of file nsArrayEnumerator.cpp.

        ::operator delete(ptr);
void * nsCOMArrayEnumerator::operator new ( size_t  size,
const nsCOMArray_base aArray 

Definition at line 175 of file nsArrayEnumerator.cpp.

    // create enough space such that mValueArray points to a large
    // enough value. Note that the initial value of size gives us
    // space for mValueArray[0], so we must subtract
    size += (aArray.Count() - 1) * sizeof(aArray[0]);

    // do the actual allocation
    nsCOMArrayEnumerator * result =
        NS_STATIC_CAST(nsCOMArrayEnumerator*, ::operator new(size));

    // now need to copy over the values, and addref each one
    // now this might seem like alot of work, but we're actually just
    // doing all our AddRef's ahead of time since GetNext() doesn't
    // need to AddRef() on the way out
    PRUint32 i;
    PRUint32 max = result->mArraySize = aArray.Count();
    for (i = 0; i<max; i++) {
        result->mValueArray[i] = aArray[i];

    return result;

Member Data Documentation

Definition at line 125 of file nsArrayEnumerator.cpp.

Definition at line 124 of file nsArrayEnumerator.cpp.

nsISupports* nsCOMArrayEnumerator::mValueArray[1] [protected]

Definition at line 128 of file nsArrayEnumerator.cpp.

The documentation for this class was generated from the following file: