michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsTHashKeys_h__ michael@0: #define nsTHashKeys_h__ michael@0: michael@0: #include "nsID.h" michael@0: #include "nsISupports.h" michael@0: #include "nsIHashable.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "pldhash.h" michael@0: #include michael@0: michael@0: #include "nsStringGlue.h" michael@0: #include "nsCRTGlue.h" michael@0: #include "nsUnicharUtils.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "mozilla/HashFunctions.h" michael@0: #include "mozilla/Move.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: // These are defined analogously to the HashString overloads in mfbt. michael@0: michael@0: inline uint32_t michael@0: HashString(const nsAString& aStr) michael@0: { michael@0: return HashString(aStr.BeginReading(), aStr.Length()); michael@0: } michael@0: michael@0: inline uint32_t michael@0: HashString(const nsACString& aStr) michael@0: { michael@0: return HashString(aStr.BeginReading(), aStr.Length()); michael@0: } michael@0: michael@0: } // namespace mozilla michael@0: michael@0: /** @file nsHashKeys.h michael@0: * standard HashKey classes for nsBaseHashtable and relatives. Each of these michael@0: * classes follows the nsTHashtable::EntryType specification michael@0: * michael@0: * Lightweight keytypes provided here: michael@0: * nsStringHashKey michael@0: * nsCStringHashKey michael@0: * nsUint32HashKey michael@0: * nsUint64HashKey michael@0: * nsFloatHashKey michael@0: * nsPtrHashkey michael@0: * nsClearingPtrHashKey michael@0: * nsVoidPtrHashKey michael@0: * nsClearingVoidPtrHashKey michael@0: * nsISupportsHashKey michael@0: * nsIDHashKey michael@0: * nsDepCharHashKey michael@0: * nsCharPtrHashKey michael@0: * nsUnicharPtrHashKey michael@0: * nsHashableHashKey michael@0: * nsGenericHashKey michael@0: */ michael@0: michael@0: /** michael@0: * hashkey wrapper using nsAString KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsStringHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const nsAString& KeyType; michael@0: typedef const nsAString* KeyTypePointer; michael@0: michael@0: nsStringHashKey(KeyTypePointer aStr) : mStr(*aStr) { } michael@0: nsStringHashKey(const nsStringHashKey& toCopy) : mStr(toCopy.mStr) { } michael@0: ~nsStringHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mStr; } michael@0: bool KeyEquals(const KeyTypePointer aKey) const michael@0: { michael@0: return mStr.Equals(*aKey); michael@0: } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(const KeyTypePointer aKey) michael@0: { michael@0: return mozilla::HashString(*aKey); michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const nsString mStr; michael@0: }; michael@0: michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: michael@0: /** michael@0: * hashkey wrapper using nsAString KeyType michael@0: * michael@0: * This is internal-API only because nsCaseInsensitiveStringComparator is michael@0: * internal-only. michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsStringCaseInsensitiveHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const nsAString& KeyType; michael@0: typedef const nsAString* KeyTypePointer; michael@0: michael@0: nsStringCaseInsensitiveHashKey(KeyTypePointer aStr) : mStr(*aStr) { } //take it easy just deal HashKey michael@0: nsStringCaseInsensitiveHashKey(const nsStringCaseInsensitiveHashKey& toCopy) : mStr(toCopy.mStr) { } michael@0: ~nsStringCaseInsensitiveHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mStr; } michael@0: bool KeyEquals(const KeyTypePointer aKey) const michael@0: { michael@0: return mStr.Equals(*aKey, nsCaseInsensitiveStringComparator()); michael@0: } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(const KeyTypePointer aKey) michael@0: { michael@0: nsAutoString tmKey(*aKey); michael@0: ToLowerCase(tmKey); michael@0: return mozilla::HashString(tmKey); michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const nsString mStr; michael@0: }; michael@0: michael@0: #endif michael@0: michael@0: /** michael@0: * hashkey wrapper using nsACString KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsCStringHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const nsACString& KeyType; michael@0: typedef const nsACString* KeyTypePointer; michael@0: michael@0: nsCStringHashKey(const nsACString* aStr) : mStr(*aStr) { } michael@0: nsCStringHashKey(const nsCStringHashKey& toCopy) : mStr(toCopy.mStr) { } michael@0: ~nsCStringHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mStr; } michael@0: michael@0: bool KeyEquals(KeyTypePointer aKey) const { return mStr.Equals(*aKey); } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) michael@0: { michael@0: return mozilla::HashString(*aKey); michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const nsCString mStr; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using uint32_t KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsUint32HashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const uint32_t& KeyType; michael@0: typedef const uint32_t* KeyTypePointer; michael@0: michael@0: nsUint32HashKey(KeyTypePointer aKey) : mValue(*aKey) { } michael@0: nsUint32HashKey(const nsUint32HashKey& toCopy) : mValue(toCopy.mValue) { } michael@0: ~nsUint32HashKey() { } michael@0: michael@0: KeyType GetKey() const { return mValue; } michael@0: bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return *aKey; } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const uint32_t mValue; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using uint64_t KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsUint64HashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const uint64_t& KeyType; michael@0: typedef const uint64_t* KeyTypePointer; michael@0: michael@0: nsUint64HashKey(KeyTypePointer aKey) : mValue(*aKey) { } michael@0: nsUint64HashKey(const nsUint64HashKey& toCopy) : mValue(toCopy.mValue) { } michael@0: ~nsUint64HashKey() { } michael@0: michael@0: KeyType GetKey() const { return mValue; } michael@0: bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return PLDHashNumber(*aKey); } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const uint64_t mValue; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using float KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsFloatHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const float& KeyType; michael@0: typedef const float* KeyTypePointer; michael@0: michael@0: nsFloatHashKey(KeyTypePointer aKey) : mValue(*aKey) { } michael@0: nsFloatHashKey(const nsFloatHashKey& toCopy) : mValue(toCopy.mValue) { } michael@0: ~nsFloatHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mValue; } michael@0: bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return *reinterpret_cast(aKey); } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const float mValue; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using nsISupports* KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsISupportsHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef nsISupports* KeyType; michael@0: typedef const nsISupports* KeyTypePointer; michael@0: michael@0: nsISupportsHashKey(const nsISupports* key) : michael@0: mSupports(const_cast(key)) { } michael@0: nsISupportsHashKey(const nsISupportsHashKey& toCopy) : michael@0: mSupports(toCopy.mSupports) { } michael@0: ~nsISupportsHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mSupports; } michael@0: michael@0: bool KeyEquals(KeyTypePointer aKey) const { return aKey == mSupports; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) michael@0: { michael@0: return NS_PTR_TO_INT32(aKey) >>2; michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: nsCOMPtr mSupports; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using refcounted * KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: template michael@0: class nsRefPtrHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef T* KeyType; michael@0: typedef const T* KeyTypePointer; michael@0: michael@0: nsRefPtrHashKey(const T* key) : michael@0: mKey(const_cast(key)) { } michael@0: nsRefPtrHashKey(const nsRefPtrHashKey& toCopy) : michael@0: mKey(toCopy.mKey) { } michael@0: ~nsRefPtrHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mKey; } michael@0: michael@0: bool KeyEquals(KeyTypePointer aKey) const { return aKey == mKey; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) michael@0: { michael@0: return NS_PTR_TO_INT32(aKey) >>2; michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: nsRefPtr mKey; michael@0: }; michael@0: michael@0: template michael@0: inline void michael@0: ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, michael@0: nsRefPtrHashKey& aField, michael@0: const char* aName, michael@0: uint32_t aFlags = 0) michael@0: { michael@0: CycleCollectionNoteChild(aCallback, aField.GetKey(), aName, aFlags); michael@0: } michael@0: michael@0: /** michael@0: * hashkey wrapper using T* KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: template michael@0: class nsPtrHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef T *KeyType; michael@0: typedef const T *KeyTypePointer; michael@0: michael@0: nsPtrHashKey(const T *key) : mKey(const_cast(key)) {} michael@0: nsPtrHashKey(const nsPtrHashKey &toCopy) : mKey(toCopy.mKey) {} michael@0: ~nsPtrHashKey() {} michael@0: michael@0: KeyType GetKey() const { return mKey; } michael@0: michael@0: bool KeyEquals(KeyTypePointer key) const { return key == mKey; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType key) { return key; } michael@0: static PLDHashNumber HashKey(KeyTypePointer key) michael@0: { michael@0: return NS_PTR_TO_INT32(key) >> 2; michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: protected: michael@0: T *mKey; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using T* KeyType that sets key to nullptr upon michael@0: * destruction. Relevant only in cases where a memory pointer-scanner michael@0: * like valgrind might get confused about stale references. michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: michael@0: template michael@0: class nsClearingPtrHashKey : public nsPtrHashKey michael@0: { michael@0: public: michael@0: nsClearingPtrHashKey(const T *key) : nsPtrHashKey(key) {} michael@0: nsClearingPtrHashKey(const nsClearingPtrHashKey &toCopy) : michael@0: nsPtrHashKey(toCopy) {} michael@0: ~nsClearingPtrHashKey() { nsPtrHashKey::mKey = nullptr; } michael@0: }; michael@0: michael@0: typedef nsPtrHashKey nsVoidPtrHashKey; michael@0: typedef nsClearingPtrHashKey nsClearingVoidPtrHashKey; michael@0: michael@0: /** michael@0: * hashkey wrapper using a function pointer KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: template michael@0: class nsFuncPtrHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef T &KeyType; michael@0: typedef const T *KeyTypePointer; michael@0: michael@0: nsFuncPtrHashKey(const T *key) : mKey(*const_cast(key)) {} michael@0: nsFuncPtrHashKey(const nsFuncPtrHashKey &toCopy) : mKey(toCopy.mKey) {} michael@0: ~nsFuncPtrHashKey() {} michael@0: michael@0: KeyType GetKey() const { return const_cast(mKey); } michael@0: michael@0: bool KeyEquals(KeyTypePointer key) const { return *key == mKey; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType key) { return &key; } michael@0: static PLDHashNumber HashKey(KeyTypePointer key) michael@0: { michael@0: return NS_PTR_TO_INT32(*key) >> 2; michael@0: } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: protected: michael@0: T mKey; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper using nsID KeyType michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsIDHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const nsID& KeyType; michael@0: typedef const nsID* KeyTypePointer; michael@0: michael@0: nsIDHashKey(const nsID* inID) : mID(*inID) { } michael@0: nsIDHashKey(const nsIDHashKey& toCopy) : mID(toCopy.mID) { } michael@0: ~nsIDHashKey() { } michael@0: michael@0: KeyType GetKey() const { return mID; } michael@0: michael@0: bool KeyEquals(KeyTypePointer aKey) const { return aKey->Equals(mID); } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) michael@0: { michael@0: // Hash the nsID object's raw bytes. michael@0: return mozilla::HashBytes(aKey, sizeof(KeyType)); michael@0: } michael@0: michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const nsID mID; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper for "dependent" const char*; this class does not "own" michael@0: * its string pointer. michael@0: * michael@0: * This class must only be used if the strings have a lifetime longer than michael@0: * the hashtable they occupy. This normally occurs only for static michael@0: * strings or strings that have been arena-allocated. michael@0: * michael@0: * @see nsTHashtable::EntryType for specification michael@0: */ michael@0: class nsDepCharHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const char* KeyType; michael@0: typedef const char* KeyTypePointer; michael@0: michael@0: nsDepCharHashKey(const char* aKey) { mKey = aKey; } michael@0: nsDepCharHashKey(const nsDepCharHashKey& toCopy) { mKey = toCopy.mKey; } michael@0: ~nsDepCharHashKey() { } michael@0: michael@0: const char* GetKey() const { return mKey; } michael@0: bool KeyEquals(const char* aKey) const michael@0: { michael@0: return !strcmp(mKey, aKey); michael@0: } michael@0: michael@0: static const char* KeyToPointer(const char* aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(const char* aKey) { return mozilla::HashString(aKey); } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const char* mKey; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper for const char*; at construction, this class duplicates michael@0: * a string pointed to by the pointer so that it doesn't matter whether or not michael@0: * the string lives longer than the hash table. michael@0: */ michael@0: class nsCharPtrHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const char* KeyType; michael@0: typedef const char* KeyTypePointer; michael@0: michael@0: nsCharPtrHashKey(const char* aKey) : mKey(strdup(aKey)) { } michael@0: nsCharPtrHashKey(const nsCharPtrHashKey& toCopy) : mKey(strdup(toCopy.mKey)) { } michael@0: michael@0: nsCharPtrHashKey(nsCharPtrHashKey&& other) michael@0: : mKey(other.mKey) michael@0: { michael@0: other.mKey = nullptr; michael@0: } michael@0: michael@0: ~nsCharPtrHashKey() { if (mKey) free(const_cast(mKey)); } michael@0: michael@0: const char* GetKey() const { return mKey; } michael@0: bool KeyEquals(KeyTypePointer aKey) const michael@0: { michael@0: return !strcmp(mKey, aKey); michael@0: } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return mozilla::HashString(aKey); } michael@0: michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const char* mKey; michael@0: }; michael@0: michael@0: /** michael@0: * hashkey wrapper for const char16_t*; at construction, this class duplicates michael@0: * a string pointed to by the pointer so that it doesn't matter whether or not michael@0: * the string lives longer than the hash table. michael@0: */ michael@0: class nsUnicharPtrHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const char16_t* KeyType; michael@0: typedef const char16_t* KeyTypePointer; michael@0: michael@0: nsUnicharPtrHashKey(const char16_t* aKey) : mKey(NS_strdup(aKey)) { } michael@0: nsUnicharPtrHashKey(const nsUnicharPtrHashKey& toCopy) : mKey(NS_strdup(toCopy.mKey)) { } michael@0: michael@0: nsUnicharPtrHashKey(nsUnicharPtrHashKey&& other) michael@0: : mKey(other.mKey) michael@0: { michael@0: other.mKey = nullptr; michael@0: } michael@0: michael@0: ~nsUnicharPtrHashKey() { if (mKey) NS_Free(const_cast(mKey)); } michael@0: michael@0: const char16_t* GetKey() const { return mKey; } michael@0: bool KeyEquals(KeyTypePointer aKey) const michael@0: { michael@0: return !NS_strcmp(mKey, aKey); michael@0: } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return mozilla::HashString(aKey); } michael@0: michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: const char16_t* mKey; michael@0: }; michael@0: michael@0: /** michael@0: * Hashtable key class to use with objects that support nsIHashable michael@0: */ michael@0: class nsHashableHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef nsIHashable* KeyType; michael@0: typedef const nsIHashable* KeyTypePointer; michael@0: michael@0: nsHashableHashKey(const nsIHashable* aKey) : michael@0: mKey(const_cast(aKey)) { } michael@0: nsHashableHashKey(const nsHashableHashKey& toCopy) : michael@0: mKey(toCopy.mKey) { } michael@0: ~nsHashableHashKey() { } michael@0: michael@0: nsIHashable* GetKey() const { return mKey; } michael@0: michael@0: bool KeyEquals(const nsIHashable* aKey) const { michael@0: bool eq; michael@0: if (NS_SUCCEEDED(mKey->Equals(const_cast(aKey), &eq))) { michael@0: return eq; michael@0: } michael@0: return false; michael@0: } michael@0: michael@0: static const nsIHashable* KeyToPointer(nsIHashable* aKey) { return aKey; } michael@0: static PLDHashNumber HashKey(const nsIHashable* aKey) { michael@0: uint32_t code = 8888; // magic number if GetHashCode fails :-( michael@0: #ifdef DEBUG michael@0: nsresult rv = michael@0: #endif michael@0: const_cast(aKey)->GetHashCode(&code); michael@0: NS_ASSERTION(NS_SUCCEEDED(rv), "GetHashCode should not throw!"); michael@0: return code; michael@0: } michael@0: michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: nsCOMPtr mKey; michael@0: }; michael@0: michael@0: /** michael@0: * Hashtable key class to use with objects for which Hash() and operator==() michael@0: * are defined. michael@0: */ michael@0: template michael@0: class nsGenericHashKey : public PLDHashEntryHdr michael@0: { michael@0: public: michael@0: typedef const T& KeyType; michael@0: typedef const T* KeyTypePointer; michael@0: michael@0: nsGenericHashKey(KeyTypePointer aKey) : mKey(*aKey) { } michael@0: nsGenericHashKey(const nsGenericHashKey& aOther) : mKey(aOther.mKey) { } michael@0: michael@0: KeyType GetKey() const { return mKey; } michael@0: bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mKey; } michael@0: michael@0: static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } michael@0: static PLDHashNumber HashKey(KeyTypePointer aKey) { return aKey->Hash(); } michael@0: enum { ALLOW_MEMMOVE = true }; michael@0: michael@0: private: michael@0: T mKey; michael@0: }; michael@0: michael@0: #endif // nsTHashKeys_h__