1// gensyscalls_common.h 2 3#ifndef _GEN_SYSCALLS_COMMON_H 4#define _GEN_SYSCALLS_COMMON_H 5 6#include <exception> 7#include <string> 8 9using namespace std; 10 11// Exception 12struct Exception : exception { 13 Exception() 14 : fMessage() 15 { 16 } 17 18 Exception(const string &message) 19 : fMessage(message) 20 { 21 } 22 23 virtual ~Exception() throw() {} 24 25 virtual const char *what() const throw() 26 { 27 return fMessage.c_str(); 28 } 29 30private: 31 string fMessage; 32}; 33 34// EOFException 35struct EOFException : public Exception { 36 EOFException() {} 37 EOFException(const string &message) : Exception(message) {} 38 virtual ~EOFException() throw() {} 39}; 40 41// IOException 42struct IOException : public Exception { 43 IOException() {} 44 IOException(const string &message) : Exception(message) {} 45 virtual ~IOException() throw() {} 46}; 47 48// ParseException 49struct ParseException : public Exception { 50 ParseException() {} 51 ParseException(const string &message) : Exception(message) {} 52 virtual ~ParseException() throw() {} 53}; 54 55#endif // _GEN_SYSCALLS_COMMON_H 56