xref: /AOO41X/main/setup_native/source/win32/customactions/reg4msdoc/registryw9x.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _REGISTRYW9X_HXX_
29 #define _REGISTRYW9X_HXX_
30 
31 #include "registry.hxx"
32 #include "registry.hxx"
33 
34 //---------------------------------------
35 // constants
36 //---------------------------------------
37 
38 class RegistryKeyImplWin9x : public RegistryKeyImpl
39 {
40 public:
41 
42     //############################################
43     // Queries
44     //############################################
45 
46     /** The number of sub values of the key at hand
47 
48         @precond IsOpen = true
49 
50         @throws
51     */
52     virtual size_t GetSubValueCount() const;
53 
54     /** The number of sub-keys of the key at hand
55 
56         @precond IsOpen = true
57 
58         @throws
59     */
60     virtual size_t GetSubKeyCount() const;
61 
62     virtual StringListPtr GetSubKeyNames() const;
63 
64     virtual StringListPtr GetSubValueNames() const;
65 
66     /** Get the specified registry value
67 
68         @precond IsOpen = true
69     */
70     virtual RegistryValue GetValue(const std::wstring& Name) const;
71 
72     /** Get the specified registry value, return the given
73         default value if value not found
74 
75         @precond IsOpen = true
76     */
77     virtual RegistryValue GetValue(const std::wstring& Name, const RegistryValue& Default) const;
78 
79     //############################################
80     // Commands
81     //############################################
82 
83     /** Open the registry key, has no effect if
84         the key is already open
85 
86         @precond IsOpen = false
87 
88         @throws RegistryWriteAccessDenyException
89                 RegistryAccessDenyException
90     */
91     virtual void Open(bool Writeable = true);
92 
93     /** Open the specified sub-key of the registry key
94         at hand
95 
96         @precond IsOpen = true
97                  HasSubKey(Name) = true
98 
99         @throws RegistryIOException
100                 RegistryKeyNotFoundException
101                 RegistryAccessDeniedException
102     */
103     virtual RegistryKey OpenSubKey(const std::wstring& Name, bool Writeable = true);
104 
105     /** Creates a new sub-key below the key at hand
106 
107         @precond IsOpen = true
108                  IsWriteable = true
109 
110         @throws  RegistryIOException
111                  RegistryWriteAccessDenyException
112     */
113     virtual RegistryKey CreateSubKey(const std::wstring& Name);
114 
115     /** Deletes a sub-key below the key at hand, the
116         key must not have sub-keys
117 
118         @precond IsOpen = true
119                  IsWriteable = true
120 
121         @throws  RegistryIOException
122                  RegistryWriteAccessDenyException
123     */
124     virtual void DeleteSubKey(const std::wstring& Name);
125 
126     /** Deletes a sub-key below the key at hand with all
127         its sub-keys
128 
129         @precond IsOpen = true
130                  IsWriteable = true;
131 
132         @throws  RegistryIOException
133                  RegistryWriteAccessDenyException
134     */
135     virtual void DeleteSubKeyTree(const std::wstring& Name);
136 
137     /** Delete the specified value
138 
139         @precond IsOpen = true
140                  IsWriteable = true
141                  HasValue(Name) = true
142 
143         @throws RegistryIOException
144                 RegistryWriteAccessDeniedException
145                 RegistryValueNotFoundException
146     */
147     virtual void DeleteValue(const std::wstring& Name);
148 
149     /** Set the specified registry value
150 
151         @precond IsOpen = true
152                  IsWriteable = true
153 
154         @throws  RegistryIOException
155                  RegistryWriteAccessDenyException
156     */
157     virtual void SetValue(const RegistryValue& Value);
158 
159     //############################################
160     // Creation
161     //
162     // only possible through WindowsRegistry class
163     //############################################
164 
165 protected:
166     /** Create instance and open the specified Registry key
167 
168         @throws  RegistryWriteAccessDenyException
169                  RegistryAccessDenyException
170                  RegistryKeyNotFoundException
171     */
172     RegistryKeyImplWin9x(HKEY RootKey, const std::wstring& KeyName);
173 
174     /** Create instance and open the specified Registry key
175 
176         @throws  RegistryWriteAccessDenyException
177                  RegistryAccessDenyException
178                  RegistryKeyNotFoundException
179     */
180     RegistryKeyImplWin9x(HKEY RootKey);
181 
182     /** Create an instances of the specified Registry key,
183     the key is assumed to be already opened.
184     */
185     RegistryKeyImplWin9x(HKEY RootKey, HKEY SubKey, const std::wstring& KeyName, bool Writeable = true);
186 
187 // prevent copy/assignment
188 private:
189     RegistryKeyImplWin9x(const RegistryKeyImplWin9x&);
190     RegistryKeyImplWin9x& operator=(const RegistryKeyImplWin9x&);
191 
192 //######################################
193 // Friend declarations
194 //######################################
195 
196 friend class WindowsRegistry;
197 };
198 
199 #endif
200