From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- xpcom/ds/nsHashtablesFwd.h | 94 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 xpcom/ds/nsHashtablesFwd.h (limited to 'xpcom/ds/nsHashtablesFwd.h') diff --git a/xpcom/ds/nsHashtablesFwd.h b/xpcom/ds/nsHashtablesFwd.h new file mode 100644 index 0000000000..080f79887d --- /dev/null +++ b/xpcom/ds/nsHashtablesFwd.h @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef XPCOM_DS_NSHASHTABLESFWD_H_ +#define XPCOM_DS_NSHASHTABLESFWD_H_ + +#include "mozilla/Attributes.h" + +struct PLDHashEntryHdr; + +template +class MOZ_IS_REFPTR nsCOMPtr; + +template +class MOZ_IS_REFPTR RefPtr; + +template +class MOZ_NEEDS_NO_VTABLE_TYPE nsTHashtable; + +template +class nsDefaultConverter; + +template > +class nsBaseHashtable; + +template +class nsClassHashtable; + +template +class nsRefCountedHashtable; + +/** + * templated hashtable class maps keys to interface pointers. + * See nsBaseHashtable for complete declaration. + * @deprecated This is going to be removed. Use nsTHashMap instead. + * @param KeyClass a wrapper-class for the hashtable key, see nsHashKeys.h + * for a complete specification. + * @param Interface the interface-type being wrapped + * @see nsClassHashtable, nsTHashMap + */ +template +using nsInterfaceHashtable = + nsRefCountedHashtable>; + +/** + * templated hashtable class maps keys to reference pointers. + * See nsBaseHashtable for complete declaration. + * @deprecated This is going to be removed. Use nsTHashMap instead. + * @param KeyClass a wrapper-class for the hashtable key, see nsHashKeys.h + * for a complete specification. + * @param PtrType the reference-type being wrapped + * @see nsClassHashtable, nsTHashMap + */ +template +using nsRefPtrHashtable = nsRefCountedHashtable>; + +namespace mozilla::detail { +template +struct nsKeyClass; +} // namespace mozilla::detail + +/** + * A universal hash map that maps some KeyType to some DataType. It can be used + * for any DataType, including RefPtr, nsCOMPtr and UniquePtr. + * + * For the default hash keys types, the appropriate hash key class is determined + * automatically, so you can just specify `nsTHashMap>`, for example. + * + * If you require custom hash behaviour (e.g. case insensitive string handling), + * you can still specify a hash key class derived from PLDHashEntryHdr + * explicitly. + * + * If you need to use a custom UserDataType, use nsBaseHashtable (or + * nsTHashtable) directly. However, you should double-check if that's really + * necessary. + */ +template +using nsTHashMap = + nsBaseHashtable::type, + DataType, DataType>; + +template +class nsTBaseHashSet; + +template +using nsTHashSet = + nsTBaseHashSet::type>; + +#endif // XPCOM_DS_NSHASHTABLESFWD_H_ -- cgit v1.2.3