DException.h
Go to the documentation of this file.
00001 /*      
00002  * File: DException.h
00003  * Project: DUtils library
00004  * Author: Dorian Galvez-Lopez
00005  * Date: October 6, 2009
00006  * Description: general exception of the library
00007  *
00008  * 
00009  * This program is free software: you can redistribute it and/or modify
00010  * it under the terms of the GNU Lesser General Public License as published by
00011  * the Free Software Foundation, either version 3 of the License, or
00012  * any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021  *
00022  */
00023 
00024 #pragma once
00025 
00026 #ifndef __D_EXCEPTION__
00027 #define __D_EXCEPTION__
00028 
00029 #include <stdexcept>
00030 #include <string>
00031 using namespace std;
00032 
00033 namespace DUtils {
00034 
00035 class DException :
00036         public exception
00037 {
00038 public:
00039         /* Creates an exception with a general error message
00040          */
00041         DException(void) throw(): m_message("DUtils exception"){}
00042 
00043         /* Creates an exception with a custom error message
00044          * @param msg: message
00045          */
00046         DException(const char *msg) throw(): m_message(msg){}
00047         DException(const string &msg) throw(): m_message(msg){}
00048 
00049         ~DException(void) throw(){}
00050 
00051         /* Returns the exception message
00052          * @overrides exception::what
00053          */
00054         virtual const char* what() const throw()
00055         {
00056                 return m_message.c_str();
00057         }
00058 
00059 protected:
00060         string m_message;
00061 };
00062 
00063 }
00064 
00065 #endif
00066 


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:01