1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org Code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1999
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #include
"nsISupports.idl"
38 #include
"nsIEnumerator.idl"
42 typedef PRUint32 nsRegistryKey
;
43 typedef long nsWellKnownRegistry
;
45 [scriptable
,uuid(5D41A440
-8E37
-11d2
-8059-00600811A9C3
)]
46 interface nsIRegistry
: nsISupports
50 const long Common
= 2;
51 const long CurrentUser
= 3;
53 const long ApplicationComponentRegistry
= 1;
54 const long ApplicationRegistry
= 2;
56 // Don't use this one. This for internal use only.
57 const long ApplicationCustomRegistry
= -1;
59 void open
(in nsIFile regFile
);
60 void openWellKnownRegistry
(in nsWellKnownRegistry regid
);
65 nsRegistryKey addKey
(in nsRegistryKey baseKey
, in wstring keyname
);
66 nsRegistryKey getKey
(in nsRegistryKey baseKey
, in wstring keyname
);
67 void removeKey
(in nsRegistryKey baseKey
, in wstring keyname
);
69 wstring getString
(in nsRegistryKey baseKey
, in wstring valname
);
70 void setString
(in nsRegistryKey baseKey
, in wstring valname
, in wstring value
);
72 string getStringUTF8
(in nsRegistryKey baseKey
, in string path
);
73 void setStringUTF8
(in nsRegistryKey baseKey
, in string path
, in string value
);
75 void getBytesUTF8
(in nsRegistryKey baseKey
, in string path
, out PRUint32 length
, [retval, array
, size_is(length
)] out PRUint8 valueArray
);
76 void setBytesUTF8
(in nsRegistryKey baseKey
, in string path
, in PRUint32 length
, [array
, size_is(length
)] in PRUint8 valueArray
);
77 PRInt32 getInt
(in nsRegistryKey baseKey
, in string path
);
78 void setInt
(in nsRegistryKey baseKey
, in string path
, in PRInt32 value
);
79 PRInt64 getLongLong
(in nsRegistryKey baseKey
, in string path
);
80 void setLongLong
(in nsRegistryKey baseKey
, in string path
, inout PRInt64 value
);
83 * addSubtree() and friends need to be renamed to addKeyUTF8().
84 * If you are using these forms make sure you pass UTF8 data
86 nsRegistryKey addSubtree
(in nsRegistryKey baseKey
, in string path
);
87 void removeSubtree
(in nsRegistryKey baseKey
, in string path
);
88 nsRegistryKey getSubtree
(in nsRegistryKey baseKey
, in string path
);
90 nsRegistryKey addSubtreeRaw
(in nsRegistryKey baseKey
, in string path
);
91 void removeSubtreeRaw
(in nsRegistryKey baseKey
, in string path
);
92 nsRegistryKey getSubtreeRaw
(in nsRegistryKey baseKey
, in string path
);
94 nsIEnumerator enumerateSubtrees
(in nsRegistryKey baseKey
);
95 nsIEnumerator enumerateAllSubtrees
(in nsRegistryKey baseKey
);
96 nsIEnumerator enumerateValues
(in nsRegistryKey baseKey
);
98 const unsigned long String = 1;
99 const unsigned long Int32
= 2;
100 const unsigned long Bytes
= 3;
101 const unsigned long File
= 4;
103 unsigned long getValueType
(in nsRegistryKey baseKey
, in string path
);
104 PRUint32 getValueLength
(in nsRegistryKey baseKey
, in string path
);
105 void deleteValue
(in nsRegistryKey baseKey
, in string path
);
108 * escapeKey() takes arbitrary binary data and converts it into
109 * valid ASCII which can be used as registry key or value names
111 void escapeKey
([array
, size_is(length
)] in PRUint8 key
, in PRUint32 terminator
, inout PRUint32 length
, [retval, array
, size_is(length
)] out PRUint8 escaped
);
112 void unescapeKey
([array
, size_is(length
)] in PRUint8 escaped
, in PRUint32 terminator
, inout PRUint32 length
, [retval, array
, size_is(length
)] out PRUint8 key
);
114 attribute
string currentUserName
;
119 [scriptable
, uuid(8cecf236
-1dd2
-11b2
-893c
-f9848956eaec
)]
120 interface nsIRegistryEnumerator
: nsIEnumerator
122 void currentItemInPlaceUTF8
(out nsRegistryKey key
,
123 [shared
, retval] out string item
);
126 [scriptable
, uuid(D1B54831
-AC07
-11d2
-805E-00600811A9C3
)]
127 interface nsIRegistryNode
: nsISupports
129 readonly attribute
string nameUTF8
;
130 readonly attribute wstring name
;
131 readonly attribute nsRegistryKey key
;
134 [scriptable
,uuid(5316C380
-B2F8
-11d2
-A374
-0080C6F80E4B
)]
135 interface nsIRegistryValue
: nsISupports
137 readonly attribute wstring name
;
138 readonly attribute
string nameUTF8
;
139 readonly attribute
unsigned long type
;
140 readonly attribute PRUint32 length
;
143 [uuid(3A15FC88
-7A61
-4Ab4
-8E58
-31E95fAB3DA8
)]
145 * It sucks that nsIRegistry has to always allocate and return
146 * strings. nsIRegistryGetter adds in interfaces for non allocating getters
147 * to registry values.
149 interface nsIRegistryGetter
: nsISupports
152 * Get a string value of attribute valname in widestring or utf8 format
156 * buf has the string value copied into it. length is NOT changed.
157 * NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
158 * length is updated to actual length in chars including
159 * terminating NULL and buf will be unchanged.
160 * NS_ERROR_FAILURE if an unknown error happened. state of buf and
162 * various failure codes otherwise. buf and length won't be updated.
164 void getStringUTF8IntoBuffer
(in nsRegistryKey baseKey
, in string path
,
165 inout
char buf
, inout PRUint32 length
);
168 * Get a a byte array value of attribute valname
171 * NS_OK on success. buf has the string value copied into it.
172 * length is updated to actual number of bytes copied into buf.
173 * NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space.
174 * length is updated to actual length in PRUint8s including
175 * terminating NULL and buf will be unchanged.
176 * NS_ERROR_FAILURE if an unknown error happened. state of buf and
178 * various other failure codes otherwise. buf and length won't be updated.
180 void getBytesUTF8IntoBuffer
(in nsRegistryKey baseKey
, in string path
,
181 inout PRUint8 buf
, inout PRUint32 length
);
185 #include
"nsIRegistryUtils.h"