Exception.hpp

Go to the documentation of this file.
00001 #ifndef wali_EXCEPTION_GUARD
00002 #define wali_EXCEPTION_GUARD 1
00003 
00004 /*!
00005  * @author Nicholas Kidd
00006  */
00007 
00008 #include "wali/Common.hpp"
00009 #include "wali/Printable.hpp"
00010 #include <string>
00011 #include <stdexcept>
00012 
00013 namespace wali
00014 {
00015 
00016   /*
00017    * @class Exception
00018    */
00019   class Exception : public Printable
00020   {
00021     public:
00022 
00023       Exception();
00024 
00025       Exception( const std::string & s );
00026 
00027       virtual ~Exception();
00028 
00029       /*!
00030        * overrides (implements) Printable::print method
00031        *
00032        * @param o the std::ostream this is written to
00033        * @return std::ostream passed in
00034        *
00035        * @see Printable
00036        */
00037       virtual std::ostream & print( std::ostream & o ) const;
00038 
00039       /*!
00040        * @return the msg this Exception holds
00041        */
00042       const std::string & message() const
00043       {
00044         return msg;
00045       }
00046 
00047     protected:
00048       std::string msg;
00049   };
00050 
00051 }
00052 #endif  // wali_EXCEPTION_GUARD
00053