[glibmm] C++11: Mark all _CLASS_OPAQUE_REFCOUNTED classes as final.



commit ceb43c2bc0edd56f43970c4e85123c7a4fcd5560
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Aug 22 11:45:03 2015 +0200

    C++11: Mark all _CLASS_OPAQUE_REFCOUNTED classes as final.
    
    Because _CLASS_OPAQUE_REFCOUNTED already generates a comment
    telling us not to derive from them, presumably because they can
    only be instantiated by reinterpret_cast<>ing a base C struct.
    
    Ideally, _CLASS_OPAQUE_REFCOUNTED would add the final keyword,
    but the class line is is not generated, so that would be a little
    difficult.

 gio/src/dbusintrospection.hg        |   14 +++++++-------
 gio/src/fileattributeinfolist.hg    |    2 +-
 gio/src/fileinfo.hg                 |    2 +-
 gio/src/resource.hg                 |    2 +-
 gio/src/settingsschema.hg           |    2 +-
 gio/src/settingsschemakey.hg        |    2 +-
 gio/src/settingsschemasource.hg     |    2 +-
 glib/src/bytearray.hg               |    2 +-
 glib/src/bytes.hg                   |    2 +-
 glib/src/regex.hg                   |    2 +-
 glib/src/variantdict.hg             |    2 +-
 tools/m4/class_opaque_refcounted.m4 |    5 ++---
 12 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/gio/src/dbusintrospection.hg b/gio/src/dbusintrospection.hg
index 442415a..d7921c8 100644
--- a/gio/src/dbusintrospection.hg
+++ b/gio/src/dbusintrospection.hg
@@ -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)
diff --git a/gio/src/fileattributeinfolist.hg b/gio/src/fileattributeinfolist.hg
index dc3903a..4f7bac7 100644
--- a/gio/src/fileattributeinfolist.hg
+++ b/gio/src/fileattributeinfolist.hg
@@ -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,
diff --git a/gio/src/fileinfo.hg b/gio/src/fileinfo.hg
index b14a601..9d31ba4 100644
--- a/gio/src/fileinfo.hg
+++ b/gio/src/fileinfo.hg
@@ -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)
diff --git a/gio/src/resource.hg b/gio/src/resource.hg
index 730e221..5cee8bf 100644
--- a/gio/src/resource.hg
+++ b/gio/src/resource.hg
@@ -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)
diff --git a/gio/src/settingsschema.hg b/gio/src/settingsschema.hg
index 4ff7e83..db768b8 100644
--- a/gio/src/settingsschema.hg
+++ b/gio/src/settingsschema.hg
@@ -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)
 
diff --git a/gio/src/settingsschemakey.hg b/gio/src/settingsschemakey.hg
index cca21c7..e7894d6 100644
--- a/gio/src/settingsschemakey.hg
+++ b/gio/src/settingsschemakey.hg
@@ -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)
 
diff --git a/gio/src/settingsschemasource.hg b/gio/src/settingsschemasource.hg
index 2731f2b..4097e93 100644
--- a/gio/src/settingsschemasource.hg
+++ b/gio/src/settingsschemasource.hg
@@ -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)
 
diff --git a/glib/src/bytearray.hg b/glib/src/bytearray.hg
index 5429275..1db85d8 100644
--- a/glib/src/bytearray.hg
+++ b/glib/src/bytearray.hg
@@ -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)
diff --git a/glib/src/bytes.hg b/glib/src/bytes.hg
index 31f1fc9..56da352 100644
--- a/glib/src/bytes.hg
+++ b/glib/src/bytes.hg
@@ -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)
diff --git a/glib/src/regex.hg b/glib/src/regex.hg
index f35af4a..0ad6f09 100644
--- a/glib/src/regex.hg
+++ b/glib/src/regex.hg
@@ -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)
diff --git a/glib/src/variantdict.hg b/glib/src/variantdict.hg
index 876591f..7b66869 100644
--- a/glib/src/variantdict.hg
+++ b/glib/src/variantdict.hg
@@ -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.
diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4
index aae4f94..e33cf52 100644
--- a/tools/m4/class_opaque_refcounted.m4
+++ b/tools/m4/class_opaque_refcounted.m4
@@ -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


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