summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2011-03-16 12:07:01 +0100
committerMurray Cumming <murrayc@murrayc.com>2011-03-16 12:07:01 +0100
commit3f08a14a7228adf5540adbc4e84074979a27d47a (patch)
treeb2827d2c3cf93ec3beabf783351a65e49acc4795
parent6909698eab565ba3b2442263959ebab1737eb964 (diff)
downloadglibmm-3f08a14a7228adf5540adbc4e84074979a27d47a.tar.gz
Gio::Variant: Add some get() method overloads.
* glib/src/variant.[hg|ccg]: Variant<VariantBase>: Add a get(VariantBase&) along with the existing VariantBase get(). VariantContainerBase: Added a VariantBase get() to match the existing get(VariantBase&). Both seem useful, particularly now that we can cast_dynamic them. VariantContainerBase::get() should maybe be renamed to get_child() too.
-rw-r--r--ChangeLog12
-rw-r--r--glib/src/variant.ccg6
-rw-r--r--glib/src/variant.hg5
3 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cbb30a38..eca20cd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2011-03-16 Murray Cumming <murrayc@murrayc.com>
+ Gio::Variant: Add some get() method overloads.
+
+ * glib/src/variant.[hg|ccg]: Variant<VariantBase>: Add a get(VariantBase&)
+ along with the existing VariantBase get().
+ VariantContainerBase: Added a VariantBase get() to match the existing
+ get(VariantBase&). Both seem useful, particularly now that we can
+ cast_dynamic them.
+
+ VariantContainerBase::get() should maybe be renamed to get_child() too.
+
+2011-03-16 Murray Cumming <murrayc@murrayc.com>
+
Dbus::Proxy: properties_changed signal: Avoid namespace qualifiers in header.
* gio/src/dbusproxy.[h|ccg]: Add a typedef to the .ccg file to help the
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index 07cc5186..39b88e04 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -152,6 +152,12 @@ Variant<VariantBase> Variant<VariantBase>::create(const VariantBase& data)
return result;
}
+void Variant<VariantBase>::get(Glib::VariantBase& variant) const
+{
+ GVariant* const gvariant = g_variant_get_variant(gobject_);
+ variant.init(gvariant);
+}
+
// static
const VariantType& Variant<Glib::ustring>::variant_type()
{
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 9cb1a9e9..7ed7d803 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -263,6 +263,8 @@ public:
void get(Glib::VariantBase& child, gsize index = 0) const;
_IGNORE(g_variant_get_child, g_variant_get_child_value)
+ _WRAP_METHOD(VariantBase get(gsize index = 0), g_variant_get_child_value)
+
/* TODO?:
/// A get() method to return the contents of the variant in the container.
template <class DataType>
@@ -349,6 +351,9 @@ public:
static Variant<VariantBase> create(const Glib::VariantBase& data);
_IGNORE(g_variant_new_variant)
+ //TODO: Documentation
+ void get(Glib::VariantBase& variant) const;
+
_WRAP_METHOD(VariantBase get() const, g_variant_get_variant)
};