Re: RFC: Glib::Variant
- From: Emmanuele Bassi <ebassi gmail com>
- To: Torsten Schoenfeld <kaffeetisch gmx de>
- Cc: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: RFC: Glib::Variant
- Date: Sun, 4 Jan 2015 17:24:32 +0000
hi Torsten;
this is brilliant, and looks fairly complete already.
since GApplication uses GVariantDict in its command line arguments
API, I wonder if we'd need a Glib::VariantDict wrapper as well, or
maybe an automatic translation to an hashref.
GVariantIter and GVariantBuilder are also the most used types when
dealing with GDBus code.
ciao,
Emmanuele.
On 4 January 2015 at 17:11, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
I just pushed mostly complete bindings of GVariant and GVariantType:
<https://git.gnome.org/browse/perl-Glib/commit/?id=d0c52b8bb864a3377403623589f1c0cd8482717b>.
After installation, rough docs are available via "perldoc
Glib::Variant" and "perldoc Glib::VariantType". Here is the initial
section of the former:
--------------------------------------------------------------------
NAME
Glib::Variant - strongly typed value datatype
SYNOPSIS
my $v = Glib::Variant->new ('as', ['GTK+', 'Perl']);
my $aref = $v->get ('as');
DESCRIPTION
There are two sets of APIs for creating and dealing with
"Glib::Variant"s: the low-level API described below under
"METHODS", and the convenience API described in this section.
CONVENIENCE API
variant = Glib::Variant->new ($format_string, $value)
(variant1, ...) = Glib::Variant->new ($format_string, $value1, ...)
Constructs a variant from $format_string and $value. Also
supports constructing multiple variants when the format string
is a concatenation of multiple types.
value = $variant->get ($format_string)
Deconstructs $variant according to $format_string.
The following symbols are currently supported in format strings:
+------------------------------+---------------------------------+
| Symbol | Meaning |
+------------------------------+---------------------------------+
| b, y, n, q, i, u, x, t, h, d | Boolean, byte and numeric types |
| s, o, g | String types |
| v | Variant types |
| a | Arrays |
| m | Maybe types |
| () | Tuples |
| {} | Dictionary entries |
+------------------------------+---------------------------------+
Note that if a format string specifies an array, a tuple or a
dictionary entry ("a", "()" or "{}"), then array references are
expected by "new" and produced by "get". For arrays of dictionary
entries ("a{}"), hash references are also supported by "new" and
handled as you would expect.
For a complete specification, see the documentation at
<https://developer.gnome.org/glib/stable/glib-GVariantType.html>
<https://developer.gnome.org/glib/stable/glib-GVariant.html>
<https://developer.gnome.org/glib/stable/gvariant-format-strings.html>
<https://developer.gnome.org/glib/stable/gvariant-text.html>
--------------------------------------------------------------------
Please try this new code and let me know what you think, especially if
anything is missing.
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
--
https://www.bassi.io
[ ] ebassi [ gmail com]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]