Re: Clarification for the application of GVariant/Glib::Variant maybe types



On Fri, 2011-10-07 at 14:54 -0400, José Alburquerque wrote:
> On Fri, 2011-10-07 at 12:54 +0200, Murray Cumming wrote:
> > On Fri, 2011-10-07 at 09:29 +0200, Markus Elfring wrote:
> > > By which (member) function can such a variable be marked to contain an
> > > unknown
> > > value?
> > > (Do I overlook a programming interface once more?)
> > > http://developer.gnome.org/glibmm/2.30/classGlib_1_1VariantBase.html
> > 
> > It looks like we don't have any API yet to create a "maybe"
> > Glib::Variant. The C API is g_variant_new_maybe() but we don't seem to
> > use that yet. I don't know how we would support this in a template
> > specialization.
> 
> One possible way might be to add a create_maybe() method to
> Glib::VariantContainerBase that could use the
> Glib::VariantBase::get_type() method of its children to create the maybe
> type, but I'm not sure it would work.  I guess I can try and add it for
> glibmm-2.32 and see if it works.

Though as you point out, Murray, it isn't as easy as it sounds because a
create method should ideally return the type of the derived class.  I'll
try to give it a little thought and see if something is possible for
2.32.

> 
> > 
> > Note that GVariant generally doesn't have set functions. It's meant to
> > be an invariant type. That probably makes it unsuitable for general use
> > anyway.
> > 
> 

-- 
José



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]