exception.cpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002     
00003     exception.cpp -- See declarations in exception.hpp.
00004 
00005     This file is a part of the Arageli library.
00006 
00007     Copyright (C) Nikolai Yu. Zolotykh, 1999--2006
00008     Copyright (C) Sergey S. Lyalin, 2005
00009     University of Nizhni Novgorod, Russia
00010 
00011 *****************************************************************************/
00012 
00019 #include "config.hpp"
00020 
00021 #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || \
00022     defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_exception)
00023 
00024 // REFERENCE ADDITIONAL HEADERS HERE
00025 
00026 
00027 namespace Arageli
00028 {
00029 
00030 // PLACE ALL TEMPLATE NOT INLINE IMPLEMENTATIONS HERE
00031 
00032 }
00033 
00034 
00035 #else   // #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || ...
00036 
00037 
00038 #include "exception.hpp"
00039 
00040 
00041 namespace Arageli
00042 {
00043 
00044 
00045 void exception::add_location
00046 (
00047     const std::string& src,
00048     std::size_t line,
00049     const std::string& desc
00050 )
00051 {
00052     std::ostringstream buf;
00053 
00054     buf
00055         << "Location:"
00056         << "\n\tSource: " << src
00057         << "\n\tLine: " << line;
00058 
00059     if(!desc.empty())
00060         buf << "\n\tDescription: " << desc;
00061 
00062     add_description(buf.str());
00063 }
00064 
00065 
00066 std::string exception::msg () const
00067 {
00068     std::string res = std::string("Arageli exception \"") + typeid(*this).name() + "\"";
00069     for
00070     (
00071         descriptions_type::const_iterator i = descriptions_m.begin();
00072         i != descriptions_m.end();
00073         ++i
00074     )
00075         (res += "\n") += *i;
00076 
00077     return res;
00078 }
00079 
00080 
00081 void assert_failed::output (std::ostream& out) const
00082 {
00083     out
00084         << "Arageli assertion failed."
00085         << "\n\tSource: " << source()
00086         << "\n\tLine: " << line ()
00087         << "\n\tExpression: " << expr()
00088         << "\nAdditional information:\n"
00089         << exception::msg();
00090 }
00091 
00092 
00093 
00094 }
00095 
00096 
00097 #endif  // #if !defined(ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE) || ...

Generated on Thu Aug 31 17:38:05 2006 for Arageli by  doxygen 1.4.7