src/exception.cpp

00001 #include <symbolism/exception.h>
00002 #include <sstream>
00003 
00004 namespace symbolism {
00005 namespace utility {
00006 
00007 using namespace std;
00008 
00009 exception::exception()
00010 : what_string()
00011 {
00012     stringstream ss;
00013     ss << typeid(this).name() << ": ";
00014     ss << description() << endl;
00015     ss << "No location info available." << endl;
00016     ss << "No extra info available." << endl;
00017     what_string = ss.str();
00018 }
00019 
00020 exception::exception(const string& extra_info)
00021 : what_string()
00022 {
00023     stringstream ss;
00024     ss << typeid(this).name() << ": ";
00025     ss << description() << endl;
00026     ss << "No location info available." << endl;
00027     ss << "Extra info:\n" << extra_info << endl;
00028     what_string = ss.str();
00029 }
00030 
00031 exception::exception(const string& file, const int line)
00032 : what_string()
00033 {
00034     stringstream ss;
00035     ss << typeid(this).name() << ": ";
00036     ss << description() << endl;
00037     ss << "In " << file << " at line " << line << endl;
00038     ss << "No extra info available." << endl;
00039     what_string = ss.str();
00040 }
00041 
00042 exception::exception(const string& file, const int line, const string& extra_info)
00043 : what_string()
00044 {
00045     stringstream ss;
00046     ss << typeid(this).name() << ": ";
00047     ss << description() << endl;
00048     ss << "In " << file << " at line " << line << endl;
00049     ss << "Extra info:\n" << extra_info << endl;
00050     what_string = ss.str();
00051 }
00052 
00053 exception::~exception() throw()
00054 {
00055 }
00056 
00057 const string exception::description() const throw()
00058 {
00059     return "Description not available.";
00060 }
00061 
00062 const char* exception::what() const throw()
00063 {
00064     return what_string.c_str();
00065 }
00066 
00067 }}

Copyright © 2007-2008 Remco Bloemen.

Generated on Tue Jan 22 17:35:31 2008 for symbolism by doxygen 1.5.4

Hosted by SourceForge.net Logo