diff options
Diffstat (limited to 'glib/src')
-rw-r--r-- | glib/src/variant.ccg | 17 | ||||
-rw-r--r-- | glib/src/variant.hg | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index c002c14d..8dc5ad80 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -23,6 +23,23 @@ namespace Glib { +VariantBase::VariantBase(GVariant* castitem, bool make_a_copy /* = false */) +{ + if (castitem) + { + if (g_variant_is_floating(castitem)) + { + g_variant_ref_sink (castitem); + } + if (make_a_copy) + { + g_variant_ref (castitem); + } + } + + gobject_ = castitem; +} + void VariantBase::get_normal_form(VariantBase& result) const { GVariant* const g_value = diff --git a/glib/src/variant.hg b/glib/src/variant.hg index d1892cc4..1433fe3a 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -82,10 +82,13 @@ namespace Glib class VariantBase { _CLASS_OPAQUE_COPYABLE(VariantBase, GVariant, NONE, g_variant_ref_sink, g_variant_unref) + _CUSTOM_CTOR_CAST _IGNORE(g_variant_ref, g_variant_ref_sink, g_variant_unref, g_variant_get, g_variant_get_va) public: + VariantBase(GVariant* castitem, bool make_a_copy = false); + /** Replace the underlying GVariant. * This is for use by methods that take a VariantBase& as an output * parameter. |