00001 #ifndef error_h
00002 #define error_h
00003
00004 #include <string>
00005 #include <strstream>
00006 #include "tag.h"
00007 #include "gettext.h"
00008
00010 class Error
00011 {
00012 private:
00013 Line line;
00014 std::string module;
00015 std::string error_string;
00016 std::string type;
00017
00018 public:
00019 Error( Line line,
00020 std::string module= _("unknown module"),
00021 std::string error_string= _("unknown error") );
00022
00023 template <class T> Error( Line line,
00024 std::string module,
00025 std::string error_string,
00026 T what )
00027 {
00028 Error::line = line;
00029 Error::type = _("Error");
00030 Error::module = module;
00031
00032 std::strstream str;
00033 str << error_string << ": " << what << std::ends;
00034 Error::error_string = str.str();
00035 str.freeze(0);
00036 }
00037
00038 Error( std::string module= _("unknown module"),
00039 std::string error_string= _("unknown error") );
00040
00041
00042 std::string str();
00043 };
00044
00045 #endif