Commit bc43d351 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

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
parent c665e04c
......@@ -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:
......
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment