RFC: Glib::Variant



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.


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