Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _cvc3__exception_h_
00024 #define _cvc3__exception_h_
00025
00026 #include <string>
00027 #include <iostream>
00028
00029 namespace CVC3 {
00030
00031 class Exception {
00032 protected:
00033 std::string d_msg;
00034 public:
00035
00036 Exception(): d_msg("Unknown exception") { }
00037 Exception(const std::string& msg): d_msg(msg) { }
00038 Exception(const char* msg): d_msg(msg) { }
00039
00040 virtual ~Exception() { }
00041
00042 void setMessage(const std::string& msg) { d_msg = msg; }
00043
00044
00045
00046 virtual std::string toString() const { return d_msg; }
00047
00048 friend std::ostream& operator<<(std::ostream& os, const Exception& e);
00049
00050 };
00051
00052 inline std::ostream& operator<<(std::ostream& os, const Exception& e) {
00053 return os << e.toString();
00054 }
00055
00056 }
00057
00058 #endif