1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: registrywnt.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _REGISTRYWNT_HXX_
32 #define _REGISTRYWNT_HXX_
34 #include "registry.hxx"
36 //---------------------------------------
38 //---------------------------------------
40 class RegistryKeyImplWinNT
: public RegistryKeyImpl
44 //############################################
46 //############################################
48 /** The number of sub values of the key at hand
50 @precond IsOpen = true
54 virtual size_t GetSubValueCount() const;
56 /** The number of sub-keys of the key at hand
58 @precond IsOpen = true
62 virtual size_t GetSubKeyCount() const;
64 virtual StringListPtr
GetSubKeyNames() const;
66 virtual StringListPtr
GetSubValueNames() const;
68 /** Get the specified registry value
70 @precond IsOpen = true
72 virtual RegistryValue
GetValue(const std::wstring
& Name
) const;
74 /** Get the specified registry value, return the given
75 default value if value not found
77 @precond IsOpen = true
79 virtual RegistryValue
GetValue(const std::wstring
& Name
, const RegistryValue
& Default
) const;
81 //############################################
83 //############################################
85 /** Open the registry key, has no effect if
86 the key is already open
88 @precond IsOpen = false
90 @throws RegistryWriteAccessDenyException
91 RegistryAccessDenyException
93 virtual void Open(bool Writeable
= true);
95 /** Open the specified sub-key of the registry key
98 @precond IsOpen = true
99 HasSubKey(Name) = true
101 @throws RegistryIOException
102 RegistryKeyNotFoundException
103 RegistryAccessDeniedException
105 virtual RegistryKey
OpenSubKey(const std::wstring
& Name
, bool Writeable
= true);
107 /** Creates a new sub-key below the key at hand
109 @precond IsOpen = true
112 @throws RegistryIOException
113 RegistryWriteAccessDenyException
115 virtual RegistryKey
CreateSubKey(const std::wstring
& Name
);
117 /** Deletes a sub-key below the key at hand, the
118 key must not have sub-keys
120 @precond IsOpen = true
123 @throws RegistryIOException
124 RegistryWriteAccessDenyException
126 virtual void DeleteSubKey(const std::wstring
& Name
);
128 /** Deletes a sub-key below the key at hand with all
131 @precond IsOpen = true
134 @throws RegistryIOException
135 RegistryWriteAccessDenyException
137 virtual void DeleteSubKeyTree(const std::wstring
& Name
);
139 /** Delete the specified value
141 @precond IsOpen = true
143 HasValue(Name) = true
145 @throws RegistryIOException
146 RegistryWriteAccessDeniedException
147 RegistryValueNotFoundException
149 virtual void DeleteValue(const std::wstring
& Name
);
151 /** Set the specified registry value
153 @precond IsOpen = true
156 @throws RegistryIOException
157 RegistryWriteAccessDenyException
159 virtual void SetValue(const RegistryValue
& Value
);
161 //############################################
164 // only possible through WindowsRegistry class
165 //############################################
168 /** Create instance and open the specified Registry key
170 @throws RegistryWriteAccessDenyException
171 RegistryAccessDenyException
172 RegistryKeyNotFoundException
174 RegistryKeyImplWinNT(HKEY RootKey
, const std::wstring
& KeyName
);
176 /** Create instance and open the specified Registry key
178 @throws RegistryWriteAccessDenyException
179 RegistryAccessDenyException
180 RegistryKeyNotFoundException
182 RegistryKeyImplWinNT(HKEY RootKey
);
184 /** Create an instances of the specified Registry key,
185 the key is assumed to be already opened.
187 RegistryKeyImplWinNT(HKEY RootKey
, HKEY SubKey
, const std::wstring
& KeyName
, bool Writeable
= true);
191 LONG
ImplDeleteSubKeyTree(HKEY RootKey
, const std::wstring
& Name
);
193 //prevent copy and assignment
195 RegistryKeyImplWinNT(const RegistryKeyImplWinNT
&);
196 RegistryKeyImplWinNT
& operator=(const RegistryKeyImplWinNT
&);
198 //######################################
199 // Friend declarations
200 //######################################
202 friend class WindowsRegistry
;