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 // RegistryException.h: Schnittstelle f�r die Klasse RegistryException. 23 // 24 ////////////////////////////////////////////////////////////////////// 25 26 #ifndef _REGISTRYEXCEPTION_HXX_ 27 #define _REGISTRYEXCEPTION_HXX_ 28 29 #include <exception> 30 31 //####################################### 32 // Base class for all Registry exceptions 33 //####################################### 34 35 class RegistryException : public std::exception 36 { 37 public: 38 39 RegistryException(long ErrorCode); 40 41 virtual ~RegistryException() throw(); 42 43 /** 44 @descr Returns a string that describes the error if 45 available, else NULL will be returned. The 46 returned string is only temporary so the caller 47 has to copy it if he needs the string further. 48 */ 49 virtual const char* what() const throw(); 50 51 /** 52 @descr Returns the error code. 53 */ 54 55 long GetErrorCode() const; 56 57 private: 58 long m_ErrorCode; 59 void* m_ErrorMsg; 60 }; 61 62 //####################################### 63 // Thrown when a Registry key is accessed 64 // that is closed 65 //####################################### 66 67 class RegistryIOException : public RegistryException 68 { 69 public: 70 RegistryIOException(long ErrorCode); 71 }; 72 73 //####################################### 74 // Thrown when trying to write to a readonly registry key 75 //####################################### 76 77 class RegistryNoWriteAccessException : public RegistryException 78 { 79 public: 80 RegistryNoWriteAccessException(long ErrorCode); 81 }; 82 83 //####################################### 84 // Thrown when trying to access an registry key, with improper 85 // access rights 86 //####################################### 87 88 class RegistryAccessDeniedException : public RegistryException 89 { 90 public: 91 RegistryAccessDeniedException(long ErrorCode); 92 }; 93 94 //####################################### 95 // A specified registry value could not be read because it is not 96 // available 97 //####################################### 98 99 class RegistryValueNotFoundException : public RegistryException 100 { 101 public: 102 RegistryValueNotFoundException(long ErrorCode); 103 }; 104 105 //####################################### 106 // A specified registry key was not found 107 //####################################### 108 109 class RegistryKeyNotFoundException : public RegistryException 110 { 111 public: 112 RegistryKeyNotFoundException(long ErrorCode); 113 }; 114 115 //####################################### 116 // A specified registry operation is invalid 117 //####################################### 118 119 class RegistryInvalidOperationException : public RegistryException 120 { 121 public: 122 RegistryInvalidOperationException(long ErrorCode); 123 }; 124 125 #endif 126