/tags/rel-1-3-25/SWIG/Lib/std/std_except.i
Swig | 79 lines | 64 code | 14 blank | 1 comment | 0 complexity | 46c42907792ca93ce6a528ab46846557 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1%include <std_string.i> 2%include <exception.i> 3 4%{ 5#include <stdexcept> 6%} 7 8namespace std { 9 /* Mark all of them as exception classes */ 10 %feature("exceptionclass") exception; 11 %feature("exceptionclass") bad_exception; 12 %feature("exceptionclass") logic_error; 13 %feature("exceptionclass") domain_error; 14 %feature("exceptionclass") invalid_argument; 15 %feature("exceptionclass") length_error; 16 %feature("exceptionclass") out_of_range; 17 %feature("exceptionclass") runtime_error; 18 %feature("exceptionclass") range_error; 19 %feature("exceptionclass") overflow_error; 20 %feature("exceptionclass") underflow_error; 21} 22 23namespace std { 24 struct exception 25 { 26 virtual ~exception() throw(); 27 virtual const char* what() const throw(); 28 }; 29 30 struct bad_exception : exception 31 { 32 }; 33 34 struct logic_error : exception 35 { 36 logic_error(const string& msg); 37 }; 38 39 struct domain_error : logic_error 40 { 41 domain_error(const string& msg); 42 }; 43 44 struct invalid_argument : logic_error 45 { 46 invalid_argument(const string& msg); 47 }; 48 49 struct length_error : logic_error 50 { 51 length_error(const string& msg); 52 }; 53 54 struct out_of_range : logic_error 55 { 56 out_of_range(const string& msg); 57 }; 58 59 struct runtime_error : exception 60 { 61 runtime_error(const string& msg); 62 }; 63 64 struct range_error : runtime_error 65 { 66 range_error(const string& msg); 67 }; 68 69 struct overflow_error : runtime_error 70 { 71 overflow_error(const string& msg); 72 }; 73 74 struct underflow_error : runtime_error 75 { 76 underflow_error(const string& msg); 77 }; 78} 79