Imported Upstream version 2.45.70 upstream/2.45.70
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 7 Sep 2020 07:01:46 +0000 (00:01 -0700)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 7 Sep 2020 07:01:46 +0000 (00:01 -0700)
102 files changed:
.gitignore
NEWS
configure.ac
docs/Makefile.am
docs/reference/Doxyfile.in
examples/network/resolver.cc
gio/giomm/filelist.am
gio/giomm/socketsource.cc
gio/giomm/socketsource.h
gio/src/dbusinterfacevtable.ccg
gio/src/dbusinterfacevtable.hg
gio/src/dbusintrospection.hg
gio/src/dbussubtreevtable.ccg
gio/src/dbussubtreevtable.hg
gio/src/fileattributeinfo.ccg
gio/src/fileattributeinfo.hg
gio/src/fileattributeinfolist.hg
gio/src/fileicon.hg
gio/src/fileinfo.hg
gio/src/resource.hg
gio/src/settingsschema.hg
gio/src/settingsschemakey.hg
gio/src/settingsschemasource.hg
glib/glibmm/arrayhandle.cc
glib/glibmm/arrayhandle.h
glib/glibmm/class.h
glib/glibmm/dispatcher.cc
glib/glibmm/dispatcher.h
glib/glibmm/filelist.am
glib/glibmm/helperlist.h
glib/glibmm/interface.cc
glib/glibmm/interface.h
glib/glibmm/listhandle.h
glib/glibmm/main.cc
glib/glibmm/main.h
glib/glibmm/object.cc
glib/glibmm/object.h
glib/glibmm/objectbase.cc
glib/glibmm/objectbase.h
glib/glibmm/pattern.cc
glib/glibmm/pattern.h
glib/glibmm/property.cc
glib/glibmm/property.h
glib/glibmm/propertyproxy_base.cc
glib/glibmm/propertyproxy_base.h
glib/glibmm/quark.cc
glib/glibmm/quark.h
glib/glibmm/random.cc
glib/glibmm/random.h
glib/glibmm/refptr.h
glib/glibmm/signalproxy.cc
glib/glibmm/slisthandle.h
glib/glibmm/streamiochannel.cc
glib/glibmm/streamiochannel.h
glib/glibmm/threadpool.cc
glib/glibmm/threadpool.h
glib/glibmm/timer.cc
glib/glibmm/timer.h
glib/glibmm/ustring.cc
glib/glibmm/ustring.h
glib/glibmm/utility.h
glib/glibmm/value.cc
glib/glibmm/value.h
glib/glibmm/vectorutils.h
glib/src/balancedtree.hg
glib/src/bytearray.hg
glib/src/bytes.hg
glib/src/convert.hg
glib/src/fileutils.hg
glib/src/iochannel.ccg
glib/src/iochannel.hg
glib/src/keyfile.ccg
glib/src/keyfile.hg
glib/src/markup.ccg
glib/src/markup.hg
glib/src/module.ccg
glib/src/module.hg
glib/src/nodetree.hg
glib/src/optioncontext.ccg
glib/src/optioncontext.hg
glib/src/optionentry.ccg
glib/src/optionentry.hg
glib/src/optiongroup.ccg
glib/src/optiongroup.hg
glib/src/regex.ccg
glib/src/regex.hg
glib/src/signalproxy.h.m4
glib/src/thread.hg
glib/src/threads.hg
glib/src/variantdict.hg
tests/Makefile.am
tests/glibmm_interface_move/main.cc [new file with mode: 0644]
tests/glibmm_object_move/main.cc [new file with mode: 0644]
tests/glibmm_objectbase_move/main.cc [new file with mode: 0644]
tools/m4/base.m4
tools/m4/class_boxedtype.m4
tools/m4/class_boxedtype_static.m4
tools/m4/class_gobject.m4
tools/m4/class_interface.m4
tools/m4/class_opaque_copyable.m4
tools/m4/class_opaque_refcounted.m4
tools/m4/class_shared.m4

index c3aa740..4ecdee3 100644 (file)
@@ -28,7 +28,8 @@ giommconfig.h
 /glibmm-*.tar.*
 /tags
 
-# scripts/
+# build/
+/build/compile
 /build/config.*
 /build/depcomp
 /build/install-sh
@@ -52,6 +53,7 @@ giommconfig.h
 /docs/tagfile-to-devhelp2.xsl
 /docs/reference/Doxyfile
 /docs/reference/doxygen.log
+/docs/reference/doxygen*.db
 /docs/reference/glibmm-2.4.devhelp2
 /docs/reference/glibmm-2.4.tag
 /docs/reference/html/
diff --git a/NEWS b/NEWS
index 54995ea..842aa4d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,55 @@
+2.45.70 (unstable):
+
+Glib:
+* C++11: Add move operations to ObjectBase and Object.
+  (Murray Cumming)
+* C++11: RefPtr: Make methods noexcept.
+  (Murray Cumming)
+
+gmmproc:
+* C++11: Generate move operations.
+  (Murray Cumming)
+* C++11: IOChannel: move operations: Call the base sigc::trackable.
+  (Murray Cumming)
+* C++11: Markup: Add move operations
+  (Murray Cumming)
+* C++11: More use of = delete instead of private copy operations.
+  (Murray Cumming)
+* C++11: Use std::stoul instead of strtoul.
+  (Murray Cumming)
+
+Documentation:
+* Update configuration for Doxygen 1.8.9.1.
+  (Daniel Elstner)
+* Exclude bogus documentation symbols.
+  (Daniel Elstner)
+* Generate documentation for API all platforms.
+  (Daniel Elstner)
+
+
+2.45.52 (unstable):
+
+Glib::
+* C++11: Glib::ObjectBase, Object, Interface: Add move operators.
+  (Murray Cumming)
+* C++11: Mark all _CLASS_OPAQUE_REFCOUNTED classes as final.
+  (Murray Cumming)
+
+Gio:
+* FileIcon: Remove unncessary IMPLEMENTS_INTERFACE.
+  (Murray Cumming)
+
+gmmproc:
+* _CLASS_GOBJECT(): Generate move operations.
+* _CLASS_INTERFACE(): Generate move operations.
+* _CLASS_BOXEDTYPE_STATIC(): Add move operations.
+* _CLASS_BOXEDTYPE_STATIC: Add explicit copy operations.
+* _CLASS_OPAQUE_COPYABLE(): Add move operations.
+* _CLASS_OPAQUE_COPYABLE: Generate static swap().
+* _CLASS_OPAQUE_REFCOUNTED: Use = delete for the default constructor.
+(Murray Cumming)
+
+
 2.45.50 (unstable):
 
 Glib:
index e1d5d53..bca54c1 100644 (file)
@@ -15,7 +15,7 @@
 ## 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/>.
 
-AC_INIT([glibmm], [2.45.50],
+AC_INIT([glibmm], [2.45.70],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
         [glibmm], [http://www.gtkmm.org/])
 AC_PREREQ([2.59])
@@ -62,9 +62,9 @@ AS_IF([test "x$enable_static" = xyes],
   AC_DEFINE([GIOMM_STATIC_LIB],  [1], [Define if giomm is built as a static library])
 ])
 
-glibreq='2.0 >= 2.45.5'
+glibreq='2.0 >= 2.45.7'
 
-GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
+GLIBMM_MODULES="sigc++-2.0 >= 2.5.4 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
 GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
 test "x$glibmm_host_windows" = xyes || GIOMM_MODULES="$GIOMM_MODULES gio-unix-$glibreq"
 
index 379591a..6297945 100644 (file)
@@ -20,13 +20,13 @@ include $(top_srcdir)/glib/glibmm/filelist.am
 include $(top_srcdir)/gio/src/filelist.am
 include $(top_srcdir)/gio/giomm/filelist.am
 
-glibmm_files_h = $(filter-out wrap_init.h,$(glibmm_files_built_h) $(glibmm_files_extra_h))
-giomm_files_h  = $(filter-out wrap_init.h,$(giomm_files_built_h) $(giomm_files_extra_h))
+glibmm_files_h = $(filter-out wrap_init.h,$(glibmm_files_all_h))
+giomm_files_h  = $(filter-out wrap_init.h,$(giomm_files_all_h))
 
 book_name = $(GLIBMM_MODULE_NAME)
 doc_input = $(addprefix $(top_srcdir)/glib/glibmm/,$(glibmm_files_h)) \
             $(addprefix $(top_srcdir)/gio/giomm/,$(giomm_files_h)) \
-            $(top_srcdir)/glib/glibmm.h
+            $(top_srcdir)/glib/glibmm.h $(top_srcdir)/gio/giomm.h
 
 docimagesdir = $(libdocdir)/images
 dist_docimages_DATA = images/gtkmm_logo.gif images/top.gif
index 55f7c97..a31544e 100644 (file)
@@ -1,11 +1,5 @@
-# Doxyfile 1.8.3
-# @configure_input@
-
-# When Doxyfile.in is updated with 'doxygen -s -u Doxyfile.in' some lines
-# will be distorted or removed, and must be manually restored.
-# - These comment lines, including the configure_input line.
-# - The lines with HOST_WINDOWS_NATIVE_[FALSE|TRUE].
-# (True of Doxygen 1.8.3. Don't know how future releases will behave.)
+## @configure_input@
+# Doxyfile 1.8.9.1
 
 #---------------------------------------------------------------------------
 # Project related configuration options
@@ -17,6 +11,7 @@ PROJECT_BRIEF          =
 PROJECT_LOGO           =
 OUTPUT_DIRECTORY       = reference
 CREATE_SUBDIRS         = NO
+ALLOW_UNICODE_NAMES    = NO
 OUTPUT_LANGUAGE        = English
 BRIEF_MEMBER_DESC      = YES
 REPEAT_BRIEF           = YES
@@ -62,7 +57,6 @@ SUBGROUPING            = YES
 INLINE_GROUPED_CLASSES = NO
 INLINE_SIMPLE_STRUCTS  = NO
 TYPEDEF_HIDES_STRUCT   = NO
-SYMBOL_CACHE_SIZE      = 0
 LOOKUP_CACHE_SIZE      = 0
 #---------------------------------------------------------------------------
 # Build related configuration options
@@ -81,7 +75,9 @@ HIDE_IN_BODY_DOCS      = YES
 INTERNAL_DOCS          = NO
 CASE_SENSE_NAMES       = YES
 HIDE_SCOPE_NAMES       = NO
+HIDE_COMPOUND_REFERENCE= NO
 SHOW_INCLUDE_FILES     = YES
+SHOW_GROUPED_MEMB_INC  = NO
 FORCE_LOCAL_INCLUDES   = NO
 INLINE_INFO            = YES
 SORT_MEMBER_DOCS       = YES
@@ -103,7 +99,7 @@ FILE_VERSION_FILTER    =
 LAYOUT_FILE            =
 CITE_BIB_FILES         =
 #---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
+# Configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
 QUIET                  = NO
 WARNINGS               = YES
@@ -113,7 +109,7 @@ WARN_NO_PARAMDOC       = NO
 WARN_FORMAT            = "$file:$line: $text"
 WARN_LOGFILE           = reference/doxygen.log
 #---------------------------------------------------------------------------
-# configuration options related to the input files
+# Configuration options related to the input files
 #---------------------------------------------------------------------------
 INPUT                  =
 INPUT_ENCODING         = UTF-8
@@ -129,7 +125,9 @@ EXCLUDE_SYMBOLS        = _* \
                          basic_streambuf \
                          binary_function \
                          char_traits \
+                         hash_load_check_resize_trigger_size_base \
                          internal \
+                         lu_counter_policy_base \
                          nil \
                          pair \
                          unary_function
@@ -144,7 +142,7 @@ FILTER_SOURCE_FILES    = NO
 FILTER_SOURCE_PATTERNS =
 USE_MDFILE_AS_MAINPAGE =
 #---------------------------------------------------------------------------
-# configuration options related to source browsing
+# Configuration options related to source browsing
 #---------------------------------------------------------------------------
 SOURCE_BROWSER         = NO
 INLINE_SOURCES         = NO
@@ -152,16 +150,19 @@ STRIP_CODE_COMMENTS    = YES
 REFERENCED_BY_RELATION = NO
 REFERENCES_RELATION    = NO
 REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
 USE_HTAGS              = NO
 VERBATIM_HEADERS       = NO
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS          =
 #---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
+# Configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
 ALPHABETICAL_INDEX     = YES
 COLS_IN_ALPHA_INDEX    = 5
 IGNORE_PREFIX          =
 #---------------------------------------------------------------------------
-# configuration options related to the HTML output
+# Configuration options related to the HTML output
 #---------------------------------------------------------------------------
 GENERATE_HTML          = YES
 HTML_OUTPUT            = html
@@ -210,14 +211,16 @@ USE_MATHJAX            = NO
 MATHJAX_FORMAT         = HTML-CSS
 MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
 MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
 SEARCHENGINE           = NO
 SERVER_BASED_SEARCH    = NO
 EXTERNAL_SEARCH        = NO
 SEARCHENGINE_URL       =
 SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
 EXTRA_SEARCH_MAPPINGS  =
 #---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
+# Configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
 GENERATE_LATEX         = NO
 LATEX_OUTPUT           = latex
@@ -228,6 +231,8 @@ PAPER_TYPE             = a4wide
 EXTRA_PACKAGES         =
 LATEX_HEADER           =
 LATEX_FOOTER           =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES      =
 PDF_HYPERLINKS         = YES
 USE_PDFLATEX           = YES
 LATEX_BATCHMODE        = NO
@@ -235,7 +240,7 @@ LATEX_HIDE_INDICES     = NO
 LATEX_SOURCE_CODE      = NO
 LATEX_BIB_STYLE        = plain
 #---------------------------------------------------------------------------
-# configuration options related to the RTF output
+# Configuration options related to the RTF output
 #---------------------------------------------------------------------------
 GENERATE_RTF           = NO
 RTF_OUTPUT             = rtf
@@ -243,27 +248,33 @@ COMPACT_RTF            = NO
 RTF_HYPERLINKS         = NO
 RTF_STYLESHEET_FILE    =
 RTF_EXTENSIONS_FILE    =
+RTF_SOURCE_CODE        = NO
 #---------------------------------------------------------------------------
-# configuration options related to the man page output
+# Configuration options related to the man page output
 #---------------------------------------------------------------------------
 GENERATE_MAN           = NO
 MAN_OUTPUT             = man
 MAN_EXTENSION          = .3
+MAN_SUBDIR             =
 MAN_LINKS              = NO
 #---------------------------------------------------------------------------
-# configuration options related to the XML output
+# Configuration options related to the XML output
 #---------------------------------------------------------------------------
 GENERATE_XML           = NO
 XML_OUTPUT             = xml
-XML_SCHEMA             =
-XML_DTD                =
 XML_PROGRAMLISTING     = NO
 #---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
 #---------------------------------------------------------------------------
 GENERATE_AUTOGEN_DEF   = NO
 #---------------------------------------------------------------------------
-# configuration options related to the Perl module output
+# Configuration options related to the Perl module output
 #---------------------------------------------------------------------------
 GENERATE_PERLMOD       = NO
 PERLMOD_LATEX          = NO
@@ -288,6 +299,8 @@ PREDEFINED             = __cplusplus \
                          "G_GNUC_NORETURN=" \
                          "G_GNUC_NULL_TERMINATED=" \
                          "G_GNUC_PURE=" \
+                         G_OS_UNIX \
+                         G_OS_WIN32 \
                          "GLIBMM_API=" \
                          "GIOMM_API=" \
                          GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED \
@@ -295,8 +308,6 @@ PREDEFINED             = __cplusplus \
                          GLIBMM_HAVE_WIDE_STREAM \
                          GLIBMM_PROPERTIES_ENABLED \
                          GLIBMM_VFUNCS_ENABLED
-@HOST_WINDOWS_NATIVE_FALSE@PREDEFINED += G_OS_UNIX
-@HOST_WINDOWS_NATIVE_TRUE@PREDEFINED += G_OS_WIN32
 EXPAND_AS_DEFINED      = GLIBMM_MAJOR_VERSION \
                          GLIBMM_MINOR_VERSION \
                          GLIBMM_MICRO_VERSION \
@@ -305,18 +316,20 @@ EXPAND_AS_DEFINED      = GLIBMM_MAJOR_VERSION \
                          GIOMM_MICRO_VERSION
 SKIP_FUNCTION_MACROS   = YES
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration options related to external references
 #---------------------------------------------------------------------------
 TAGFILES               = @DOXYGEN_TAGFILES@
 GENERATE_TAGFILE       = "reference/@GLIBMM_MODULE_NAME@.tag"
 ALLEXTERNALS           = NO
 EXTERNAL_GROUPS        = NO
+EXTERNAL_PAGES         = YES
 PERL_PATH              = @PERL@
 #---------------------------------------------------------------------------
 # Configuration options related to the dot tool
 #---------------------------------------------------------------------------
 CLASS_DIAGRAMS         = YES
 MSCGEN_PATH            =
+DIA_PATH               =
 HIDE_UNDOC_RELATIONS   = NO
 HAVE_DOT               = YES
 DOT_NUM_THREADS        = 0
@@ -340,6 +353,9 @@ INTERACTIVE_SVG        = NO
 DOT_PATH               =
 DOTFILE_DIRS           =
 MSCFILE_DIRS           =
+DIAFILE_DIRS           =
+PLANTUML_JAR_PATH      =
+PLANTUML_INCLUDE_PATH  =
 DOT_GRAPH_MAX_NODES    = 50
 MAX_DOT_GRAPH_DEPTH    = 0
 DOT_TRANSPARENT        = NO
index 42f36a6..a3c431a 100644 (file)
@@ -401,7 +401,7 @@ do_connectable (const std::string& arg, gboolean synchronous)
         {
             host = arg.substr (0, pos);
             port_str = arg.substr(pos);
-            port = strtoul (port_str.c_str (), nullptr, 10);
+            port = std::stoul (port_str);
         }
         else
             port = 0;
index 24c0784..98c0e64 100644 (file)
@@ -7,3 +7,5 @@ giomm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(giomm_files_used_hg))
 giomm_files_extra_cc = contenttype.cc init.cc slot_async.cc socketsource.cc
 giomm_files_extra_h  = contenttype.h init.h socketsource.h wrap_init.h
 giomm_files_extra_ph =
+
+giomm_files_all_h = $(giomm_files_hg:.hg=.h) $(giomm_files_extra_h)
index f17b41a..32c89bd 100644 (file)
@@ -95,7 +95,7 @@ SocketSource::SocketSource(const Glib::RefPtr<Socket>& socket, Glib::IOCondition
            (GSourceFunc)&giomm_socketsource_callback)
 {}
 
-SocketSource::~SocketSource()
+SocketSource::~SocketSource() noexcept
 {}
 
 } // namespace Gio
