Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsInt2StrHashtable Class Reference

#include <nsErrorService.h>

List of all members.

Public Member Functions

 nsInt2StrHashtable ()
nsresult Put (PRUint32 key, const char *aData)
char * Get (PRUint32 key)
nsresult Remove (PRUint32 key)

Protected Attributes

nsObjectHashtable mHashtable

Detailed Description

Definition at line 44 of file nsErrorService.h.


Constructor & Destructor Documentation

Definition at line 54 of file nsErrorService.cpp.


Member Function Documentation

Definition at line 73 of file nsErrorService.cpp.

{
  nsPRUint32Key k(key);
  const char* value = (const char*)mHashtable.Get(&k);
  if (value == nsnull)
    return nsnull;
  return nsCRT::strdup(value);
}
nsresult nsInt2StrHashtable::Put ( PRUint32  key,
const char *  aData 
)

Definition at line 60 of file nsErrorService.cpp.

{
  char* value = nsCRT::strdup(aData);
  if (value == nsnull)
    return NS_ERROR_OUT_OF_MEMORY;
  nsPRUint32Key k(key);
  char* oldValue = (char*)mHashtable.Put(&k, value);
  if (oldValue)
    nsCRT::free(oldValue);
  return NS_OK;
}

Definition at line 83 of file nsErrorService.cpp.

{
  nsPRUint32Key k(key);
  char* oldValue = (char*)mHashtable.Remove(&k);
  if (oldValue)
    nsCRT::free(oldValue);
  return NS_OK;
}

Member Data Documentation

nsObjectHashtable nsInt2StrHashtable::mHashtable [protected]

Definition at line 54 of file nsErrorService.h.


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