Re: A few comments on GVariant



Hi,

On Mon, 2009-11-30 at 21:08 +0100, Christian Persch wrote:
> schrieb Ryan Lortie <desrt desrt ca>:
> > Note that you can do in-place parsing of:
> > 
> >   "( { 'zero': 0, 'one': 1, 'two': 2 }, '' )"
> > 
> > if you prefer.
> 
> If I have to build the string at runtime, I can just as well use
> GVariantBuilder directly. 

Sorry.  I should have mentioned.  This also works:

g_variant_new_parsed ("{ 'zero': %i, 'one': %i, 'two': %i }", 0, 1, 2);

Where the part after the '%' is any GVariant format string -- the
arguments are collected from the varargs list as if you were using
g_variant_new() with that string.

I hope that makes things nicer.

cheers



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