Back to index

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

List of all members.

Public Member Functions

 nsGroupsEnumerator (nsHashtable &inHashTable)
virtual ~nsGroupsEnumerator ()
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

nsresult Initialize ()

Static Protected Member Functions

static PRBool PR_CALLBACK HashEnum (nsHashKey *aKey, void *aData, void *aClosure)

Protected Attributes

nsHashtable & mHashTable
PRInt32 mIndex
char ** mGroupNames
PRBool mInitted

Detailed Description

Definition at line 51 of file nsCommandGroup.cpp.


Constructor & Destructor Documentation

nsGroupsEnumerator::nsGroupsEnumerator ( nsHashtable &  inHashTable)

Definition at line 78 of file nsCommandGroup.cpp.

: mHashTable(inHashTable)
, mIndex(-1)
, mGroupNames(nsnull)
, mInitted(PR_FALSE)
{
  /* member initializers and constructor code */
}

Definition at line 87 of file nsCommandGroup.cpp.

{
  delete [] mGroupNames;    // ok on null pointer
}

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:

PRBool nsGroupsEnumerator::HashEnum ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static, protected]

Definition at line 138 of file nsCommandGroup.cpp.

{
  nsGroupsEnumerator*   groupsEnum = NS_REINTERPRET_CAST(nsGroupsEnumerator *, aClosure);
  nsCStringKey*         stringKey = NS_STATIC_CAST(nsCStringKey*, aKey);
  
  groupsEnum->mGroupNames[groupsEnum->mIndex] = (char*)stringKey->GetString();
  groupsEnum->mIndex ++;
  return PR_TRUE;
}

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:

Definition at line 149 of file nsCommandGroup.cpp.

{
  if (mInitted) return NS_OK;
  
  mGroupNames = new char*[mHashTable.Count()];
  if (!mGroupNames) return NS_ERROR_OUT_OF_MEMORY;
  
  mIndex = 0; 
  mHashTable.Enumerate(HashEnum, (void*)this);

  mIndex = -1;
  mInitted = PR_TRUE;
  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

char** nsGroupsEnumerator::mGroupNames [protected]

Definition at line 70 of file nsCommandGroup.cpp.

nsHashtable& nsGroupsEnumerator::mHashTable [protected]

Definition at line 68 of file nsCommandGroup.cpp.

Definition at line 69 of file nsCommandGroup.cpp.

Definition at line 71 of file nsCommandGroup.cpp.


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