Commit 87492daa authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In ElementaryUtils (trunk) :
- Correct CustomException class implementation : now inherit from std::exception.
- Update CMakeLists to force C++11 : problem with SFML compiled library -> doesn't support C++98.
parent 5cef8de7
......@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6)
project(ElementaryUtils CXX)
# Force C++98
add_definitions(-std=c++98 -pedantic-errors)
add_definitions(-std=c++11 -pedantic-errors)
# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)
......
......@@ -8,7 +8,7 @@
* @version 1.0
*/
#include <stdexcept>
#include <exception>
#include <string>
namespace ElemUtils {
......@@ -17,13 +17,11 @@ namespace ElemUtils {
* @class CustomException
* @brief
*/
class CustomException: public std::runtime_error {
class CustomException: public std::exception {
public:
CustomException(const std::string &className, const std::string &funcName,
const std::string &errorMsg) throw ();
virtual ~CustomException() throw ();
CustomException(const CustomException& other) throw ();
CustomException& operator=(const CustomException& other) throw ();
virtual const char* what() const throw ();
......
......@@ -7,8 +7,7 @@ namespace ElemUtils {
CustomException::CustomException(const std::string &className,
const std::string &funcName, const std::string &errorMsg) throw () :
std::runtime_error(errorMsg), m_className(className), m_funcName(
funcName), m_errorMsg(errorMsg), m_finalExceptionMsg(
m_className(className), m_funcName(funcName), m_errorMsg(errorMsg), m_finalExceptionMsg(
StringUtils::EMPTY) {
m_finalExceptionMsg = Formatter() << "(" << m_className << "::"
<< m_funcName << ") " << m_errorMsg;
......@@ -18,24 +17,6 @@ CustomException::~CustomException() throw () {
//Noting to do
}
CustomException::CustomException(const CustomException& other) throw () :
std::runtime_error(other) {
m_className = other.m_className;
m_funcName = other.m_funcName;
m_errorMsg = other.m_errorMsg;
m_finalExceptionMsg = other.m_finalExceptionMsg;
}
CustomException& CustomException::operator =(
const CustomException& other) throw () {
m_className = other.m_className;
m_funcName = other.m_funcName;
m_errorMsg = other.m_errorMsg;
m_finalExceptionMsg = other.m_finalExceptionMsg;
return *this;
}
const char* CustomException::what() const throw () {
return m_finalExceptionMsg.c_str();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment