00001
00002 #ifndef AKAXISO2_EXCEPTION_H__
00003 #define AKAXISO2_EXCEPTION_H__
00004
00010 #include <exception>
00011 #include <string>
00012
00013 namespace aka2 {
00014
00021 struct error : public std::exception {
00027 explicit error(const std::string &msg, const char *file, const unsigned long line);
00028 virtual ~error() throw();
00029 virtual const char *what() const throw();
00030 protected:
00031 error() {}
00032 std::string msg_;
00033 };
00034
00035
00036 struct positioned_error : error {
00037 explicit positioned_error(const std::string &msg,
00038 const char *file, const unsigned long file_line,
00039 const std::string &path = std::string(),
00040 const std::string &source = std::string(),
00041 long line = -1, long column = -1);
00042 positioned_error(const error &e);
00043 positioned_error(const positioned_error &e);
00044 void set_position(const std::string &source, long line, long column);
00045 virtual ~positioned_error() throw();
00046 virtual const char *what() const throw();
00047 private:
00048 std::string source_;
00049 std::string path_;
00050 long line_;
00051 long column_;
00052 mutable std::string positioned_msg_;
00053 };
00054
00055
00056 struct tagged_error : public error {
00057 explicit tagged_error(const std::string &caption,
00058 const std::string &tagname,
00059 const std::string &msg,
00060 const char *file, const unsigned long line);
00061 virtual ~tagged_error() throw();
00062 };
00063
00064 }
00065
00066 #endif