00001
00007 #pragma once
00008
00009 #include <string>
00010
00011 #include <boost/date_time/posix_time/posix_time.hpp>
00012
00013 #include "tools/Message.hpp"
00014
00015 #define STRINGIFY(x) #x
00016 #define TOSTRING(x) STRINGIFY(x)
00017 #define AT_FILE __FILE__ "," TOSTRING(__LINE__) ": "
00018
00019 namespace Tool {
00020
00026 class Exception : public Message {
00027 private:
00029 std::string header;
00031 std::string description;
00033 std::string sourcefile;
00035 unsigned linenumber;
00036
00038 boost::posix_time::ptime time;
00039 public:
00044 static std::string convertToString(const boost::posix_time::ptime &time,
00045 const std::string &format);
00046
00051 Exception();
00052
00056 Exception(const Exception &exception);
00057
00058
00063 Exception( const std::string &header,
00064 const std::string &description,
00065 const std::string &sourcefile,
00066 unsigned linenumber);
00067
00071 virtual Exception &operator=(const Exception &exception);
00072
00076 const std::string &getHeader() const;
00077
00081 const std::string &getDescription() const;
00082
00086 const std::string &getSourceFile() const;
00087
00091 const unsigned &lineNumber() const;
00092
00096 const boost::posix_time::ptime &getTime() const;
00097
00098 Message convertToMessage() const;
00099 };
00100
00101 }