libqi
1.12
|
00001 00012 #pragma once 00013 #ifndef _LIBQI_QI_ERROR_HPP_ 00014 #define _LIBQI_QI_ERROR_HPP_ 00015 00016 # include <qi/macro.hpp> 00017 # include <qi/config.hpp> 00018 00019 # include <stdexcept> 00020 # include <string> 00021 00022 namespace qi { 00023 namespace os { 00027 #ifdef _MSC_VER 00028 # pragma warning( push ) 00029 # pragma warning( disable : 4251 ) 00030 #endif 00031 00032 class QI_API QiException : public std::runtime_error 00033 { 00034 public: 00042 explicit QiException(const std::string &message) 00043 : std::runtime_error(message) 00044 , _message(message) 00045 {} 00046 00051 QiException(const QiException &e) 00052 : std::runtime_error(e.what()) 00053 {} 00054 00056 virtual ~QiException() throw() 00057 {} 00058 00060 inline virtual const char* what() const throw () 00061 { 00062 return _message.c_str(); 00063 } 00064 00065 private: 00070 std::string _message; 00071 #ifdef _MSC_VER 00072 # pragma warning( pop ) 00073 #endif 00074 }; 00075 } 00076 } 00077 00078 #endif // _LIBQI_QI_ERROR_HPP_