1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/ds/nsIPersistentProperties2.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsIProperties.idl" 1.10 + 1.11 +interface nsIInputStream; 1.12 +interface nsIOutputStream; 1.13 +interface nsISimpleEnumerator; 1.14 + 1.15 +[scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)] 1.16 +interface nsIPropertyElement : nsISupports { 1.17 + attribute AUTF8String key; 1.18 + attribute AString value; 1.19 +}; 1.20 + 1.21 +[scriptable, uuid(1A180F60-93B2-11d2-9B8B-00805F8A16D9)] 1.22 +interface nsIPersistentProperties : nsIProperties 1.23 +{ 1.24 + /** 1.25 + * load a set of name/value pairs from the input stream 1.26 + * names and values should be in UTF8 1.27 + */ 1.28 + void load(in nsIInputStream input); 1.29 + 1.30 + /** 1.31 + * output the values to the stream - results will be in UTF8 1.32 + */ 1.33 + void save(in nsIOutputStream output, in AUTF8String header); 1.34 + 1.35 + /** 1.36 + * call subclass() to make future calls to load() set the properties 1.37 + * in this "superclass" instead 1.38 + */ 1.39 + void subclass(in nsIPersistentProperties superclass); 1.40 + 1.41 + /** 1.42 + * get an enumeration of nsIPropertyElement objects, 1.43 + * which are read-only (i.e. setting properties on the element will 1.44 + * not make changes back into the source nsIPersistentProperties 1.45 + */ 1.46 + nsISimpleEnumerator enumerate(); 1.47 + 1.48 + /** 1.49 + * shortcut to nsIProperty's get() which retrieves a string value 1.50 + * directly (and thus faster) 1.51 + */ 1.52 + AString getStringProperty(in AUTF8String key); 1.53 + 1.54 + /** 1.55 + * shortcut to nsIProperty's set() which sets a string value 1.56 + * directly (and thus faster). If the given property already exists, 1.57 + * then the old value will be returned 1.58 + */ 1.59 + AString setStringProperty(in AUTF8String key, in AString value); 1.60 +}; 1.61 + 1.62 + 1.63 +%{C++ 1.64 + 1.65 +#define NS_IPERSISTENTPROPERTIES_CID \ 1.66 +{ 0x2245e573, 0x9464, 0x11d2, \ 1.67 + { 0x9b, 0x8b, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } } 1.68 + 1.69 +#define NS_PERSISTENTPROPERTIES_CONTRACTID "@mozilla.org/persistent-properties;1" 1.70 + 1.71 +%} 1.72 +