Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
nsCharPtrHashKey Class Reference

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...

#include <nsHashKeys.h>

Inheritance diagram for nsCharPtrHashKey:
Inheritance graph
[legend]
Collaboration diagram for nsCharPtrHashKey:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { ALLOW_MEMMOVE = PR_TRUE }
typedef const char * KeyType
typedef const char * KeyTypePointer

Public Member Functions

 nsCharPtrHashKey (const char *aKey)
 nsCharPtrHashKey (const nsCharPtrHashKey &toCopy)
 ~nsCharPtrHashKey ()
const char * GetKey () const
const char * GetKeyPointer () const
PRBool KeyEquals (KeyTypePointer aKey) const

Static Public Member Functions

static KeyTypePointer KeyToPointer (KeyType aKey)
static PLDHashNumber HashKey (KeyTypePointer aKey)

Public Attributes

PLDHashNumber keyHash

Private Attributes

const char * mKey

Detailed Description

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.

Definition at line 299 of file nsHashKeys.h.


Member Typedef Documentation

Definition at line 302 of file nsHashKeys.h.

Definition at line 303 of file nsHashKeys.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
ALLOW_MEMMOVE 

Definition at line 319 of file nsHashKeys.h.


Constructor & Destructor Documentation

nsCharPtrHashKey::nsCharPtrHashKey ( const char *  aKey) [inline]

Definition at line 305 of file nsHashKeys.h.

: mKey(strdup(aKey)) { }

Definition at line 306 of file nsHashKeys.h.

: mKey(strdup(toCopy.mKey)) { }

Definition at line 307 of file nsHashKeys.h.

{ if (mKey) free(NS_CONST_CAST(char *, mKey)); }

Member Function Documentation

const char* nsCharPtrHashKey::GetKey ( void  ) const [inline]

Definition at line 309 of file nsHashKeys.h.

{ return mKey; }
const char* nsCharPtrHashKey::GetKeyPointer ( ) const [inline]

Definition at line 310 of file nsHashKeys.h.

{ return mKey; }
static PLDHashNumber nsCharPtrHashKey::HashKey ( KeyTypePointer  aKey) [inline, static]

Definition at line 317 of file nsHashKeys.h.

{ return HashCString(aKey); }

Here is the call graph for this function:

Definition at line 311 of file nsHashKeys.h.

  {
    return !strcmp(mKey, aKey);
  }
static KeyTypePointer nsCharPtrHashKey::KeyToPointer ( KeyType  aKey) [inline, static]

Definition at line 316 of file nsHashKeys.h.

{ return aKey; }

Member Data Documentation

Definition at line 113 of file pldhash.h.

const char* nsCharPtrHashKey::mKey [private]

Definition at line 322 of file nsHashKeys.h.


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