Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsHashKeys.h File Reference

standard HashKey classes for nsBaseHashtable and relatives. More...

#include "nsID.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
#include "pldhash.h"
#include "nsStringAPI.h"
#include <stdlib.h>
#include <string.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nsStringHashKey
 hashkey wrapper using nsAString KeyType More...
class  nsCStringHashKey
 hashkey wrapper using nsACString KeyType More...
class  nsUint32HashKey
 hashkey wrapper using PRUint32 KeyType More...
class  nsISupportsHashKey
 hashkey wrapper using nsISupports* KeyType More...
class  nsVoidPtrHashKey
 hashkey wrapper using void* KeyType More...
class  nsIDHashKey
 hashkey wrapper using nsID KeyType More...
class  nsDepCharHashKey
 hashkey wrapper for "dependent" const char*; this class does not "own" its string pointer. More...
class  nsCharPtrHashKey
 hashkey wrapper for const char*; at construction, this class duplicates a string pointed to by the pointer so that it doesn't matter whether or not the string lives longer than the hash table. More...

Functions

NS_COM_GLUE PRUint32 HashString (const nsAString &aStr)
NS_COM_GLUE PRUint32 HashString (const nsACString &aStr)
NS_COM_GLUE PRUint32 HashCString (const char *aKey)

Detailed Description

standard HashKey classes for nsBaseHashtable and relatives.

Each of these classes follows the nsTHashtable::EntryType specification

Lightweight keytypes provided here: nsStringHashKey nsCStringHashKey nsUint32HashKey nsISupportsHashKey nsIDHashKey nsDepCharHashKey

Definition in file nsHashKeys.h.


Function Documentation

Definition at line 88 of file nsTHashtable.cpp.

{
  PRUint32 code = 0;

  while (*str) {
    code = (code>>28) ^ (code<<4) ^ PRUint32(*str);
    ++str;
  }

  return code;
}

Here is the caller graph for this function:

NS_COM_GLUE PRUint32 HashString ( const nsAString &  aStr)

Definition at line 42 of file nsTHashtable.cpp.

{
  PRUint32 code = 0;

#ifdef MOZILLA_INTERNAL_API
  nsAString::const_iterator begin, end;
  aStr.BeginReading(begin);
  aStr.EndReading(end);
#else
  const PRUnichar *begin, *end;
  PRUint32 len = NS_StringGetData(aStr, &begin);
  end = begin + len;
#endif

  while (begin != end) {
    code = (code>>28) ^ (code<<4) ^ PRUint32(*begin);
    ++begin;
  }

  return code;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM_GLUE PRUint32 HashString ( const nsACString &  aStr)

Definition at line 65 of file nsTHashtable.cpp.

{
  PRUint32 code = 0;

#ifdef MOZILLA_INTERNAL_API
  nsACString::const_iterator begin, end;
  aStr.BeginReading(begin);
  aStr.EndReading(end);
#else
  const char *begin, *end;
  PRUint32 len = NS_CStringGetData(aStr, &begin);
  end = begin + len;
#endif

  while (begin != end) {
    code = (code>>28) ^ (code<<4) ^ PRUint32(*begin);
    ++begin;
  }

  return code;
}

Here is the call graph for this function: