1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsIINIParser.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIUTF8StringEnumerator; 1.11 +interface nsIFile; 1.12 + 1.13 +[scriptable, uuid(7eb955f6-3e78-4d39-b72f-c1bf12a94bce)] 1.14 +interface nsIINIParser : nsISupports 1.15 +{ 1.16 + /** 1.17 + * Enumerates the [section]s available in the INI file. 1.18 + */ 1.19 + nsIUTF8StringEnumerator getSections(); 1.20 + 1.21 + /** 1.22 + * Enumerates the keys available within a section. 1.23 + */ 1.24 + nsIUTF8StringEnumerator getKeys(in AUTF8String aSection); 1.25 + 1.26 + /** 1.27 + * Get the value of a string for a particular section and key. 1.28 + */ 1.29 + AUTF8String getString(in AUTF8String aSection, in AUTF8String aKey); 1.30 +}; 1.31 + 1.32 +[scriptable, uuid(b67bb24b-31a3-4a6a-a5d9-0485c9af5a04)] 1.33 +interface nsIINIParserWriter : nsISupports 1.34 +{ 1.35 + /** 1.36 + * Windows and the NSIS installer code sometimes expect INI files to be in 1.37 + * UTF-16 encoding. On Windows only, this flag to writeFile can be used to 1.38 + * change the encoding from its default UTF-8. 1.39 + */ 1.40 + const unsigned long WRITE_UTF16 = 0x1; 1.41 + 1.42 + /** 1.43 + * Set the value of a string for a particular section and key. 1.44 + */ 1.45 + void setString(in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue); 1.46 + 1.47 + /** 1.48 + * Write to the INI file. 1.49 + */ 1.50 + void writeFile([optional] in nsIFile aINIFile, 1.51 + [optional] in unsigned long aFlags); 1.52 +}; 1.53 + 1.54 +[scriptable, uuid(ccae7ea5-1218-4b51-aecb-c2d8ecd46af9)] 1.55 +interface nsIINIParserFactory : nsISupports 1.56 +{ 1.57 + /** 1.58 + * Create an iniparser instance from a local file. 1.59 + */ 1.60 + nsIINIParser createINIParser(in nsIFile aINIFile); 1.61 +};