libsmbios_c library
|
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 00019 #ifndef IEXCEPTION_H 00020 #define IEXCEPTION_H 00021 00022 // compat header should always be first header 00023 #include "smbios/compat.h" 00024 00025 #include <string> 00026 #include <exception> 00027 00028 // types.h should be first user-defined header. 00029 #include "smbios/types.h" 00030 00031 // abi_prefix should be last header included before declarations 00032 #include "smbios/config/abi_prefix.hpp" 00033 00034 #define DECLARE_EXCEPTION_EX( excName, namespace, superclass ) \ 00035 class excName : public namespace::superclass \ 00036 {\ 00037 public:\ 00038 virtual ~excName() throw() {};\ 00039 excName() {};\ 00040 } 00041 #define DECLARE_EXCEPTION( excName ) DECLARE_EXCEPTION_EX( excName, smbios, IException ) 00042 00043 namespace smbios 00044 { 00046 00048 class IException : public std::exception 00049 { 00050 public: 00051 // use default compiler-generated constructor/copy constructor/operator = 00052 // but need virtual destructor 00053 virtual ~IException() throw() {}; 00054 IException() {}; 00055 }; 00056 00057 // some standard exceptions 00058 00063 DECLARE_EXCEPTION( NotImplemented ); 00064 00069 DECLARE_EXCEPTION( InternalError ); 00070 00072 DECLARE_EXCEPTION( PermissionException ); 00073 } 00074 00075 // always should be last thing in header file 00076 #include "smbios/config/abi_suffix.hpp" 00077 00078 #endif /* IEXCEPTION_H */