Line data Source code
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 : #ifndef nsPersistentProperties_h___
8 : #define nsPersistentProperties_h___
9 :
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"
16 :
17 : class nsIUnicharInputStream;
18 :
19 : class nsPersistentProperties final : public nsIPersistentProperties
20 : {
21 : public:
22 : nsPersistentProperties();
23 :
24 : NS_DECL_THREADSAFE_ISUPPORTS
25 : NS_DECL_NSIPROPERTIES
26 : NS_DECL_NSIPERSISTENTPROPERTIES
27 :
28 : static MOZ_MUST_USE nsresult
29 : Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
30 :
31 : private:
32 : ~nsPersistentProperties();
33 :
34 : protected:
35 : nsCOMPtr<nsIUnicharInputStream> mIn;
36 :
37 : PLDHashTable mTable;
38 : mozilla::ArenaAllocator<2048,4> mArena;
39 : };
40 :
41 : class nsPropertyElement final : public nsIPropertyElement
42 : {
43 : public:
44 0 : nsPropertyElement()
45 0 : {
46 0 : }
47 :
48 0 : nsPropertyElement(const nsACString& aKey, const nsAString& aValue)
49 0 : : mKey(aKey)
50 0 : , mValue(aValue)
51 : {
52 0 : }
53 :
54 : NS_DECL_ISUPPORTS
55 : NS_DECL_NSIPROPERTYELEMENT
56 :
57 : static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
58 :
59 : private:
60 0 : ~nsPropertyElement() {}
61 :
62 : protected:
63 : nsCString mKey;
64 : nsString mValue;
65 : };
66 :
67 : #endif /* nsPersistentProperties_h___ */
|