michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIUTF8StringEnumerator; michael@0: interface nsIFile; michael@0: michael@0: [scriptable, uuid(7eb955f6-3e78-4d39-b72f-c1bf12a94bce)] michael@0: interface nsIINIParser : nsISupports michael@0: { michael@0: /** michael@0: * Enumerates the [section]s available in the INI file. michael@0: */ michael@0: nsIUTF8StringEnumerator getSections(); michael@0: michael@0: /** michael@0: * Enumerates the keys available within a section. michael@0: */ michael@0: nsIUTF8StringEnumerator getKeys(in AUTF8String aSection); michael@0: michael@0: /** michael@0: * Get the value of a string for a particular section and key. michael@0: */ michael@0: AUTF8String getString(in AUTF8String aSection, in AUTF8String aKey); michael@0: }; michael@0: michael@0: [scriptable, uuid(b67bb24b-31a3-4a6a-a5d9-0485c9af5a04)] michael@0: interface nsIINIParserWriter : nsISupports michael@0: { michael@0: /** michael@0: * Windows and the NSIS installer code sometimes expect INI files to be in michael@0: * UTF-16 encoding. On Windows only, this flag to writeFile can be used to michael@0: * change the encoding from its default UTF-8. michael@0: */ michael@0: const unsigned long WRITE_UTF16 = 0x1; michael@0: michael@0: /** michael@0: * Set the value of a string for a particular section and key. michael@0: */ michael@0: void setString(in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue); michael@0: michael@0: /** michael@0: * Write to the INI file. michael@0: */ michael@0: void writeFile([optional] in nsIFile aINIFile, michael@0: [optional] in unsigned long aFlags); michael@0: }; michael@0: michael@0: [scriptable, uuid(ccae7ea5-1218-4b51-aecb-c2d8ecd46af9)] michael@0: interface nsIINIParserFactory : nsISupports michael@0: { michael@0: /** michael@0: * Create an iniparser instance from a local file. michael@0: */ michael@0: nsIINIParser createINIParser(in nsIFile aINIFile); michael@0: };