From 7ee3947039352c29f596acdb2ace16ad1a6b2ca1 Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Fri, 28 Sep 2001 21:37:23 +0000 Subject: [PATCH] Adding new hash key. r=darin@netscape.com, sr=brendan@mozilla.org bug=81956 git-svn-id: svn://10.0.0.236/trunk@104131 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/ds/nsHashtable.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mozilla/xpcom/ds/nsHashtable.h b/mozilla/xpcom/ds/nsHashtable.h index 505b2549a2a..b3fcaba788b 100644 --- a/mozilla/xpcom/ds/nsHashtable.h +++ b/mozilla/xpcom/ds/nsHashtable.h @@ -62,6 +62,7 @@ class NS_COM nsHashKey { enum nsHashKeyType { UnknownKey, SupportsKey, + PRUint32Key, VoidKey, IDKey, CStringKey, @@ -227,6 +228,31 @@ class NS_COM nsISupportsKey : public nsHashKey { nsresult Write(nsIObjectOutputStream* aStream) const; }; + +class nsPRUint32Key : public nsHashKey { +protected: + PRUint32 mKey; +public: + nsPRUint32Key(PRUint32 key) { +#ifdef DEBUG + mKeyType = PRUint32Key; +#endif + mKey = key; + } + + PRUint32 HashCode(void) const { + return mKey; + } + + PRBool Equals(const nsHashKey *aKey) const { + return mKey == ((const nsPRUint32Key *) aKey)->mKey; + } + nsHashKey *Clone() const { + return new nsPRUint32Key(mKey); + } + PRUint32 GetValue() { return mKey; } +}; + //////////////////////////////////////////////////////////////////////////////// // nsVoidKey: Where keys are void* objects that don't get refcounted.