index 77bec40..826dca5 100644 (file)
@@ -108,7 +108,7 @@ public:
 protected:
   SocketSource(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
     const Glib::RefPtr<Cancellable>& cancellable);
-  virtual ~SocketSource();
+  virtual ~SocketSource() noexcept;
 };
 
 } // namespace Gio
index d750b5c..53e52b9 100644 (file)
@@ -143,6 +143,35 @@ InterfaceVTable::InterfaceVTable(
   gobject_.set_property = &DBusInterfaceVTable_SetProperty_giomm_callback;
 }
 
+InterfaceVTable::InterfaceVTable(InterfaceVTable&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+  slot_method_call_(std::move(other.slot_method_call_)),
+  slot_get_property_(std::move(other.slot_get_property_)),
+  slot_set_property_(std::move(other.slot_set_property_))
+{
+  other.slot_method_call_ = nullptr;
+  other.slot_get_property_ = nullptr;
+  other.slot_set_property_ = nullptr;
+}
+
+InterfaceVTable& InterfaceVTable::operator=(InterfaceVTable&& other) noexcept
+{
+  delete slot_method_call_;
+  delete slot_get_property_;
+  delete slot_set_property_;
+
+  gobject_ = std::move(other.gobject_);
+  slot_method_call_ = std::move(other.slot_method_call_);
+  slot_get_property_ = std::move(other.slot_get_property_);
+  slot_set_property_ = std::move(other.slot_set_property_);
+
+  other.slot_method_call_ = nullptr;
+  other.slot_get_property_ = nullptr;
+  other.slot_set_property_ = nullptr;
+
+  return *this;
+}
+
 InterfaceVTable::~InterfaceVTable()
 {
   delete slot_method_call_;
index c17e82f..87aeee0 100644 (file)
@@ -126,6 +126,12 @@ public:
    const SlotInterfaceSetProperty& slot_set_property = SlotInterfaceSetProperty()
   );
 
+  InterfaceVTable(const InterfaceVTable& other) = delete;
+  InterfaceVTable& operator=(const InterfaceVTable& other) = delete;
+
+  InterfaceVTable(InterfaceVTable&& other) noexcept;
+  InterfaceVTable& operator=(InterfaceVTable&& other) noexcept;
+
   /// Destructor.
   virtual ~InterfaceVTable();
 
@@ -137,13 +143,6 @@ public:
   const GDBusInterfaceVTable* gobj() const
     { return reinterpret_cast<const GDBusInterfaceVTable*>(&gobject_); }
 
-
-private:
-  // Non-copyable.
-  InterfaceVTable(const InterfaceVTable& other);
-  InterfaceVTable& operator=(const InterfaceVTable& other);
-
-public:
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   // These are so the C callbacks and the
   // Gio::DBus::Connection::register_object() method can have access to the
index 442415a..d7921c8 100644 (file)
@@ -34,7 +34,7 @@ _WRAP_ENUM(PropertyInfoFlags, GDBusPropertyInfoFlags, s#^DBUS_##, NO_GTYPE)
  * @newin{2,28}
  * @ingroup DBus
  */
-class AnnotationInfo
+class AnnotationInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(AnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
   _IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
@@ -50,7 +50,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class ArgInfo
+class ArgInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(ArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref)
   _IGNORE(g_dbus_arg_info_ref, g_dbus_arg_info_unref)
@@ -63,7 +63,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class MethodInfo
+class MethodInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(MethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref)
   _IGNORE(g_dbus_method_info_ref, g_dbus_method_info_unref)
@@ -76,7 +76,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class SignalInfo
+class SignalInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(SignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref)
   _IGNORE(g_dbus_signal_info_ref, g_dbus_signal_info_unref)
@@ -89,7 +89,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class PropertyInfo
+class PropertyInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(PropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref)
   _IGNORE(g_dbus_property_info_ref, g_dbus_property_info_unref)
@@ -102,7 +102,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class InterfaceInfo
+class InterfaceInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(InterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref)
   _IGNORE(g_dbus_interface_info_ref, g_dbus_interface_info_unref)
@@ -129,7 +129,7 @@ public:
  * @newin{2,28}
  * @ingroup DBus
  */
-class NodeInfo
+class NodeInfo final
 {
   _CLASS_OPAQUE_REFCOUNTED(NodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref)
   _IGNORE(g_dbus_node_info_ref, g_dbus_node_info_unref)
index da8dd75..1299787 100644 (file)
@@ -154,6 +154,35 @@ SubtreeVTable::SubtreeVTable(
   gobject_.dispatch = &DBusSubtreeVTable_Dispatch_giomm_callback;
 }
 
+SubtreeVTable::SubtreeVTable(SubtreeVTable&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+  slot_enumerate_(std::move(other.slot_enumerate_)),
+  slot_introspect_(std::move(other.slot_introspect_)),
+  slot_dispatch_(std::move(other.slot_dispatch_))
+{
+  other.slot_enumerate_ = nullptr;
+  other.slot_introspect_ = nullptr;
+  other.slot_dispatch_ = nullptr;
+}
+
+SubtreeVTable& SubtreeVTable::operator=(SubtreeVTable&& other) noexcept
+{
+  delete slot_enumerate_;
+  delete slot_introspect_;
+  delete slot_dispatch_;
+
+  gobject_ = std::move(other.gobject_);
+  slot_enumerate_ = std::move(other.slot_enumerate_);
+  slot_introspect_ = std::move(other.slot_introspect_);
+  slot_dispatch_ = std::move(other.slot_dispatch_);
+
+  other.slot_enumerate_ = nullptr;
+  other.slot_introspect_ = nullptr;
+  other.slot_dispatch_ = nullptr;
+
+  return *this;
+}
+
 SubtreeVTable::~SubtreeVTable()
 {
   delete slot_enumerate_;
index ec519ed..b5e921b 100644 (file)
@@ -135,6 +135,12 @@ public:
    const SlotSubtreeDispatch& slot_dispatch = SlotSubtreeDispatch()
   );
 
+  SubtreeVTable(const SubtreeVTable& other) = delete;
+  SubtreeVTable& operator=(const SubtreeVTable& other) = delete;
+
+  SubtreeVTable(SubtreeVTable&& other) noexcept;
+  SubtreeVTable& operator=(SubtreeVTable&& other) noexcept;
+
   /// Destructor.
   virtual ~SubtreeVTable();
 
@@ -146,12 +152,6 @@ public:
   const GDBusSubtreeVTable* gobj() const
     { return reinterpret_cast<const GDBusSubtreeVTable*>(&gobject_); }
 
-
-private:
-  // Non-copyable.
-  SubtreeVTable(const SubtreeVTable& other);
-  SubtreeVTable& operator=(const SubtreeVTable& other);
-
 public:
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   // These are so the C callbacks and the
index ffb848d..d3e9597 100644 (file)
@@ -44,6 +44,22 @@ FileAttributeInfo::operator=(const FileAttributeInfo& other)
   return *this;
 }
 
+FileAttributeInfo::FileAttributeInfo(FileAttributeInfo&& other) noexcept
+: m_name(std::move(other.m_name)),
+  m_type(std::move(other.m_type)),
+  m_flags(std::move(other.m_flags))
+{
+}
+
+FileAttributeInfo& FileAttributeInfo::operator=(FileAttributeInfo&& other) noexcept
+{
+  m_name = std::move(other.m_name);
+  m_type = std::move(other.m_type);
+  m_flags = std::move(other.m_flags);
+
+  return *this;
+}
+
 FileAttributeInfo::~FileAttributeInfo()
 {
 }
index 7d5c92b..391249e 100644 (file)
@@ -44,6 +44,9 @@ public:
   FileAttributeInfo(const FileAttributeInfo& other);
   FileAttributeInfo& operator=(const FileAttributeInfo& other);
 
+  FileAttributeInfo(FileAttributeInfo&& other) noexcept;
+  FileAttributeInfo& operator=(FileAttributeInfo&& other) noexcept;
+
   ~FileAttributeInfo();
 
   std::string get_name() const;
index dc3903a..4f7bac7 100644 (file)
@@ -45,7 +45,7 @@ namespace Gio
  *
  * @newin{2,16}
  */
-class FileAttributeInfoList
+class FileAttributeInfoList final
 {
   _CLASS_OPAQUE_REFCOUNTED(FileAttributeInfoList, GFileAttributeInfoList,
                            g_file_attribute_info_list_new,
index ed73c8b..35d1a7a 100644 (file)
@@ -38,7 +38,6 @@ class FileIcon
   public LoadableIcon
 {
   _CLASS_GOBJECT(FileIcon, GFileIcon, G_FILE_ICON, Glib::Object, GObject)
-  _IMPLEMENTS_INTERFACE(Icon)
   _IMPLEMENTS_INTERFACE(LoadableIcon)
 
 protected:
index b14a601..9d31ba4 100644 (file)
@@ -47,7 +47,7 @@ const FileType FILE_TYPE_UNKNOWN = FILE_TYPE_NOT_KNOWN;
  *
  * @newin{2,16}
  */
-class FileAttributeMatcher
+class FileAttributeMatcher final
 {
   _CLASS_OPAQUE_REFCOUNTED(FileAttributeMatcher, GFileAttributeMatcher,
                            NONE, g_file_attribute_matcher_ref, g_file_attribute_matcher_unref)
index 730e221..5cee8bf 100644 (file)
@@ -128,7 +128,7 @@ _WRAP_ENUM(ResourceLookupFlags, GResourceLookupFlags, newin "2,44")
  *
  * @newin{2,44}
  */
-class Resource
+class Resource final
 {
   _CLASS_OPAQUE_REFCOUNTED(Resource, GResource, NONE, g_resource_ref, g_resource_unref)
   _IGNORE(g_resource_ref, g_resource_unref)
index 4ff7e83..db768b8 100644 (file)
@@ -52,7 +52,7 @@ namespace Gio
  *
  * @newin{2,32}
  */
-class SettingsSchema
+class SettingsSchema final
 {
   _CLASS_OPAQUE_REFCOUNTED(SettingsSchema, GSettingsSchema, NONE, g_settings_schema_ref, g_settings_schema_unref)
 
index cca21c7..e7894d6 100644 (file)
@@ -35,7 +35,7 @@ namespace Gio
  *
  * @newin{2,32}
  */
-class SettingsSchemaKey
+class SettingsSchemaKey final
 {
   _CLASS_OPAQUE_REFCOUNTED(SettingsSchemaKey, GSettingsSchemaKey, NONE, g_settings_schema_key_ref, g_settings_schema_key_unref)
 
index 2731f2b..4097e93 100644 (file)
@@ -35,7 +35,7 @@ namespace Gio
  *
  * @newin{2,32}
  */
-class SettingsSchemaSource
+class SettingsSchemaSource final
 {
   _CLASS_OPAQUE_REFCOUNTED(SettingsSchemaSource, GSettingsSchemaSource, NONE, g_settings_schema_source_ref, g_settings_schema_source_unref)
 
index ce153c7..95a67eb 100644 (file)
@@ -20,7 +20,7 @@
 namespace Glib
 {
 
-ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::~ArrayHandle()
+ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::~ArrayHandle() noexcept
 {
   if(parray_ && ownership_ != Glib::OWNERSHIP_NONE)
   {
index 87127eb..e92223f 100644 (file)
@@ -247,7 +247,7 @@ public:
   // Copying clears the ownership flag of the source handle.
   inline ArrayHandle(const ArrayHandle<T,Tr>& other);
 
-  ~ArrayHandle();
+  ~ArrayHandle() noexcept;
 
   inline const_iterator begin() const;
   inline const_iterator end()   const;
@@ -302,7 +302,7 @@ public:
   // Copying clears the ownership flag of the source handle.
   inline ArrayHandle(const Me& other);
 
-  ~ArrayHandle();
+  ~ArrayHandle() noexcept;
 
   inline const_iterator begin() const;
   inline const_iterator end()   const;
@@ -549,7 +549,7 @@ ArrayHandle<T,Tr>::ArrayHandle(const ArrayHandle<T,Tr>& other)
 }
 
 template <class T, class Tr>
-ArrayHandle<T,Tr>::~ArrayHandle()
+ArrayHandle<T,Tr>::~ArrayHandle() noexcept
 {
   if(parray_ && ownership_ != Glib::OWNERSHIP_NONE)
   {
index 89e9d34..d43f7ce 100644 (file)
@@ -43,7 +43,7 @@ public:
    * is zero-initialized at program start.
    */
   //Class();
-  //~Class();
+  //~Class() noexcept;
 
   //static void class_init_function(BaseClassType *p);
   //static void object_init_function(BaseObjectType *o);
index d611731..5a206ff 100644 (file)
@@ -125,7 +125,7 @@ namespace Glib
 class DispatchNotifier : public sigc::trackable
 {
 public:
-  ~DispatchNotifier();
+  ~DispatchNotifier() noexcept;
 
   // noncopyable
   DispatchNotifier(const DispatchNotifier&) = delete;
@@ -218,7 +218,7 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
   }
 }
 
-DispatchNotifier::~DispatchNotifier()
+DispatchNotifier::~DispatchNotifier() noexcept
 {
 #ifndef G_OS_WIN32
   fd_close_and_invalidate(fd_sender_);
@@ -481,7 +481,7 @@ Dispatcher::Dispatcher(const Glib::RefPtr<MainContext>& context)
   notifier_ (DispatchNotifier::reference_instance(context, this))
 {}
 
-Dispatcher::~Dispatcher()
+Dispatcher::~Dispatcher() noexcept
 {
   DispatchNotifier::unreference_instance(notifier_, this);
 }
index 5de499d..e7fda78 100644 (file)
@@ -86,7 +86,7 @@ public:
    * @throw Glib::FileError
    */
   explicit Dispatcher(const Glib::RefPtr<MainContext>& context);
-  ~Dispatcher();
+  ~Dispatcher() noexcept;
 
   void emit();
   void operator()();
index 909ef6d..4de7bad 100644 (file)
@@ -2,7 +2,7 @@
 
 glibmm_files_built_cc = $(glibmm_files_used_hg:.hg=.cc) $(glibmm_files_cc_m4:.m4=) wrap_init.cc
 glibmm_files_built_h  = $(glibmm_files_used_hg:.hg=.h) $(glibmm_files_h_m4:.m4=)
-glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_hg))
+glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_used_hg))
 
 glibmm_files_extra_cc =                        \
        arrayhandle.cc                  \
@@ -87,3 +87,5 @@ glibmm_files_extra_h =                        \
 glibmm_files_extra_ph =                        \
        private/interface_p.h           \
        private/object_p.h
+
+glibmm_files_all_h = $(glibmm_files_hg:.hg=.h) $(glibmm_files_h_m4:.m4=) $(glibmm_files_extra_h)
index 1c9b9ba..1b5c2c6 100644 (file)
@@ -51,7 +51,7 @@ public:
   : gparent_(gp)
   {}
 
-  virtual ~HelperList()
+  virtual ~HelperList() noexcept
   {}
 
   typedef T_Child value_type;
index 8ed14d3..7af932c 100644 (file)
@@ -117,7 +117,23 @@ Interface::Interface(GObject* castitem)
 Interface::Interface()
 {}
 
-Interface::~Interface()
+Interface::Interface(Interface&& src) noexcept
+: ObjectBase(std::move(src))
+{
+  //We don't call initialize_move() because we 
+  //want the derived move constructor to only cause it
+  //to be called once, so we just let it be called
+  //by the implementing class, such as Entry (implementing Editable).
+  //ObjectBase::initialize_move(src.gobject_, &src);
+}
+
+Interface& Interface::operator=(Interface&& src) noexcept
+{
+  ObjectBase::operator=(std::move(src));
+  return *this;
+}
+
+Interface::~Interface() noexcept
 {}
 
 GType Interface::get_type()
index 0fc9ba6..f7cd864 100644 (file)
@@ -45,6 +45,9 @@ public:
    */
   Interface();
 
+  Interface(Interface&& src) noexcept;
+  Interface& operator=(Interface&& src) noexcept;
+
   /** Called by constructors of derived classes. Provide the result of
    * the Class object's init() function to ensure that it is properly
    * initialized.
@@ -60,7 +63,7 @@ public:
    * if necessary.
    */
   explicit Interface(GObject* castitem);
-  virtual ~Interface();
+  virtual ~Interface() noexcept;
 
   // noncopyable
   Interface(const Interface&) = delete;
index 76bb7a8..25ca328 100644 (file)
@@ -181,7 +181,7 @@ public:
   // Copying clears the ownership flag of the source handle.
   inline ListHandle(const ListHandle<T,Tr>& other);
 
-  ~ListHandle();
+  ~ListHandle() noexcept;
 
   inline const_iterator begin() const;
   inline const_iterator end()   const;
@@ -290,7 +290,7 @@ ListHandle<T,Tr>::ListHandle(const ListHandle<T,Tr>& other)
 }
 
 template <class T, class Tr>
-ListHandle<T,Tr>::~ListHandle()
+ListHandle<T,Tr>::~ListHandle() noexcept
 {
   if(ownership_ != Glib::OWNERSHIP_NONE)
   {
index 9dfe09f..c2f1c4d 100644 (file)
@@ -934,7 +934,7 @@ Source::Source(GSource* cast_item, GSourceFunc callback_func)
       &SourceCallbackData::destroy_notify_callback);
 }
 
-Source::~Source()
+Source::~Source() noexcept
 {
   // The dtor should be invoked by destroy_notify_callback() only, which clears
   // gobject_ before deleting.  However, we might also get to this point if
@@ -1120,7 +1120,7 @@ TimeoutSource::TimeoutSource(unsigned int interval)
   expiration_.add_milliseconds(std::min<unsigned long>(G_MAXLONG, interval_));
 }
 
-TimeoutSource::~TimeoutSource()
+TimeoutSource::~TimeoutSource() noexcept
 {}
 
 bool TimeoutSource::prepare(int& timeout)
@@ -1212,7 +1212,7 @@ IdleSource::IdleSource()
   set_priority(PRIORITY_DEFAULT_IDLE);
 }
 
-IdleSource::~IdleSource()
+IdleSource::~IdleSource() noexcept
 {}
 
 bool IdleSource::prepare(int& timeout)
@@ -1268,7 +1268,7 @@ IOSource::IOSource(GSource* cast_item, GSourceFunc callback_func)
   Source(cast_item, callback_func)
 {}
 
-IOSource::~IOSource()
+IOSource::~IOSource() noexcept
 {}
 
 bool IOSource::prepare(int& timeout)
index 53a2370..2dd9358 100644 (file)
@@ -741,7 +741,7 @@ protected:
    */
   Source(GSource* cast_item, GSourceFunc callback_func);
 
-  virtual ~Source();
+  virtual ~Source() noexcept;
 
   sigc::connection connect_generic(const sigc::slot_base& slot);
 
@@ -819,7 +819,7 @@ public:
 
 protected:
   explicit TimeoutSource(unsigned int interval);
-  virtual ~TimeoutSource();
+  virtual ~TimeoutSource() noexcept;
 
   virtual bool prepare(int& timeout);
   virtual bool check();
@@ -843,7 +843,7 @@ public:
 
 protected:
   IdleSource();
-  virtual ~IdleSource();
+  virtual ~IdleSource() noexcept;
 
   virtual bool prepare(int& timeout);
   virtual bool check();
@@ -871,7 +871,7 @@ protected:
    */
   IOSource(GSource* cast_item, GSourceFunc callback_func);
 
-  virtual ~IOSource();
+  virtual ~IOSource() noexcept;
 
   virtual bool prepare(int& timeout);
   virtual bool check();
index ddaa47b..0373c5d 100644 (file)
@@ -128,7 +128,7 @@ ConstructParams::ConstructParams(const Glib::Class& glibmm_class_,
   va_end(var_args);
 }
 
-ConstructParams::~ConstructParams()
+ConstructParams::~ConstructParams() noexcept
 {
   while(n_parameters > 0)
     g_value_unset(&parameters[--n_parameters].value);
@@ -285,7 +285,19 @@ Object::Object(GObject* castitem)
   ObjectBase::initialize(castitem);
 }
 
-Object::~Object()
+Object::Object(Object&& src) noexcept
+: ObjectBase(std::move(src)) //not actually called because it's a virtual base
+{
+  ObjectBase::initialize_move(src.gobject_, &src);
+}
+
+Object& Object::operator=(Object&& src) noexcept
+{
+  ObjectBase::operator=(std::move(src));
+  return *this;
+}
+
+Object::~Object() noexcept
 {
   cpp_destruction_in_progress_ = true;
 }
index 202b28e..d172025 100644 (file)
@@ -77,7 +77,7 @@ public:
   explicit ConstructParams(const Glib::Class& glibmm_class_);
   ConstructParams(const Glib::Class& glibmm_class_, const char* first_property_name, ...)
     G_GNUC_NULL_TERMINATED; // warn if called without a trailing NULL pointer
-  ~ConstructParams();
+  ~ConstructParams() noexcept;
 
   // The copy constructor is semantically required by the C++ compiler
   // (since g++ 3.4) to be able to create temporary instances, depending
@@ -107,11 +107,14 @@ public:
   Object(const Object&) = delete;
   Object& operator=(const Object&) = delete;
 
+  Object(Object&& src) noexcept;
+  Object& operator=(Object&& src) noexcept;
+
 protected:
   Object(); //For use by C++-only sub-types.
   explicit Object(const Glib::ConstructParams& construct_params);
   explicit Object(GObject* castitem);
-  virtual ~Object(); //It should only be deleted by the callback.
+  virtual ~Object() noexcept; //It should only be deleted by the callback.
 
 public:
   //static RefPtr<Object> create(); //You must reimplement this in each derived class.
index c1efb13..1a1f522 100644 (file)
@@ -90,7 +90,50 @@ void ObjectBase::initialize(GObject* castitem)
   _set_current_wrapper(castitem);
 }
 
-ObjectBase::~ObjectBase()
+void ObjectBase::initialize_move(GObject* castitem, Glib::ObjectBase* previous_wrapper)
+{
+  if(gobject_)
+  {
+    g_assert(gobject_ == castitem);
+
+    // TODO: Think about it.  Will this really be called twice?
+    g_printerr("ObjectBase::initialize_move() called twice for the same GObject\n");
+
+    return; // Don't initialize the wrapper twice.
+  }
+
+  gobject_ = castitem;
+  _move_current_wrapper(castitem, previous_wrapper);
+  custom_type_name_ = previous_wrapper->custom_type_name_;
+  cpp_destruction_in_progress_ = previous_wrapper->cpp_destruction_in_progress_;
+
+  //Clear the previous wrapper:
+  previous_wrapper->custom_type_name_ = nullptr;
+  previous_wrapper->cpp_destruction_in_progress_ = false;
+}
+
+ObjectBase::ObjectBase(ObjectBase&& src) noexcept
+: sigc::trackable(std::move(src)),
+  gobject_(std::move(src.gobject_)),
+  custom_type_name_(std::move(src.custom_type_name_)),
+  cpp_destruction_in_progress_(std::move(src.custom_type_name_))
+{}
+
+ObjectBase& ObjectBase::operator=(ObjectBase&& src) noexcept
+{
+  sigc::trackable::operator=(std::move(src));
+
+  if(gobject_)
+    unreference();
+
+  gobject_ = std::move(src.gobject_);
+  custom_type_name_ = std::move(src.custom_type_name_);
+  cpp_destruction_in_progress_ = std::move(src.custom_type_name_);
+
+  return *this;
+}
+
+ObjectBase::~ObjectBase() noexcept
 {
   // Normally, gobject_ should always be 0 at this point, because:
   //
@@ -177,6 +220,28 @@ void ObjectBase::_set_current_wrapper(GObject* object)
   }
 }
 
+void ObjectBase::_move_current_wrapper(GObject* object, Glib::ObjectBase* previous_wrapper) noexcept
+{
+  //See _set_current_wrapper().
+  ObjectBase* current_wrapper = _get_current_wrapper(object);
+  if(current_wrapper != previous_wrapper)
+  {
+    g_warning("%s: Unexpected previous wrapper, for object of type %s.\n"
+              "previous_wrapper=%p, current_wrapper=%p",
+                G_STRFUNC, G_OBJECT_TYPE_NAME(object),
+                previous_wrapper, current_wrapper);
+  }
+
+  //Remove the previous wrapper, without invoking destroy_notify_callback_():
+  g_object_steal_qdata(object, Glib::quark_);
+
+  //Set the new wrapper:
+  g_object_set_qdata_full(object, Glib::quark_, this, &destroy_notify_callback_);
+
+  //Clear the previous wrapper:
+  previous_wrapper->gobject_ = nullptr;
+}
+
 // static
 ObjectBase* ObjectBase::_get_current_wrapper(GObject* object)
 {
index 44fb7ad..43438e0 100644 (file)
@@ -95,11 +95,17 @@ protected:
    */
   explicit ObjectBase(const std::type_info& custom_type_info);
 
-  virtual ~ObjectBase() = 0;
+  ObjectBase(ObjectBase&& src) noexcept;
+  ObjectBase& operator=(ObjectBase&& src) noexcept;
+
+  virtual ~ObjectBase() noexcept = 0;
 
   // Called by Glib::Object and Glib::Interface constructors. See comments there.
   void initialize(GObject* castitem);
 
+  // Called by Glib::Object and Glib::Interface C++ move operations.
+  void initialize_move(GObject* castitem, Glib::ObjectBase* previous_wrapper);
+
 public:
 
   /// You probably want to use a specific property_*() accessor method instead.
@@ -238,6 +244,9 @@ protected:
   virtual void destroy_notify_();
 
   void _set_current_wrapper(GObject* object);
+
+  /// For (indirect) use by C++ move operations.
+  void _move_current_wrapper(GObject* object, Glib::ObjectBase* previous_wrapper) noexcept;
 #endif //DOXYGEN_SHOULD_SKIP_THIS
 
 private:
index c04e51f..de2e5f6 100644 (file)
@@ -37,7 +37,7 @@ PatternSpec::PatternSpec(GPatternSpec* gobject)
   gobject_ (gobject)
 {}
 
-PatternSpec::~PatternSpec()
+PatternSpec::~PatternSpec() noexcept
 {
   g_pattern_spec_free(gobject_);
 }
index dff0a97..ff556bd 100644 (file)
@@ -41,7 +41,7 @@ class PatternSpec
 public:
   explicit PatternSpec(const Glib::ustring& pattern);
   explicit PatternSpec(GPatternSpec* gobject);
-  ~PatternSpec();
+  ~PatternSpec() noexcept;
 
   // noncopyable
   PatternSpec(const PatternSpec&) = delete;
index 346c3e1..c3ff33d 100644 (file)
@@ -231,7 +231,7 @@ PropertyBase::PropertyBase(Glib::Object& object, GType value_type)
   value_.init(value_type);
 }
 
-PropertyBase::~PropertyBase()
+PropertyBase::~PropertyBase() noexcept
 {
   if(param_spec_)
     g_param_spec_unref(param_spec_);
index dadc0f2..0b67906 100644 (file)
@@ -84,7 +84,7 @@ protected:
    * first instance of an object.
    */
   PropertyBase(Glib::Object& object, GType value_type);
-  ~PropertyBase();
+  ~PropertyBase() noexcept;
 
   /**
    * Checks if the property has already been installed.
index 4d44939..ea69ba3 100644 (file)
@@ -53,7 +53,7 @@ SignalProxyProperty::SignalProxyProperty(Glib::ObjectBase* obj, const gchar* pro
 {
 }
 
-SignalProxyProperty::~SignalProxyProperty()
+SignalProxyProperty::~SignalProxyProperty() noexcept
 {
 }
 
index b933590..c317a2e 100644 (file)
@@ -38,7 +38,7 @@ public:
   friend class PropertyProxy_Base;
 
   SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name);
-  ~SignalProxyProperty();
+  ~SignalProxyProperty() noexcept;
 
   typedef sigc::slot<void> SlotType;
   sigc::connection connect(const SlotType& sl);
index 810ec34..29458be 100644 (file)
@@ -55,7 +55,7 @@ Quark::Quark(const char* s)
 : QueryQuark(g_quark_from_string(s))
 {}
 
-Quark::~Quark()
+Quark::~Quark() noexcept
 {}
 
 
index 472589f..5eac617 100644 (file)
@@ -47,7 +47,7 @@ class QueryQuark
     QueryQuark(const GQuark& q);
     QueryQuark(const ustring& s);
     QueryQuark(const char*s);
-    ~QueryQuark() {}
+    ~QueryQuark() noexcept {}
     QueryQuark& operator=(const QueryQuark& q);
     operator ustring() const;
 
@@ -63,7 +63,7 @@ class Quark: public QueryQuark
   public:
     Quark(const ustring& s);
     Quark(const char* s);
-    ~Quark();
+    ~Quark() noexcept;
 };
 
 /** @relates Glib::QueryQuark */
index a69a63a..daffc6c 100644 (file)
@@ -36,7 +36,7 @@ Rand::Rand(guint32 seed)
   gobject_ (g_rand_new_with_seed(seed))
 {}
 
-Rand::~Rand()
+Rand::~Rand() noexcept
 {
   g_rand_free(gobject_);
 }
index aeda3a6..cd6bb77 100644 (file)
@@ -41,7 +41,7 @@ class Rand
 public:
   Rand();
   explicit Rand(guint32 seed);
-  ~Rand();
+  ~Rand() noexcept;
 
   // noncopyable
   Rand(const Rand&) = delete;
index 30dbf18..b4e2b41 100644 (file)
@@ -41,7 +41,8 @@ namespace Glib
  * zero, the contained object is deleted, meaning  you don't need to remember
  * to delete the object.
  *
- * RefPtr<> can store any class that has reference() and unreference() methods.
+ * RefPtr<> can store any class that has reference() and unreference() methods,
+ * and whose destructor is noexcept (the default for destructors).
  * In gtkmm, that is anything derived from Glib::ObjectBase, such as
  * Gdk::Pixmap.
  *
@@ -56,72 +57,72 @@ public:
    *
    * Afterwards it will be null and use of -> will cause a segmentation fault.
    */
-  inline RefPtr();
+  inline RefPtr() noexcept;
 
   /// Destructor - decrements reference count.
-  inline ~RefPtr();
+  inline ~RefPtr() noexcept;
 
   /// For use only by the \::create() methods.
-  explicit inline RefPtr(T_CppObject* pCppObject);
+  explicit inline RefPtr(T_CppObject* pCppObject) noexcept;
 
   /** Copy constructor
    *
    * This increments the shared reference count.
    */
-  inline RefPtr(const RefPtr& src);
+  inline RefPtr(const RefPtr& src) noexcept;
 
   /** Move constructor
    */
-  inline RefPtr(RefPtr&& src);
+  inline RefPtr(RefPtr&& src) noexcept;
 
   /** Move constructor (from different, but castable type).
    */
   template <class T_CastFrom>
-  inline RefPtr(RefPtr<T_CastFrom>&& src);
+  inline RefPtr(RefPtr<T_CastFrom>&& src) noexcept;
 
   /** Copy constructor (from different, but castable type).
    *
    * Increments the reference count.
    */
   template <class T_CastFrom>
-  inline RefPtr(const RefPtr<T_CastFrom>& src);
+  inline RefPtr(const RefPtr<T_CastFrom>& src) noexcept;
 
   /** Swap the contents of two RefPtr<>.
    * This method swaps the internal pointers to T_CppObject.  This can be
    * done safely without involving a reference/unreference cycle and is
    * therefore highly efficient.
    */
-  inline void swap(RefPtr& other);
+  inline void swap(RefPtr& other) noexcept;
 
   /// Copy from another RefPtr:
-  inline RefPtr& operator=(const RefPtr& src);
+  inline RefPtr& operator=(const RefPtr& src) noexcept;
 
   /// Move assignment operator:
-  inline RefPtr& operator=(RefPtr&& src);
+  inline RefPtr& operator=(RefPtr&& src) noexcept;
 
   /// Move assignment operator (from different, but castable type):
   template <class T_CastFrom>
-  inline RefPtr& operator=(RefPtr<T_CastFrom>&& src);
+  inline RefPtr& operator=(RefPtr<T_CastFrom>&& src) noexcept;
 
   /** Copy from different, but castable type).
    *
    * Increments the reference count.
    */
   template <class T_CastFrom>
-  inline RefPtr& operator=(const RefPtr<T_CastFrom>& src);
+  inline RefPtr& operator=(const RefPtr<T_CastFrom>& src) noexcept;
 
   /// Tests whether the RefPtr<> point to the same underlying instance.
-  inline bool operator==(const RefPtr& src) const;
+  inline bool operator==(const RefPtr& src) const noexcept;
 
   /// See operator==().
-  inline bool operator!=(const RefPtr& src) const;
+  inline bool operator!=(const RefPtr& src) const noexcept;
 
   /** Dereferencing.
    *
    * Use the methods of the underlying instance like so:
    * <code>refptr->memberfun()</code>.
    */
-  inline T_CppObject* operator->() const;
+  inline T_CppObject* operator->() const noexcept;
 
   /** Test whether the RefPtr<> points to any underlying instance.
    *
@@ -131,17 +132,17 @@ public:
    *     do_something();
    * @endcode
    */
-  inline operator bool() const;
+  inline operator bool() const noexcept;
 
 #ifndef GLIBMM_DISABLE_DEPRECATED
   /// @deprecated Use reset() instead because this leads to confusion with clear() methods on the underlying class. For instance, people use .clear() when they mean ->clear().
-  inline void clear();
+  inline void clear() noexcept;
 #endif //GLIBMM_DISABLE_DEPRECATED
 
   /** Set underlying instance to 0, decrementing reference count of existing instance appropriately.
    * @newin{2,16}
    */
-  inline void reset();
+  inline void reset() noexcept;
 
   /** Release the ownership of underlying instance.
    *
@@ -152,7 +153,7 @@ public:
    * of the managed object. A legitimate use is if you immediately give RefPtr's
    * reference to another object.
    */
-  inline T_CppObject* release() G_GNUC_WARN_UNUSED_RESULT;
+  inline T_CppObject* release() noexcept G_GNUC_WARN_UNUSED_RESULT;
 
   /** Dynamic cast to derived class.
    *
@@ -162,7 +163,7 @@ public:
    * @endcode
    */
   template <class T_CastFrom>
-  static inline RefPtr cast_dynamic(const RefPtr<T_CastFrom>& src);
+  static inline RefPtr cast_dynamic(const RefPtr<T_CastFrom>& src) noexcept;
 
   /** Static cast to derived class.
    *
@@ -172,7 +173,7 @@ public:
    * @endcode
    */
   template <class T_CastFrom>
-  static inline RefPtr cast_static(const RefPtr<T_CastFrom>& src);
+  static inline RefPtr cast_static(const RefPtr<T_CastFrom>& src) noexcept;
 
   /** Cast to non-const.
    *
@@ -182,7 +183,7 @@ public:
    * @endcode
    */
   template <class T_CastFrom>
-  static inline RefPtr cast_const(const RefPtr<T_CastFrom>& src);
+  static inline RefPtr cast_const(const RefPtr<T_CastFrom>& src) noexcept;
 
   //TODO: Maybe remove these if we replace operator bool() with operator const void* after
   //an API/ABI break, as suggested by Daniel Elstner? murrayc.
@@ -197,16 +198,16 @@ public:
    * is still syntactically possible, but the result is semantically
    * wrong, as p1 REL_OP p2 is interpreted as (bool)p1 REL_OP (bool)p2.
    */
-  inline bool operator<(const RefPtr& src) const;
+  inline bool operator<(const RefPtr& src) const noexcept;
 
   /// See operator<().
-  inline bool operator<=(const RefPtr& src) const;
+  inline bool operator<=(const RefPtr& src) const noexcept;
 
   /// See operator<().
-  inline bool operator>(const RefPtr& src) const;
+  inline bool operator>(const RefPtr& src) const noexcept;
 
   /// See operator<().
-  inline bool operator>=(const RefPtr& src) const;
+  inline bool operator>=(const RefPtr& src) const noexcept;
 
 private:
   T_CppObject* pCppObject_;
@@ -219,32 +220,32 @@ private:
 // If it would come after them it wouldn't be inlined.
 
 template <class T_CppObject> inline
-T_CppObject* RefPtr<T_CppObject>::operator->() const
+T_CppObject* RefPtr<T_CppObject>::operator->() const noexcept
 {
   return pCppObject_;
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr()
+RefPtr<T_CppObject>::RefPtr() noexcept
 :
   pCppObject_ (0)
 {}
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::~RefPtr()
+RefPtr<T_CppObject>::~RefPtr() noexcept
 {
   if(pCppObject_)
     pCppObject_->unreference(); // This could cause pCppObject to be deleted.
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject)
+RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject) noexcept
 :
   pCppObject_ (pCppObject)
 {}
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(const RefPtr& src)
+RefPtr<T_CppObject>::RefPtr(const RefPtr& src) noexcept
 :
   pCppObject_ (src.pCppObject_)
 {
@@ -253,7 +254,7 @@ RefPtr<T_CppObject>::RefPtr(const RefPtr& src)
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(RefPtr&& src)
+RefPtr<T_CppObject>::RefPtr(RefPtr&& src) noexcept
 :
   pCppObject_ (src.pCppObject_)
 {
@@ -263,7 +264,7 @@ RefPtr<T_CppObject>::RefPtr(RefPtr&& src)
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src)
+RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src) noexcept
 :
   pCppObject_ (src.release())
 {
@@ -275,7 +276,7 @@ RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src)
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src) noexcept
 :
   // A different RefPtr<> will not allow us access to pCppObject_.  We need
   // to add a get_underlying() for this, but that would encourage incorrect
@@ -287,7 +288,7 @@ RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
 }
 
 template <class T_CppObject> inline
-void RefPtr<T_CppObject>::swap(RefPtr& other)
+void RefPtr<T_CppObject>::swap(RefPtr& other) noexcept
 {
   T_CppObject *const temp = pCppObject_;
   pCppObject_ = other.pCppObject_;
@@ -295,7 +296,7 @@ void RefPtr<T_CppObject>::swap(RefPtr& other)
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src) noexcept
 {
   // In case you haven't seen the swap() technique to implement copy
   // assignment before, here's what it does:
@@ -327,7 +328,7 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src)
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src) noexcept
 {
   RefPtr<T_CppObject> temp (std::move(src));
   this->swap(temp);
@@ -339,7 +340,7 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src)
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src) noexcept
 {
   if (pCppObject_)
     pCppObject_->unreference();
@@ -351,7 +352,7 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src)
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src) noexcept
 {
   RefPtr<T_CppObject> temp (src);
   this->swap(temp);
@@ -359,40 +360,40 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& sr
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator==(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator==(const RefPtr& src) const noexcept
 {
   return (pCppObject_ == src.pCppObject_);
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator!=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator!=(const RefPtr& src) const noexcept
 {
   return (pCppObject_ != src.pCppObject_);
 }
 
 template <class T_CppObject> inline
-RefPtr<T_CppObject>::operator bool() const
+RefPtr<T_CppObject>::operator bool() const noexcept
 {
   return (pCppObject_ != nullptr);
 }
 
 #ifndef GLIBMM_DISABLE_DEPRECATED
 template <class T_CppObject> inline
-void RefPtr<T_CppObject>::clear()
+void RefPtr<T_CppObject>::clear() noexcept
 {
   reset();
 }
 #endif //GLIBMM_DISABLE_DEPRECATED
 
 template <class T_CppObject> inline
-void RefPtr<T_CppObject>::reset()
+void RefPtr<T_CppObject>::reset() noexcept
 {
   RefPtr<T_CppObject> temp; // swap with an empty RefPtr<> to clear *this
   this->swap(temp);
 }
 
 template <class T_CppObject> inline
-T_CppObject* RefPtr<T_CppObject>::release()
+T_CppObject* RefPtr<T_CppObject>::release() noexcept
 {
   T_CppObject *tmp = pCppObject_;
   pCppObject_ = nullptr;
@@ -402,7 +403,7 @@ T_CppObject* RefPtr<T_CppObject>::release()
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src) noexcept
 {
   T_CppObject *const pCppObject = dynamic_cast<T_CppObject*>(src.operator->());
 
@@ -415,7 +416,7 @@ RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>&
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src) noexcept
 {
   T_CppObject *const pCppObject = static_cast<T_CppObject*>(src.operator->());
 
@@ -428,7 +429,7 @@ RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& s
 template <class T_CppObject>
   template <class T_CastFrom>
 inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src) noexcept
 {
   T_CppObject *const pCppObject = const_cast<T_CppObject*>(src.operator->());
 
@@ -439,25 +440,25 @@ RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& sr
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator<(const RefPtr& src) const noexcept
 {
   return (pCppObject_ < src.pCppObject_);
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator<=(const RefPtr& src) const noexcept
 {
   return (pCppObject_ <= src.pCppObject_);
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator>(const RefPtr& src) const noexcept
 {
   return (pCppObject_ > src.pCppObject_);
 }
 
 template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const noexcept
 {
   return (pCppObject_ >= src.pCppObject_);
 }
@@ -466,7 +467,7 @@ bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const
 
 /** @relates Glib::RefPtr */
 template <class T_CppObject> inline
-void swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs)
+void swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs) noexcept
 {
   lhs.swap(rhs);
 }
index 41ee5f7..4c9e9d3 100644 (file)
@@ -42,7 +42,7 @@ SignalProxyNormal::SignalProxyNormal(Glib::ObjectBase* obj, const SignalProxyInf
   info_           (info)
 {}
 
-SignalProxyNormal::~SignalProxyNormal()
+SignalProxyNormal::~SignalProxyNormal() noexcept
 {}
 
 sigc::slot_base&
@@ -109,7 +109,7 @@ SignalProxyDetailed::SignalProxyDetailed(Glib::ObjectBase* obj,
                    (detail_name.empty() ? Glib::ustring() : ("::" + detail_name)))
 {}
 
-SignalProxyDetailed::~SignalProxyDetailed()
+SignalProxyDetailed::~SignalProxyDetailed() noexcept
 {}
 
 sigc::slot_base&
index 231d675..c5cf740 100644 (file)
@@ -181,7 +181,7 @@ public:
   // Copying clears the ownership flag of the source handle.
   inline SListHandle(const SListHandle<T,Tr>& other);
 
-  ~SListHandle();
+  ~SListHandle() noexcept;
 
   inline const_iterator begin() const;
   inline const_iterator end()   const;
@@ -289,7 +289,7 @@ SListHandle<T,Tr>::SListHandle(const SListHandle<T,Tr>& other)
 }
 
 template <class T, class Tr>
-SListHandle<T,Tr>::~SListHandle()
+SListHandle<T,Tr>::~SListHandle() noexcept
 {
   if(ownership_ != Glib::OWNERSHIP_NONE)
   {
index 674960d..8be257f 100644 (file)
@@ -54,7 +54,7 @@ StreamIOChannel::StreamIOChannel(std::istream* stream_in, std::ostream* stream_o
   get_flags_vfunc(); // initialize GIOChannel flag bits
 }
 
-StreamIOChannel::~StreamIOChannel()
+StreamIOChannel::~StreamIOChannel() noexcept
 {}
 
 IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read)
index 16b357f..7c243ba 100644 (file)
@@ -34,7 +34,7 @@ namespace Glib
 class StreamIOChannel : public Glib::IOChannel
 {
 public:
-  virtual ~StreamIOChannel();
+  virtual ~StreamIOChannel() noexcept;
 
   static Glib::RefPtr<StreamIOChannel> create(std::istream& stream);
   static Glib::RefPtr<StreamIOChannel> create(std::ostream& stream);
index a007a43..2cf8f14 100644 (file)
@@ -32,7 +32,7 @@ class ThreadPool::SlotList
 {
 public:
   SlotList();
-  ~SlotList();
+  ~SlotList() noexcept;
 
   // noncopyable
   SlotList(const ThreadPool::SlotList&) = delete;
@@ -51,7 +51,7 @@ private:
 ThreadPool::SlotList::SlotList()
 {}
 
-ThreadPool::SlotList::~SlotList()
+ThreadPool::SlotList::~SlotList() noexcept
 {}
 
 sigc::slot<void>* ThreadPool::SlotList::push(const sigc::slot<void>& slot)
@@ -141,7 +141,7 @@ ThreadPool::ThreadPool(int max_threads, bool exclusive)
   }
 }
 
-ThreadPool::~ThreadPool()
+ThreadPool::~ThreadPool() noexcept
 {
   if(gobject_)
     g_thread_pool_free(gobject_, 1, 1);
index 2c65c2e..696e69f 100644 (file)
@@ -60,7 +60,7 @@ public:
    * set to <tt>true</tt> and not all @a max_threads threads could be created.
    */
   explicit ThreadPool(int max_threads = -1, bool exclusive = false);
-  virtual ~ThreadPool();
+  virtual ~ThreadPool() noexcept;
 
   //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
   // TODO: At the next ABI break, consider changing const sigc::slot<void>& slot
index 6c0511e..ba69b62 100644 (file)
@@ -32,7 +32,7 @@ Timer::Timer()
   gobject_ (g_timer_new())
 {}
 
-Timer::~Timer()
+Timer::~Timer() noexcept
 {
   g_timer_destroy(gobject_);
 }
index 2c68d3a..9bd75e5 100644 (file)
@@ -39,7 +39,7 @@ public:
    * Also starts timing by calling start() implicitly.
    */
   Timer();
-  ~Timer();
+  ~Timer() noexcept;
 
   // not copyable
   Timer(const Timer&) = delete;
index 1d5e841..2ded2c8 100644 (file)
@@ -345,7 +345,7 @@ ustring::ustring(const std::string& src)
   string_ (src)
 {}
 
-ustring::~ustring()
+ustring::~ustring() noexcept
 {}
 
 void ustring::swap(ustring& other)
@@ -1255,7 +1255,7 @@ ustring::FormatStream::FormatStream()
   stream_ ()
 {}
 
-ustring::FormatStream::~FormatStream()
+ustring::FormatStream::~FormatStream() noexcept
 {}
 
 ustring ustring::FormatStream::to_string() const
index 3f74be7..fa3411b 100644 (file)
@@ -264,7 +264,7 @@ public:
    */
   ustring();
 
-  ~ustring();
+  ~ustring() noexcept;
 
   /*! Construct a ustring as a copy of another ustring.
    * @param other A source string.
@@ -891,7 +891,7 @@ private:
 
 public:
   FormatStream();
-  ~FormatStream();
+  ~FormatStream() noexcept;
 
   template <class T> inline void stream(const T& value);
 
index 79fecb6..3038dff 100644 (file)
@@ -69,7 +69,7 @@ private:
 public:
   ScopedPtr()                 : ptr_ (0)   {}
   explicit ScopedPtr(T* ptr)  : ptr_ (ptr) {}
-  ~ScopedPtr()                { g_free(ptr_); }
+  ~ScopedPtr()  noexcept      { g_free(ptr_); }
   T*  get() const             { return ptr_;  }
   T** addr()                  { return &ptr_; }
 };
index 811b82d..b49d9a4 100644 (file)
@@ -62,7 +62,7 @@ ValueBase& ValueBase::operator=(const ValueBase& other)
   return *this;
 }
 
-ValueBase::~ValueBase()
+ValueBase::~ValueBase() noexcept
 {
   g_value_unset(&gobject_);
 }
index fd1e225..48c934f 100644 (file)
@@ -60,7 +60,7 @@ public:
   ValueBase(const ValueBase& other);
   ValueBase& operator=(const ValueBase& other);
 
-  ~ValueBase();
+  ~ValueBase() noexcept;
 
   /** Setup the GValue for storing the specified @a type.
    * The contents will be initialized to the default value for this type.
index 8011344..fcf8fe0 100644 (file)
@@ -290,7 +290,7 @@ public:
    */
   explicit inline ArrayKeeper(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
   inline ArrayKeeper(const ArrayKeeper& keeper);
-  ~ArrayKeeper();
+  ~ArrayKeeper() noexcept;
 
   /** Gets data the keeper holds.
    *
@@ -348,7 +348,7 @@ public:
    */
   explicit inline GListKeeper(const GList* glist, Glib::OwnershipType ownership);
   inline GListKeeper(const GListKeeper& keeper);
-  ~GListKeeper();
+  ~GListKeeper() noexcept;
 
   /** Gets data the keeper holds.
    *
@@ -405,7 +405,7 @@ public:
    */
   explicit inline GSListKeeper(const GSList* gslist, Glib::OwnershipType ownership);
   inline GSListKeeper(const GSListKeeper& keeper);
-  ~GSListKeeper();
+  ~GSListKeeper() noexcept;
 
   /** Gets data the keeper holds.
    *
@@ -787,7 +787,7 @@ inline ArrayKeeper<Tr>::ArrayKeeper(const ArrayKeeper& keeper)
 }
 
 template <typename Tr>
-ArrayKeeper<Tr>::~ArrayKeeper()
+ArrayKeeper<Tr>::~ArrayKeeper() noexcept
 {
   if(array_ && ownership_ != Glib::OWNERSHIP_NONE)
   {
@@ -830,7 +830,7 @@ inline GListKeeper<Tr>::GListKeeper(const GListKeeper& keeper)
 }
 
 template <typename Tr>
-GListKeeper<Tr>::~GListKeeper()
+GListKeeper<Tr>::~GListKeeper() noexcept
 {
   typedef typename Tr::CTypeNonConst CTypeNonConst;
 
@@ -873,7 +873,7 @@ inline GSListKeeper<Tr>::GSListKeeper(const GSListKeeper& keeper)
 }
 
 template <typename Tr>
-GSListKeeper<Tr>::~GSListKeeper()
+GSListKeeper<Tr>::~GSListKeeper() noexcept
 {
   typedef typename Tr::CTypeNonConst CTypeNonConst;
   if(gslist_ && ownership_ != Glib::OWNERSHIP_NONE)
index 5895511..9c59020 100644 (file)
@@ -73,6 +73,8 @@ protected:
     gobject_ = g_tree_new_full(on_compare_tree, &key_compare_slot, on_destroy_key, on_destroy_value);
   }
 
+  //TODO: Add move operations, being careful of universal references and overload resolution.
+
 public:
   static Glib::RefPtr< BalancedTree<K, V> > create()
   {
index 5429275..1db85d8 100644 (file)
@@ -42,7 +42,7 @@ namespace Glib
  *
  * @newin{2,36}
  */
-class ByteArray
+class ByteArray final
 {
   _CLASS_OPAQUE_REFCOUNTED(ByteArray, GByteArray, NONE, g_byte_array_ref, g_byte_array_unref)
   _IGNORE(g_byte_array_ref, g_byte_array_unref)
index 31f1fc9..56da352 100644 (file)
@@ -51,7 +51,7 @@ namespace Glib
  *
  * @newin{2,34}
  */
-class Bytes
+class Bytes final
 {
   _CLASS_OPAQUE_REFCOUNTED(Bytes, GBytes, NONE, g_bytes_ref, g_bytes_unref)
   _IGNORE(g_bytes_ref, g_bytes_unref)
index de5e12a..408ceb3 100644 (file)
@@ -61,6 +61,9 @@ public:
   IConv(const std::string& to_codeset, const std::string& from_codeset);
   _IGNORE(g_iconv_open)
 
+  IConv(const IConv&) = delete;
+  IConv& operator=(const IConv&) = delete;
+
   explicit IConv(GIConv gobject);
 
   /** Close conversion descriptor.
@@ -99,10 +102,6 @@ public:
 
 private:
   GIConv gobject_;
-
-  // noncopyable
-  IConv(const IConv&);
-  IConv& operator=(const IConv&);
 };
 
 
index f665f32..4320c42 100644 (file)
@@ -271,6 +271,9 @@ public:
   explicit Dir(GDir* gobject);
 #endif
 
+  Dir(const Dir&) = delete;
+  Dir& operator=(const Dir&) = delete;
+
   /** Closes the directory and deallocates all related resources.
    */
   ~Dir();
@@ -306,10 +309,6 @@ public:
 
 private:
   GDir* gobject_;
-
-  // noncopyable
-  Dir(const Dir&);
-  Dir& operator=(const Dir&);
 };
 
 
index 93faefa..13319f1 100644 (file)
@@ -127,6 +127,25 @@ IOChannel::IOChannel()
   reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = this;
 }
 
+IOChannel::IOChannel(IOChannel&& other) noexcept
+: sigc::trackable(std::move(other)),
+  gobject_(std::move(other.gobject_))
+{
+  other.gobject_ = nullptr;
+}
+
+IOChannel& IOChannel::operator=(IOChannel&& other) noexcept
+{
+  sigc::trackable::operator=(std::move(other));
+
+  release_gobject();
+
+  gobject_ = std::move(other.gobject_);
+  other.gobject_ = nullptr;
+
+  return *this;
+}
+
 /* Construct an IOChannel wrapper for an already created GIOChannel.
  * See the comment at the top of this file for an explanation of the
  * problems with this approach.
@@ -143,7 +162,7 @@ IOChannel::IOChannel(GIOChannel* gobject, bool take_copy)
     g_io_channel_ref(gobject_);
 }
 
-IOChannel::~IOChannel()
+void IOChannel::release_gobject()
 {
   if(gobject_)
   {
@@ -167,6 +186,11 @@ IOChannel::~IOChannel()
   }
 }
 
+IOChannel::~IOChannel()
+{
+  release_gobject();
+}
+
 Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode)
 {
   GError* gerror = nullptr;
index 9c97ce7..12b6b8d 100644 (file)
@@ -84,6 +84,9 @@ class IOChannel : public sigc::trackable
 {
   _CLASS_GENERIC(IOChannel, GIOChannel)
 
+  IOChannel(IOChannel&& other) noexcept;
+  IOChannel& operator=(IOChannel&& other) noexcept;
+
   dnl // We can't support get_fd() properly because it is impossible
   dnl // to detect the specific GIOChannel type at runtime.
   _IGNORE(g_io_channel_unix_get_fd, g_io_channel_win32_get_fd)
@@ -470,6 +473,9 @@ protected:
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   friend class Glib::GlibmmIOChannel;
 #endif
+
+private:
+  void release_gobject();
 };
 
 Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy = false);
index 4488e31..5e7a215 100644 (file)
@@ -32,6 +32,28 @@ KeyFile::KeyFile(GKeyFile* castitem, bool takes_ownership)
   owns_gobject_ = takes_ownership;
 }
 
+KeyFile::KeyFile(KeyFile&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+  owns_gobject_(std::move(other.owns_gobject_))
+{
+  other.gobject_ = nullptr;
+  other.owns_gobject_ = false;
+}
+
+KeyFile& KeyFile::operator=(KeyFile&& other) noexcept
+{
+  if (owns_gobject_)
+    g_key_file_free(gobject_);
+
+  gobject_ = std::move(other.gobject_);
+  owns_gobject_ = std::move(other.owns_gobject_);
+
+  other.gobject_ = nullptr;
+  other.owns_gobject_ = false;
+
+  return *this;
+}
+
 KeyFile::~KeyFile()
 {
   if (owns_gobject_)
index c976a95..f7094b6 100644 (file)
@@ -106,6 +106,12 @@ public:
    */
   KeyFile();
 
+  KeyFile(const KeyFile&) = delete;
+  KeyFile& operator=(const KeyFile&) = delete;
+
+  KeyFile(KeyFile&& other) noexcept;
+  KeyFile& operator=(KeyFile&& other) noexcept;
+
   /** Destructor
    */
   ~KeyFile();
@@ -425,11 +431,6 @@ public:
 protected:
   GKeyFile* gobject_;
   bool owns_gobject_;
-
-private:
-  // noncopyable
-  KeyFile(const KeyFile&);
-  KeyFile& operator=(const KeyFile&);
 };
 
 } // namespace Glib
index 738ce78..14f5c25 100644 (file)
@@ -219,6 +219,17 @@ void ParserCallbacks::error(GMarkupParseContext* context,
 Parser::Parser()
 {}
 
+Parser::Parser(Parser&& other) noexcept
+: sigc::trackable(std::move(other))
+{
+}
+
+Parser& Parser::operator=(Parser&& other) noexcept
+{
+  sigc::trackable::operator=(std::move(other));
+  return *this;
+}
+
 Parser::~Parser()
 {}
 
@@ -247,6 +258,26 @@ ParseContext::ParseContext(Parser& parser, ParseFlags flags)
                                        this, &ParseContext::destroy_notify_callback))
 {}
 
+ParseContext::ParseContext(ParseContext&& other) noexcept
+: sigc::trackable(std::move(other)),
+  parser_(std::move(other.parser_)),
+  gobject_(std::move(other.gobject_))
+{
+}
+
+ParseContext& ParseContext::operator=(ParseContext&& other) noexcept
+{
+  sigc::trackable::operator=(std::move(other));
+
+  parser_ = std::move(other.parser_);
+  gobject_ = std::move(other.gobject_);
+
+  other.parser_ = nullptr;
+  other.gobject_ = nullptr;
+
+  return *this;
+}
+
 ParseContext::~ParseContext()
 {
   parser_ = nullptr;
index 6ad7f51..14c4163 100644 (file)
@@ -173,6 +173,12 @@ protected:
    */
   Parser();
 
+  Parser(const Parser&) = delete;
+  Parser& operator=(const Parser&) = delete;
+
+  Parser(Parser&& other) noexcept;
+  Parser& operator=(Parser&& other) noexcept;
+
   /** Called for open tags <tt>\<foo bar="baz"\></tt>.
    * This virtual method is invoked when the opening tag of an element is seen.
    * @param context The Markup::ParseContext object the parsed data belongs to.
@@ -235,9 +241,6 @@ protected:
   virtual void on_error(ParseContext& context, const MarkupError& error);
 
 private:
-  // noncopyable
-  Parser(const Parser&);
-  Parser& operator=(const Parser&);
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   friend class Glib::Markup::ParserCallbacks;
@@ -259,6 +262,13 @@ public:
    * @param flags Bitwise combination of Markup::ParseFlags.
    */
   explicit ParseContext(Parser& parser, ParseFlags flags = ParseFlags(0));
+
+  ParseContext(const ParseContext&) = delete;
+  ParseContext& operator=(const ParseContext&) = delete;
+
+  ParseContext(ParseContext&& other) noexcept;
+  ParseContext& operator=(ParseContext&& other) noexcept;
+
   virtual ~ParseContext();
 
   /** Feed some data to the ParseContext.
@@ -326,10 +336,6 @@ private:
   Markup::Parser*       parser_;
   GMarkupParseContext*  gobject_;
 
-  // noncopyable
-  ParseContext(const ParseContext&);
-  ParseContext& operator=(const ParseContext&);
-
   static void destroy_notify_callback(void* data);
 };
 
index 4e4666c..bcce3e4 100644 (file)
@@ -26,6 +26,23 @@ Module::Module(const std::string& file_name, ModuleFlags flags)
   gobject_ (g_module_open(file_name.c_str(), (GModuleFlags) flags))
 {}
 
+Module::Module(Module&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+  other.gobject_ = nullptr;
+}
+
+Module& Module::operator=(Module&& other) noexcept
+{
+  if(gobject_)
+    g_module_close(gobject_);
+
+  gobject_ = std::move(other.gobject_);
+  other.gobject_ = nullptr;
+
+  return *this;
+}
+
 Module::~Module()
 {
   if(gobject_)
index f1caf77..2009c03 100644 (file)
@@ -71,6 +71,12 @@ public:
    */
   explicit Module(const std::string& file_name, ModuleFlags flags = ModuleFlags(0));
 
+  Module(const Module&) = delete;
+  Module& operator=(const Module&) = delete;
+
+  Module(Module&& other) noexcept;
+  Module& operator=(Module&& other) noexcept;
+
   /** Close a module. The module will be removed from memory, unless
    * <tt>make_resident</tt> has been called.
    */
@@ -137,11 +143,6 @@ public:
 
 protected:
   GModule* gobject_;
-
-private:
-  // noncopyable
-  Module(const Module&);
-  Module& operator=(const Module&);
 };
 
 } // namespace Glib
index fb0ff7b..60e8276 100644 (file)
@@ -100,6 +100,8 @@ public:
     clone(&node);
   }
 
+  //TODO: Add move operations, being careful of universal references and overload resolution.
+
   /** Removes the instance and its children from the tree,
    * freeing any memory allocated.
    */
index 56980b4..7bd3c07 100644 (file)
@@ -60,6 +60,28 @@ OptionContext::OptionContext(GOptionContext* castitem, bool take_ownership)
 {
 }
 
+OptionContext::OptionContext(OptionContext&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+  has_ownership_(std::move(other.has_ownership_))
+{
+  other.gobject_ = nullptr;
+  other.has_ownership_ = false;
+}
+
+OptionContext& OptionContext::operator=(OptionContext&& other) noexcept
+{
+  if(has_ownership_)
+    g_option_context_free(gobj());
+
+  gobject_ = std::move(other.gobject_);
+  has_ownership_ = std::move(other.has_ownership_);
+
+  other.gobject_ = nullptr;
+  other.has_ownership_ = false;
+
+  return *this;
+}
+
 OptionContext::~OptionContext()
 {
   if(has_ownership_)
index 321bb66..f20ec36 100644 (file)
@@ -98,6 +98,14 @@ public:
   //Note that, unlike Glib::Wrap(), this would create a second C++ instance for the same C instance,u
   //so it should be used carefully. For instance you could not access data in a derived class via this second instance.
   explicit OptionContext(GOptionContext* castitem, bool take_ownership = false);
+
+  //TODO?:
+  //OptionContext(const OptionContext& other) = delete;
+  //OptionContext& operator=(const OptionContext& other) = delete;
+
+  OptionContext(OptionContext&& other) noexcept;
+  OptionContext& operator=(OptionContext&& other) noexcept;
+
   virtual ~OptionContext();
 
   _WRAP_METHOD(void set_help_enabled(bool help_enabled = true), g_option_context_set_help_enabled)
index 3764169..85df578 100644 (file)
@@ -28,6 +28,14 @@ OptionEntry::OptionEntry()
 
 OptionEntry::~OptionEntry()
 {
+  release_gobject();
+}
+
+void OptionEntry::release_gobject() noexcept
+{
+  if(!gobject_)
+    return;
+
   g_free(const_cast<char*>(gobject_->long_name));
   g_free(const_cast<char*>(gobject_->description));
   g_free(const_cast<char*>(gobject_->arg_description));
@@ -70,6 +78,22 @@ OptionEntry& OptionEntry::operator=(const OptionEntry& src)
   return *this;
 }
 
+OptionEntry::OptionEntry(OptionEntry&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+  other.gobject_ = nullptr;
+}
+
+OptionEntry& OptionEntry::operator=(OptionEntry&& other) noexcept
+{
+  release_gobject();
+
+  gobject_ = std::move(other.gobject_);
+  other.gobject_ = nullptr;
+
+  return *this;
+}
+
 void OptionEntry::set_long_name(const Glib::ustring& value)
 {
   if(gobject_->long_name)
index d77eab7..8ff4a11 100644 (file)
@@ -59,6 +59,10 @@ public:
 
   OptionEntry();
   OptionEntry(const OptionEntry& src);
+
+  OptionEntry(OptionEntry&& other) noexcept;
+  OptionEntry& operator=(OptionEntry&& other) noexcept;
+
   virtual ~OptionEntry();
 
   OptionEntry& operator=(const OptionEntry& src);
@@ -91,6 +95,9 @@ public:
   GOptionEntry*       gobj()       { return gobject_; }
   const GOptionEntry* gobj() const { return gobject_; }
 
+private:
+  void release_gobject() noexcept;
+
 protected:
 
   GOptionEntry* gobject_;
index 4d26a8f..2ce9102 100644 (file)
@@ -281,8 +281,30 @@ OptionGroup::OptionGroup(GOptionGroup* castitem)
   //Always takes ownership - never takes copy.
 }
 
+OptionGroup::OptionGroup(OptionGroup&& other) noexcept
+: map_entries_(std::move(other.map_entries_)),
+  gobject_(std::move(other.gobject_)),
+  has_ownership_(std::move(other.has_ownership_))
+{
+  other.gobject_ = nullptr;
+  other.has_ownership_ = false;
+}
 
-OptionGroup::~OptionGroup()
+OptionGroup& OptionGroup::operator=(OptionGroup&& other) noexcept
+{
+  release_gobject();
+
+  map_entries_ = std::move(other.map_entries_);
+  gobject_ = std::move(other.gobject_);
+  has_ownership_ = std::move(other.has_ownership_);
+
+  other.gobject_ = nullptr;
+  other.has_ownership_ = false;
+
+  return *this;
+}
+
+void OptionGroup::release_gobject() noexcept
 {
   //Free any C types that were allocated during add_entry():
   for(auto& the_pair : map_entries_)
@@ -291,13 +313,18 @@ OptionGroup::~OptionGroup()
     cpp_entry.release_c_arg();
   }
 
-  if(has_ownership_)
+  if(has_ownership_ && gobject_)
   {
     g_option_group_unref(gobj());
     gobject_ = nullptr;
   }
 }
 
+OptionGroup::~OptionGroup()
+{
+  release_gobject();
+}
+
 void OptionGroup::add_entry(const OptionEntry& entry)
 {
   //It does not copy the entry, so it needs to live as long as the group.
index 4afe9c1..5cfe0e5 100644 (file)
@@ -69,6 +69,9 @@ public:
   explicit OptionGroup(GOptionGroup* castitem);
   _IGNORE(g_option_group_new, g_option_group_ref)
 
+  OptionGroup(OptionGroup&& other) noexcept;
+  OptionGroup& operator=(OptionGroup&& other) noexcept;
+
   virtual ~OptionGroup();
   _IGNORE(g_option_group_free, g_option_group_unref)
 
@@ -196,6 +199,9 @@ protected:
   GOptionGroup* gobject_;
   bool has_ownership_; //Whether the gobject_ belongs to this C++ instance.
 #endif //DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+  void release_gobject() noexcept;
 };
 
 } // namespace Glib
index 61408cc..3b9e2b2 100644 (file)
@@ -248,6 +248,29 @@ MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_the_ownership)
 {
 }
 
+
+MatchInfo::MatchInfo(MatchInfo&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+  take_ownership(std::move(other.take_ownership))
+{
+  other.gobject_ = nullptr;
+  other.take_ownership = false;
+}
+
+MatchInfo& MatchInfo::operator=(MatchInfo&& other) noexcept
+{
+  if(take_ownership && gobject_)
+    g_match_info_free(gobject_);
+
+  gobject_ = std::move(other.gobject_);
+  take_ownership = std::move(other.take_ownership);
+
+  other.gobject_ = nullptr;
+  other.take_ownership = false;
+
+  return *this;
+}
+
 void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_the_ownership)
 {
   if(gobject_ && this->take_ownership)
index f35af4a..0044b12 100644 (file)
@@ -93,7 +93,7 @@ class MatchInfo;
  *
  * @newin{2,14}
  */
-class Regex
+class Regex final
 {
   _CLASS_OPAQUE_REFCOUNTED(Regex, GRegex, NONE, g_regex_ref, g_regex_unref)
   _IGNORE(g_regex_ref, g_regex_unref)
@@ -227,6 +227,12 @@ public:
    */
   explicit MatchInfo(GMatchInfo* castitem, bool take_the_ownership = true); //TODO: Rename to take_ownership when we can rename the member variable.
 
+  MatchInfo(const MatchInfo& other) = delete;
+  MatchInfo& operator=(const MatchInfo& other) = delete;
+
+  MatchInfo(MatchInfo&& other) noexcept;
+  MatchInfo& operator=(MatchInfo&& other) noexcept;
+
   /// Destructor.
   virtual ~MatchInfo();
 
@@ -239,9 +245,6 @@ public:
     { return reinterpret_cast<GMatchInfo*>(gobject_); }
 
 private:
-// noncopyable
-  MatchInfo(const MatchInfo& other);
-  MatchInfo& operator=(const MatchInfo& other);
 
   friend class Regex;
 
index 2f275f9..af02e7f 100644 (file)
@@ -87,7 +87,7 @@ private:
 class SignalProxyNormal : public SignalProxyBase
 {
 public:
-  ~SignalProxyNormal();
+  ~SignalProxyNormal() noexcept;
 
   /// Stops the current signal emission (not in libsigc++)
   void emission_stop();
@@ -147,7 +147,7 @@ private:
 class SignalProxyDetailed : public SignalProxyBase
 {
 public:
-  ~SignalProxyDetailed();
+  ~SignalProxyDetailed() noexcept;
 
   /// Stops the current signal emission (not in libsigc++)
   void emission_stop();
index b5efa43..24df5de 100644 (file)
@@ -160,6 +160,10 @@ _WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE)
 class Thread
 {
 public:
+
+  Thread(const Thread&) = delete;
+  Thread& operator=(const Thread&) = delete;
+
   class Exit;
 
   //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
@@ -287,10 +291,6 @@ private:
   // Glib::Thread can neither be constructed nor deleted.
   Thread();
   void operator delete(void*, std::size_t);
-
-  // noncopyable
-  Thread(const Thread&);
-  Thread& operator=(const Thread&);
 };
 
 /** %Exception class used to exit from a thread.
@@ -371,6 +371,10 @@ public:
   class Lock;
 
   Mutex();
+
+  Mutex(const Mutex&) = delete;
+  Mutex& operator=(const Mutex&) = delete;
+
   ~Mutex();
 
   /** Locks the mutex.
@@ -399,10 +403,6 @@ public:
 
 private:
   GMutex* gobject_;
-
-  // noncopyable
-  Mutex(const Mutex&);
-  Mutex& operator=(const Mutex&);
 };
 
 /** Utility class for exception-safe mutex locking.
@@ -437,9 +437,7 @@ private:
   Mutex&  mutex_;
   bool    locked_;
 
-  // noncopyable
-  Lock(const Mutex::Lock&);
-  Mutex::Lock& operator=(const Mutex::Lock&);
+
 };
 
 
@@ -502,6 +500,10 @@ public:
   explicit inline Lock(RecMutex& mutex);
   inline Lock(RecMutex& mutex, NotLock);
   inline Lock(RecMutex& mutex, TryLock);
+
+  Lock(const RecMutex::Lock&) = delete;
+  RecMutex::Lock& operator=(const RecMutex::Lock&) = delete;
+
   inline ~Lock();
 
   inline void acquire();
@@ -512,10 +514,6 @@ public:
 private:
   RecMutex& mutex_;
   bool      locked_;
-
-  // noncopyable
-  Lock(const RecMutex::Lock&);
-  RecMutex::Lock& operator=(const RecMutex::Lock&);
 };
 
 
@@ -562,12 +560,11 @@ public:
   class WriterLock;
 
   RWLock();
-  ~RWLock();
 
-private:
-  // noncopyable
-  RWLock(const RWLock&);
-  RWLock& operator=(const RWLock&);
+  RWLock(const RWLock&) = delete;
+  RWLock& operator=(const RWLock&) = delete;
+
+  ~RWLock();
 };
 
 /** Utility class for exception-safe locking of read/write locks.
@@ -580,6 +577,10 @@ public:
   explicit inline ReaderLock(RWLock& rwlock);
   inline ReaderLock(RWLock& rwlock, NotLock);
   inline ReaderLock(RWLock& rwlock, TryLock);
+
+  ReaderLock(const RWLock::ReaderLock&) = delete;
+  RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete;
+
   inline ~ReaderLock();
 
   inline void acquire();
@@ -590,10 +591,6 @@ public:
 private:
   RWLock& rwlock_;
   bool    locked_;
-
-  // noncopyable
-  ReaderLock(const RWLock::ReaderLock&);
-  RWLock::ReaderLock& operator=(const RWLock::ReaderLock&);
 };
 
 /** Utility class for exception-safe locking of read/write locks.
@@ -606,6 +603,10 @@ public:
   explicit inline WriterLock(RWLock& rwlock);
   inline WriterLock(RWLock& rwlock, NotLock);
   inline WriterLock(RWLock& rwlock, TryLock);
+
+  WriterLock(const RWLock::WriterLock&) = delete;
+  RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete;
+
   inline ~WriterLock();
 
   inline void acquire();
@@ -616,10 +617,6 @@ public:
 private:
   RWLock& rwlock_;
   bool    locked_;
-
-  // noncopyable
-  WriterLock(const RWLock::WriterLock&);
-  RWLock::WriterLock& operator=(const RWLock::WriterLock&);
 };
 
 /** An opaque data structure to represent a condition.
@@ -660,6 +657,10 @@ class Cond
 {
 public:
   Cond();
+
+  Cond(const Cond&) = delete;
+  Cond& operator=(const Cond&) = delete;
+
   ~Cond();
 
   /** If threads are waiting for this @a Cond, exactly one of them is woken up.
@@ -708,10 +709,6 @@ public:
 
 private:
   GCond* gobject_;
-
-  // noncopyable
-  Cond(const Cond&);
-  Cond& operator=(const Cond&);
 };
 
 
@@ -745,6 +742,10 @@ template <class T>
 class Private
 {
 public:
+
+  Private(const Private<T>&) = delete;
+  Private<T>& operator=(const Private<T>&) = delete;
+
   typedef void (*DestructorFunc) (void*);
 
   static void delete_ptr(void* data);
@@ -757,10 +758,6 @@ public:
 
 private:
   GPrivate* gobject_;
-
-  // noncopyable
-  Private(const Private<T>&);
-  Private<T>& operator=(const Private<T>&);
 };
 
 /** @} group Threads */
index 412d5fb..691af05 100644 (file)
@@ -75,6 +75,10 @@ _WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE)
 class Thread
 {
 public:
+
+  Thread(const Thread&) = delete;
+  Thread& operator=(const Thread&) = delete;
+
   class Exit;
 
   //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
@@ -154,10 +158,6 @@ private:
   // Glib::Thread can neither be constructed nor deleted.
   Thread();
   void operator delete(void*, std::size_t);
-
-  // noncopyable
-  Thread(const Thread&);
-  Thread& operator=(const Thread&);
 };
 
 /** %Exception class used to exit from a thread.
@@ -195,6 +195,10 @@ public:
   class Lock;
 
   Mutex();
+
+  Mutex(const Mutex&) = delete;
+  Mutex& operator=(const Mutex&) = delete;
+
   ~Mutex();
 
   /** Locks the mutex.
@@ -223,10 +227,6 @@ public:
 
 private:
   GMutex gobject_;
-
-  // noncopyable
-  Mutex(const Mutex&);
-  Mutex& operator=(const Mutex&);
 };
 
 /** Utility class for exception-safe mutex locking.
@@ -248,6 +248,10 @@ public:
   explicit inline Lock(Mutex& mutex);
   inline Lock(Mutex& mutex, NotLock);
   inline Lock(Mutex& mutex, TryLock);
+
+  Lock(const Mutex::Lock&) = delete;
+  Mutex::Lock& operator=(const Mutex::Lock&) = delete;
+
   inline ~Lock();
 
   inline void acquire();
@@ -258,10 +262,6 @@ public:
 private:
   Mutex&  mutex_;
   bool    locked_;
-
-  // noncopyable
-  Lock(const Mutex::Lock&);
-  Mutex::Lock& operator=(const Mutex::Lock&);
 };
 
 /** A C++ wrapper for the C object.
@@ -288,6 +288,10 @@ public:
   class Lock;
 
   RecMutex();
+
+  RecMutex(const RecMutex&) = delete;
+  RecMutex& operator=(const RecMutex&) = delete;
+
   ~RecMutex();
 
   void lock();
@@ -297,10 +301,6 @@ public:
   GRecMutex* gobj() { return &gobject_; }
 
 private:
-  // noncopyable
-  RecMutex(const RecMutex&);
-  RecMutex& operator=(const RecMutex&);
-
   GRecMutex gobject_;
 };
 
@@ -312,6 +312,10 @@ public:
   explicit inline Lock(RecMutex& mutex);
   inline Lock(RecMutex& mutex, NotLock);
   inline Lock(RecMutex& mutex, TryLock);
+
+  Lock(const RecMutex::Lock&) = delete;
+  RecMutex::Lock& operator=(const RecMutex::Lock&) = delete;
+
   inline ~Lock();
 
   inline void acquire();
@@ -322,10 +326,6 @@ public:
 private:
   RecMutex& mutex_;
   bool      locked_;
-
-  // noncopyable
-  Lock(const RecMutex::Lock&);
-  RecMutex::Lock& operator=(const RecMutex::Lock&);
 };
 
 /** A C++ wrapper for the C object.
@@ -358,6 +358,10 @@ public:
   class WriterLock;
 
   RWLock();
+
+  RWLock(const RWLock&) = delete;
+  RWLock& operator=(const RWLock&) = delete;
+
   ~RWLock();
 
   void reader_lock();
@@ -371,10 +375,6 @@ public:
   GRWLock* gobj() { return &gobject_; }
 
 private:
-  // noncopyable
-  RWLock(const RWLock&);
-  RWLock& operator=(const RWLock&);
-
   GRWLock gobject_;
 };
 
@@ -386,6 +386,10 @@ public:
   explicit inline ReaderLock(RWLock& rwlock);
   inline ReaderLock(RWLock& rwlock, NotLock);
   inline ReaderLock(RWLock& rwlock, TryLock);
+
+  ReaderLock(const RWLock::ReaderLock&) = delete;
+  RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete;
+
   inline ~ReaderLock();
 
   inline void acquire();
@@ -396,10 +400,6 @@ public:
 private:
   RWLock& rwlock_;
   bool    locked_;
-
-  // noncopyable
-  ReaderLock(const RWLock::ReaderLock&);
-  RWLock::ReaderLock& operator=(const RWLock::ReaderLock&);
 };
 
 /** Utility class for exception-safe locking of read/write locks.
@@ -410,6 +410,10 @@ public:
   explicit inline WriterLock(RWLock& rwlock);
   inline WriterLock(RWLock& rwlock, NotLock);
   inline WriterLock(RWLock& rwlock, TryLock);
+
+  WriterLock(const RWLock::WriterLock&) = delete;
+  RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete;
+
   inline ~WriterLock();
 
   inline void acquire();
@@ -420,10 +424,6 @@ public:
 private:
   RWLock& rwlock_;
   bool    locked_;
-
-  // noncopyable
-  WriterLock(const RWLock::WriterLock&);
-  RWLock::WriterLock& operator=(const RWLock::WriterLock&);
 };
 
 /** An opaque data structure to represent a condition.
@@ -462,6 +462,10 @@ class Cond
 {
 public:
   Cond();
+
+  Cond(const Cond&) = delete;
+  Cond& operator=(const Cond&) = delete;
+
   ~Cond();
 
   /** If threads are waiting for this @a Cond, exactly one of them is woken up.
@@ -538,10 +542,6 @@ public:
 
 private:
   GCond gobject_;
-
-  // noncopyable
-  Cond(const Cond&);
-  Cond& operator=(const Cond&);
 };
 
 /** Thread-local data pointer.
@@ -554,6 +554,9 @@ template <class T>
 class Private
 {
 public:
+  Private(const Private<T>&) = delete;
+  Private<T>& operator=(const Private<T>&) = delete;
+
   typedef void (*DestructorFunc) (void*);
 
   /** Deletes static_cast<T*>(data)
@@ -591,10 +594,6 @@ public:
 
 private:
   GPrivate gobject_;
-
-  // noncopyable
-  Private(const Private<T>&);
-  Private<T>& operator=(const Private<T>&);
 };
 
 /** @} group Threads */
index 876591f..7b66869 100644 (file)
@@ -33,7 +33,7 @@ namespace Glib
  *
  * newin{2,40}
  */
-class VariantDict
+class VariantDict final
 {
   //GVariantDict is registered as a boxed type, but it has ref/unref functions instead of copy/free,
   //so we use it via RefPtr.
index 8f35cbb..e01f418 100644 (file)
@@ -29,8 +29,11 @@ check_PROGRAMS =                             \
        glibmm_date/test                        \
        glibmm_buildfilename/test               \
        glibmm_interface_implementation/test    \
+       glibmm_interface_move/test                      \
        glibmm_mainloop/test                    \
        glibmm_nodetree/test                    \
+       glibmm_object_move/test                 \
+       glibmm_objectbase_move/test                     \
        glibmm_ustring_compose/test             \
        glibmm_ustring_format/test              \
        glibmm_value/test                       \
@@ -87,8 +90,11 @@ glibmm_date_test_SOURCES                 = glibmm_date/main.cc
 glibmm_interface_implementation_test_SOURCES = glibmm_interface_implementation/main.cc
 glibmm_interface_implementation_test_LDADD = $(giomm_ldadd)
 
+glibmm_interface_move_test_SOURCES       = glibmm_interface_move/main.cc
 glibmm_mainloop_test_SOURCES             = glibmm_mainloop/main.cc
 glibmm_nodetree_test_SOURCES             = glibmm_nodetree/main.cc
+glibmm_object_move_test_SOURCES          = glibmm_object_move/main.cc
+glibmm_objectbase_move_test_SOURCES      = glibmm_objectbase_move/main.cc
 glibmm_ustring_compose_test_SOURCES      = glibmm_ustring_compose/main.cc
 glibmm_ustring_format_test_SOURCES       = glibmm_ustring_format/main.cc
 glibmm_value_test_SOURCES                = glibmm_value/glibmm_value.cc glibmm_value/main.cc
diff --git a/tests/glibmm_interface_move/main.cc b/tests/glibmm_interface_move/main.cc
new file mode 100644 (file)
index 0000000..29662e9
--- /dev/null
@@ -0,0 +1,292 @@
+#include <glibmm.h>
+#include <glibmm/private/interface_p.h>
+#include <glibmm/private/object_p.h>
+#include <iostream>
+#include <stdlib.h>
+
+//A basic derived GInterface, just to test Glib::Interface
+
+G_DECLARE_INTERFACE (TestIface, test_Iface, TEST, IFACE, GObject)
+
+struct _TestIface
+{
+  GTypeInterface g_iface;
+};
+
+static void
+test_Iface_init (gpointer)
+{}
+
+GType
+test_Iface_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      const GTypeInfo info =
+      {
+        sizeof (TestIface),  /* class_size */
+        test_Iface_init,           /* base_init */
+             0, 0, 0, 0, 0, 0, 0, 0
+      };
+
+      type = g_type_register_static (G_TYPE_INTERFACE, "TestIface",
+                                             &info, GTypeFlags(0));
+    }
+
+  return type;
+}
+
+#define TEST_TYPE_IFACE           (test_Iface_get_type               ())
+
+
+//A basic derived GObject, just to test Glib::Object.
+typedef struct {
+    GObject parent;
+} TestDerived;
+
+typedef struct {
+    GObjectClass parent;
+} TestDerivedClass;
+
+#define TEST_TYPE_DERIVED           (test_derived_get_type               ())
+#define TEST_DERIVED(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DERIVED, TestDerived))
+#define TEST_DERIVED_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST    ((cls), TEST_TYPE_DERIVED, TestDerivedClass))
+#define TEST_DERIVED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS  ((obj), TEST_TYPE_DERIVED, TestDerivedClass))
+
+static void test_derived_class_init (TestDerivedClass *)
+{}
+static void test_derived_init       (TestDerived *)
+{}
+
+G_DEFINE_TYPE_EXTENDED(TestDerived, test_derived, G_TYPE_OBJECT,
+  0, G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE,
+                            test_Iface_init))
+
+class TestInterface;
+
+class TestInterface_Class : public Glib::Interface_Class
+{
+public:
+  typedef TestInterface BaseClassType;
+
+  friend class TestInterface;
+
+  const Glib::Interface_Class& init()
+  {
+    if(!gtype_) // create the GType if necessary
+    {
+      // Glib::Interface_Class has to know the interface init function
+      // in order to add interfaces to implementing types.
+      class_init_func_ = &TestInterface_Class::iface_init_function;
+
+      // We can not derive from another interface, and it is not necessary anyway.
+      gtype_ = test_Iface_get_type();
+  }
+
+  return *this;
+  }
+
+  static void iface_init_function(void* /* g_iface */, void* /* iface_data */)
+  {
+  }
+
+  //static Glib::ObjectBase* wrap_new(GObject*);
+};
+
+class TestInterface : public Glib::Interface
+{
+protected:
+  typedef TestInterface_Class CppClassType;
+
+  TestInterface()
+  : Glib::Interface(derived_interface_class_.init())
+  {}
+
+public:
+  //A real application would never make the constructor public.
+  //It would instead have a protectd constructor and a public create() method.
+  TestInterface(GObject* gobject, int i)
+  : Glib::Interface(gobject),
+    i_(i)
+  {
+  }
+
+  static void add_interface(GType gtype_implementer)
+  {
+    derived_interface_class_.init().add_interface(gtype_implementer);
+  }
+
+  TestInterface(const TestInterface& src) = delete;
+  TestInterface& operator=(const TestInterface& src) = delete;
+
+  TestInterface(TestInterface&& src) noexcept
+  : Glib::Interface(std::move(src)),
+    i_(std::move(src.i_))
+  {}
+
+  TestInterface& operator=(TestInterface&& src) noexcept
+  {
+    Glib::Interface::operator=(std::move(src));
+    i_ = std::move(src.i_);
+
+    return *this;
+  }
+
+  int i_;
+
+private:
+  friend class TestInterface_Class;
+  static CppClassType derived_interface_class_;
+};
+
+class DerivedObject_Class : public Glib::Class
+{
+public:
+  typedef GObjectClass BaseClassType;
+  typedef Glib::Object_Class CppClassParent;
+
+  static void class_init_function(void* g_class, void* class_data)
+  {
+    const auto klass = static_cast<BaseClassType*>(g_class);
+    CppClassParent::class_init_function(klass, class_data);
+  }
+
+  const Glib::Class& init()
+  {
+    if(!gtype_) // create the GType if necessary
+    {
+      // Glib::Class has to know the class init function to clone custom types.
+      class_init_func_ = &DerivedObject_Class::class_init_function;
+
+      // This is actually just optimized away, apparently with no harm.
+      // Make sure that the parent type has been created.
+      //CppClassParent::CppObjectType::get_type();
+
+      // Create the wrapper type, with the same class/instance size as the base type.
+      register_derived_type(test_derived_get_type());
+
+      // Add derived versions of interfaces, if the C type implements any interfaces:
+      TestInterface::add_interface(get_type());
+    }
+
+    return *this;
+  }
+};
+
+TestInterface::CppClassType TestInterface::derived_interface_class_; // initialize static member
+
+class DerivedObject
+: public Glib::Object,
+  public TestInterface
+{
+public:
+  typedef DerivedObject_Class CppClassType;
+
+  //A real application would never make the constructor public.
+  //It would instead have a protected constructor and a public create() method.
+  DerivedObject(int i)
+  : Glib::ObjectBase(0),
+    Glib::Object(Glib::ConstructParams(derived_object_class_.init())),
+    i_(i)
+  {
+  }
+
+  DerivedObject(const DerivedObject& src) = delete;
+  DerivedObject& operator=(const DerivedObject& src) = delete;
+
+  DerivedObject(DerivedObject&& src) noexcept
+  : Glib::Object(std::move(src)),
+    TestInterface(std::move(src)),
+    i_(std::move(src.i_))
+  {}
+
+  DerivedObject& operator=(DerivedObject&& src) noexcept
+  {
+    Glib::Object::operator=(std::move(src));
+    TestInterface::operator=(std::move(src));
+    i_ = std::move(src.i_);
+
+    return *this;
+  }
+
+  int i_;
+
+private:
+  friend class DerivedObject_Class;
+  static CppClassType derived_object_class_;
+};
+
+DerivedObject::CppClassType DerivedObject::derived_object_class_; // initialize static member
+
+/* TODO: Shouldn't this work too?
+static
+void test_interface_move_constructor()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  TestInterface derived(gobject, 5);
+  std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  TestInterface derived2(std::move(derived));
+  g_assert_cmpint(derived2.i_, ==, 5);
+  std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_interface_move_assignment_operator()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  TestInterface derived(gobject, 5);
+  //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  TestInterface derived2 = std::move(derived);
+  g_assert_cmpint(derived2.i_, ==, 5);
+  //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+*/
+
+
+static
+void test_object_with_interface_move_constructor()
+{
+  DerivedObject derived(5);
+  g_assert_cmpint(derived.i_, ==, 5);
+  GObject *gobject = derived.gobj();
+  g_assert(derived.gobj() == gobject);
+  DerivedObject derived2(std::move(derived));
+  g_assert_cmpint(derived2.i_, ==, 5);
+  g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_object_with_interface_move_assignment_operator()
+{
+  DerivedObject derived(5);
+  g_assert_cmpint(derived.i_, ==, 5);
+  GObject *gobject = derived.gobj();
+  g_assert(derived.gobj() == gobject);
+  DerivedObject derived2 = std::move(derived);
+  g_assert_cmpint(derived2.i_, ==, 5);
+  g_assert(derived2.gobj() == gobject);
+}
+
+
+int main(int, char**)
+{
+  Glib::init();
+
+  //test_interface_move_constructor();
+  //test_interface_move_assignment_operator();
+
+  test_object_with_interface_move_constructor();
+  test_object_with_interface_move_assignment_operator();
+
+  return EXIT_SUCCESS;
+}
diff --git a/tests/glibmm_object_move/main.cc b/tests/glibmm_object_move/main.cc
new file mode 100644 (file)
index 0000000..a62bcf9
--- /dev/null
@@ -0,0 +1,96 @@
+#include <glibmm.h>
+#include <iostream>
+#include <stdlib.h>
+
+//A basic derived GObject, just to test Glib::ObjectBase.
+typedef struct {
+    GObject parent;
+} TestDerived;
+
+typedef struct {
+    GObjectClass parent;
+} TestDerivedClass;
+
+#define TEST_TYPE_DERIVED           (test_derived_get_type               ())
+#define TEST_DERIVED(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DERIVED, TestDerived))
+#define TEST_DERIVED_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST    ((cls), TEST_TYPE_DERIVED, TestDerivedClass))
+#define TEST_DERIVED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS  ((obj), TEST_TYPE_DERIVED, TestDerivedClass))
+
+static void test_derived_class_init (TestDerivedClass *)
+{}
+static void test_derived_init       (TestDerived *)
+{}
+
+G_DEFINE_TYPE(TestDerived, test_derived, G_TYPE_OBJECT)
+
+class DerivedObject : public Glib::Object
+{
+public:
+  //A real application would never make the constructor public.
+  //It would instead have a protectd constructor and a public create() method.
+  DerivedObject(GObject* gobject, int i)
+  : Glib::Object(gobject),
+    i_(i)
+  {
+  }
+
+  DerivedObject(const DerivedObject& src) = delete;
+  DerivedObject& operator=(const DerivedObject& src) = delete;
+
+  DerivedObject(DerivedObject&& src) noexcept
+  : Glib::Object(std::move(src)),
+    i_(std::move(src.i_))
+  {}
+
+  DerivedObject& operator=(DerivedObject&& src) noexcept
+  {
+    Glib::Object::operator=(std::move(src));
+    i_ = std::move(src.i_);
+
+    return *this;
+  }
+
+  int i_;
+};
+
+static
+void test_object_move_constructor()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  DerivedObject derived(gobject, 5);
+  std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  DerivedObject derived2(std::move(derived));
+  g_assert_cmpint(derived2.i_, ==, 5);
+  std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+
+
+static
+void test_object_move_assignment_operator()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  DerivedObject derived(gobject, 5);
+  //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  DerivedObject derived2 = std::move(derived);
+  g_assert_cmpint(derived2.i_, ==, 5);
+  //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+
+
+int main(int, char**)
+{
+  Glib::init();
+
+  test_object_move_constructor();
+  test_object_move_assignment_operator();
+
+  return EXIT_SUCCESS;
+}
diff --git a/tests/glibmm_objectbase_move/main.cc b/tests/glibmm_objectbase_move/main.cc
new file mode 100644 (file)
index 0000000..ed71fe1
--- /dev/null
@@ -0,0 +1,96 @@
+#include <glibmm.h>
+#include <iostream>
+#include <stdlib.h>
+
+//A basic derived GObject, just to test Glib::ObjectBase.
+typedef struct {
+    GObject parent;
+} TestDerived;
+
+typedef struct {
+    GObjectClass parent;
+} TestDerivedClass;
+
+#define TEST_TYPE_DERIVED           (test_derived_get_type               ())
+#define TEST_DERIVED(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_DERIVED, TestDerived))
+#define TEST_DERIVED_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST    ((cls), TEST_TYPE_DERIVED, TestDerivedClass))
+#define TEST_DERIVED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS  ((obj), TEST_TYPE_DERIVED, TestDerivedClass))
+
+static void test_derived_class_init (TestDerivedClass *)
+{}
+static void test_derived_init       (TestDerived *)
+{}
+
+G_DEFINE_TYPE(TestDerived, test_derived, G_TYPE_OBJECT)
+
+
+class DerivedObjectBase : public Glib::ObjectBase
+{
+public:
+  //A real application would never make the constructor public.
+  //It would instead have a protectd constructor and a public create() method.
+  DerivedObjectBase(GObject* gobject, int i)
+  : Glib::ObjectBase(nullptr),
+    i_(i)
+  {
+    Glib::ObjectBase::initialize(gobject);
+  }
+
+  DerivedObjectBase(const DerivedObjectBase& src) = delete;
+  DerivedObjectBase& operator=(const DerivedObjectBase& src) = delete;
+
+  DerivedObjectBase(DerivedObjectBase&& src) noexcept
+  : Glib::ObjectBase(std::move(src)),
+    i_(std::move(src.i_))
+  {}
+
+  DerivedObjectBase& operator=(DerivedObjectBase&& src) noexcept
+  {
+    Glib::ObjectBase::operator=(std::move(src));
+    i_ = std::move(src.i_);
+
+    return *this;
+  }
+
+  int i_;
+};
+
+static
+void test_objectbase_move_constructor()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  DerivedObjectBase derived(gobject, 5);
+  //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  DerivedObjectBase derived2(std::move(derived));
+  g_assert_cmpint(derived2.i_, ==, 5);
+  //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_objectbase_move_assignment_operator()
+{
+  GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+  g_object_ref(gobject);
+
+  DerivedObjectBase derived(gobject, 5);
+  //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+  g_assert(derived.gobj() == gobject);
+  DerivedObjectBase derived2 = std::move(derived);
+  g_assert_cmpint(derived2.i_, ==, 5);
+  //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+  g_assert(derived2.gobj() == gobject);
+}
+
+int main(int, char**)
+{
+  Glib::init();
+
+  test_objectbase_move_constructor();
+  test_objectbase_move_assignment_operator();
+
+  return EXIT_SUCCESS;
+}
index 2824026..6734b2a 100644 (file)
@@ -179,6 +179,8 @@ _NEW_SECTION(SECTION_CLASS2)      dnl  _CLASS to end of class
 _NEW_SECTION(SECTION_CC)   dnl  section for methods (in current namespace)
 
 _NEW_SECTION(SECTION_CC_IMPLEMENTS_INTERFACES)   dnl Calls SomeBaseInterface::add_interface(get_type()).
+_NEW_SECTION(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)   dnl Calls the base constructors
+_NEW_SECTION(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)   dnl Calls the base move assignment operator
 
 dnl Virtual Functions and Default Signal Handlers (Very similar)
 _NEW_SECTION(SECTION_H_VFUNCS)      dnl Declaration of vfunc hooks.
index 3df7f69..58682f1 100644 (file)
@@ -61,7 +61,7 @@ __NAMESPACE_BEGIN__
  * @param lhs The left-hand side
  * @param rhs The right-hand side
  */
-inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs)
+inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
   { lhs.swap(rhs); }
 
 __NAMESPACE_END__
@@ -166,7 +166,7 @@ __CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other)
   return *this;
 }
 
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::~__CPPNAME__`'() noexcept
 {
 dnl This could be a free or an unref, we do not need to know.
   if(gobject_)
@@ -226,7 +226,7 @@ ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
   __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
 
 _IMPORT(SECTION_DTOR_DOCUMENTATION)
-  ~__CPPNAME__`'();
+  ~__CPPNAME__`'() noexcept;
 
   void swap(__CPPNAME__& other) noexcept;
 
index c265a0e..9624257 100644 (file)
@@ -99,6 +99,33 @@ dnl
 dnl The implementation:
 dnl
 
+__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other) noexcept
+:
+  gobject_(other.gobject_)
+{
+}
+
+__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other) noexcept
+{
+  gobject_ = other.gobject_;
+  return *this;
+}
+
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
+:
+  gobject_(std::move(other.gobject_))
+{
+  //We could wipe other.gobject_ via memset,
+  //but that is not really necessary:
+  //other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
+{
+  gobject_ = std::move(other.gobject_);
+  return *this;
+}
+
 dnl // static
 dnl const __CNAME__ __CPPNAME__::gobject_initializer_ = { 0, };
 dnl
@@ -145,6 +172,12 @@ public:
   typedef __CNAME__ BaseObjectType;
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
+  __CPPNAME__`'(const __CPPNAME__& other) noexcept;
+  __CPPNAME__& operator=(const __CPPNAME__& other) noexcept;
+
+  __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+  __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
+
   /** Get the GType for this class, for use with the underlying GObject type system.
    */
   static GType get_type() G_GNUC_CONST;
index edd0c5b..793f7d7 100644 (file)
@@ -211,9 +211,21 @@ __CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
 
 ')dnl
 
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
+: __CPPPARENT__`'(std::move(src))
+_IMPORT(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
+{}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
+{
+  __CPPPARENT__::operator=`'(std::move(src));
+_IMPORT(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
+  return *this;
+}
+
 ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
 ',`dnl
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::~__CPPNAME__`'() noexcept
 {}
 
 ')dnl
@@ -259,8 +271,12 @@ protected:
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
 public:
+
+  __CPPNAME__`'(__CPPNAME__&& src) noexcept;
+  __CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
+
 _IMPORT(SECTION_DTOR_DOCUMENTATION)
-  virtual ~__CPPNAME__`'();
+  virtual ~__CPPNAME__`'() noexcept;
 
   /** Get the GType for this class, for use with the underlying GObject type system.
    */
index 7226a32..9302863 100644 (file)
@@ -202,7 +202,17 @@ __CPPNAME__::__CPPNAME__`'(const Glib::Interface_Class& interface_class)
 {
 }
 
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
+: __CPPPARENT__`'(std::move(src))
+{}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
+{
+  __CPPPARENT__::operator=`'(std::move(src));
+  return *this;
+}
+
+__CPPNAME__::~__CPPNAME__`'() noexcept
 {}
 
 // static
@@ -268,8 +278,12 @@ protected:
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
 public:
+
+  __CPPNAME__`'(__CPPNAME__&& src) noexcept;
+  __CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
+
 _IMPORT(SECTION_DTOR_DOCUMENTATION)
-  virtual ~__CPPNAME__`'();
+  virtual ~__CPPNAME__`'() noexcept;
 
   static void add_interface(GType gtype_implementer);
 
index f3fe4bd..cfe7915 100644 (file)
@@ -41,6 +41,17 @@ define(`_END_CLASS_OPAQUE_COPYABLE',`
 
 _SECTION(SECTION_HEADER3)
 
+__NAMESPACE_BEGIN__
+
+/** @relates __NAMESPACE__::__CPPNAME__
+ * @param lhs The left-hand side
+ * @param rhs The right-hand side
+ */
+inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
+  { lhs.swap(rhs); }
+
+__NAMESPACE_END__
+
 ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
 ',`dnl else
 namespace Glib
@@ -133,12 +144,33 @@ __CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
 }
 ')dnl
 
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
+:
+  gobject_(other.gobject_)
+{
+  other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
+{
+  __CPPNAME__ temp (other);
+  swap(temp);
+  return *this;
+}
+
+__CPPNAME__::~__CPPNAME__`'() noexcept
 {
   if(gobject_)
     __OPAQUE_FUNC_FREE`'(gobject_);
 }
 
+void __CPPNAME__::swap(__CPPNAME__& other) noexcept
+{
+  __CNAME__ *const temp = gobject_;
+  gobject_ = other.gobject_;
+  other.gobject_ = temp;
+}
+
 __CNAME__* __CPPNAME__::gobj_copy() const
 {
   return __OPAQUE_FUNC_COPY`'(gobject_);
@@ -180,8 +212,13 @@ ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
   __CPPNAME__`'(const __CPPNAME__& src);
   __CPPNAME__& operator=(const __CPPNAME__& src);
 
+  __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+  __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
+
 _IMPORT(SECTION_DTOR_DOCUMENTATION)
-  ~__CPPNAME__`'();
+  ~__CPPNAME__`'() noexcept;
+
+  void swap(__CPPNAME__& other) noexcept;
 
   __CNAME__*       gobj()       { return gobject_; }
   const __CNAME__* gobj() const { return gobject_; }
index 847ac3b..e33cf52 100644 (file)
@@ -53,9 +53,8 @@ _SECTION(SECTION_SRC_GENERATED)
  * wrap it dynamically either.
  *
  * The cast works because __CPPNAME__ does not have any member data, and
- * it is impossible to derive from it.  This is ensured by not implementing
- * the (protected) default constructor.  The ctor is protected rather than
- * private just to avoid a compile warning.
+ * it is impossible to derive from it.  This is ensured by using final on the
+ * class and by using = delete on the default constructor.
  */
 
 namespace Glib
@@ -166,15 +165,17 @@ ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
   __CNAME__* gobj_copy() const;
 
-protected:
-  // Do not derive this.  __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
-  __CPPNAME__`'();
-  void operator delete(void*, std::size_t);
+  __CPPNAME__`'() = delete;
 
   // noncopyable
   __CPPNAME__`'(const __CPPNAME__&) = delete;
   __CPPNAME__& operator=(const __CPPNAME__&) = delete;
 
+protected:
+  // Do not derive this.  __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
+
+  void operator delete(void*, std::size_t);
+
 private:
 _IMPORT(SECTION_CLASS2)
 ')
index 3442ad1..7a3e0fb 100644 (file)
@@ -39,6 +39,22 @@ ifelse(`$2',,,`
 #endif // $2
 ')dnl
 _POP()
+_PUSH(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
+ifelse(`$2',,,`#ifdef $2'
+)dnl
+  , $1`'(std::move(src))
+ifelse(`$2',,,`
+#endif // $2
+')dnl
+_POP()
+_PUSH(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
+ifelse(`$2',,,`#ifdef $2'
+)dnl
+  $1`'::operator=(std::move(src));
+ifelse(`$2',,,`
+#endif // $2
+')dnl
+_POP()
 ')
 
 dnl GVolumeMonitor can be broken/impeded by defining a sub-type.