1*2c7984eaSAndrew Rist /**************************************************************
2*2c7984eaSAndrew Rist  *
3*2c7984eaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2c7984eaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2c7984eaSAndrew Rist  * distributed with this work for additional information
6*2c7984eaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2c7984eaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2c7984eaSAndrew Rist  * "License"); you may not use this file except in compliance
9*2c7984eaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2c7984eaSAndrew Rist  *
11*2c7984eaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2c7984eaSAndrew Rist  *
13*2c7984eaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2c7984eaSAndrew Rist  * software distributed under the License is distributed on an
15*2c7984eaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2c7984eaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2c7984eaSAndrew Rist  * specific language governing permissions and limitations
18*2c7984eaSAndrew Rist  * under the License.
19*2c7984eaSAndrew Rist  *
20*2c7984eaSAndrew Rist  *************************************************************/
21*2c7984eaSAndrew Rist 
22cdf0e10cSrcweir // RegistryException.h: Schnittstelle f�r die Klasse RegistryException.
23cdf0e10cSrcweir //
24cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef _REGISTRYEXCEPTION_HXX_
27cdf0e10cSrcweir #define _REGISTRYEXCEPTION_HXX_
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <exception>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //#######################################
32cdf0e10cSrcweir // Base class for all Registry exceptions
33cdf0e10cSrcweir //#######################################
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class RegistryException : public std::exception
36cdf0e10cSrcweir {
37cdf0e10cSrcweir public:
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 	RegistryException(long ErrorCode);
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	virtual ~RegistryException() throw();
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 	/**
44cdf0e10cSrcweir 		@descr	Returns a string that describes the error if
45cdf0e10cSrcweir 				available, else NULL will be returned. The
46cdf0e10cSrcweir 				returned string is only temporary so the caller
47cdf0e10cSrcweir 				has to copy it if he needs the string further.
48cdf0e10cSrcweir 	*/
49cdf0e10cSrcweir 	virtual const char* what() const throw();
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	/**
52cdf0e10cSrcweir 		@descr	Returns the error code.
53cdf0e10cSrcweir 	*/
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	long GetErrorCode() const;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir private:
58cdf0e10cSrcweir     long    m_ErrorCode;
59cdf0e10cSrcweir 	void*  m_ErrorMsg;
60cdf0e10cSrcweir };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //#######################################
63cdf0e10cSrcweir // Thrown when a Registry key is accessed
64cdf0e10cSrcweir // that is closed
65cdf0e10cSrcweir //#######################################
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class RegistryIOException : public RegistryException
68cdf0e10cSrcweir {
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir 	RegistryIOException(long ErrorCode);
71cdf0e10cSrcweir };
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //#######################################
74cdf0e10cSrcweir // Thrown when trying to write to a readonly registry key
75cdf0e10cSrcweir //#######################################
76cdf0e10cSrcweir 
77cdf0e10cSrcweir class RegistryNoWriteAccessException : public RegistryException
78cdf0e10cSrcweir {
79cdf0e10cSrcweir public:
80cdf0e10cSrcweir 	RegistryNoWriteAccessException(long ErrorCode);
81cdf0e10cSrcweir };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir //#######################################
84cdf0e10cSrcweir // Thrown when trying to access an registry key, with improper
85cdf0e10cSrcweir // access rights
86cdf0e10cSrcweir //#######################################
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class RegistryAccessDeniedException : public RegistryException
89cdf0e10cSrcweir {
90cdf0e10cSrcweir public:
91cdf0e10cSrcweir 	RegistryAccessDeniedException(long ErrorCode);
92cdf0e10cSrcweir };
93cdf0e10cSrcweir 
94cdf0e10cSrcweir //#######################################
95cdf0e10cSrcweir // A specified registry value could not be read because it is not
96cdf0e10cSrcweir // available
97cdf0e10cSrcweir //#######################################
98cdf0e10cSrcweir 
99cdf0e10cSrcweir class RegistryValueNotFoundException : public RegistryException
100cdf0e10cSrcweir {
101cdf0e10cSrcweir public:
102cdf0e10cSrcweir 	RegistryValueNotFoundException(long ErrorCode);
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir //#######################################
106cdf0e10cSrcweir // A specified registry key was not found
107cdf0e10cSrcweir //#######################################
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class RegistryKeyNotFoundException : public RegistryException
110cdf0e10cSrcweir {
111cdf0e10cSrcweir public:
112cdf0e10cSrcweir 	RegistryKeyNotFoundException(long ErrorCode);
113cdf0e10cSrcweir };
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //#######################################
116cdf0e10cSrcweir // A specified registry operation is invalid
117cdf0e10cSrcweir //#######################################
118cdf0e10cSrcweir 
119cdf0e10cSrcweir class RegistryInvalidOperationException : public RegistryException
120cdf0e10cSrcweir {
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir 	RegistryInvalidOperationException(long ErrorCode);
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir #endif
126