Bug 1690340 - Part 4: Insert the "Page Source" before the "Extensions for Developers...
[gecko.git] / xpcom / ds / nsPersistentProperties.h
bloba83c6e3b46409430d367b288b8ef3b101696d93a
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 nsPersistentProperties_h___
8 #define nsPersistentProperties_h___
10 #include "nsIPersistentProperties2.h"
11 #include "PLDHashTable.h"
12 #include "nsString.h"
13 #include "nsCOMPtr.h"
14 #include "mozilla/ArenaAllocator.h"
15 #include "mozilla/Attributes.h"
17 class nsIUnicharInputStream;
19 class nsPersistentProperties final : public nsIPersistentProperties {
20 public:
21 nsPersistentProperties();
23 NS_DECL_THREADSAFE_ISUPPORTS
24 NS_DECL_NSIPROPERTIES
25 NS_DECL_NSIPERSISTENTPROPERTIES
27 size_t SizeOfIncludingThis(
28 mozilla::MallocSizeOf aMallocSizeOf) const override;
30 private:
31 ~nsPersistentProperties();
33 protected:
34 nsCOMPtr<nsIUnicharInputStream> mIn;
36 PLDHashTable mTable;
37 mozilla::ArenaAllocator<2048, 4> mArena;
40 class nsPropertyElement final : public nsIPropertyElement {
41 public:
42 nsPropertyElement() = default;
44 nsPropertyElement(const nsACString& aKey, const nsAString& aValue)
45 : mKey(aKey), mValue(aValue) {}
47 NS_DECL_ISUPPORTS
48 NS_DECL_NSIPROPERTYELEMENT
50 static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
52 private:
53 ~nsPropertyElement() = default;
55 protected:
56 nsCString mKey;
57 nsString mValue;
60 #endif /* nsPersistentProperties_h___ */