|
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 #include "nsIProperties.idl" |
|
7 |
|
8 interface nsIInputStream; |
|
9 interface nsIOutputStream; |
|
10 interface nsISimpleEnumerator; |
|
11 |
|
12 [scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)] |
|
13 interface nsIPropertyElement : nsISupports { |
|
14 attribute AUTF8String key; |
|
15 attribute AString value; |
|
16 }; |
|
17 |
|
18 [scriptable, uuid(1A180F60-93B2-11d2-9B8B-00805F8A16D9)] |
|
19 interface nsIPersistentProperties : nsIProperties |
|
20 { |
|
21 /** |
|
22 * load a set of name/value pairs from the input stream |
|
23 * names and values should be in UTF8 |
|
24 */ |
|
25 void load(in nsIInputStream input); |
|
26 |
|
27 /** |
|
28 * output the values to the stream - results will be in UTF8 |
|
29 */ |
|
30 void save(in nsIOutputStream output, in AUTF8String header); |
|
31 |
|
32 /** |
|
33 * call subclass() to make future calls to load() set the properties |
|
34 * in this "superclass" instead |
|
35 */ |
|
36 void subclass(in nsIPersistentProperties superclass); |
|
37 |
|
38 /** |
|
39 * get an enumeration of nsIPropertyElement objects, |
|
40 * which are read-only (i.e. setting properties on the element will |
|
41 * not make changes back into the source nsIPersistentProperties |
|
42 */ |
|
43 nsISimpleEnumerator enumerate(); |
|
44 |
|
45 /** |
|
46 * shortcut to nsIProperty's get() which retrieves a string value |
|
47 * directly (and thus faster) |
|
48 */ |
|
49 AString getStringProperty(in AUTF8String key); |
|
50 |
|
51 /** |
|
52 * shortcut to nsIProperty's set() which sets a string value |
|
53 * directly (and thus faster). If the given property already exists, |
|
54 * then the old value will be returned |
|
55 */ |
|
56 AString setStringProperty(in AUTF8String key, in AString value); |
|
57 }; |
|
58 |
|
59 |
|
60 %{C++ |
|
61 |
|
62 #define NS_IPERSISTENTPROPERTIES_CID \ |
|
63 { 0x2245e573, 0x9464, 0x11d2, \ |
|
64 { 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } } |
|
65 |
|
66 #define NS_PERSISTENTPROPERTIES_CONTRACTID "@mozilla.org/persistent-properties;1" |
|
67 |
|
68 %} |
|
69 |