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