Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / setup_native / source / win32 / customactions / reg4msdoc / registrywnt.hxx
blob517327f34582a6b4851746b8ebd9bc2476534d24
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _REGISTRYWNT_HXX_
30 #define _REGISTRYWNT_HXX_
32 #include "registry.hxx"
34 //---------------------------------------
35 // constants
36 //---------------------------------------
38 class RegistryKeyImplWinNT : public RegistryKeyImpl
40 public:
42 //############################################
43 // Queries
44 //############################################
46 /** The number of sub values of the key at hand
48 @precond IsOpen = true
50 @throws
52 virtual size_t GetSubValueCount() const;
54 /** The number of sub-keys of the key at hand
56 @precond IsOpen = true
58 @throws
60 virtual size_t GetSubKeyCount() const;
62 virtual StringListPtr GetSubKeyNames() const;
64 virtual StringListPtr GetSubValueNames() const;
66 /** Get the specified registry value
68 @precond IsOpen = true
70 virtual RegistryValue GetValue(const std::wstring& Name) const;
72 /** Get the specified registry value, return the given
73 default value if value not found
75 @precond IsOpen = true
77 virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const;
79 //############################################
80 // Commands
81 //############################################
83 /** Open the registry key, has no effect if
84 the key is already open
86 @precond IsOpen = false
88 @throws RegistryWriteAccessDenyException
89 RegistryAccessDenyException
91 virtual void Open(bool Writeable = true);
93 /** Open the specified sub-key of the registry key
94 at hand
96 @precond IsOpen = true
97 HasSubKey(Name) = true
99 @throws RegistryIOException
100 RegistryKeyNotFoundException
101 RegistryAccessDeniedException
103 virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true);
105 /** Creates a new sub-key below the key at hand
107 @precond IsOpen = true
108 IsWriteable = true
110 @throws RegistryIOException
111 RegistryWriteAccessDenyException
113 virtual RegistryKey CreateSubKey(const std::wstring& Name);
115 /** Deletes a sub-key below the key at hand, the
116 key must not have sub-keys
118 @precond IsOpen = true
119 IsWriteable = true
121 @throws RegistryIOException
122 RegistryWriteAccessDenyException
124 virtual void DeleteSubKey(const std::wstring& Name);
126 /** Deletes a sub-key below the key at hand with all
127 its sub-keys
129 @precond IsOpen = true
130 IsWriteable = true;
132 @throws RegistryIOException
133 RegistryWriteAccessDenyException
135 virtual void DeleteSubKeyTree(const std::wstring& Name);
137 /** Delete the specified value
139 @precond IsOpen = true
140 IsWriteable = true
141 HasValue(Name) = true
143 @throws RegistryIOException
144 RegistryWriteAccessDeniedException
145 RegistryValueNotFoundException
147 virtual void DeleteValue(const std::wstring& Name);
149 /** Set the specified registry value
151 @precond IsOpen = true
152 IsWriteable = true
154 @throws RegistryIOException
155 RegistryWriteAccessDenyException
157 virtual void SetValue(const RegistryValue& Value);
159 //############################################
160 // Creation
162 // only possible through WindowsRegistry class
163 //############################################
165 protected:
166 /** Create instance and open the specified Registry key
168 @throws RegistryWriteAccessDenyException
169 RegistryAccessDenyException
170 RegistryKeyNotFoundException
172 RegistryKeyImplWinNT(HKEY RootKey, const std::wstring& KeyName);
174 /** Create instance and open the specified Registry key
176 @throws RegistryWriteAccessDenyException
177 RegistryAccessDenyException
178 RegistryKeyNotFoundException
180 RegistryKeyImplWinNT(HKEY RootKey);
182 /** Create an instances of the specified Registry key,
183 the key is assumed to be already opened.
185 RegistryKeyImplWinNT(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true);
187 private:
189 LONG ImplDeleteSubKeyTree(HKEY RootKey, const std::wstring& Name);
191 //prevent copy and assignment
192 private:
193 RegistryKeyImplWinNT(const RegistryKeyImplWinNT&);
194 RegistryKeyImplWinNT& operator=(const RegistryKeyImplWinNT&);
196 //######################################
197 // Friend declarations
198 //######################################
200 friend class WindowsRegistry;
203 #endif
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */