/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIUTF8StringEnumerator;
interface nsILocalFile;

[scriptable, uuid(7eb955f6-3e78-4d39-b72f-c1bf12a94bce)]
interface nsIINIParser : nsISupports
{
  /**
   * Enumerates the [section]s available in the INI file.
   */
  nsIUTF8StringEnumerator getSections();

  /**
   * Enumerates the keys available within a section.
   */
  nsIUTF8StringEnumerator getKeys(in AUTF8String aSection);

  /**
   * Get the value of a string for a particular section and key.
   */
  AUTF8String getString(in AUTF8String aSection, in AUTF8String aKey);
};

[scriptable, uuid(712dc5da-8d09-45d0-ba2e-de27eb384c4c)]
interface nsIINIParserWriter : nsISupports
{
  /**
   * Set the value of a string for a particular section and key.
   */
  void setString(in AUTF8String aSection, in AUTF8String aKey, in AUTF8String aValue);

  /**
   * Write to the INI file.
   */
  void writeFile([optional] in nsILocalFile aINIFile);
};

[scriptable, uuid(ccae7ea5-1218-4b51-aecb-c2d8ecd46af9)]
interface nsIINIParserFactory : nsISupports
{
  /**
   * Create an iniparser instance from a local file.
   */
  nsIINIParser createINIParser(in nsILocalFile aINIFile);
};
