d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync/* ***** BEGIN LICENSE BLOCK *****
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * Version: MPL 1.1/GPL 2.0/LGPL 2.1
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync *
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * The contents of this file are subject to the Mozilla Public License Version
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * 1.1 (the "License"); you may not use this file except in compliance with
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * the License. You may obtain a copy of the License at
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * http://www.mozilla.org/MPL/
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync *
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * Software distributed under the License is distributed on an "AS IS" basis,
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * for the specific language governing rights and limitations under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * License.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The Original Code is mozilla.org code.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync *
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * The Initial Developer of the Original Code is
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Netscape Communications Corporation.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Portions created by the Initial Developer are Copyright (C) 1998
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * the Initial Developer. All Rights Reserved.
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync *
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * Contributor(s):
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync *
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * Alternatively, the contents of this file may be used under the terms of
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * either of the GNU General Public License Version 2 or later (the "GPL"),
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * in which case the provisions of the GPL or the LGPL are applicable instead
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * of those above. If you wish to allow use of your version of this file only
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * under the terms of either the GPL or the LGPL, and not to allow others to
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * use your version of this file under the terms of the MPL, indicate your
7e960d3a0a8a3a84d7aba2cca45d72b1c31cc97bvboxsync * decision by deleting the provisions above and replace them with the notice
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * and other provisions required by the GPL or the LGPL. If you do not delete
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * the provisions above, a recipient may use your version of this file under
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * the terms of any one of the MPL, the GPL or the LGPL.
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync *
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * ***** END LICENSE BLOCK ***** */
61fa69e2bc9fc9e7490feed1c020273f3ddb238dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync#include "nsISupports.idl"
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync#include "nsIProperties.idl"
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync#include "nsISimpleEnumerator.idl"
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
b74ca013e5f201a2dd371e6c438433ceac12af30vboxsyncinterface nsIInputStream;
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsyncinterface nsIOutputStream;
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync[scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)]
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsyncinterface nsIPropertyElement : nsISupports {
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync attribute AUTF8String key;
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync attribute AString value;
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync};
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
223cf005b18af2c21352a70693ebaf0582f68ebcvboxsync[scriptable, uuid(1A180F60-93B2-11d2-9B8B-00805F8A16D9)]
223cf005b18af2c21352a70693ebaf0582f68ebcvboxsyncinterface nsIPersistentProperties : nsIProperties
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync{
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync /**
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * load a set of name/value pairs from the input stream
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * names and values should be in UTF8
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync */
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync void load(in nsIInputStream input);
afed5ab737f4aacfae3fe73776f40e989190a7cavboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync /**
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * output the values to the stream - results will be in UTF8
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync */
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync void save(in nsIOutputStream output, in AUTF8String header);
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync /**
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * call subclass() to make future calls to load() set the properties
0174432b2b1a760b89840ba696f7ba51def65dddvboxsync * in this "superclass" instead
2daaccf68be3773aee600c5c3e48bcf5401418a6vboxsync */
0174432b2b1a760b89840ba696f7ba51def65dddvboxsync void subclass(in nsIPersistentProperties superclass);
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync /**
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync * get an enumeration of nsIPropertyElement objects,
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync * which are read-only (i.e. setting properties on the element will
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync * not make changes back into the source nsIPersistentProperties
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync */
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync nsISimpleEnumerator enumerate();
7666082b743c5e146a8cee6cc794ff4bc3fd0ffdvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync /**
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * shortcut to nsIProperty's get() which retrieves a string value
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * directly (and thus faster)
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync */
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync AString getStringProperty(in AUTF8String key);
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync /**
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * shortcut to nsIProperty's set() which sets a string value
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync * directly (and thus faster)
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync */
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync AString setStringProperty(in AUTF8String key, in AString value);
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync};
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync%{C++
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync//{283EE645-1AEF-11D4-98B3-00C04fA0CE9A}
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync#define NS_IPROPERTYELEMENT_CID \
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync{ 0x283ee645, 0x1aef, 0x11d4, \
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync { 0x98, 0xb3, 0x0, 0xc0, 0x4f, 0xa0, 0xce, 0x9a } }
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync
d408b82da0773c7e8cd4b3a01cb8a065a2c73a2dvboxsync#define NS_IPERSISTENTPROPERTIES_CID \
22e281e75ed636601178296c6daebda8f1d17c59vboxsync{ 0x2245e573, 0x9464, 0x11d2, \
22e281e75ed636601178296c6daebda8f1d17c59vboxsync { 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
22e281e75ed636601178296c6daebda8f1d17c59vboxsync
22e281e75ed636601178296c6daebda8f1d17c59vboxsync#define NS_PERSISTENTPROPERTIES_CONTRACTID "@mozilla.org/persistent-properties;1"
22e281e75ed636601178296c6daebda8f1d17c59vboxsync#define NS_PERSISTENTPROPERTIES_CLASSNAME "Persistent Properties"
22e281e75ed636601178296c6daebda8f1d17c59vboxsync
22e281e75ed636601178296c6daebda8f1d17c59vboxsync%}
22e281e75ed636601178296c6daebda8f1d17c59vboxsync
22e281e75ed636601178296c6daebda8f1d17c59vboxsync