1*2c7984eaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2c7984eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2c7984eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2c7984eaSAndrew Rist  * distributed with this work for additional information
6*2c7984eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2c7984eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2c7984eaSAndrew Rist  * "License"); you may not use this file except in compliance
9*2c7984eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2c7984eaSAndrew Rist  *
11*2c7984eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2c7984eaSAndrew Rist  *
13*2c7984eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2c7984eaSAndrew Rist  * software distributed under the License is distributed on an
15*2c7984eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2c7984eaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2c7984eaSAndrew Rist  * specific language governing permissions and limitations
18*2c7984eaSAndrew Rist  * under the License.
19*2c7984eaSAndrew Rist  *
20*2c7984eaSAndrew Rist  *************************************************************/
21*2c7984eaSAndrew Rist 
22*2c7984eaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _REGISTRYW9X_HXX_
25cdf0e10cSrcweir #define _REGISTRYW9X_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "registry.hxx"
28cdf0e10cSrcweir #include "registry.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir //---------------------------------------
31cdf0e10cSrcweir // constants
32cdf0e10cSrcweir //---------------------------------------
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class RegistryKeyImplWin9x : public RegistryKeyImpl
35cdf0e10cSrcweir {
36cdf0e10cSrcweir public:
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 	//############################################
39cdf0e10cSrcweir 	// Queries
40cdf0e10cSrcweir 	//############################################
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	/** The number of sub values of the key at hand
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 		@precond IsOpen = true
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 		@throws
47cdf0e10cSrcweir 	*/
48cdf0e10cSrcweir 	virtual size_t GetSubValueCount() const;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	/** The number of sub-keys of the key at hand
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 		@precond IsOpen = true
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 		@throws
55cdf0e10cSrcweir 	*/
56cdf0e10cSrcweir 	virtual size_t GetSubKeyCount() const;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	virtual StringListPtr GetSubKeyNames() const;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	virtual StringListPtr GetSubValueNames() const;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	/** Get the specified registry value
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		@precond IsOpen = true
65cdf0e10cSrcweir 	*/
66cdf0e10cSrcweir 	virtual RegistryValue GetValue(const std::wstring& Name) const;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	/** Get the specified registry value, return the given
69cdf0e10cSrcweir 		default value if value not found
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 		@precond IsOpen = true
72cdf0e10cSrcweir 	*/
73cdf0e10cSrcweir 	virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	//############################################
76cdf0e10cSrcweir 	// Commands
77cdf0e10cSrcweir 	//############################################
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	/** Open the registry key, has no effect if
80cdf0e10cSrcweir 		the key is already open
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 		@precond IsOpen = false
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		@throws RegistryWriteAccessDenyException
85cdf0e10cSrcweir 				RegistryAccessDenyException
86cdf0e10cSrcweir 	*/
87cdf0e10cSrcweir 	virtual void Open(bool Writeable = true);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	/** Open the specified sub-key of the registry key
90cdf0e10cSrcweir 		at hand
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 		@precond IsOpen = true
93cdf0e10cSrcweir 				 HasSubKey(Name) = true
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 		@throws RegistryIOException
96cdf0e10cSrcweir 				RegistryKeyNotFoundException
97cdf0e10cSrcweir 				RegistryAccessDeniedException
98cdf0e10cSrcweir 	*/
99cdf0e10cSrcweir 	virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true);
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	/** Creates a new sub-key below the key at hand
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 		@precond IsOpen = true
104cdf0e10cSrcweir 				 IsWriteable = true
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 		@throws  RegistryIOException
107cdf0e10cSrcweir 				 RegistryWriteAccessDenyException
108cdf0e10cSrcweir 	*/
109cdf0e10cSrcweir 	virtual RegistryKey CreateSubKey(const std::wstring& Name);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	/** Deletes a sub-key below the key at hand, the
112cdf0e10cSrcweir 		key must not have sub-keys
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 		@precond IsOpen = true
115cdf0e10cSrcweir 				 IsWriteable = true
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		@throws  RegistryIOException
118cdf0e10cSrcweir 				 RegistryWriteAccessDenyException
119cdf0e10cSrcweir 	*/
120cdf0e10cSrcweir 	virtual void DeleteSubKey(const std::wstring& Name);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	/** Deletes a sub-key below the key at hand with all
123cdf0e10cSrcweir 		its sub-keys
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 		@precond IsOpen = true
126cdf0e10cSrcweir 				 IsWriteable = true;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 		@throws  RegistryIOException
129cdf0e10cSrcweir 				 RegistryWriteAccessDenyException
130cdf0e10cSrcweir 	*/
131cdf0e10cSrcweir 	virtual void DeleteSubKeyTree(const std::wstring& Name);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	/** Delete the specified value
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 		@precond IsOpen = true
136cdf0e10cSrcweir 				 IsWriteable = true
137cdf0e10cSrcweir 				 HasValue(Name) = true
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		@throws	RegistryIOException
140cdf0e10cSrcweir 				RegistryWriteAccessDeniedException
141cdf0e10cSrcweir 				RegistryValueNotFoundException
142cdf0e10cSrcweir 	*/
143cdf0e10cSrcweir 	virtual void DeleteValue(const std::wstring& Name);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	/** Set the specified registry value
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 		@precond IsOpen = true
148cdf0e10cSrcweir 				 IsWriteable = true
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 		@throws  RegistryIOException
151cdf0e10cSrcweir 				 RegistryWriteAccessDenyException
152cdf0e10cSrcweir 	*/
153cdf0e10cSrcweir 	virtual void SetValue(const RegistryValue& Value);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	//############################################
156cdf0e10cSrcweir 	// Creation
157cdf0e10cSrcweir 	//
158cdf0e10cSrcweir 	// only possible through WindowsRegistry class
159cdf0e10cSrcweir 	//############################################
160cdf0e10cSrcweir 
161cdf0e10cSrcweir protected:
162cdf0e10cSrcweir 	/** Create instance and open the specified Registry key
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		@throws  RegistryWriteAccessDenyException
165cdf0e10cSrcweir 				 RegistryAccessDenyException
166cdf0e10cSrcweir 				 RegistryKeyNotFoundException
167cdf0e10cSrcweir 	*/
168cdf0e10cSrcweir     RegistryKeyImplWin9x(HKEY RootKey, const std::wstring& KeyName);
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 	/** Create instance and open the specified Registry key
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 		@throws  RegistryWriteAccessDenyException
173cdf0e10cSrcweir 				 RegistryAccessDenyException
174cdf0e10cSrcweir 				 RegistryKeyNotFoundException
175cdf0e10cSrcweir 	*/
176cdf0e10cSrcweir 	RegistryKeyImplWin9x(HKEY RootKey);
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 	/** Create an instances of the specified Registry key,
179cdf0e10cSrcweir 	the key is assumed to be already opened.
180cdf0e10cSrcweir 	*/
181cdf0e10cSrcweir 	RegistryKeyImplWin9x(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir // prevent copy/assignment
184cdf0e10cSrcweir private:
185cdf0e10cSrcweir     RegistryKeyImplWin9x(const RegistryKeyImplWin9x&);
186cdf0e10cSrcweir     RegistryKeyImplWin9x& operator=(const RegistryKeyImplWin9x&);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir //######################################
189cdf0e10cSrcweir // Friend declarations
190cdf0e10cSrcweir //######################################
191cdf0e10cSrcweir 
192cdf0e10cSrcweir friend class WindowsRegistry;
193cdf0e10cSrcweir };
194cdf0e10cSrcweir 
195cdf0e10cSrcweir #endif
196