libsmbios_c library
IException.h
Go to the documentation of this file.
1 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2 /*
3  * Copyright (C) 2005 Dell Inc.
4  * by Michael Brown <Michael_E_Brown@dell.com>
5  * Licensed under the Open Software License version 2.1
6  *
7  * Alternatively, you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License,
10  * or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  */
17 
18 
19 #ifndef IEXCEPTION_H
20 #define IEXCEPTION_H
21 
22 // compat header should always be first header
23 #include "smbios/compat.h"
24 
25 #include <string>
26 #include <exception>
27 
28 // types.h should be first user-defined header.
29 #include "smbios/types.h"
30 
31 // abi_prefix should be last header included before declarations
33 
34 #define DECLARE_EXCEPTION_EX( excName, namespace, superclass ) \
35  class excName : public namespace::superclass \
36  {\
37  public:\
38  virtual ~excName() throw() {};\
39  excName() {};\
40  }
41 #define DECLARE_EXCEPTION( excName ) DECLARE_EXCEPTION_EX( excName, smbios, IException )
42 
43 namespace smbios
44 {
46 
48  class IException : public std::exception
49  {
50  public:
51  // use default compiler-generated constructor/copy constructor/operator =
52  // but need virtual destructor
53  virtual ~IException() throw() {};
54  IException() {};
55  };
56 
57  // some standard exceptions
58 
63  DECLARE_EXCEPTION( NotImplemented );
64 
69  DECLARE_EXCEPTION( InternalError );
70 
72  DECLARE_EXCEPTION( PermissionException );
73 }
74 
75 // always should be last thing in header file
77 
78 #endif /* IEXCEPTION_H */
Base class for all Abstract Exceptions.
Definition: IException.h:48
Definition: IException.h:43
DECLARE_EXCEPTION(NotImplemented)
IException()
Definition: IException.h:54
virtual ~IException()
Definition: IException.h:53