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: registryw9x.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 _REGISTRYW9X_HXX_
32 #define _REGISTRYW9X_HXX_
34 #include "registry.hxx"
35 #include "registry.hxx"
37 //---------------------------------------
39 //---------------------------------------
41 class RegistryKeyImplWin9x
: public RegistryKeyImpl
45 //############################################
47 //############################################
49 /** The number of sub values of the key at hand
51 @precond IsOpen = true
55 virtual size_t GetSubValueCount() const;
57 /** The number of sub-keys of the key at hand
59 @precond IsOpen = true
63 virtual size_t GetSubKeyCount() const;
65 virtual StringListPtr
GetSubKeyNames() const;
67 virtual StringListPtr
GetSubValueNames() const;
69 /** Get the specified registry value
71 @precond IsOpen = true
73 virtual RegistryValue
GetValue(const std::wstring
& Name
) const;
75 /** Get the specified registry value, return the given
76 default value if value not found
78 @precond IsOpen = true
80 virtual RegistryValue
GetValue(const std::wstring
& Name
, const RegistryValue
& Default
) const;
82 //############################################
84 //############################################
86 /** Open the registry key, has no effect if
87 the key is already open
89 @precond IsOpen = false
91 @throws RegistryWriteAccessDenyException
92 RegistryAccessDenyException
94 virtual void Open(bool Writeable
= true);
96 /** Open the specified sub-key of the registry key
99 @precond IsOpen = true
100 HasSubKey(Name) = true
102 @throws RegistryIOException
103 RegistryKeyNotFoundException
104 RegistryAccessDeniedException
106 virtual RegistryKey
OpenSubKey(const std::wstring
& Name
, bool Writeable
= true);
108 /** Creates a new sub-key below the key at hand
110 @precond IsOpen = true
113 @throws RegistryIOException
114 RegistryWriteAccessDenyException
116 virtual RegistryKey
CreateSubKey(const std::wstring
& Name
);
118 /** Deletes a sub-key below the key at hand, the
119 key must not have sub-keys
121 @precond IsOpen = true
124 @throws RegistryIOException
125 RegistryWriteAccessDenyException
127 virtual void DeleteSubKey(const std::wstring
& Name
);
129 /** Deletes a sub-key below the key at hand with all
132 @precond IsOpen = true
135 @throws RegistryIOException
136 RegistryWriteAccessDenyException
138 virtual void DeleteSubKeyTree(const std::wstring
& Name
);
140 /** Delete the specified value
142 @precond IsOpen = true
144 HasValue(Name) = true
146 @throws RegistryIOException
147 RegistryWriteAccessDeniedException
148 RegistryValueNotFoundException
150 virtual void DeleteValue(const std::wstring
& Name
);
152 /** Set the specified registry value
154 @precond IsOpen = true
157 @throws RegistryIOException
158 RegistryWriteAccessDenyException
160 virtual void SetValue(const RegistryValue
& Value
);
162 //############################################
165 // only possible through WindowsRegistry class
166 //############################################
169 /** Create instance and open the specified Registry key
171 @throws RegistryWriteAccessDenyException
172 RegistryAccessDenyException
173 RegistryKeyNotFoundException
175 RegistryKeyImplWin9x(HKEY RootKey
, const std::wstring
& KeyName
);
177 /** Create instance and open the specified Registry key
179 @throws RegistryWriteAccessDenyException
180 RegistryAccessDenyException
181 RegistryKeyNotFoundException
183 RegistryKeyImplWin9x(HKEY RootKey
);
185 /** Create an instances of the specified Registry key,
186 the key is assumed to be already opened.
188 RegistryKeyImplWin9x(HKEY RootKey
, HKEY SubKey
, const std::wstring
& KeyName
, bool Writeable
= true);
190 // prevent copy/assignment
192 RegistryKeyImplWin9x(const RegistryKeyImplWin9x
&);
193 RegistryKeyImplWin9x
& operator=(const RegistryKeyImplWin9x
&);
195 //######################################
196 // Friend declarations
197 //######################################
199 friend class WindowsRegistry
;