2001-07-31 23:05:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2000-05-03 02:38:04 +04:00
|
|
|
* This Original Code has been modified by IBM Corporation.
|
|
|
|
* Modifications made by IBM described herein are
|
|
|
|
* Copyright (c) International Business Machines
|
|
|
|
* Corporation, 2000
|
|
|
|
*
|
|
|
|
* Modifications to Mozilla code or documentation
|
|
|
|
* identified per MPL Section 3.3
|
|
|
|
*
|
|
|
|
* Date Modified by Description of modification
|
|
|
|
* 04/20/2000 IBM Corp. Added PR_CALLBACK for Optlink use in OS2
|
1998-10-19 21:48:55 +04:00
|
|
|
*/
|
|
|
|
|
2003-04-02 10:53:57 +04:00
|
|
|
/**
|
|
|
|
* nsHashtable is OBSOLETE. Use nsTHashtable or a derivative instead.
|
|
|
|
*/
|
|
|
|
|
1998-10-19 21:48:55 +04:00
|
|
|
#ifndef nsHashtable_h__
|
|
|
|
#define nsHashtable_h__
|
|
|
|
|
2002-11-16 05:33:49 +03:00
|
|
|
#include "pldhash.h"
|
2000-06-14 10:28:13 +04:00
|
|
|
#include "nscore.h"
|
2000-08-23 21:27:06 +04:00
|
|
|
#include "nsString.h"
|
2004-02-19 05:44:03 +03:00
|
|
|
#include "nsISupportsBase.h"
|
|
|
|
#include "nsTraceRefcnt.h"
|
1998-10-19 21:48:55 +04:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
class nsIObjectInputStream;
|
|
|
|
class nsIObjectOutputStream;
|
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
class nsHashtable;
|
|
|
|
class nsStringKey;
|
2013-03-17 06:46:40 +04:00
|
|
|
struct PRLock;
|
2000-08-10 10:19:37 +04:00
|
|
|
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsHashKey {
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
2001-11-28 02:55:03 +03:00
|
|
|
nsHashKey(void) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
mKeyType = UnknownKey;
|
|
|
|
#endif
|
|
|
|
MOZ_COUNT_CTOR(nsHashKey);
|
|
|
|
}
|
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
2004-01-22 04:01:19 +03:00
|
|
|
// Virtual destructor because all hash keys are |delete|d via a
|
|
|
|
// nsHashKey pointer.
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
virtual ~nsHashKey(void);
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual uint32_t HashCode(void) const = 0;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool Equals(const nsHashKey *aKey) const = 0;
|
2001-07-31 23:05:34 +04:00
|
|
|
virtual nsHashKey *Clone() const = 0;
|
|
|
|
virtual nsresult Write(nsIObjectOutputStream* aStream) const;
|
2000-08-10 10:19:37 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
|
|
|
// used for verification that we're casting to the correct key type
|
|
|
|
enum nsHashKeyType {
|
|
|
|
UnknownKey,
|
|
|
|
SupportsKey,
|
2001-09-29 01:37:23 +04:00
|
|
|
PRUint32Key,
|
2001-07-31 23:05:34 +04:00
|
|
|
VoidKey,
|
|
|
|
IDKey,
|
|
|
|
CStringKey,
|
2003-03-15 04:04:32 +03:00
|
|
|
StringKey
|
2001-07-31 23:05:34 +04:00
|
|
|
};
|
|
|
|
nsHashKeyType GetKeyType() const { return mKeyType; }
|
|
|
|
protected:
|
|
|
|
nsHashKeyType mKeyType;
|
2000-08-10 10:19:37 +04:00
|
|
|
#endif
|
1998-10-19 21:48:55 +04:00
|
|
|
};
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
// Enumerator and Read/Write callback functions.
|
|
|
|
|
2002-07-30 02:48:15 +04:00
|
|
|
// Return values for nsHashtableEnumFunc
|
|
|
|
enum {
|
2011-10-17 18:59:28 +04:00
|
|
|
kHashEnumerateStop = false,
|
|
|
|
kHashEnumerateNext = true
|
2002-07-30 02:48:15 +04:00
|
|
|
};
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
typedef bool
|
2008-10-10 19:04:34 +04:00
|
|
|
(* nsHashtableEnumFunc)(nsHashKey *aKey, void *aData, void* aClosure);
|
1998-10-19 21:48:55 +04:00
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
typedef nsresult
|
2008-10-10 19:04:34 +04:00
|
|
|
(* nsHashtableReadEntryFunc)(nsIObjectInputStream *aStream, nsHashKey **aKey,
|
|
|
|
void **aData);
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
// NB: may be called with null aKey or aData, to free just one of the two.
|
|
|
|
typedef void
|
2008-10-10 19:04:34 +04:00
|
|
|
(* nsHashtableFreeEntryFunc)(nsIObjectInputStream *aStream, nsHashKey *aKey,
|
|
|
|
void *aData);
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
typedef nsresult
|
2008-10-10 19:04:34 +04:00
|
|
|
(* nsHashtableWriteDataFunc)(nsIObjectOutputStream *aStream, void *aData);
|
1998-10-19 21:48:55 +04:00
|
|
|
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsHashtable {
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
|
|
|
// members
|
2002-11-16 05:33:49 +03:00
|
|
|
PRLock* mLock;
|
|
|
|
PLDHashTable mHashtable;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mEnumerating;
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
nsHashtable(uint32_t aSize = 16, bool threadSafe = false);
|
2004-02-13 22:04:38 +03:00
|
|
|
virtual ~nsHashtable();
|
2001-07-31 23:05:34 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t Count(void) { return mHashtable.entryCount; }
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Exists(nsHashKey *aKey);
|
2001-07-31 23:05:34 +04:00
|
|
|
void *Put(nsHashKey *aKey, void *aData);
|
|
|
|
void *Get(nsHashKey *aKey);
|
|
|
|
void *Remove(nsHashKey *aKey);
|
|
|
|
nsHashtable *Clone();
|
|
|
|
void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = NULL);
|
|
|
|
void Reset();
|
|
|
|
void Reset(nsHashtableEnumFunc destroyFunc, void* aClosure = NULL);
|
|
|
|
|
|
|
|
nsHashtable(nsIObjectInputStream* aStream,
|
|
|
|
nsHashtableReadEntryFunc aReadEntryFunc,
|
|
|
|
nsHashtableFreeEntryFunc aFreeEntryFunc,
|
|
|
|
nsresult *aRetVal);
|
|
|
|
nsresult Write(nsIObjectOutputStream* aStream,
|
|
|
|
nsHashtableWriteDataFunc aWriteDataFunc) const;
|
1998-10-19 21:48:55 +04:00
|
|
|
};
|
|
|
|
|
1999-07-28 11:56:28 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsObjectHashtable: an nsHashtable where the elements are C++ objects to be
|
|
|
|
// deleted
|
|
|
|
|
2008-10-10 19:04:34 +04:00
|
|
|
typedef void* (* nsHashtableCloneElementFunc)(nsHashKey *aKey, void *aData, void* aClosure);
|
1999-07-28 11:56:28 +04:00
|
|
|
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsObjectHashtable : public nsHashtable {
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
|
|
|
nsObjectHashtable(nsHashtableCloneElementFunc cloneElementFun,
|
|
|
|
void* cloneElementClosure,
|
|
|
|
nsHashtableEnumFunc destroyElementFun,
|
|
|
|
void* destroyElementClosure,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aSize = 16, bool threadSafe = false);
|
2001-07-31 23:05:34 +04:00
|
|
|
~nsObjectHashtable();
|
|
|
|
|
|
|
|
nsHashtable *Clone();
|
|
|
|
void Reset();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool RemoveAndDelete(nsHashKey *aKey);
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
protected:
|
2008-10-10 19:04:34 +04:00
|
|
|
static PLDHashOperator CopyElement(PLDHashTable* table,
|
|
|
|
PLDHashEntryHdr* hdr,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i, void *arg);
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
nsHashtableCloneElementFunc mCloneElementFun;
|
|
|
|
void* mCloneElementClosure;
|
|
|
|
nsHashtableEnumFunc mDestroyElementFun;
|
|
|
|
void* mDestroyElementClosure;
|
1999-07-28 11:56:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsSupportsHashtable: an nsHashtable where the elements are nsISupports*
|
|
|
|
|
2000-06-07 02:06:56 +04:00
|
|
|
class nsISupports;
|
|
|
|
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsSupportsHashtable
|
2001-07-31 23:05:34 +04:00
|
|
|
: private nsHashtable
|
2000-06-07 02:06:56 +04:00
|
|
|
{
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
nsSupportsHashtable(uint32_t aSize = 16, bool threadSafe = false)
|
2001-07-31 23:05:34 +04:00
|
|
|
: nsHashtable(aSize, threadSafe) {}
|
|
|
|
~nsSupportsHashtable();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t Count(void) {
|
2001-07-31 23:05:34 +04:00
|
|
|
return nsHashtable::Count();
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Exists(nsHashKey *aKey) {
|
2001-07-31 23:05:34 +04:00
|
|
|
return nsHashtable::Exists (aKey);
|
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Put(nsHashKey *aKey,
|
2001-07-31 23:05:34 +04:00
|
|
|
nsISupports *aData,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsISupports **value = nullptr);
|
2001-07-31 23:05:34 +04:00
|
|
|
nsISupports* Get(nsHashKey *aKey);
|
2012-07-30 18:20:58 +04:00
|
|
|
bool Remove(nsHashKey *aKey, nsISupports **value = nullptr);
|
2001-07-31 23:05:34 +04:00
|
|
|
nsHashtable *Clone();
|
2011-08-23 06:15:54 +04:00
|
|
|
void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = NULL) {
|
2001-07-31 23:05:34 +04:00
|
|
|
nsHashtable::Enumerate(aEnumFunc, aClosure);
|
|
|
|
}
|
|
|
|
void Reset();
|
|
|
|
|
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool ReleaseElement(nsHashKey *, void *, void *);
|
2008-10-10 19:04:34 +04:00
|
|
|
static PLDHashOperator EnumerateCopy(PLDHashTable*,
|
|
|
|
PLDHashEntryHdr* hdr,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i, void *arg);
|
1999-07-28 11:56:28 +04:00
|
|
|
};
|
|
|
|
|
1999-01-27 05:02:22 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
1999-02-06 07:01:23 +03:00
|
|
|
// nsISupportsKey: Where keys are nsISupports objects that get refcounted.
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsISupportsKey : public nsHashKey {
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
|
|
|
nsISupports* mKey;
|
|
|
|
|
|
|
|
public:
|
2002-03-01 12:28:55 +03:00
|
|
|
nsISupportsKey(const nsISupportsKey& aKey) : mKey(aKey.mKey) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
mKeyType = SupportsKey;
|
|
|
|
#endif
|
|
|
|
NS_IF_ADDREF(mKey);
|
|
|
|
}
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
nsISupportsKey(nsISupports* key) {
|
2000-08-10 10:19:37 +04:00
|
|
|
#ifdef DEBUG
|
2001-07-31 23:05:34 +04:00
|
|
|
mKeyType = SupportsKey;
|
2000-08-10 10:19:37 +04:00
|
|
|
#endif
|
2001-07-31 23:05:34 +04:00
|
|
|
mKey = key;
|
|
|
|
NS_IF_ADDREF(mKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsISupportsKey(void) {
|
|
|
|
NS_IF_RELEASE(mKey);
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t HashCode(void) const {
|
2001-08-14 08:18:27 +04:00
|
|
|
return NS_PTR_TO_INT32(mKey);
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Equals(const nsHashKey *aKey) const {
|
2001-07-31 23:05:34 +04:00
|
|
|
NS_ASSERTION(aKey->GetKeyType() == SupportsKey, "mismatched key types");
|
|
|
|
return (mKey == ((nsISupportsKey *) aKey)->mKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsHashKey *Clone() const {
|
|
|
|
return new nsISupportsKey(mKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsISupportsKey(nsIObjectInputStream* aStream, nsresult *aResult);
|
|
|
|
nsresult Write(nsIObjectOutputStream* aStream) const;
|
2011-11-04 00:39:08 +04:00
|
|
|
|
|
|
|
nsISupports* GetValue() { return mKey; }
|
1999-02-06 07:01:23 +03:00
|
|
|
};
|
|
|
|
|
2001-09-29 01:37:23 +04:00
|
|
|
|
|
|
|
class nsPRUint32Key : public nsHashKey {
|
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mKey;
|
2001-09-29 01:37:23 +04:00
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
nsPRUint32Key(uint32_t key) {
|
2001-09-29 01:37:23 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
mKeyType = PRUint32Key;
|
|
|
|
#endif
|
|
|
|
mKey = key;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t HashCode(void) const {
|
2001-09-29 01:37:23 +04:00
|
|
|
return mKey;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Equals(const nsHashKey *aKey) const {
|
2001-09-29 01:37:23 +04:00
|
|
|
return mKey == ((const nsPRUint32Key *) aKey)->mKey;
|
|
|
|
}
|
|
|
|
nsHashKey *Clone() const {
|
|
|
|
return new nsPRUint32Key(mKey);
|
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetValue() { return mKey; }
|
2001-09-29 01:37:23 +04:00
|
|
|
};
|
|
|
|
|
1999-02-06 07:01:23 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsVoidKey: Where keys are void* objects that don't get refcounted.
|
|
|
|
|
|
|
|
class nsVoidKey : public nsHashKey {
|
2001-07-31 23:05:34 +04:00
|
|
|
protected:
|
|
|
|
void* mKey;
|
|
|
|
|
|
|
|
public:
|
2002-03-01 12:28:55 +03:00
|
|
|
nsVoidKey(const nsVoidKey& aKey) : mKey(aKey.mKey) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
mKeyType = aKey.mKeyType;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
nsVoidKey(void* key) {
|
2000-08-10 10:19:37 +04:00
|
|
|
#ifdef DEBUG
|
2001-07-31 23:05:34 +04:00
|
|
|
mKeyType = VoidKey;
|
2000-08-10 10:19:37 +04:00
|
|
|
#endif
|
2001-07-31 23:05:34 +04:00
|
|
|
mKey = key;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t HashCode(void) const {
|
2001-08-14 08:18:27 +04:00
|
|
|
return NS_PTR_TO_INT32(mKey);
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Equals(const nsHashKey *aKey) const {
|
2001-07-31 23:05:34 +04:00
|
|
|
NS_ASSERTION(aKey->GetKeyType() == VoidKey, "mismatched key types");
|
|
|
|
return (mKey == ((const nsVoidKey *) aKey)->mKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsHashKey *Clone() const {
|
|
|
|
return new nsVoidKey(mKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
void* GetValue() { return mKey; }
|
1999-02-06 07:01:23 +03:00
|
|
|
};
|
|
|
|
|
1999-07-22 06:11:04 +04:00
|
|
|
#include "nsString.h"
|
1999-03-09 12:44:27 +03:00
|
|
|
|
2000-08-21 06:37:20 +04:00
|
|
|
// for null-terminated c-strings
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsCStringKey : public nsHashKey {
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
|
|
|
|
|
|
|
// NB: when serializing, NEVER_OWN keys are deserialized as OWN.
|
|
|
|
enum Ownership {
|
|
|
|
NEVER_OWN, // very long lived, even clones don't need to copy it.
|
|
|
|
OWN_CLONE, // as long lived as this key. But clones make a copy.
|
|
|
|
OWN // to be free'd in key dtor. Clones make their own copy.
|
|
|
|
};
|
|
|
|
|
2002-03-01 12:28:55 +03:00
|
|
|
nsCStringKey(const nsCStringKey& aStrKey);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsCStringKey(const char* str, int32_t strLen = -1, Ownership own = OWN_CLONE);
|
2001-07-31 23:05:34 +04:00
|
|
|
nsCStringKey(const nsAFlatCString& str);
|
|
|
|
nsCStringKey(const nsACString& str);
|
|
|
|
~nsCStringKey(void);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t HashCode(void) const;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Equals(const nsHashKey* aKey) const;
|
2001-07-31 23:05:34 +04:00
|
|
|
nsHashKey* Clone() const;
|
|
|
|
nsCStringKey(nsIObjectInputStream* aStream, nsresult *aResult);
|
|
|
|
nsresult Write(nsIObjectOutputStream* aStream) const;
|
|
|
|
|
|
|
|
// For when the owner of the hashtable wants to peek at the actual
|
|
|
|
// string in the key. No copy is made, so be careful.
|
|
|
|
const char* GetString() const { return mStr; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetStringLength() const { return mStrLen; }
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
char* mStr;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStrLen;
|
2001-07-31 23:05:34 +04:00
|
|
|
Ownership mOwnership;
|
2000-08-10 10:19:37 +04:00
|
|
|
};
|
1999-11-16 06:10:54 +03:00
|
|
|
|
2000-08-21 06:37:20 +04:00
|
|
|
// for null-terminated unicode strings
|
2011-08-18 17:46:39 +04:00
|
|
|
class nsStringKey : public nsHashKey {
|
2001-07-31 23:05:34 +04:00
|
|
|
public:
|
|
|
|
|
|
|
|
// NB: when serializing, NEVER_OWN keys are deserialized as OWN.
|
|
|
|
enum Ownership {
|
|
|
|
NEVER_OWN, // very long lived, even clones don't need to copy it.
|
|
|
|
OWN_CLONE, // as long lived as this key. But clones make a copy.
|
|
|
|
OWN // to be free'd in key dtor. Clones make their own copy.
|
|
|
|
};
|
|
|
|
|
2002-03-01 12:28:55 +03:00
|
|
|
nsStringKey(const nsStringKey& aKey);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsStringKey(const PRUnichar* str, int32_t strLen = -1, Ownership own = OWN_CLONE);
|
2001-07-31 23:05:34 +04:00
|
|
|
nsStringKey(const nsAFlatString& str);
|
|
|
|
nsStringKey(const nsAString& str);
|
|
|
|
~nsStringKey(void);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t HashCode(void) const;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Equals(const nsHashKey* aKey) const;
|
2001-07-31 23:05:34 +04:00
|
|
|
nsHashKey* Clone() const;
|
|
|
|
nsStringKey(nsIObjectInputStream* aStream, nsresult *aResult);
|
|
|
|
nsresult Write(nsIObjectOutputStream* aStream) const;
|
|
|
|
|
|
|
|
// For when the owner of the hashtable wants to peek at the actual
|
|
|
|
// string in the key. No copy is made, so be careful.
|
|
|
|
const PRUnichar* GetString() const { return mStr; }
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t GetStringLength() const { return mStrLen; }
|
2001-07-31 23:05:34 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
PRUnichar* mStr;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStrLen;
|
2001-07-31 23:05:34 +04:00
|
|
|
Ownership mOwnership;
|
1999-11-16 06:10:54 +03:00
|
|
|
};
|
1999-07-22 06:11:04 +04:00
|
|
|
|
2000-08-10 10:19:37 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-07-31 23:05:34 +04:00
|
|
|
#endif // nsHashtable_h__
|