[glibmm] DateTime, TimeZone: Use classes without Glib::RefPt<>.
- From: Josà Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] DateTime, TimeZone: Use classes without Glib::RefPt<>.
- Date: Thu, 16 Jun 2011 16:09:21 +0000 (UTC)
commit a56a1c0855c22b3618586734131b282a1d813d88
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Thu Jun 16 12:07:28 2011 -0400
DateTime, TimeZone: Use classes without Glib::RefPt<>.
* glib/src/datetime.hg:
* glib/src/timezone.hg: Since these classes are immutable (like
Glib::VariantBase), remove the need to use these classes with
Glib::RefPtr<> by using the _CLASS_OPAQUE_COPYABLE macro instead of
the _CLASS_OPAQUE_REFCOUNTED macro. This should make using the
classes a little less tedious.
* tools/m4/convert_glib.m4: Modify the corresponding conversions
according to the above.
ChangeLog | 13 +++++++++++
glib/src/datetime.hg | 52 +++++++++++++++++++++++-----------------------
glib/src/timezone.hg | 8 +++---
tools/m4/convert_glib.m4 | 8 +++---
4 files changed, 47 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 436f0b6..03713c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-06-16 Josà Alburquerque <jaalburqu svn gnome org>
+
+ DateTime, TimeZone: Use classes without Glib::RefPt<>.
+
+ * glib/src/datetime.hg:
+ * glib/src/timezone.hg: Since these classes are immutable (like
+ Glib::VariantBase), remove the need to use these classes with
+ Glib::RefPtr<> by using the _CLASS_OPAQUE_COPYABLE macro instead of
+ the _CLASS_OPAQUE_REFCOUNTED macro. This should make using the
+ classes a little less tedious.
+ * tools/m4/convert_glib.m4: Modify the corresponding conversions
+ according to the above.
+
2011-06-15 Josà Alburquerque <jaalburqu svn gnome org>
DateTime: Add methods and create() methods not creating now instances.
diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg
index 8717ae5..6b5c62f 100644
--- a/glib/src/datetime.hg
+++ b/glib/src/datetime.hg
@@ -63,38 +63,38 @@ typedef GTimeSpan TimeSpan;
*/
class DateTime
{
- _CLASS_OPAQUE_REFCOUNTED(DateTime, GDateTime, NONE, g_date_time_ref, g_date_time_unref)
+ _CLASS_OPAQUE_COPYABLE(DateTime, GDateTime, NONE, g_date_time_ref, g_date_time_unref)
_IGNORE(g_date_time_ref, g_date_time_unref)
public:
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now(const Glib::RefPtr<const TimeZone>& tz), g_date_time_new_now)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_local(), g_date_time_new_now_local)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_utc(), g_date_time_new_now_utc)
+ _WRAP_METHOD(static DateTime create_now(const TimeZone& tz), g_date_time_new_now)
+ _WRAP_METHOD(static DateTime create_now_local(), g_date_time_new_now_local)
+ _WRAP_METHOD(static DateTime create_now_utc(), g_date_time_new_now_utc)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_local(gint64 t), g_date_time_new_from_unix_local)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_utc(gint64 t), g_date_time_new_from_unix_utc)
+ _WRAP_METHOD(static DateTime create_now_local(gint64 t), g_date_time_new_from_unix_local)
+ _WRAP_METHOD(static DateTime create_now_utc(gint64 t), g_date_time_new_from_unix_utc)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_local(const TimeVal& tv), g_date_time_new_from_timeval_local)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_now_utc(const TimeVal& tv), g_date_time_new_from_timeval_utc)
+ _WRAP_METHOD(static DateTime create_now_local(const TimeVal& tv), g_date_time_new_from_timeval_local)
+ _WRAP_METHOD(static DateTime create_now_utc(const TimeVal& tv), g_date_time_new_from_timeval_utc)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create(const Glib::RefPtr<const TimeZone>& tz, int year, int month, int day, int hour, int minute, double seconds), g_date_time_new)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_local(int year, int month, int day, int hour, int minute, double seconds), g_date_time_new_local)
- _WRAP_METHOD(static Glib::RefPtr<DateTime> create_utc(int year, int month, int day, int hour, int minute, double seconds), g_date_time_new_utc)
+ _WRAP_METHOD(static DateTime create(const TimeZone& tz, int year, int month, int day, int hour, int minute, double seconds), g_date_time_new)
+ _WRAP_METHOD(static DateTime create_local(int year, int month, int day, int hour, int minute, double seconds), g_date_time_new_local)
+ _WRAP_METHOD(static DateTime create_utc(int year, int month, int day, int hour, int minute, double seconds), g_date_time_new_utc)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add(TimeSpan timespan) const, g_date_time_add)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_years(int years) const, g_date_time_add_years)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_months(int months) const, g_date_time_add_months)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_weeks(int weeks) const, g_date_time_add_weeks)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_days(int days) const, g_date_time_add_days)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_hours(int hours) const, g_date_time_add_hours)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_minutes(int minutes) const, g_date_time_add_minutes)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_seconds(double seconds) const, g_date_time_add_seconds)
- _WRAP_METHOD(Glib::RefPtr<DateTime> add_full(int years, int months, int days, int hours, int minutes, double seconds) const, g_date_time_add_full)
- _WRAP_METHOD(TimeSpan difference(const Glib::RefPtr<const DateTime>& other) const, g_date_time_difference)
+ _WRAP_METHOD(DateTime add(TimeSpan timespan) const, g_date_time_add)
+ _WRAP_METHOD(DateTime add_years(int years) const, g_date_time_add_years)
+ _WRAP_METHOD(DateTime add_months(int months) const, g_date_time_add_months)
+ _WRAP_METHOD(DateTime add_weeks(int weeks) const, g_date_time_add_weeks)
+ _WRAP_METHOD(DateTime add_days(int days) const, g_date_time_add_days)
+ _WRAP_METHOD(DateTime add_hours(int hours) const, g_date_time_add_hours)
+ _WRAP_METHOD(DateTime add_minutes(int minutes) const, g_date_time_add_minutes)
+ _WRAP_METHOD(DateTime add_seconds(double seconds) const, g_date_time_add_seconds)
+ _WRAP_METHOD(DateTime add_full(int years, int months, int days, int hours, int minutes, double seconds) const, g_date_time_add_full)
+ _WRAP_METHOD(TimeSpan difference(const DateTime& other) const, g_date_time_difference)
- _WRAP_METHOD(int compare(const Glib::RefPtr<const DateTime>& other) const, g_date_time_compare)
+ _WRAP_METHOD(int compare(const DateTime& other) const, g_date_time_compare)
_WRAP_METHOD(guint hash() const, g_date_time_hash)
- _WRAP_METHOD(bool equal(const Glib::RefPtr<const DateTime>& other) const, g_date_time_equal)
+ _WRAP_METHOD(bool equal(const DateTime& other) const, g_date_time_equal)
_WRAP_METHOD(void get_ymd(int& year, int& month, int& day) const, g_date_time_get_ymd)
_WRAP_METHOD(int get_year() const, g_date_time_get_year)
@@ -114,9 +114,9 @@ public:
_WRAP_METHOD(TimeSpan get_utc_offset() const, g_date_time_get_utc_offset)
_WRAP_METHOD(Glib::ustring get_timezone_abbreviation() const, g_date_time_get_timezone_abbreviation)
_WRAP_METHOD(bool is_daylight_savings() const, g_date_time_is_daylight_savings)
- _WRAP_METHOD(Glib::RefPtr<DateTime> to_timezone(const Glib::RefPtr<const TimeZone>& tz) const, g_date_time_to_timezone)
- _WRAP_METHOD(Glib::RefPtr<DateTime> to_local() const, g_date_time_to_local)
- _WRAP_METHOD(Glib::RefPtr<DateTime> to_utc() const, g_date_time_to_utc)
+ _WRAP_METHOD(DateTime to_timezone(const TimeZone& tz) const, g_date_time_to_timezone)
+ _WRAP_METHOD(DateTime to_local() const, g_date_time_to_local)
+ _WRAP_METHOD(DateTime to_utc() const, g_date_time_to_utc)
_WRAP_METHOD(Glib::ustring format(const Glib::ustring& format) const, g_date_time_format)
};
diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg
index 3d88e88..3bc2ef2 100644
--- a/glib/src/timezone.hg
+++ b/glib/src/timezone.hg
@@ -54,13 +54,13 @@ _WRAP_ENUM(TimeType, GTimeType, NO_GTYPE)
*/
class TimeZone
{
- _CLASS_OPAQUE_REFCOUNTED(TimeZone, GTimeZone, NONE, g_time_zone_ref, g_time_zone_unref)
+ _CLASS_OPAQUE_COPYABLE(TimeZone, GTimeZone, NONE, g_time_zone_ref, g_time_zone_unref)
_IGNORE(g_time_zone_ref, g_time_zone_unref)
public:
- _WRAP_METHOD(static Glib::RefPtr<TimeZone> create(const Glib::ustring& identifier), g_time_zone_new)
- _WRAP_METHOD(static Glib::RefPtr<TimeZone> create_local(), g_time_zone_new_local)
- _WRAP_METHOD(static Glib::RefPtr<TimeZone> create_utc(), g_time_zone_new_utc)
+ _WRAP_METHOD(static TimeZone create(const Glib::ustring& identifier), g_time_zone_new)
+ _WRAP_METHOD(static TimeZone create_local(), g_time_zone_new_local)
+ _WRAP_METHOD(static TimeZone create_utc(), g_time_zone_new_utc)
_WRAP_METHOD(static void refresh_local(), g_time_zone_refresh_local)
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index c2bc5a7..f5a3bbe 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -103,8 +103,8 @@ _CONVERSION(`return-gchar*',`std::string',`Glib::convert_return_gchar_ptr_to_std
_CONVERSION(`return-char*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
dnl DateTime
-_CONVERSION(`GDateTime*',`Glib::RefPtr<DateTime>',`Glib::wrap($3)')
-_CONVERSION(`const Glib::RefPtr<const DateTime>&',`GDateTime*',`const_cast<$2>(Glib::unwrap($3))')
+_CONVERSION(`GDateTime*',`DateTime',`Glib::wrap($3)')
+_CONVERSION(`const DateTime&',`GDateTime*',`const_cast<$2>($3.gobj())')
dnl KeyFile
_CONVERSION(`Glib::KeyFile&',`GKeyFile*',`($3).gobj()')
@@ -131,8 +131,8 @@ _CONVERSION(`const TimeVal&',`const GTimeVal*',`&($3)')
_CONVERSION(`TimeVal&',`GTimeVal*',`&($3)')
dnl TimeZone
-_CONVERSION(`GTimeZone*',`Glib::RefPtr<TimeZone>',`Glib::wrap($3)')
-_CONVERSION(`const Glib::RefPtr<const TimeZone>&',`GTimeZone*',`const_cast<$2>(Glib::unwrap($3))')
+_CONVERSION(`GTimeZone*',`TimeZone',`Glib::wrap($3)')
+_CONVERSION(`const TimeZone&',`GTimeZone*',`const_cast<$2>($3.gobj())')
dnl ValueBase
_CONVERSION(`Glib::ValueBase&',`GValue*',`($3).gobj()')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]