Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
PLDHashTableEnumeratorImpl Class Reference
Inheritance diagram for PLDHashTableEnumeratorImpl:
Inheritance graph
[legend]
Collaboration diagram for PLDHashTableEnumeratorImpl:
Collaboration graph
[legend]

List of all members.

Classes

struct  Closure

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIENUMERATOR
NS_DECL_NSIBIDIRECTIONALENUMERATOR
NS_DECL_NSISIMPLEENUMERATOR 
PLDHashTableEnumeratorImpl (PLDHashTable *table, EnumeratorConverter converter, void *converterData)
PRInt32 Count ()
void last ()
 Last will reset the list to the end.
void prev ()
 Prev will decrement the list.
void first ()
 First will reset the list.
void next ()
 Next will advance the list.
nsISupports currentItem ()
 CurrentItem will return the CurrentItem item it will fail if the list is empty.
void isDone ()
 return if the collection is at the end.
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.

Private Member Functions

 PLDHashTableEnumeratorImpl ()
 ~PLDHashTableEnumeratorImpl ()
NS_IMETHODIMP ReleaseElements ()

Static Private Member Functions

static PLDHashOperator PR_CALLBACK Enumerator (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *data)

Private Attributes

nsVoidArray mElements
PRInt32 mCount
PRInt32 mCurrent
PRMonitormMonitor

Detailed Description

Definition at line 431 of file nsComponentManager.cpp.


Class Documentation

struct PLDHashTableEnumeratorImpl::Closure

Definition at line 454 of file nsComponentManager.cpp.

Collaboration diagram for PLDHashTableEnumeratorImpl::Closure:
Class Members
EnumeratorConverter converter
void * data
PLDHashTableEnumeratorImpl * impl
PRBool succeeded

Constructor & Destructor Documentation

Definition at line 486 of file nsComponentManager.cpp.

: mCurrent(0)
{
    mMonitor = nsAutoMonitor::NewMonitor("PLDHashTableEnumeratorImpl");
    NS_ASSERTION(mMonitor, "NULL Monitor");

    nsAutoMonitor mon(mMonitor);

    Closure c = { PR_FALSE, converter, converterData, this };
    mCount = PL_DHashTableEnumerate(table, Enumerator, &c);
    if (!c.succeeded) {
        ReleaseElements();
        mCount = 0;
    }
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 443 of file nsComponentManager.cpp.

{ return mCount; }

Here is the caller graph for this function:

nsISupports nsIEnumerator::currentItem ( ) [inherited]

CurrentItem will return the CurrentItem item it will fail if the list is empty.

PLDHashOperator PR_CALLBACK PLDHashTableEnumeratorImpl::Enumerator ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void data 
) [static, private]

Definition at line 469 of file nsComponentManager.cpp.

{
    Closure *c = NS_REINTERPRET_CAST(Closure *, data);
    nsISupports *converted;
    if (NS_FAILED(c->converter(table, hdr, c->data, &converted)) ||
        !c->impl->mElements.AppendElement(converted)) {
        c->succeeded = PR_FALSE;
        return PL_DHASH_STOP;
    }

    c->succeeded = PR_TRUE;
    return PL_DHASH_NEXT;
}

Here is the caller graph for this function:

void nsIEnumerator::first ( ) [inherited]

First will reset the list.

will return NS_FAILED if no items

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:
hasMoreElements()
Returns:
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:
getNext()
Returns:
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 nsIEnumerator::isDone ( ) [inherited]

return if the collection is at the end.

that is the beginning following a call to Prev and it is the end of the list following a call to next

Last will reset the list to the end.

will return NS_FAILED if no items

void nsIEnumerator::next ( ) [inherited]

Next will advance the list.

will return failed if already at end

Prev will decrement the list.

will return failed if already at beginning

Definition at line 519 of file nsComponentManager.cpp.

{
    for (PRInt32 i = 0; i < mCount; i++) {
        nsISupports *supports = NS_REINTERPRET_CAST(nsISupports *,
                                                    mElements[i]);
        NS_IF_RELEASE(supports);
    }
    return NS_OK;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 451 of file nsComponentManager.cpp.

Definition at line 451 of file nsComponentManager.cpp.

Definition at line 450 of file nsComponentManager.cpp.

Definition at line 452 of file nsComponentManager.cpp.


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