summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/m4/class_gobject.m415
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4
index dd9c1732..015eb287 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;