Back to index

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsPermissionEnumerator (const nsTHashtable< nsHostEntry > *aHostTable, const char **aHostList, const PRUint32 aHostCount, const char **aTypeArray)
NS_IMETHOD HasMoreElements (PRBool *aResult)
NS_IMETHOD GetNext (nsISupports **aResult)
virtual ~nsPermissionEnumerator ()
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 Member Functions

void Prefetch ()

Protected Attributes

PRInt32 mHostCount
PRInt32 mHostIndex
PRInt32 mTypeIndex
const nsTHashtable< nsHostEntry > * mHostTable
const char ** mHostList
nsCOMPtr< nsIPermissionmNextPermission
const char ** mTypeArray

Detailed Description

Definition at line 87 of file nsPermissionManager.cpp.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS nsPermissionEnumerator::nsPermissionEnumerator ( const nsTHashtable< nsHostEntry > *  aHostTable,
const char **  aHostList,
const PRUint32  aHostCount,
const char **  aTypeArray 
) [inline]

Definition at line 92 of file nsPermissionManager.cpp.

      : mHostCount(aHostCount),
        mHostIndex(0),
        mTypeIndex(0),
        mHostTable(aHostTable),
        mHostList(aHostList),
        mTypeArray(aTypeArray)
    {
      Prefetch();
    }

Here is the call graph for this function:

virtual nsPermissionEnumerator::~nsPermissionEnumerator ( ) [inline, virtual]

Definition at line 125 of file nsPermissionManager.cpp.

    {
      delete[] mHostList;
    }

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 nsPermissionEnumerator::GetNext ( nsISupports **  aResult) [inline]

Definition at line 112 of file nsPermissionManager.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:

Definition at line 106 of file nsPermissionManager.cpp.

    {
      *aResult = (mNextPermission != nsnull);
      return NS_OK;
    }

Definition at line 148 of file nsPermissionManager.cpp.

{
  // init to null, so we know when we've prefetched something
  mNextPermission = nsnull;

  // check we have something more to get
  PRUint32 permission;
  while (mHostIndex < mHostCount && !mNextPermission) {
    // loop over the types to find it
    nsHostEntry *entry = mHostTable->GetEntry(mHostList[mHostIndex]);
    if (entry) {
      // see if we've found it
      permission = entry->GetPermission(mTypeIndex);
      if (permission != nsIPermissionManager::UNKNOWN_ACTION && mTypeArray[mTypeIndex]) {
        mNextPermission = new nsPermission(entry->GetHost(), 
                                           nsDependentCString(mTypeArray[mTypeIndex]),
                                           permission);
      }
    }

    // increment mTypeIndex/mHostIndex as required
    ++mTypeIndex;
    if (mTypeIndex == NUMBER_OF_TYPES) {
      mTypeIndex = 0;
      ++mHostIndex;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file nsPermissionManager.cpp.

Definition at line 134 of file nsPermissionManager.cpp.

Definition at line 138 of file nsPermissionManager.cpp.

Definition at line 137 of file nsPermissionManager.cpp.

Definition at line 139 of file nsPermissionManager.cpp.

Definition at line 140 of file nsPermissionManager.cpp.

Definition at line 135 of file nsPermissionManager.cpp.


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