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