Changeset 1061:e3433c024123 in lemon-0.x for src/work/klao
- Timestamp:
- 01/08/05 21:12:50 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1457
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/klao/error.h
r1056 r1061 33 33 class ErrorMessage { 34 34 protected: 35 ///\e 35 36 boost::shared_ptr<std::ostringstream> buf; 36 37 38 ///\e 37 39 bool init() throw() { 38 40 try { … … 47 49 public: 48 50 51 ///\e 49 52 ErrorMessage() throw() { init(); } 50 53 54 ///\e 51 55 ErrorMessage(const char *message) throw() { 52 56 init(); … … 54 58 } 55 59 60 ///\e 56 61 ErrorMessage(const std::string &message) throw() { 57 62 init(); … … 59 64 } 60 65 66 ///\e 61 67 template <typename T> 62 68 ErrorMessage& operator<<(const T &t) throw() { … … 71 77 } 72 78 79 ///\e 73 80 const char* message() throw() { 74 81 if( !buf ) return 0; … … 91 98 class Exception : public std::exception, public ErrorMessage { 92 99 public: 100 ///\e 93 101 Exception() throw() {} 102 ///\e 94 103 explicit Exception(const std::string &s) throw() 95 104 : ErrorMessage(s) {} 105 ///\e 96 106 virtual ~Exception() throw() {} 97 107 108 ///\e 98 109 virtual const char* what() const throw() { 99 110 const char *mes = message(); … … 103 114 }; 104 115 105 116 ///\e 106 117 class LogicError : public Exception { 118 ///\e 107 119 explicit LogicError(const std::string &s) 108 120 : Exception(s) {} 109 121 }; 110 122 123 ///\e 111 124 class RuntimeError : public Exception { 125 ///\e 112 126 explicit RuntimeError(const std::string &s) 113 127 : Exception(s) {} 114 128 }; 115 129 130 ///\e 116 131 class RangeError : public RuntimeError { 132 ///\e 117 133 explicit RangeError(const std::string &s) 118 134 : RuntimeError(s) {} 119 135 }; 120 136 137 ///\e 121 138 class IOError : public RuntimeError { 139 ///\e 122 140 explicit IOError(const std::string &s) 123 141 : RuntimeError(s) {} 124 142 }; 125 143 144 ///\e 126 145 class DataFormatError : public IOError { 146 ///\e 127 147 explicit DataFormatError(const std::string &message) 128 148 : IOError(message) : line(0) {} 149 ///\e 129 150 DataFormatError(const std::string &file_name, int line_num, 130 sconst std::string &message)151 const std::string &message) 131 152 : IOError(message), line(line_num) { set_file(file_name); } 132 153 154 ///\e 133 155 void set_line(int line_num) { line=line_num; } 156 ///\e 134 157 void set_file(const std::string &file_name) { 135 158 try { … … 142 165 } 143 166 167 ///\e 144 168 virtual const char* what() const { 145 169 const char *mes = 0;
Note: See TracChangeset
for help on using the changeset viewer.