From 4d32b30fd7b413edcf4d48642478f5577fb92a02 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Wed, 4 Oct 2017 13:09:16 +0200 Subject: [PATCH] Refactor GUIHelpers::Error: make it more c++11 --- GUI/coregui/utils/GUIHelpers.cpp | 4 ++++ GUI/coregui/utils/GUIHelpers.h | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/GUI/coregui/utils/GUIHelpers.cpp b/GUI/coregui/utils/GUIHelpers.cpp index 15267c99e87..806fab12b2c 100644 --- a/GUI/coregui/utils/GUIHelpers.cpp +++ b/GUI/coregui/utils/GUIHelpers.cpp @@ -44,6 +44,10 @@ const QMap<QString, QString> invalidCharacterMap = initializeCharacterMap(); namespace GUIHelpers { +Error::~Error() noexcept =default; + +const char* Error::what() const noexcept { return message.toLatin1().data(); } + void information(QWidget *parent, const QString &title, const QString &text, const QString &detailedText) { QScopedPointer<QMessageBox> messageBox(new QMessageBox(parent)); diff --git a/GUI/coregui/utils/GUIHelpers.h b/GUI/coregui/utils/GUIHelpers.h index d7374a09357..63b0fe980e6 100644 --- a/GUI/coregui/utils/GUIHelpers.h +++ b/GUI/coregui/utils/GUIHelpers.h @@ -31,11 +31,15 @@ namespace GUIHelpers class BA_CORE_API_ Error : public std::exception { public: - explicit Error(const QString& message) throw() - : message(message) {} - virtual ~Error() throw() {} + explicit Error(const QString& message) noexcept : message(message) {} + virtual ~Error() noexcept; - virtual const char* what() const throw() { return message.toLatin1().data(); } + Error(const Error&) =default; + Error& operator=(const Error&) =default; + Error(Error&&) =default; + Error& operator=(Error&&) =default; + + virtual const char* what() const noexcept; private: QString message; -- GitLab