michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 "nsIProperties.idl" michael@0: michael@0: interface nsIInputStream; michael@0: interface nsIOutputStream; michael@0: interface nsISimpleEnumerator; michael@0: michael@0: [scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)] michael@0: interface nsIPropertyElement : nsISupports { michael@0: attribute AUTF8String key; michael@0: attribute AString value; michael@0: }; michael@0: michael@0: [scriptable, uuid(1A180F60-93B2-11d2-9B8B-00805F8A16D9)] michael@0: interface nsIPersistentProperties : nsIProperties michael@0: { michael@0: /** michael@0: * load a set of name/value pairs from the input stream michael@0: * names and values should be in UTF8 michael@0: */ michael@0: void load(in nsIInputStream input); michael@0: michael@0: /** michael@0: * output the values to the stream - results will be in UTF8 michael@0: */ michael@0: void save(in nsIOutputStream output, in AUTF8String header); michael@0: michael@0: /** michael@0: * call subclass() to make future calls to load() set the properties michael@0: * in this "superclass" instead michael@0: */ michael@0: void subclass(in nsIPersistentProperties superclass); michael@0: michael@0: /** michael@0: * get an enumeration of nsIPropertyElement objects, michael@0: * which are read-only (i.e. setting properties on the element will michael@0: * not make changes back into the source nsIPersistentProperties michael@0: */ michael@0: nsISimpleEnumerator enumerate(); michael@0: michael@0: /** michael@0: * shortcut to nsIProperty's get() which retrieves a string value michael@0: * directly (and thus faster) michael@0: */ michael@0: AString getStringProperty(in AUTF8String key); michael@0: michael@0: /** michael@0: * shortcut to nsIProperty's set() which sets a string value michael@0: * directly (and thus faster). If the given property already exists, michael@0: * then the old value will be returned michael@0: */ michael@0: AString setStringProperty(in AUTF8String key, in AString value); michael@0: }; michael@0: michael@0: michael@0: %{C++ michael@0: michael@0: #define NS_IPERSISTENTPROPERTIES_CID \ michael@0: { 0x2245e573, 0x9464, 0x11d2, \ michael@0: { 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } } michael@0: michael@0: #define NS_PERSISTENTPROPERTIES_CONTRACTID "@mozilla.org/persistent-properties;1" michael@0: michael@0: %} michael@0: