/src/mozilla-central/xpcom/ds/nsPointerHashKeys.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | /* Definitions for nsPtrHashKey<T> and nsVoidPtrHashKey. */ |
8 | | |
9 | | #ifndef nsPointerHashKeys_h |
10 | | #define nsPointerHashKeys_h |
11 | | |
12 | | #include "nscore.h" |
13 | | |
14 | | #include "mozilla/Attributes.h" |
15 | | #include "mozilla/HashFunctions.h" |
16 | | |
17 | | /** |
18 | | * hashkey wrapper using T* KeyType |
19 | | * |
20 | | * @see nsTHashtable::EntryType for specification |
21 | | */ |
22 | | template<class T> |
23 | | class nsPtrHashKey : public PLDHashEntryHdr |
24 | | { |
25 | | public: |
26 | | typedef T* KeyType; |
27 | | typedef const T* KeyTypePointer; |
28 | | |
29 | 0 | explicit nsPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {} Unexecuted instantiation: nsPtrHashKey<nsXBLPrototypeHandler>::nsPtrHashKey(nsXBLPrototypeHandler const*) Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::nsPtrHashKey(mozilla::dom::Element const*) Unexecuted instantiation: nsPtrHashKey<imgIRequest>::nsPtrHashKey(imgIRequest const*) Unexecuted instantiation: nsPtrHashKey<RawServoStyleRule const>::nsPtrHashKey(RawServoStyleRule const*) Unexecuted instantiation: nsPtrHashKey<nsIFrame>::nsPtrHashKey(nsIFrame const*) Unexecuted instantiation: nsPtrHashKey<nsIContent>::nsPtrHashKey(nsIContent const*) Unexecuted instantiation: nsPtrHashKey<mozilla::dom::NodeInfo::NodeInfoInner>::nsPtrHashKey(mozilla::dom::NodeInfo::NodeInfoInner const*) Unexecuted instantiation: nsPtrHashKey<gfxFontEntry>::nsPtrHashKey(gfxFontEntry const*) |
30 | | nsPtrHashKey(nsPtrHashKey<T>&& aToMove) |
31 | | : PLDHashEntryHdr(std::move(aToMove)) |
32 | | , mKey(std::move(aToMove.mKey)) |
33 | 0 | {} |
34 | 0 | ~nsPtrHashKey() {} Unexecuted instantiation: nsPtrHashKey<nsXBLPrototypeHandler>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<imgIRequest>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<RawServoStyleRule const>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<nsIFrame>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<nsIContent>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<mozilla::dom::NodeInfo::NodeInfoInner>::~nsPtrHashKey() Unexecuted instantiation: nsPtrHashKey<gfxFontEntry>::~nsPtrHashKey() |
35 | | |
36 | 0 | KeyType GetKey() const { return mKey; } Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::GetKey() const Unexecuted instantiation: nsPtrHashKey<nsINode>::GetKey() const Unexecuted instantiation: nsPtrHashKey<imgIRequest>::GetKey() const Unexecuted instantiation: nsPtrHashKey<nsSVGElement>::GetKey() const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Link>::GetKey() const Unexecuted instantiation: nsPtrHashKey<nsISupports>::GetKey() const Unexecuted instantiation: nsPtrHashKey<nsIObjectLoadingContent>::GetKey() const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::SVGUseElement>::GetKey() const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::HTMLImageElement>::GetKey() const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::DOMIntersectionObserver>::GetKey() const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Selection>::GetKey() const |
37 | 0 | bool KeyEquals(KeyTypePointer aKey) const { return aKey == mKey; } Unexecuted instantiation: nsPtrHashKey<nsIFrame>::KeyEquals(nsIFrame const*) const Unexecuted instantiation: nsPtrHashKey<nsXBLPrototypeHandler>::KeyEquals(nsXBLPrototypeHandler const*) const Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::KeyEquals(mozilla::dom::Element const*) const Unexecuted instantiation: nsPtrHashKey<imgIRequest>::KeyEquals(imgIRequest const*) const Unexecuted instantiation: nsPtrHashKey<RawServoStyleRule const>::KeyEquals(RawServoStyleRule const*) const Unexecuted instantiation: nsPtrHashKey<nsIContent>::KeyEquals(nsIContent const*) const Unexecuted instantiation: nsPtrHashKey<gfxFontEntry>::KeyEquals(gfxFontEntry const*) const |
38 | | |
39 | 0 | static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; } Unexecuted instantiation: nsPtrHashKey<nsINode>::KeyToPointer(nsINode*) Unexecuted instantiation: nsPtrHashKey<nsXBLPrototypeHandler>::KeyToPointer(nsXBLPrototypeHandler*) Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::KeyToPointer(mozilla::dom::Element*) Unexecuted instantiation: nsPtrHashKey<imgIRequest>::KeyToPointer(imgIRequest*) Unexecuted instantiation: nsPtrHashKey<nsIContent>::KeyToPointer(nsIContent*) Unexecuted instantiation: nsPtrHashKey<mozilla::dom::NodeInfo::NodeInfoInner>::KeyToPointer(mozilla::dom::NodeInfo::NodeInfoInner*) |
40 | | static PLDHashNumber HashKey(KeyTypePointer aKey) |
41 | 0 | { |
42 | 0 | return mozilla::HashGeneric(aKey); |
43 | 0 | } Unexecuted instantiation: nsPtrHashKey<nsIFrame>::HashKey(nsIFrame const*) Unexecuted instantiation: nsPtrHashKey<nsXBLPrototypeHandler>::HashKey(nsXBLPrototypeHandler const*) Unexecuted instantiation: nsPtrHashKey<mozilla::dom::Element>::HashKey(mozilla::dom::Element const*) Unexecuted instantiation: nsPtrHashKey<imgIRequest>::HashKey(imgIRequest const*) Unexecuted instantiation: nsPtrHashKey<RawServoStyleRule const>::HashKey(RawServoStyleRule const*) Unexecuted instantiation: nsPtrHashKey<nsIContent>::HashKey(nsIContent const*) Unexecuted instantiation: nsPtrHashKey<gfxFontEntry>::HashKey(gfxFontEntry const*) |
44 | | enum { ALLOW_MEMMOVE = true }; |
45 | | |
46 | | protected: |
47 | | T* MOZ_NON_OWNING_REF mKey; |
48 | | }; |
49 | | |
50 | | typedef nsPtrHashKey<const void> nsVoidPtrHashKey; |
51 | | |
52 | | #endif // nsPointerHashKeys_h |