Re: Function completion for GVariant maybe types?
- From: Markus Elfring <Markus Elfring web de>
- To: Simon McVittie <simon mcvittie collabora co uk>
- Cc: gtk-devel-list gnome org
- Subject: Re: Function completion for GVariant maybe types?
- Date: Tue, 11 Oct 2011 12:12:53 +0200
> If you have a GVariant* variable, you should usually know what type it is already,
> but if not, g_variant_get_type() will tell you.
Is a direct use of a function like "g_variant_type_is_maybe" recommended?
> GVariants are immutable. Once a GVariant instance has been created, you can't
> change its value/contents - you can only throw it away and create a new GVariant.
Thanks for your clarification.
I am still interested in an addition to the interface "g_variant_new_maybe".
> You can reset a (GVariant *) variable to point to a variant representing
> "nothing" the same way you'd make it point to anything else.
I imagine that this approach can be improved a bit.
How do you think about an interface like the following?
GVariant* g_variant_set_to_nothing(GVariant const * gv);
The generated new object will be just marked to contain "nothing" for the type
from the data source.
If the passed instance is a maybe type already, its "container" will be removed
while the contained type will be kept. (I would like to avoid the nesting of a
maybe type into another one.)
Regards,
Markus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]