Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsPathsDirectoryEnumerator Class Reference
Inheritance diagram for nsPathsDirectoryEnumerator:
Inheritance graph
[legend]
Collaboration diagram for nsPathsDirectoryEnumerator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsPathsDirectoryEnumerator (nsIDirectoryServiceProvider *aProvider, const char *aKeyList[])
 aKeyList is a null-terminated list.
NS_IMETHOD HasMoreElements (PRBool *result)
NS_IMETHOD GetNext (nsISupports **result)
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

const char * mEndPath
nsIDirectoryServiceProvidermProvider
const char ** mCurrentKey
nsCOMPtr< nsIFilemNext

Detailed Description

Definition at line 548 of file nsAppFileLocationProvider.cpp.


Constructor & Destructor Documentation

aKeyList is a null-terminated list.

The first element is a path list. The remainder are properties provided by aProvider. They do not need to be publicly defined keys.

Definition at line 557 of file nsAppFileLocationProvider.cpp.

                                                       :
    nsAppDirectoryEnumerator(aProvider, aKeyList+1),
    mEndPath(aKeyList[0])
    {
    }

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:
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:

NS_IMETHOD nsAppDirectoryEnumerator::GetNext ( nsISupports **  result) [inline, inherited]

Definition at line 507 of file nsAppFileLocationProvider.cpp.

Here is the call 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:

Reimplemented from nsAppDirectoryEnumerator.

Definition at line 564 of file nsAppFileLocationProvider.cpp.

    {
        if (mEndPath)
            while (!mNext && *mEndPath)
            {
                const char *pathVar = mEndPath;
                do { ++mEndPath; } while (*mEndPath && *mEndPath != PATH_SEPARATOR);

                nsCOMPtr<nsILocalFile> localFile;
                NS_NewNativeLocalFile(Substring(pathVar, mEndPath),
                                      PR_TRUE,
                                      getter_AddRefs(localFile));
                if (*mEndPath == PATH_SEPARATOR)
                    ++mEndPath;
                // Don't return a "file" (directory) which does not exist.
                PRBool exists;
                if (localFile &&
                    NS_SUCCEEDED(localFile->Exists(&exists)) &&
                    exists)
                    mNext = localFile;
            }
        if (mNext)
            *result = PR_TRUE;
        else
            nsAppDirectoryEnumerator::HasMoreElements(result);

        return NS_OK;
    }

Here is the call graph for this function:


Member Data Documentation

const char** nsAppDirectoryEnumerator::mCurrentKey [protected, inherited]

Definition at line 533 of file nsAppFileLocationProvider.cpp.

Definition at line 594 of file nsAppFileLocationProvider.cpp.

Definition at line 534 of file nsAppFileLocationProvider.cpp.

Definition at line 532 of file nsAppFileLocationProvider.cpp.


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