Re: Construct Glib::VariantContainerBase for "container of container" types?



That's great Jose! So it means that this will be available in gtkmm 3.7?


On Fri, Dec 28, 2012 at 11:32 AM, José Alburquerque <jaalburquerque gmail com> wrote:
On Fri, 2012-12-21 at 17:47 -0800, Andrew Potter wrote:
> On Fri, Dec 21, 2012 at 3:12 PM, Phong Cao <phongvcao phongvcao com>
> wrote:
>         For example, what should "a{sv}" be implemented as in
>         Glib::VariantContainerBase? Should it be
>         Glib::Variant<std::vector<std::map<Glib::ustring,
>         Glib::VariantBase> > >?

That would just be Glib::Variant< std::map< Glib::ustring,
Glib::Variant<T> > with 'T' being the underlying type in the variant.
Using Glib::VariantBase instead of Glib::Variant<T> is possible only
that to get the value in the variant, it has to be cast to the actual
Glib::Variant<T> type.  Of course, none of this is possible presently
without the below mentioned commit.

> Right now it seems that you can only create arrays of basic types
> (int, float, strings) with Glibmm. To create an array of variants,
> you'll need to call a C function:

Yes, the following commit makes it possible to have array of types more
complex than the basic types:

http://git.gnome.org/browse/glibmm/commit/?id=8460377403f9cb02f2fd3972a9dcfa1d978ab7ab

It also adds a Glib::Variant< Glib::Variant<T> > class so that it is
possible to include more complex types in a variant.  See the modified
test as an example of what is possible.


--
José






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