[glibmm] gmmproc: _CLASS_GOBJECT(): allow provide custom move operations.



commit fa77097d794e2979f60eadf94c2ed101f6455f79
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Fri Apr 1 22:07:03 2016 +0200

    gmmproc: _CLASS_GOBJECT(): allow provide custom move
     operations.
    
    If class contains movable fields, custom move constructor and move
    assignment operator should be provided. Use macro _CUSTOM_MOVE_OPERATIONS
    for NOT generating default move operations.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756593

 tools/m4/class_gobject.m4 |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4
index dd9c173..015eb28 100644
--- a/tools/m4/class_gobject.m4
+++ b/tools/m4/class_gobject.m4
@@ -32,6 +32,14 @@ define(`__BOOL_CUSTOM_DTOR__',`$1')
 _POP()
 ')
 
+dnl For classes that need custom code for move operations.
+define(`_CUSTOM_MOVE_OPERATIONS', `dnl
+_PUSH()
+dnl Define this macro to be tested for later.
+define(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`$1')
+_POP()
+')
+
 dnl For classes that need custom code in their cast and construct_params
 dnl constructor.
 define(`_CUSTOM_CTOR_CAST',`dnl
@@ -211,6 +219,8 @@ __CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
 
 ')dnl
 
+ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl
+',`dnl
 __CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
 : __CPPPARENT__`'(std::move(src))
 _IMPORT(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
@@ -223,6 +233,8 @@ _IMPORT(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
   return *this;
 }
 
+')dnl
+
 ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
 ',`dnl
 __CPPNAME__::~__CPPNAME__`'() noexcept
@@ -272,8 +284,11 @@ protected:
 
 public:
 
+ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl
+',`dnl
   __CPPNAME__`'(__CPPNAME__&& src) noexcept;
   __CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
+')dnl
 
 _IMPORT(SECTION_DTOR_DOCUMENTATION)
   ~__CPPNAME__`'() noexcept override;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]