Re: RFC: Glib::Variant

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.


On 4 January 2015 at 17:11, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
I just pushed mostly complete bindings of GVariant and GVariantType:

After installation, rough docs are available via "perldoc
Glib::Variant" and "perldoc Glib::VariantType".  Here is the initial
section of the former:

    Glib::Variant - strongly typed value datatype

      my $v = Glib::Variant->new ('as', ['GTK+', 'Perl']);
      my $aref = $v->get ('as');

    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.

    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


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

[ ] ebassi [ gmail com]

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