summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-12-14 12:31:39 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-12-14 12:31:39 +0100
commit2f4a122fa05e9e6514f62112d75d1ee7e4d894f2 (patch)
treedf45a9a00fa204b7a09a3189b16600bd87c7bfc1 /glib
parent729b1ae95d5d05b78741eeef1d635f95b19d790b (diff)
downloadglibmm-2f4a122fa05e9e6514f62112d75d1ee7e4d894f2.tar.gz
Derive Glib::Error from std::exception, remove Glib::Exception
Glib::Error::what() returns const char* (was Glib::ustring). It overrides std::exception::what() that returns const char* and is noexcept. Fixes #23
Diffstat (limited to 'glib')
-rw-r--r--glib/glibmm.h1
-rw-r--r--glib/glibmm/error.cc6
-rw-r--r--glib/glibmm/error.h6
-rw-r--r--glib/glibmm/exception.cc39
-rw-r--r--glib/glibmm/exception.h36
-rw-r--r--glib/glibmm/filelist.am2
6 files changed, 6 insertions, 84 deletions
diff --git a/glib/glibmm.h b/glib/glibmm.h
index a7587d17..93e3a4ff 100644
--- a/glib/glibmm.h
+++ b/glib/glibmm.h
@@ -99,7 +99,6 @@
#include <glibmm/dispatcher.h>
#include <glibmm/enums.h>
#include <glibmm/error.h>
-#include <glibmm/exception.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/fileutils.h>
#include <glibmm/interface.h>
diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc
index 68c20e18..c8e22fc3 100644
--- a/glib/glibmm/error.cc
+++ b/glib/glibmm/error.cc
@@ -50,7 +50,7 @@ Error::Error(GError* gobject, bool take_copy)
}
Error::Error(const Error& other)
-: Exception(other), gobject_((other.gobject_) ? g_error_copy(other.gobject_) : nullptr)
+: std::exception(other), gobject_((other.gobject_) ? g_error_copy(other.gobject_) : nullptr)
{
}
@@ -99,8 +99,8 @@ Error::code() const
return gobject_->code;
}
-Glib::ustring
-Error::what() const
+const char*
+Error::what() const noexcept
{
g_return_val_if_fail(gobject_ != nullptr, "");
g_return_val_if_fail(gobject_->message != nullptr, "");
diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h
index 5f49ee26..32e3a60c 100644
--- a/glib/glibmm/error.h
+++ b/glib/glibmm/error.h
@@ -18,14 +18,14 @@
*/
#include <glibmmconfig.h>
-#include <glibmm/exception.h>
#include <glibmm/value.h>
#include <glib.h>
+#include <exception>
namespace Glib
{
-class Error : public Glib::Exception
+class Error : public std::exception
{
public:
Error();
@@ -45,7 +45,7 @@ public:
GQuark domain() const;
int code() const;
- Glib::ustring what() const override;
+ const char* what() const noexcept override;
bool matches(GQuark error_domain, int error_code) const;
diff --git a/glib/glibmm/exception.cc b/glib/glibmm/exception.cc
deleted file mode 100644
index 2c25ea9c..00000000
--- a/glib/glibmm/exception.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* exception.cc
- *
- * Copyright 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-//#include <glib/gtestutils.h> //For g_assert() in glib >= 2.15.0
-//#include <glib/gmessages.h> //For g_assert() in glib < 2.15.0
-#include <glib.h> //For g_assert() in all versions of glib.
-
-#include <glibmm/exception.h>
-
-namespace Glib
-{
-
-Exception::~Exception() noexcept
-{
-}
-
-Glib::ustring
-Exception::what() const
-{
- g_assert_not_reached();
- return Glib::ustring();
-}
-
-} // namespace Glib
diff --git a/glib/glibmm/exception.h b/glib/glibmm/exception.h
deleted file mode 100644
index 726f39e0..00000000
--- a/glib/glibmm/exception.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _GLIBMM_EXCEPTION_H
-#define _GLIBMM_EXCEPTION_H
-
-/* exception.h
- *
- * Copyright 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <glibmm/ustring.h>
-
-namespace Glib
-{
-
-class Exception
-{
-public:
- virtual ~Exception() noexcept = 0;
- virtual Glib::ustring what() const = 0;
-};
-
-} // namespace Glib
-
-#endif /* _GLIBMM_EXCEPTION_H */
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index 530c439f..e606d5fd 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -9,7 +9,6 @@ glibmm_files_extra_cc = \
debug.cc \
dispatcher.cc \
error.cc \
- exception.cc \
exceptionhandler.cc \
extraclassinit.cc \
init.cc \
@@ -42,7 +41,6 @@ glibmm_files_extra_h = \
debug.h \
dispatcher.h \
error.h \
- exception.h \
exceptionhandler.h \
extraclassinit.h \
i18n-lib.h \