Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
helloworldException.cpp
00001 /* $Id$ */
00002 
00003 #include <cstdlib>
00004 
00005 #include "helloworld/helloworldException.hpp"
00006 
00007 using std::string;
00008 using std::cerr;
00009 using std::endl;
00010 
00011 using namespace jafar::helloworld;
00012 
00013 /*
00014  * class HelloworldException
00015  */
00016 
00017 HelloworldException::HelloworldException(ExceptionId id_, const string& message_, const string& file_, int line_) throw() :
00018   jafar::kernel::Exception(message_, "helloworld", exceptionIdToString(id_), file_, line_),
00019   id(id_)
00020 {}
00021 
00022 HelloworldException::~HelloworldException() throw() {}
00023 
00024 HelloworldException::ExceptionId HelloworldException::getExceptionId() const throw() {
00025   return id;
00026 }
00027 
00028 string HelloworldException::exceptionIdToString(ExceptionId id_) throw() {
00029   switch(id_) {
00030   case EMPTY_HELLO:
00031     return "HelloworldException::EMPTY_HELLO";
00032   case BAD_FORMAT:
00033     return "HelloworldException::BAD_FORMAT";
00034 
00035   default:
00036     std::stringstream s;
00037     s << id_;
00038     return s.str();
00039   }
00040 }
00041 
00042 /*
00043  * class HelloworldFormatException
00044  */
00045 
00046 HelloworldFormatException::HelloworldFormatException(const string& hello_, 
00047                                                      const string& message_, 
00048                                                      const string& file_, int line_) throw() :
00049   HelloworldException(BAD_FORMAT, 
00050                       message_, 
00051                       file_, line_),
00052   hello()
00053 {
00054   try {
00055     hello = hello_;
00056     _what +=  "given string: " + hello + "\n";
00057   }
00058   catch (std::exception& e) {
00059     cerr << "Exception: " << endl;
00060     cerr << e.what() << endl;
00061     cerr << "thrown in HelloworldFormatException constructor:" << endl;
00062     cerr << _what;
00063     cerr << "given string: " << hello << endl;
00064   }
00065 }
00066 
00067 HelloworldFormatException::~HelloworldFormatException() throw() {}
00068 
00069 const string& HelloworldFormatException::getHello() const throw() {
00070   return hello;
00071 }
00072 
00073 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:20 for Jafar by doxygen 1.7.6.1
LAAS-CNRS