diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-09-20 14:58:30 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-09-20 14:58:30 +0000 |
commit | c241cf3bef737a58162868d51a2c773c5af5abbf (patch) | |
tree | 741fac2402e78a85bdc42e3b47ee23d7c10db9f8 /src/util/exception.h | |
parent | f1c1cc7c3de0d4a5f310357a249cef82f73c588c (diff) |
Merge from "swig" branch: language binding for Java is compiling and linking. Enable with --enable-language-bindings=java
Diffstat (limited to 'src/util/exception.h')
-rw-r--r-- | src/util/exception.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util/exception.h b/src/util/exception.h index 1b1eb224e..43a0354ca 100644 --- a/src/util/exception.h +++ b/src/util/exception.h @@ -30,16 +30,20 @@ namespace CVC4 { class CVC4_PUBLIC Exception { protected: std::string d_msg; + public: // Constructors Exception() : d_msg("Unknown exception") {} Exception(const std::string& msg) : d_msg(msg) {} Exception(const char* msg) : d_msg(msg) {} + // Destructor virtual ~Exception() throw() {} + // NON-VIRTUAL METHOD for setting and printing the error message void setMessage(const std::string& msg) { d_msg = msg; } std::string getMessage() const { return d_msg; } + /** * Get this exception as a string. Note that * cout << ex.toString(); @@ -57,16 +61,17 @@ public: toStream(ss); return ss.str(); } + /** * Printing: feel free to redefine toStream(). When overridden in * a derived class, it's recommended that this method print the * type of exception before the actual message. */ virtual void toStream(std::ostream& os) const { os << d_msg; } - // No need to overload operator<< for the inherited classes - friend std::ostream& operator<<(std::ostream& os, const Exception& e); + };/* class Exception */ +inline std::ostream& operator<<(std::ostream& os, const Exception& e) CVC4_PUBLIC; inline std::ostream& operator<<(std::ostream& os, const Exception& e) { e.toStream(os); return os; |