diff options
author | Morgan Deters <mdeters@gmail.com> | 2009-11-25 00:42:52 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2009-11-25 00:42:52 +0000 |
commit | 2a1ac62e56d43893c59c4c2d91bcaca0dd7ce417 (patch) | |
tree | 5d2e6b493d8d366ab75163effaf13191dbf0bd71 /src/util/exception.h | |
parent | 06b391f721c8e9de4835e5a5bf2c60383ea7f8e9 (diff) |
additional work on parser hookup, configuration + build
Diffstat (limited to 'src/util/exception.h')
-rw-r--r-- | src/util/exception.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/util/exception.h b/src/util/exception.h index e3b8f2293..76eabe67e 100644 --- a/src/util/exception.h +++ b/src/util/exception.h @@ -15,19 +15,20 @@ #include <string> #include <iostream> +#include "cvc4_config.h" namespace CVC4 { -class Exception { +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) { } + Exception() : d_msg("Unknown exception") {} + Exception(const std::string& msg) : d_msg(msg) {} + Exception(const char* msg) : d_msg(msg) {} // Destructor - virtual ~Exception() { } + virtual ~Exception() {} // NON-VIRTUAL METHODs for setting and printing the error message void setMessage(const std::string& msg) { d_msg = msg; } // Printing: feel free to redefine toString(). When inherited, @@ -36,13 +37,22 @@ public: virtual std::string toString() const { return d_msg; } // No need to overload operator<< for the inherited classes friend std::ostream& operator<<(std::ostream& os, const Exception& e); +};/* class Exception */ + + +class CVC4_PUBLIC IllegalArgumentException : public Exception { +public: + IllegalArgumentException() : Exception("Illegal argument to method or function") {} + IllegalArgumentException(const std::string& msg) : Exception(msg) {} + IllegalArgumentException(const char* msg) : Exception(msg) {} +};/* class IllegalArgumentException */ -}; // end of class Exception inline std::ostream& operator<<(std::ostream& os, const Exception& e) { return os << e.toString(); } + }/* CVC4 namespace */ #endif /* __CVC4__EXCEPTION_H */ |