|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsPersistentProperties_h___ |
|
7 #define nsPersistentProperties_h___ |
|
8 |
|
9 #include "nsIPersistentProperties2.h" |
|
10 #include "pldhash.h" |
|
11 #include "plarena.h" |
|
12 #include "nsString.h" |
|
13 #include "nsCOMPtr.h" |
|
14 #include "mozilla/Attributes.h" |
|
15 |
|
16 class nsIUnicharInputStream; |
|
17 |
|
18 class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties |
|
19 { |
|
20 public: |
|
21 nsPersistentProperties(); |
|
22 |
|
23 NS_DECL_THREADSAFE_ISUPPORTS |
|
24 NS_DECL_NSIPROPERTIES |
|
25 NS_DECL_NSIPERSISTENTPROPERTIES |
|
26 |
|
27 static nsresult |
|
28 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
|
29 |
|
30 private: |
|
31 ~nsPersistentProperties(); |
|
32 |
|
33 protected: |
|
34 nsCOMPtr<nsIUnicharInputStream> mIn; |
|
35 |
|
36 nsIPersistentProperties* mSubclass; |
|
37 struct PLDHashTable mTable; |
|
38 PLArenaPool mArena; |
|
39 }; |
|
40 |
|
41 class nsPropertyElement MOZ_FINAL : public nsIPropertyElement |
|
42 { |
|
43 public: |
|
44 nsPropertyElement() |
|
45 { |
|
46 } |
|
47 |
|
48 nsPropertyElement(const nsACString& aKey, const nsAString& aValue) |
|
49 : mKey(aKey), mValue(aValue) |
|
50 { |
|
51 } |
|
52 |
|
53 NS_DECL_ISUPPORTS |
|
54 NS_DECL_NSIPROPERTYELEMENT |
|
55 |
|
56 static NS_METHOD |
|
57 Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); |
|
58 |
|
59 private: |
|
60 ~nsPropertyElement() {} |
|
61 |
|
62 protected: |
|
63 nsCString mKey; |
|
64 nsString mValue; |
|
65 }; |
|
66 |
|
67 #endif /* nsPersistentProperties_h___ */ |