Logo Search packages:      
Sourcecode: xulrunner-1.9 version File versions

template<class KeyClass, class Interface>
PRBool nsInterfaceHashtable< KeyClass, Interface >::Get ( KeyType  aKey,
UserDataType *  pData 
) const [inline]

retrieve the value for a key.

Parameters:
aKey the key to retreive
pData data associated with this key will be placed at this pointer. If you only need to check if the key exists, pData may be null.
Returns:
PR_TRUE if the key exists. If key does not exist, pData is not modified.
Parameters:
pData This is an XPCOM getter, so pData is already_addrefed. If the key doesn't exist, pData will be set to nsnull.

Definition at line 111 of file nsInterfaceHashtable.h.

Referenced by nsXULDocument::DoneWalking().

{
  typename nsBaseHashtable<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent =
    GetEntry(aKey);

  if (ent)
  {
    if (pInterface)
    {
      *pInterface = ent->mData;

      NS_IF_ADDREF(*pInterface);
    }

    return PR_TRUE;
  }

  // if the key doesn't exist, set *pInterface to null
  // so that it is a valid XPCOM getter
  if (pInterface)
    *pInterface = nsnull;

  return PR_FALSE;
}


Generated by  Doxygen 1.6.0   Back to index