fix reserved macro, reorder members, adds virtual destructor

This commit is contained in:
Johann Dreo 2022-09-05 18:53:25 +02:00
commit 97b60f5cb9

View file

@ -1,5 +1,6 @@
#ifndef __EXCEPTIONS_H__ #pragma once
#define __EXCEPTIONS_H__ #ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -35,8 +36,6 @@
class Exception : public std::exception class Exception : public std::exception
{ {
protected: protected:
//! Name of the current exception class
std::string name;
//! Description of the exception //! Description of the exception
std::string description; std::string description;
@ -50,6 +49,9 @@ protected:
//! Line where the exception has been raised //! Line where the exception has been raised
int line; int line;
//! Name of the current exception class
std::string name;
//! Assembled message //! Assembled message
std::string message; std::string message;
@ -71,7 +73,7 @@ public:
} }
//! The destructor is not allowed to throw exceptions //! The destructor is not allowed to throw exceptions
virtual ~Exception() throw () {} virtual ~Exception() noexcept {}
//! The method to use for printing the complete description of the exception //! The method to use for printing the complete description of the exception
const char* what() const noexcept const char* what() const noexcept
@ -80,5 +82,5 @@ public:
} }
}; };
#endif // __EXCEPTIONS_H__ #endif // EXCEPTIONS_H