Bug 1734063 [wpt PR 31107] - [GridNG] Fix rounding of distributed free space to flexi...
[gecko.git] / xpcom / ds / nsHashPropertyBag.h
blobd6a3d7ee7da045deef66619ca43c71ab6353328a
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/. */
7 #ifndef nsHashPropertyBag_h___
8 #define nsHashPropertyBag_h___
10 #include "nsIVariant.h"
11 #include "nsIWritablePropertyBag.h"
12 #include "nsIWritablePropertyBag2.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsInterfaceHashtable.h"
17 class nsHashPropertyBagBase : public nsIWritablePropertyBag,
18 public nsIWritablePropertyBag2 {
19 public:
20 nsHashPropertyBagBase() = default;
22 void CopyFrom(const nsHashPropertyBagBase* aOther);
23 void CopyFrom(nsIPropertyBag* aOther);
24 static void CopyFrom(nsIWritablePropertyBag* aTo, nsIPropertyBag* aFrom);
26 NS_DECL_NSIPROPERTYBAG
27 NS_DECL_NSIPROPERTYBAG2
29 NS_DECL_NSIWRITABLEPROPERTYBAG
30 NS_DECL_NSIWRITABLEPROPERTYBAG2
32 protected:
33 // a hash table of string -> nsIVariant
34 nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
37 class nsHashPropertyBag : public nsHashPropertyBagBase {
38 public:
39 nsHashPropertyBag() = default;
40 NS_DECL_THREADSAFE_ISUPPORTS
42 protected:
43 virtual ~nsHashPropertyBag();
46 /* A cycle collected nsHashPropertyBag for main-thread-only use. */
47 class nsHashPropertyBagCC final : public nsHashPropertyBagBase {
48 public:
49 nsHashPropertyBagCC() = default;
50 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
51 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHashPropertyBagCC,
52 nsIWritablePropertyBag)
53 protected:
54 virtual ~nsHashPropertyBagCC() = default;
57 inline nsISupports* ToSupports(nsHashPropertyBagBase* aPropertyBag) {
58 return static_cast<nsIWritablePropertyBag*>(aPropertyBag);
61 #endif /* nsHashPropertyBag_h___ */