|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIUTF8StringEnumerator; |
|
8 interface nsIFile; |
|
9 |
|
10 [scriptable, uuid(7eb955f6-3e78-4d39-b72f-c1bf12a94bce)] |
|
11 interface nsIINIParser : nsISupports |
|
12 { |
|
13 /** |
|
14 * Enumerates the [section]s available in the INI file. |
|
15 */ |
|
16 nsIUTF8StringEnumerator getSections(); |
|
17 |
|
18 /** |
|
19 * Enumerates the keys available within a section. |
|
20 */ |
|
21 nsIUTF8StringEnumerator getKeys(in AUTF8String aSection); |
|
22 |
|
23 /** |
|
24 * Get the value of a string for a particular section and key. |
|
25 */ |
|
26 AUTF8String getString(in AUTF8String aSection, in AUTF8String aKey); |
|
27 }; |
|
28 |
|
29 [scriptable, uuid(b67bb24b-31a3-4a6a-a5d9-0485c9af5a04)] |
|
30 interface nsIINIParserWriter : nsISupports |
|
31 { |
|
32 /** |
|
33 * Windows and the NSIS installer code sometimes expect INI files to be in |
|
34 * UTF-16 encoding. On Windows only, this flag to writeFile can be used to |
|
35 * change the encoding from its default UTF-8. |
|
36 */ |
|
37 const unsigned long WRITE_UTF16 = 0x1; |
|
38 |
|
39 /** |
|
40 * Set the value of a string for a particular section and key. |
|
41 */ |
|
42 void setString(in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue); |
|
43 |
|
44 /** |
|
45 * Write to the INI file. |
|
46 */ |
|
47 void writeFile([optional] in nsIFile aINIFile, |
|
48 [optional] in unsigned long aFlags); |
|
49 }; |
|
50 |
|
51 [scriptable, uuid(ccae7ea5-1218-4b51-aecb-c2d8ecd46af9)] |
|
52 interface nsIINIParserFactory : nsISupports |
|
53 { |
|
54 /** |
|
55 * Create an iniparser instance from a local file. |
|
56 */ |
|
57 nsIINIParser createINIParser(in nsIFile aINIFile); |
|
58 }; |