[glibmm] Added VariantIter.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Added VariantIter.
- Date: Mon, 13 Sep 2010 13:15:52 +0000 (UTC)
commit edf658df32ddf2ff24ab07252a13328d2fd4fcb1
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Sep 13 15:06:38 2010 +0200
Added VariantIter.
* glib/src/glib_functions.defs:
* glib/src/gobject_functions.defs: Regenerated with h2defs.py.
* glib/src/filelist.am:
* glib/src/variantiter.[hg|ccg]: Added the VariantIter class. Unfortunately
it can't be much like a std::iterator until we fix the C API - see the
comments.
* glib/src/varianttype.hg: Added an m4 line to fix the build.
ChangeLog | 12 ++
glib/src/filelist.am | 1 +
glib/src/glib_functions.defs | 381 +++++++++++++++++++++++++++++++++++++--
glib/src/gobject_functions.defs | 20 ++
glib/src/varianttype.hg | 19 ++-
5 files changed, 413 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index adda0ee..1ef8e77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2010-09-13 Murray Cumming <murrayc murrayc com>
+ Added VariantIter.
+
+ * glib/src/glib_functions.defs:
+ * glib/src/gobject_functions.defs: Regenerated with h2defs.py.
+ * glib/src/filelist.am:
+ * glib/src/variantiter.[hg|ccg]: Added the VariantIter class. Unfortunately
+ it can't be much like a std::iterator until we fix the C API - see the
+ comments.
+ * glib/src/varianttype.hg: Added an m4 line to fix the build.
+
+2010-09-13 Murray Cumming <murrayc murrayc com>
+
VariantBase: Added a byte/guchar specialization.
* glib/src/variant_basictypes.cc.m4:
diff --git a/glib/src/filelist.am b/glib/src/filelist.am
index d9dd26c..64ffa22 100644
--- a/glib/src/filelist.am
+++ b/glib/src/filelist.am
@@ -35,6 +35,7 @@ glibmm_files_hg = \
uriutils.hg \
valuearray.hg \
variant.hg \
+ variantiter.hg \
varianttype.hg
glibmm_files_ccg = $(glibmm_files_hg:.hg=.ccg)
diff --git a/glib/src/glib_functions.defs b/glib/src/glib_functions.defs
index 919a777..9f42377 100644
--- a/glib/src/glib_functions.defs
+++ b/glib/src/glib_functions.defs
@@ -2974,6 +2974,369 @@
+;; From gdatetime.h
+
+(define-function g_date_time_new_now
+ (c-name "g_date_time_new_now")
+ (return-type "GDateTime*")
+)
+
+(define-function g_date_time_new_today
+ (c-name "g_date_time_new_today")
+ (return-type "GDateTime*")
+)
+
+(define-function g_date_time_new_utc_now
+ (c-name "g_date_time_new_utc_now")
+ (return-type "GDateTime*")
+)
+
+(define-function g_date_time_new_from_date
+ (c-name "g_date_time_new_from_date")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "year")
+ '("gint" "month")
+ '("gint" "day")
+ )
+)
+
+(define-function g_date_time_new_from_epoch
+ (c-name "g_date_time_new_from_epoch")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint64" "secs")
+ )
+)
+
+(define-function g_date_time_new_from_timeval
+ (c-name "g_date_time_new_from_timeval")
+ (return-type "GDateTime*")
+ (parameters
+ '("GTimeVal*" "tv")
+ )
+)
+
+(define-function g_date_time_new_full
+ (c-name "g_date_time_new_full")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "year")
+ '("gint" "month")
+ '("gint" "day")
+ '("gint" "hour")
+ '("gint" "minute")
+ '("gint" "second")
+ '("const-gchar*" "time_zone")
+ )
+)
+
+(define-method copy
+ (of-object "GDateTime")
+ (c-name "g_date_time_copy")
+ (return-type "GDateTime*")
+)
+
+(define-method ref
+ (of-object "GDateTime")
+ (c-name "g_date_time_ref")
+ (return-type "GDateTime*")
+)
+
+(define-method unref
+ (of-object "GDateTime")
+ (c-name "g_date_time_unref")
+ (return-type "none")
+)
+
+(define-method add
+ (of-object "GDateTime")
+ (c-name "g_date_time_add")
+ (return-type "GDateTime*")
+ (parameters
+ '("GTimeSpan" "timespan")
+ )
+)
+
+(define-method add_days
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_days")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "days")
+ )
+)
+
+(define-method add_hours
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_hours")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "hours")
+ )
+)
+
+(define-method add_milliseconds
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_milliseconds")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "milliseconds")
+ )
+)
+
+(define-method add_minutes
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_minutes")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "minutes")
+ )
+)
+
+(define-method add_months
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_months")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "months")
+ )
+)
+
+(define-method add_seconds
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_seconds")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "seconds")
+ )
+)
+
+(define-method add_weeks
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_weeks")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "weeks")
+ )
+)
+
+(define-method add_years
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_years")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "years")
+ )
+)
+
+(define-method add_full
+ (of-object "GDateTime")
+ (c-name "g_date_time_add_full")
+ (return-type "GDateTime*")
+ (parameters
+ '("gint" "years")
+ '("gint" "months")
+ '("gint" "days")
+ '("gint" "hours")
+ '("gint" "minutes")
+ '("gint" "seconds")
+ )
+)
+
+(define-method day
+ (of-object "GDateTime")
+ (c-name "g_date_time_day")
+ (return-type "GDateTime*")
+)
+
+(define-function g_date_time_compare
+ (c-name "g_date_time_compare")
+ (return-type "gint")
+ (parameters
+ '("gconstpointer" "dt1")
+ '("gconstpointer" "dt2")
+ )
+)
+
+(define-function g_date_time_equal
+ (c-name "g_date_time_equal")
+ (return-type "gboolean")
+ (parameters
+ '("gconstpointer" "dt1")
+ '("gconstpointer" "dt2")
+ )
+)
+
+(define-function g_date_time_hash
+ (c-name "g_date_time_hash")
+ (return-type "guint")
+ (parameters
+ '("gconstpointer" "datetime")
+ )
+)
+
+(define-method difference
+ (of-object "GDateTime")
+ (c-name "g_date_time_difference")
+ (return-type "GTimeSpan")
+ (parameters
+ '("const-GDateTime*" "end")
+ )
+)
+
+(define-method get_julian
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_julian")
+ (return-type "none")
+ (parameters
+ '("gint*" "period")
+ '("gint*" "julian")
+ '("gint*" "hour")
+ '("gint*" "minute")
+ '("gint*" "second")
+ )
+)
+
+(define-method get_hour
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_hour")
+ (return-type "gint")
+)
+
+(define-method get_minute
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_minute")
+ (return-type "gint")
+)
+
+(define-method get_second
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_second")
+ (return-type "gint")
+)
+
+(define-method get_millisecond
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_millisecond")
+ (return-type "gint")
+)
+
+(define-method get_microsecond
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_microsecond")
+ (return-type "gint")
+)
+
+(define-method get_day_of_week
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_day_of_week")
+ (return-type "gint")
+)
+
+(define-method get_day_of_month
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_day_of_month")
+ (return-type "gint")
+)
+
+(define-method get_week_of_year
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_week_of_year")
+ (return-type "gint")
+)
+
+(define-method get_day_of_year
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_day_of_year")
+ (return-type "gint")
+)
+
+(define-method get_month
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_month")
+ (return-type "gint")
+)
+
+(define-method get_year
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_year")
+ (return-type "gint")
+)
+
+(define-method get_dmy
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_dmy")
+ (return-type "none")
+ (parameters
+ '("gint*" "day")
+ '("gint*" "month")
+ '("gint*" "year")
+ )
+)
+
+(define-method get_utc_offset
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_utc_offset")
+ (return-type "GTimeSpan")
+)
+
+(define-method get_timezone_name
+ (of-object "GDateTime")
+ (c-name "g_date_time_get_timezone_name")
+ (return-type "const-gchar*")
+)
+
+(define-method is_leap_year
+ (of-object "GDateTime")
+ (c-name "g_date_time_is_leap_year")
+ (return-type "gboolean")
+)
+
+(define-method is_daylight_savings
+ (of-object "GDateTime")
+ (c-name "g_date_time_is_daylight_savings")
+ (return-type "gboolean")
+)
+
+(define-method to_local
+ (of-object "GDateTime")
+ (c-name "g_date_time_to_local")
+ (return-type "GDateTime*")
+)
+
+(define-method to_epoch
+ (of-object "GDateTime")
+ (c-name "g_date_time_to_epoch")
+ (return-type "gint64")
+)
+
+(define-method to_timeval
+ (of-object "GDateTime")
+ (c-name "g_date_time_to_timeval")
+ (return-type "none")
+ (parameters
+ '("GTimeVal*" "tv")
+ )
+)
+
+(define-method to_utc
+ (of-object "GDateTime")
+ (c-name "g_date_time_to_utc")
+ (return-type "GDateTime*")
+)
+
+(define-method printf
+ (of-object "GDateTime")
+ (c-name "g_date_time_printf")
+ (return-type "gchar*")
+ (parameters
+ '("const-gchar*" "format")
+ )
+)
+
+
+
;; From gdir.h
(define-function g_dir_open
@@ -12234,20 +12597,16 @@
(return-type "const-GVariantType*")
)
-(define-function g_variant_type_new_array
+(define-method new_array
+ (of-object "GVariantType")
(c-name "g_variant_type_new_array")
(return-type "GVariantType*")
- (parameters
- '("const-GVariantType*" "element")
- )
)
-(define-function g_variant_type_new_maybe
+(define-method new_maybe
+ (of-object "GVariantType")
(c-name "g_variant_type_new_maybe")
(return-type "GVariantType*")
- (parameters
- '("const-GVariantType*" "element")
- )
)
(define-function g_variant_type_new_tuple
@@ -12259,11 +12618,11 @@
)
)
-(define-function g_variant_type_new_dict_entry
+(define-method new_dict_entry
+ (of-object "GVariantType")
(c-name "g_variant_type_new_dict_entry")
(return-type "GVariantType*")
(parameters
- '("const-GVariantType*" "key")
'("const-GVariantType*" "value")
)
)
@@ -12341,5 +12700,3 @@
'("const-gchar*" "utf8filename")
)
)
-
-
diff --git a/glib/src/gobject_functions.defs b/glib/src/gobject_functions.defs
index d81d629..bd373df 100644
--- a/glib/src/gobject_functions.defs
+++ b/glib/src/gobject_functions.defs
@@ -23,6 +23,7 @@
'("default" "G_BINDING_DEFAULT")
'("bidirectional" "G_BINDING_BIDIRECTIONAL")
'("sync-create" "G_BINDING_SYNC_CREATE")
+ '("invert-boolean" "G_BINDING_INVERT_BOOLEAN")
)
)
@@ -188,6 +189,20 @@
)
)
+(define-function g_object_bind_property_with_closures
+ (c-name "g_object_bind_property_with_closures")
+ (return-type "GBinding*")
+ (parameters
+ '("gpointer" "source")
+ '("const-gchar*" "source_property")
+ '("gpointer" "target")
+ '("const-gchar*" "target_property")
+ '("GBindingFlags" "flags")
+ '("GClosure*" "transform_to")
+ '("GClosure*" "transform_from")
+ )
+)
+
;; From gboxed.h
@@ -333,6 +348,11 @@
(return-type "GType")
)
+(define-function g_date_time_get_type
+ (c-name "g_date_time_get_type")
+ (return-type "GType")
+)
+
(define-function g_variant_get_gtype
(c-name "g_variant_get_gtype")
(return-type "GType")
diff --git a/glib/src/varianttype.hg b/glib/src/varianttype.hg
index f6c9eef..c034677 100644
--- a/glib/src/varianttype.hg
+++ b/glib/src/varianttype.hg
@@ -41,21 +41,24 @@ public:
/** Copy the C item into a new VariantType instance.
*/
explicit VariantType(const GVariantType* castitem);
-
+
//TODO: Docuementation
explicit VariantType(const std::string& type_string);
-
+
VariantType& operator=(const GVariantType* castitem);
-
-
+
+
+//The C parameters are actually const, but gmmproc doesn't understand that,
+//so we add a m4 conversion to satisfy it:
+#m4 _CONVERSION(`const VariantType&',`GVariantType*',`($3).gobj()')
_WRAP_METHOD(static VariantType create_array(const VariantType& element), g_variant_type_new_array)
_WRAP_METHOD(static VariantType create_maybe(const VariantType& element), g_variant_type_new_maybe)
-
+
//TODO: Use a single list parameter:
//_WRAP_METHOD(static VariantType create_tuple(const GVariantType * const *items, gint length), g_variant_type_new_tuple)
_WRAP_METHOD(static VariantType create_dict_entry(const VariantType& key, const VariantType& value), g_variant_type_new_dict_entry)
-
+
//TODO: Use something instead of gsize?
_WRAP_METHOD(gsize _get_string_length() const, g_variant_type_get_string_length)
_WRAP_METHOD(std::string get_string() const, g_variant_type_peek_string)
@@ -73,9 +76,9 @@ public:
#m4 _CONVERSION(`const VariantType&',`gconstpointer',`const_cast<GVariantType*>(($3).gobj())')
_WRAP_METHOD(guint hash() const, g_variant_type_hash)
_WRAP_METHOD(bool equal(const VariantType& other) const, g_variant_type_equal)
-
+
_WRAP_METHOD(bool is_subtype_of(const VariantType& supertype) const, g_variant_type_is_subtype_of)
-
+
_WRAP_METHOD(VariantType element() const, g_variant_type_element)
_WRAP_METHOD(VariantType first() const, g_variant_type_first)
_WRAP_METHOD(VariantType next () const, g_variant_type_next)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]