[glibmm] Glib::Checksum, Datetime, TimeZone: _CLASS_BOXEDTYPE



commit bc43d3511d56d11ba1248a831b3c50a5c89efa24
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Apr 26 15:55:17 2019 +0200

    Glib::Checksum, Datetime, TimeZone: _CLASS_BOXEDTYPE
    
    These classes can be wrapped as _CLASS_BOXEDTYPE. Then Glib::Value
    specializations are generated, and these classes can be more easily used
    with Glib::Value. See discussion on gtkmm-list
    https://mail.gnome.org/archives/gtkmm-list/2019-April/msg00011.html

 glib/src/checksum.hg |  2 +-
 glib/src/datetime.hg | 10 +++++-----
 glib/src/timezone.hg |  9 ++++++---
 3 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/glib/src/checksum.hg b/glib/src/checksum.hg
index 47854701..25a8ec04 100644
--- a/glib/src/checksum.hg
+++ b/glib/src/checksum.hg
@@ -38,7 +38,7 @@ namespace Glib
  */
 class Checksum
 {
-  _CLASS_OPAQUE_COPYABLE(Checksum, GChecksum, NONE, g_checksum_copy, g_checksum_free)
+  _CLASS_BOXEDTYPE(Checksum, GChecksum, NONE, g_checksum_copy, g_checksum_free)
   _IGNORE(g_checksum_copy, g_checksum_free)
 
 public:
diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg
index ac6e81da..c18a35c4 100644
--- a/glib/src/datetime.hg
+++ b/glib/src/datetime.hg
@@ -17,7 +17,6 @@
 _DEFS(glibmm,glib)
 
 #include <glibmmconfig.h>
-#include <glibmm/refptr.h>
 #include <glibmm/timezone.h>
 #include <glibmm/ustring.h>
 #include <glib.h>
@@ -49,9 +48,6 @@ using TimeSpan = GTimeSpan;
  * functions can fail due to the date or time going out of range, in which case
  * <tt>0</tt> will be returned.
  *
- * DateTime is reference counted.  When the reference count drops to 0, the
- * resources allocated by the DateTime structure are released.
- *
  * Many parts of the API may produce non-obvious results. As an example, adding
  * two months to January 31st will yield March 31st whereas adding one month
  * and then one month again will yield either March 28th or March 29th. Also
@@ -62,7 +58,11 @@ using TimeSpan = GTimeSpan;
  */
 class DateTime
 {
-  _CLASS_OPAQUE_COPYABLE(DateTime, GDateTime, NONE, g_date_time_ref, g_date_time_unref)
+  // GDateTime is refcounted, but Glib::DateTime is not.
+  // GDateTime is immutable. Therefore, there is no problem having several
+  // Glib::DateTime instances wrap the same GDateTime, and it's easier to use
+  // Glib::DateTime without Glib::RefPtr.
+  _CLASS_BOXEDTYPE(DateTime, GDateTime, NONE, g_date_time_ref, g_date_time_unref)
   _IGNORE(g_date_time_ref, g_date_time_unref)
 
 public:
diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg
index afa2f7fd..df4372fd 100644
--- a/glib/src/timezone.hg
+++ b/glib/src/timezone.hg
@@ -17,7 +17,6 @@
 _DEFS(glibmm,glib)
 
 #include <glibmmconfig.h>
-#include <glibmm/refptr.h>
 #include <glibmm/ustring.h>
 #include <glib.h>
 
@@ -32,7 +31,7 @@ _WRAP_ENUM(TimeType, GTimeType, NO_GTYPE)
 
 /** TimeZone - A structure representing a time zone.
  * TimeZone is a structure that represents a time zone, at no particular point
- * in time. It is refcounted and immutable.
+ * in time. It is immutable.
  *
  * A time zone contains a number of intervals. Each interval has an
  * abbreviation to describe it, an offet to UTC and a flag indicating if the
@@ -53,7 +52,11 @@ _WRAP_ENUM(TimeType, GTimeType, NO_GTYPE)
  */
 class TimeZone
 {
-  _CLASS_OPAQUE_COPYABLE(TimeZone, GTimeZone, NONE, g_time_zone_ref, g_time_zone_unref)
+  // GTimeZone is refcounted, but Glib::TimeZone is not.
+  // GTimeZone is immutable. Therefore, there is no problem having several
+  // Glib::TimeZone instances wrap the same GTimeZone, and it's easier to use
+  // Glib::TimeZone without Glib::RefPtr.
+  _CLASS_BOXEDTYPE(TimeZone, GTimeZone, NONE, g_time_zone_ref, g_time_zone_unref)
   _IGNORE(g_time_zone_ref, g_time_zone_unref)
 
 public:


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