summaryrefslogtreecommitdiff
path: root/tools/m4
diff options
context:
space:
mode:
Diffstat (limited to 'tools/m4')
-rw-r--r--tools/m4/class_boxedtype.m417
-rw-r--r--tools/m4/class_gobject.m48
-rw-r--r--tools/m4/class_interface.m415
-rw-r--r--tools/m4/class_opaque_copyable.m44
-rw-r--r--tools/m4/class_opaque_refcounted.m48
-rw-r--r--tools/m4/class_shared.m42
-rw-r--r--tools/m4/convert_gio.m414
-rw-r--r--tools/m4/enum.m42
-rw-r--r--tools/m4/filelist.am1
-rw-r--r--tools/m4/gerror.m42
-rw-r--r--tools/m4/list.m4232
-rw-r--r--tools/m4/method.m467
-rw-r--r--tools/m4/property.m47
-rw-r--r--tools/m4/signal.m473
-rw-r--r--tools/m4/vfunc.m475
15 files changed, 180 insertions, 347 deletions
diff --git a/tools/m4/class_boxedtype.m4 b/tools/m4/class_boxedtype.m4
index 1a9b731f..1afa53a5 100644
--- a/tools/m4/class_boxedtype.m4
+++ b/tools/m4/class_boxedtype.m4
@@ -135,6 +135,20 @@ __CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : 0)
{}
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other)
+:
+ gobject_(other.gobject_)
+{
+ other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other)
+{
+ __CPPNAME__ temp (other);
+ swap(temp);
+ return *this;
+}
+
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__::__CPPNAME__`'(__CNAME__* gobject, bool make_a_copy)
:
@@ -208,6 +222,9 @@ ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__`'(const __CPPNAME__& other);
__CPPNAME__& operator=(const __CPPNAME__& other);
+ __CPPNAME__`'(__CPPNAME__&& other);
+ __CPPNAME__& operator=(__CPPNAME__&& other);
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
~__CPPNAME__`'();
diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4
index f097f180..edd0c5b5 100644
--- a/tools/m4/class_gobject.m4
+++ b/tools/m4/class_gobject.m4
@@ -115,7 +115,10 @@ ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
_STRUCT_PROTOTYPE()
')dnl
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
+#endif //DOXYGEN_SHOULD_SKIP_THIS
+
_SECTION(SECTION_HEADER3)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
@@ -245,10 +248,9 @@ private:')dnl endif
friend class __CPPNAME__`'_Class;
static CppClassType `'__BASE__`'_class_;
-private:
// noncopyable
- __CPPNAME__`'(const __CPPNAME__&);
- __CPPNAME__& operator=(const __CPPNAME__&);
+ __CPPNAME__`'(const __CPPNAME__&) = delete;
+ __CPPNAME__& operator=(const __CPPNAME__&) = delete;
protected:
explicit __CPPNAME__`'(const Glib::ConstructParams& construct_params);
diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4
index fe4add6b..7226a32b 100644
--- a/tools/m4/class_interface.m4
+++ b/tools/m4/class_interface.m4
@@ -92,11 +92,11 @@ const Glib::Interface_Class& __CPPNAME__`'_Class::init()
void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*)
{
- BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
+ const auto klass = static_cast<BaseClassType*>(g_iface);
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
- g_assert(klass != 0);
+ g_assert(klass != nullptr);
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
@@ -117,7 +117,10 @@ define(`_END_CLASS_INTERFACE',`
_SECTION(SECTION_HEADER1)
_STRUCT_PROTOTYPE()
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
_SECTION(SECTION_HEADER3)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
@@ -231,14 +234,14 @@ public:
typedef __CNAME__ BaseObjectType;
typedef __CCLASS__ BaseClassType;
+ // noncopyable
+ __CPPNAME__`'(const __CPPNAME__&) = delete;
+ __CPPNAME__& operator=(const __CPPNAME__&) = delete;
+
private:
friend class __CPPNAME__`'_Class;
static CppClassType `'__BASE__`'_class_;
- // noncopyable
- __CPPNAME__`'(const __CPPNAME__&);
- __CPPNAME__& operator=(const __CPPNAME__&);
-
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
protected:
/**
diff --git a/tools/m4/class_opaque_copyable.m4 b/tools/m4/class_opaque_copyable.m4
index 9e53649e..f3fe4bd6 100644
--- a/tools/m4/class_opaque_copyable.m4
+++ b/tools/m4/class_opaque_copyable.m4
@@ -113,7 +113,7 @@ __CPPNAME__::__CPPNAME__`'(__CNAME__* castitem, bool make_a_copy /* = false */)
if(castitem)
gobject_ = __OPAQUE_FUNC_COPY`'(castitem);
else
- gobject_ = 0;
+ gobject_ = nullptr;
}
}
')
@@ -122,7 +122,7 @@ ifelse(__OPAQUE_FUNC_COPY,NONE,`dnl
',`dnl else
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
{
- __CNAME__ *const new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
+ const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4
index c9242baf..847ac3be 100644
--- a/tools/m4/class_opaque_refcounted.m4
+++ b/tools/m4/class_opaque_refcounted.m4
@@ -116,7 +116,7 @@ const __CNAME__* __CPPNAME__::gobj() const
__CNAME__* __CPPNAME__::gobj_copy() const
{
// See the comment at the top of this file, if you want to know why the cast works.
- __CNAME__ *const gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
+ const auto gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
__OPAQUE_FUNC_REF`'(gobject);
return gobject;
}
@@ -171,11 +171,11 @@ protected:
__CPPNAME__`'();
void operator delete(void*, std::size_t);
-private:
// noncopyable
- __CPPNAME__`'(const __CPPNAME__&);
- __CPPNAME__& operator=(const __CPPNAME__&);
+ __CPPNAME__`'(const __CPPNAME__&) = delete;
+ __CPPNAME__& operator=(const __CPPNAME__&) = delete;
+private:
_IMPORT(SECTION_CLASS2)
')
diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4
index 4175b575..3442ad15 100644
--- a/tools/m4/class_shared.m4
+++ b/tools/m4/class_shared.m4
@@ -190,7 +190,7 @@ ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data)
{
- BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
+ const auto klass = static_cast<BaseClassType*>(g_class);
CppClassParent::class_init_function(klass, class_data);
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 3d170668..8219d4d0 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -32,6 +32,8 @@ _CONV_ENUM(G,FileType)
_CONV_ENUM(G,MountMountFlags)
_CONV_ENUM(G,MountOperationResult)
_CONV_ENUM(G,MountUnmountFlags)
+_CONV_ENUM(G,NetworkConnectivity)
+_CONV_ENUM(G,NotificationPriority)
_CONV_ENUM(G,OutputStreamSpliceFlags)
_CONV_ENUM(G,PasswordSave)
_CONV_ENUM(G,ResolverRecordType)
@@ -240,6 +242,10 @@ _CONVERSION(`PasswordSave',`GPasswordSave',`($2)$3')
#MountOperation
#_CONVERSION(`GAskPasswordFlags',`AskPasswordFlags',`($2)$3')
+# NetworkMonitor
+_CONVERSION(`GNetworkMonitor*',`Glib::RefPtr<NetworkMonitor>',`Glib::wrap($3)')
+
+
# Notification
_CONVERSION(`GNotification*',`Glib::RefPtr<Notification>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Notification>&',`GNotification*',__CONVERT_CONST_REFPTR_TO_P)
@@ -262,6 +268,14 @@ _CONVERSION(`GSettings*',`Glib::RefPtr<Settings>',`Glib::wrap($3)')
_CONVERSION(`const Glib::StringArrayHandle&',`const gchar*-const*',`($3).data()')
_CONVERSION(`const Glib::RefPtr<SettingsBackend>&',`GSettingsBackend*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`GSettingsSchemaKey*',`Glib::RefPtr<SettingsSchemaKey>',`Glib::wrap($3)')
+_CONVERSION(`GSettingsSchemaKey*',`Glib::RefPtr<const SettingsSchemaKey>',`Glib::wrap($3)')
+
+_CONVERSION(`GSettingsSchema*',`Glib::RefPtr<SettingsSchema>',`Glib::wrap($3)')
+_CONVERSION(`GSettingsSchema*',`Glib::RefPtr<const SettingsSchema>',`Glib::wrap($3)')
+
+_CONVERSION(`GSettingsSchemaSource*',`Glib::RefPtr<SettingsSchemaSource>',`Glib::wrap($3)')
+
#Socket
_CONVERSION(`const Glib::RefPtr<Socket>&',`GSocket*',__CONVERT_CONST_REFPTR_TO_P)
diff --git a/tools/m4/enum.m4 b/tools/m4/enum.m4
index 3ac338b2..dc988925 100644
--- a/tools/m4/enum.m4
+++ b/tools/m4/enum.m4
@@ -1,5 +1,6 @@
dnl
dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `flags', `optional_refdoc_comment', 'get_type_function_name')
+dnl $1 $2 $3 $4 $5 $6 $7
dnl
m4_define(`_ENUM',`dnl
_PUSH()
@@ -20,6 +21,7 @@ m4_define(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__')dnl
dnl
dnl
/** $6
+ *
* @ingroup __MODULE_CANONICAL__`'Enums
m4_ifelse($3,Flags,`dnl
* @par Bitwise operators:
diff --git a/tools/m4/filelist.am b/tools/m4/filelist.am
index 04d0b01b..55fedb2b 100644
--- a/tools/m4/filelist.am
+++ b/tools/m4/filelist.am
@@ -25,7 +25,6 @@ files_codegen_m4 = \
initialize_gio.m4 \
initialize_glib.m4 \
initialize_glibmm.m4 \
- list.m4 \
member.m4 \
method.m4 \
property.m4 \
diff --git a/tools/m4/gerror.m4 b/tools/m4/gerror.m4
index a8b8437e..e48aef6e 100644
--- a/tools/m4/gerror.m4
+++ b/tools/m4/gerror.m4
@@ -15,7 +15,7 @@ _POP()
class __CPPNAME__ : public Glib::Error
{
public:
- $6
+ /** $6
*/
enum Code
{
diff --git a/tools/m4/list.m4 b/tools/m4/list.m4
deleted file mode 100644
index 954beb19..00000000
--- a/tools/m4/list.m4
+++ /dev/null
@@ -1,232 +0,0 @@
-_PUSH()
-
-dnl
-dnl These variables affect the generation of the list
-dnl
-define(GP_LIST_HELPER_NAMESPACE,`define(`__LIST_NAMESPACE__',$1)')
-define(GP_LIST_ELEM,`define(`__LISTELEM__',`$*')')
-define(GP_LIST_ITER,`define(`__LISTITER__',`$*')')
-define(GP_LIST_NOINSERT,`define(`__LISTEO__')')
-
-dnl
-dnl GP_LIST(ListName, ParentCppType, ParentCType, ChildCppType, FieldNameC)
-dnl
-dnl In the .ccg file, you'll need to implement:
-dnl iterator insert(iterator position, element_type& e);
-dnl
-dnl Fieldname assumed to be children if not specified
-define(GP_LIST,`
-_PUSH()
-
-define(`__LISTNAME__',$1)
-define(`__LISTPARENT__',$2)
-define(`__LISTPARENT_G__',$3)
-define(`__LISTTYPE__',$4)
-define(`__LISTELEM__',const Element)
-define(`__LISTITER__',Glib::List_Iterator< __LISTTYPE__ >)
-define(`__LIST_NAMESPACE__',$2_Helpers)
-#define(`__LISTFIELD__',ifelse($5,,children,$5))
-define(`__LISTFIELD__',$5)
-
-_SECTION(SECTION_USR)
-')
-
-dnl
-dnl GP_LIST_END()
-dnl
-dnl Closes a list
-define(GP_LIST_END,`dnl
-_POP()
-
-class __LISTNAME__ : public Glib::HelperList< __LISTTYPE__, __LISTELEM__, __LISTITER__ >
-{
-public:
- __LISTNAME__`'();
- explicit __LISTNAME__`'(__LISTPARENT_G__* gparent);
- __LISTNAME__`'(const __LISTNAME__& src);
- virtual ~__LISTNAME__`'() {}
-
- __LISTNAME__& operator=(const __LISTNAME__& src);
-
- typedef Glib::HelperList< __LISTTYPE__, __LISTELEM__, __LISTITER__ > type_base;
-
- __LISTPARENT_G__* gparent();
- const __LISTPARENT_G__* gparent() const;
-
- virtual GList*& glist() const; // front of list
-
- virtual void erase(iterator start, iterator stop);
- virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE
- virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
-
- /// This is order n. (use at own risk)
- reference operator[](size_type l) const;
-
-ifdef(`__LISTEO__',`dnl
-protected:
- //Hide these because it's read-only:
- iterator insert(iterator position, element_type& e);
-
- inline void pop_front();
- inline void pop_back();
-,`dnl
-public:
- iterator insert(iterator position, element_type& e); //custom-implemented.
-
- template <class InputIterator>
- inline void insert(iterator position, InputIterator first, InputIterator last)
- {
- for(;first != last; ++first)
- position = insert(position, *first);
- }
-
- inline void push_front(element_type& e)
- { insert(begin(), e); }
- inline void push_back(element_type& e)
- { insert(end(), e); }
-')dnl
-
-_IMPORT(SECTION_USR)
-};
-
-_PUSH(SECTION_CC)
-
-namespace __LIST_NAMESPACE__
-{
-
-__LISTNAME__::__LISTNAME__`'()
-{}
-
-__LISTNAME__::__LISTNAME__`'(__LISTPARENT_G__* gparent)
-: type_base((GObject*)gparent)
-{}
-
-__LISTNAME__::__LISTNAME__`'(const __LISTNAME__& src)
-:
- type_base(src)
-{}
-
-__LISTNAME__& __LISTNAME__::operator=(const __LISTNAME__& src)
-{
- type_base::operator=(src);
- return *this;
-}
-
-ifelse(__LISTFIELD__,CUSTOM,`dnl
-',`dnl else
-GList*& __LISTNAME__::glist() const
-{
- return ((__LISTPARENT_G__*)gparent_)->__LISTFIELD__;
-}
-')dnl endif
-
-void __LISTNAME__::erase(iterator start, iterator stop)
-{
- type_base::erase(start, stop);
-}
-
-__LISTPARENT_G__* __LISTNAME__::gparent()
-{
- return (__LISTPARENT_G__*)type_base::gparent();
-}
-
-const __LISTPARENT_G__* __LISTNAME__::gparent() const
-{
- return (__LISTPARENT_G__*)type_base::gparent();
-}
-
-__LISTNAME__::reference __LISTNAME__::operator[](size_type l) const
-{
- return type_base::operator[](l);
-}
-
-} /* namespace __LIST_NAMESPACE__ */
-
-undefine(`__LISTNAME__')dnl
-undefine(`__LISTTYPE__')dnl
-undefine(`__LISTPARENT__')dnl
-undefine(`__LISTELEM__')dnl
-undefine(`__LISTFIELD__')dnl
-_POP()
-')
-
-dnl
-dnl GP_LIST_FIND(access_method)
-dnl
-dnl Defines find(containertype) and find(Widget&)
-dnl access_method is the name of method returning a Widget*
-define(GP_LIST_FIND,`
- iterator find(const_reference c);
- iterator find(Widget&);
-_PUSH(SECTION_CC)
-
-namespace __LIST_NAMESPACE__
-{
-
-__LISTNAME__::iterator __LISTNAME__::find(const_reference w)
-{
- iterator i = begin();
- while (i != end() && (i->ifelse($1,,,$1()->)gobj() != w.ifelse($1,,,$1()->)gobj()))
- ++i;
- return i;
-}
-
-__LISTNAME__::iterator __LISTNAME__::find(Widget& w)
-{
- iterator i = begin();
- while (i != end() && ((GtkWidget*)i->ifelse($1,,,$1()->)gobj() != w.gobj()))
- ++i;
- return i;
-}
-
-} /* namespace __LIST_NAMESPACE__ */
-
-_POP()
-')
-
-dnl
-dnl GP_LIST_CONTAINER_REMOVE(access_method)
-dnl
-dnl Implements remove(const_reference), erase(iterator)
-dnl and defines remove(Widget&)
-dnl (assumes that the widget uses gtk+ container methods).
-dnl access_method is the name of the method returning a Widget*
-define(GP_LIST_CONTAINER_REMOVE,`
-virtual void remove(Widget& w); //Implented as custom or by LIST_CONTAINER_REMOVE
-_PUSH(SECTION_CC)
-
-namespace __LIST_NAMESPACE__
-{
-
-void __LISTNAME__::remove(const_reference child)
-{
- gtk_container_remove(GTK_CONTAINER(gparent_),
- (GtkWidget*)(child.ifelse($1,,,$1()->)gobj()));
-}
-
-void __LISTNAME__::remove(Widget& widget)
-{
- gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj()));
-}
-
-__LISTNAME__::iterator __LISTNAME__::erase(iterator position)
-{
- //Check that it is a valid iterator, to a real item:
- if ( !position.node_|| (position == end()) )
- return end();
-
- //Get an iterator the the next item, to return:
- iterator next = position;
- next++;
-
- //Use GTK+ C function to remove it, by providing the GtkWidget*:
- gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->ifelse($1,,,$1()->)gobj()) );
- return next;
-}
-
-} /* namespace __LIST_NAMESPACE__ */
-
-_POP()
-')
-
-_POP()dnl
diff --git a/tools/m4/method.m4 b/tools/m4/method.m4
index 3c48b3e1..3ca4de6e 100644
--- a/tools/m4/method.m4
+++ b/tools/m4/method.m4
@@ -1,22 +1,24 @@
-dnl $Id$
-
dnl
dnl
dnl Code generation sections for making a method.
dnl
dnl
-
dnl
dnl method
-dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21
-dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,const,refreturn,errthrow,deprecated,constversion,ifdef,arglist_without_types,out_param,out_param_cpptype,slot_type,slot_name,no_slot_copy,wrap_line)
+dnl $1 $2 $3 $4 $5 $6 $7 $8
+dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,
+dnl $9 $10 $11 $12 $13 $14 $15
+dnl const,refreturn,errthrow,deprecated,constversion,arglist_without_types,ifdef,
+dnl $16 $17 $18 $19 $20 $21
+dnl out_param,out_param_cpptype,slot_type,slot_name,no_slot_copy,wrap_line)
define(`_METHOD',`dnl
_PUSH(SECTION_CC)
-ifelse(`$12',,,`_DEPRECATE_IFDEF_START
-')dnl
ifelse(`$15',,,`#ifdef $15'
)dnl
+ifelse(`$12',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+')dnl
$3 __CPPNAME__::$1`'($5)ifelse(`$9',1,` const')
{
ifelse(`$13',,dnl
@@ -26,10 +28,10 @@ dnl If a slot type has been specified insert a slot copy declaration.
dnl See if the slot should or should not be copied
`ifelse(`$20',,dnl
` // Create a copy of the slot.
- $18* slot_copy = new $18($19); ',dnl
+ auto slot_copy = new $18($19); ',dnl
dnl
` // Use the original slot (not a copy).
- $18* slot_copy = const_cast<$18*>(&$19);')
+ auto slot_copy = const_cast<$18*>(&$19);')
')`'dnl
dnl Insert the declarations for C output parameters
@@ -59,17 +61,17 @@ ifelse(`$8',,,`$8
')dnl
')',dnl End if a C++ output parameter is specified.
dnl If is errthrow or refreturn
-`ifelse(`$11',,,` GError* gerror = 0;
+`ifelse(`$11',,,` GError* gerror = nullptr;
')dnl
dnl If a slot type has been specified insert a slot copy declaration.
ifelse(`$18',,,dnl
dnl See if the slot should or should not be copied
`ifelse(`$20',,dnl
` // Create a copy of the slot.
- $18* slot_copy = new $18($19); ',dnl
+ auto slot_copy = new $18($19); ',dnl
dnl
` // Use the original slot (not a copy).
- $18* slot_copy = const_cast<$18*>(&$19);')
+ auto slot_copy = const_cast<$18*>(&$19);')
')`'dnl
dnl Insert the declarations for C output parameters
@@ -99,24 +101,27 @@ ifelse(`$3',void,,` return retvalue;
',` return const_cast<__CPPNAME__*>(this)->$1($14);
')dnl
}
-
-ifelse(`$15',,,`
-#endif // $15
-')dnl
-ifelse(`$12',,,`_DEPRECATE_IFDEF_END
-')dnl
+ifelse(`$12',,,`G_GNUC_END_IGNORE_DEPRECATIONS
+_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
+ifelse(`$15',,,`#endif // $15
+')
_POP()')
dnl
dnl static method
-dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18
-dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,cinitializations,refreturn,errthrow,deprecated,ifdef,out_param,out_param_type,slot_type,slot_name,no_slot_copy,wrap_line)
+dnl $1 $2 $3 $4 $5 $6 $7
+dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cdeclarations,cargs,
+dnl $8 $9 $10 $11 $12 $13
+dnl cinitializations,refreturn,errthrow,deprecated,ifdef,out_param,
+dnl $14 $15 $16 $17 $18
+dnl out_param_type,slot_type,slot_name,no_slot_copy,wrap_line)
define(`_STATIC_METHOD',`dnl
_PUSH(SECTION_CC)
-ifelse(`$11',,,`_DEPRECATE_IFDEF_START
-')dnl
ifelse(`$12',,,`#ifdef $12'
)dnl
+ifelse(`$11',,,`_DEPRECATE_IFDEF_START`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+')dnl
$3 __CPPNAME__::$1($5)
{
ifelse(`$9'`$10',,dnl
@@ -125,10 +130,10 @@ ifelse(`$15',,,dnl
dnl See if the slot should or should not be copied
`ifelse(`$17',,dnl
` // Create a copy of the slot.
- $15* slot_copy = new $15($16); ',dnl
+ auto slot_copy = new $15($16); ',dnl
dnl
` // Use the original slot (not a copy).
- $15* slot_copy = const_cast<$15*>(&$16);')
+ auto slot_copy = const_cast<$15*>(&$16);')
')`'dnl
dnl Insert declarations for C the output parameters
@@ -150,16 +155,16 @@ dnl Return the value if it was stored and if the method returns something
ifelse(`$3',void,,`ifelse(`$6',,,` return retval;
')')dnl
',dnl End if a C++ output parameter is specified.
-`ifelse(`$10',,,` GError* gerror = 0;')
+`ifelse(`$10',,,` GError* gerror = nullptr;')
dnl If a slot type has been specified insert a slot copy declaration.
ifelse(`$15',,,dnl
dnl See if the slot should or should not be copied
`ifelse(`$17',,dnl
` // Create a copy of the slot.
- $15* slot_copy = new $15($16); ',dnl
+ auto slot_copy = new $15($16); ',dnl
dnl
` // Use the original slot (not a copy).
- $15* slot_copy = const_cast<$15*>(&$16);')
+ auto slot_copy = const_cast<$15*>(&$16);')
')`'dnl
dnl Insert the declarations for the C output parameters
@@ -185,10 +190,8 @@ ifelse(`$3',void,,` return retvalue;
')dnl
')dnl
}
-
-ifelse(`$12',,,`
-#endif // $12
-')dnl
-ifelse(`$11',,,`_DEPRECATE_IFDEF_END
+ifelse(`$11',,,`G_GNUC_END_IGNORE_DEPRECATIONS
+_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline
+ifelse(`$12',,,`#endif // $12
')
_POP()')
diff --git a/tools/m4/property.m4 b/tools/m4/property.m4
index 119f21cb..1709affa 100644
--- a/tools/m4/property.m4
+++ b/tools/m4/property.m4
@@ -1,5 +1,3 @@
-dnl $Id$
-
dnl
dnl
dnl Code generation sections for properties
@@ -17,25 +15,20 @@ dnl Put spaces around the template parameter if necessary.
pushdef(`__PROXY_TYPE__',`dnl
Glib::PropertyProxy$4< _QUOTE($3) >'dnl
)dnl
-#ifdef GLIBMM_PROPERTIES_ENABLED
/** $6
*
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
* @return A PropertyProxy$4 that allows you to dnl
ifelse($4,_ReadOnly,get,`ifelse($4,_WriteOnly,set,get or set)') the value of the property,
* or receive notification when the value of the property changes.
*/
__PROXY_TYPE__ property_$2`'() ifelse($4,_ReadOnly, const,);
-#endif //#GLIBMM_PROPERTIES_ENABLED
_PUSH(SECTION_CC_PROPERTYPROXIES)
ifelse(`$5',,,`_DEPRECATE_IFDEF_START
')dnl
-#ifdef GLIBMM_PROPERTIES_ENABLED
__PROXY_TYPE__ __CPPNAME__::property_$2`'() ifelse($4,_ReadOnly, const,)
{
return __PROXY_TYPE__`'(this, "$1");
}
-#endif //GLIBMM_PROPERTIES_ENABLED
ifelse(`$5',,,`_DEPRECATE_IFDEF_END
')dnl
diff --git a/tools/m4/signal.m4 b/tools/m4/signal.m4
index d84838d9..d85f93c7 100644
--- a/tools/m4/signal.m4
+++ b/tools/m4/signal.m4
@@ -1,4 +1,3 @@
-
#
# --------------------------- Signal Decl----------------------------
#
@@ -14,15 +13,29 @@ dnl $8 = `custom_c_callback (boolean)',
dnl $9 = `deprecated' (boolean),
dnl $10 = `refdoc_comment',
dnl $11 = ifdef,
-dnl $12 = exceptionHandler)
+dnl $12 = exceptionHandler,
+dnl $13 = detail_name,
+dnl $14 = two_signal_methods (boolean))
define(`_SIGNAL_PROXY',`
ifelse(`$11',,,`#ifdef $11'
)dnl
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
')dnl
+ifelse($13,,`dnl no detail_name
+$10
+ Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'();
+',dnl detail_name
+$14,0,`dnl
+$10
+ Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13 = Glib::ustring());
+',`dnl detail_name and two_signal_methods
$10
Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'();
+
+$10
+ Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13);
+')dnl end detail_name
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
')dnl
ifelse(`$11',,,`#endif // $11
@@ -54,25 +67,22 @@ static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3
using namespace __NAMESPACE__;
typedef sigc::slot< $5`'_COMMA_PREFIX($6) > SlotType;
- __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+ auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
if(obj)
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
ifelse(`$2',void,`dnl
(*static_cast<SlotType*>(slot))($7);
',`dnl else
return _CONVERT($5,$2,`(*static_cast<SlotType*>(slot))($7)');
')dnl endif
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
-ifelse($15, `', `dnl
+ifelse($12, `', `dnl
Glib::exception_handlers_invoke`'();
', `dnl
try
@@ -85,7 +95,6 @@ ifelse($15, `', `dnl
}
')dnl
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
ifelse($2,void,,`dnl else
@@ -100,17 +109,14 @@ static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SU
using namespace __NAMESPACE__;
typedef sigc::slot< void`'_COMMA_PREFIX($6) > SlotType;
- __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+ auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
if(obj)
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
(*static_cast<SlotType*>(slot))($7);
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
@@ -127,7 +133,6 @@ ifelse($12, `', `dnl
}
')dnl
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
typedef $2 RType;
@@ -155,10 +160,28 @@ ifelse(`$11',,,`#ifdef $11'
)dnl
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
')dnl
+ifelse($13,,`dnl no detail_name
+Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
+{
+ return Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
+}
+',dnl detail_name
+$14,0,`dnl
+Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
+{
+ return Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
+}
+',`dnl detail_name and two_signal_methods
Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
{
return Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
}
+
+Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
+{
+ return Glib::SignalProxyDetailed`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
+}
+')dnl end detail_name
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
')dnl
ifelse(`$11',,,`#endif // $11
@@ -212,7 +235,7 @@ $4 __CPPNAME__`'_Class::$2_callback`'($5)
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
@@ -225,13 +248,11 @@ _IMPORT(SECTION_CHECK)
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
ifelse($4,void,`dnl
obj->on_$1`'($7);
@@ -239,16 +260,15 @@ ifelse($4,void,`dnl
',`dnl
return _CONVERT($3,$4,`obj->on_$1`'($7)');
')dnl
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
-ifelse($15, `', `dnl
+ifelse($11, `', `dnl
Glib::exception_handlers_invoke`'();
', `dnl
try
{
- return _CONVERT($3, $4, `obj->$15`'()');
+ return _CONVERT($3, $4, `obj->$11`'()');
}
catch(...)
{
@@ -256,17 +276,16 @@ ifelse($15, `', `dnl
}
')dnl
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT($8)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT($8)dnl
') );
-dnl g_assert(base != 0);
+dnl g_assert(base != nullptr);
// Call the original underlying C function:
if(base && base->$2)
@@ -306,13 +325,13 @@ ifelse(`$9',,,`#ifdef $9'
)dnl
$3 __NAMESPACE__::__CPPNAME__::on_$1`'($5)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
') );
-dnl g_assert(base != 0);
+dnl g_assert(base != nullptr);
if(base && base->$2)
ifelse($3,void,`dnl
diff --git a/tools/m4/vfunc.m4 b/tools/m4/vfunc.m4
index beac4c86..fd2aeb82 100644
--- a/tools/m4/vfunc.m4
+++ b/tools/m4/vfunc.m4
@@ -20,28 +20,30 @@ _POP()')
dnl $1 $2 $3 $4
dnl _VFUNC_PCC(cppname,gtkname,cpprettype,crettype,
-dnl $5 $6 $7 $8 $9 $10 $11
-dnl `<cargs and names>',`<cnames>',`<cpparg names>',firstarg, refreturn_ctype, ifdef, errthrow,
-dnl $12 $13 $14 $15
-dnl slot_type, c_data_param_name, return_value, exception_handler)
+dnl $5 $6 $7 $8
+dnl `<cargs and names>',`<cnames>',`<cpparg names>',firstarg,
+dnl $9 $10 $11 $12
+dnl refreturn_ctype, keep_return, ifdef, errthrow,
+dnl $13 $14 $15 $16
+dnl slot_type, c_data_param_name, return_value, exception_handler)
dnl
dnl Note: _get_current_wrapper_inline() could be used throughout for performance instead of _get_current_wrapper(),
dnl and is_derived_() instead of is_derived_(),
dnl but it is not yet clear whether that would be a worthwhile performance optimization.
define(`_VFUNC_PCC',`dnl
_PUSH(SECTION_PCC_VFUNCS)
-ifelse(`$10',,,`#ifdef $10'
+ifelse(`$11',,,`#ifdef $11'
)dnl
$4 __CPPNAME__`'_Class::$2_vfunc_callback`'($5)
{
-ifelse(`$13',,,dnl
-` const $12* slot = static_cast<$12*>($13);
+ifelse(`$14',,,dnl
+` const auto slot = static_cast<$13*>($14);
')dnl
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
@@ -54,37 +56,50 @@ _IMPORT(SECTION_CHECK)
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
ifelse($4,void,`dnl
obj->$1`'($7);
return;
-',`dnl
+',`dnl not void
ifelse($9,refreturn_ctype,`dnl Assume Glib::unwrap_copy() is correct if refreturn_ctype is requested.
return Glib::unwrap_copy`'(`obj->$1'($7));
-',`dnl
+',`dnl not refreturn_ctype
+ifelse($10,keep_return,`dnl
+ static auto quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
+
+ auto return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
+ if (!return_value)
+ {
+ return_value = new $3`'();
+ g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
+ &Glib::destroy_notify_delete<$3>);
+ }
+ // Keep a copy of the return value. The caller is not expected
+ // to free the object that the returned pointer points to.
+ *return_value = obj->$1`'($7);
+ return _CONVERT($3,$4,`(*return_value)');
+',`dnl not keep_return
return _CONVERT($3,$4,`obj->$1`'($7)');
-')dnl
-')dnl
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
+')dnl end keep_return
+')dnl end refreturn_ctype
+')dnl end void
}
catch(...)
{
-ifelse($15, `', `dnl
+ifelse($16, `', `dnl
Glib::exception_handlers_invoke`'();
', `dnl
try
{
ifelse($9,refreturn_ctype,`dnl
- return Glib::unwrap_copy`'(obj->$15`'());
+ return Glib::unwrap_copy`'(obj->$16`'());
', `dnl
- return _CONVERT($3, $4, `obj->$15`'()');
+ return _CONVERT($3, $4, `obj->$16`'()');
')dnl
}
catch(...)
@@ -93,7 +108,6 @@ ifelse($9,refreturn_ctype,`dnl
}
')dnl
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
@@ -103,13 +117,13 @@ ifdef(`__BOOL_IS_INTERFACE__',`dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT($8)dnl
') );
-dnl g_assert(base != 0);
+dnl g_assert(base != nullptr);
// Call the original underlying C function:
if(base && base->$2)
{
ifelse($4,void,,`$4 retval = ')(*base->$2)`'($6);
-ifelse($11,errthrow,`dnl
+ifelse($12,errthrow,`dnl
if(*error)
::Glib::Error::throw_exception(*error);
')dnl
@@ -118,15 +132,15 @@ ifelse($4,void,,` return retval;
}
ifelse($4,void,,`dnl
-ifelse(`$14', `',`dnl
+ifelse(`$15', `',`dnl
typedef $4 RType;
return RType`'();
',`dnl
- return _CONVERT($3,$4,`$14');
+ return _CONVERT($3,$4,`$15');
')dnl
')dnl
}
-ifelse(`$10',,,`#endif // $10
+ifelse(`$11',,,`#endif // $11
')dnl
_POP()')
@@ -144,24 +158,24 @@ ifelse(`$11',,,dnl
dnl See if the slot should or should not be copied
`ifelse(`$13',,dnl
` // Create a copy of the slot.
- $11* slot_copy = new $11($12); ',dnl
+ auto slot_copy = new $11($12); ',dnl
dnl
` // Use the original slot (not a copy).
- $11* slot_copy = const_cast<$11*>(&$12);')
+ auto slot_copy = const_cast<$11*>(&$12);')
')dnl
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
') );
-dnl g_assert(base != 0);
+dnl g_assert(base != nullptr);
if(base && base->$2)
{
ifelse($10,errthrow,`dnl
- GError* gerror = 0;
+ GError* gerror = nullptr;
')dnl
ifelse($3,void,`dnl
(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6));
@@ -209,4 +223,3 @@ ifelse(`$5',,,`#endif // $5
')dnl
_POP()')
-