GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GLIB::VARIANT (3)

.ds Aq ’

NAME

Glib::Variant - strongly typed value datatype

CONTENTS

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::Variants: 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>

HIERARCHY



  Glib::Variant



METHODS

variant = Glib::Variant->new_array ($child_type, CW$children)

o $child_type (Glib::VariantType)
o $children (scalar)

variant = Glib::Variant->new_boolean ($value)

o $value (boolean)

variant = Glib::Variant->new_byte ($value)

o $value (Glib::UChar)

variant = Glib::Variant->new_bytestring ($string)

o $string (byte string)
Since: glib 2.26

variant = Glib::Variant->new_dict_entry ($key, CW$value)

o $key (Glib::Variant)
o $value (Glib::Variant)

variant = Glib::Variant->new_double ($value)

o $value (double)

variant = Glib::Variant->new_handle ($value)

o $value (integer)

variant = Glib::Variant->new_int16 ($value)

o $value (integer)

variant = Glib::Variant->new_int32 ($value)

o $value (integer)

variant = Glib::Variant->new_int64 ($value)

o $value (64 bit integer)

variant = Glib::Variant->new_maybe ($child_type, CW$child)

o $child_type (Glib::VariantType)
o $child (Glib::Variant)

variant = Glib::Variant->new_object_path ($object_path)

o $object_path (string)

variant = Glib::Variant->new_signature ($signature)

o $signature (string)

variant = Glib::Variant->new_string ($string)

o $string (string)

variant = Glib::Variant->new_tuple ($children)

o $children (scalar)

variant = Glib::Variant->new_uint16 ($value)

o $value (unsigned)

variant = Glib::Variant->new_uint32 ($value)

o $value (unsigned)

variant = Glib::Variant->new_uint64 ($value)

o $value (64 bit unsigned)

variant = Glib::Variant->new_variant ($value)

o $value (Glib::Variant)

boolean = CW$value->get_boolean

uchar = CW$value->get_byte

string = CW$value->get_bytestring

Since: glib 2.26

variant = CW$value->byteswap

variant = CW$value->get_child_value ($index_)

o $index_ (unsigned)

string = CW$value->classify

integer = CW$one->compare ($two)

o $two (Glib::Variant)
Since: glib 2.26

double = CW$value->get_double

boolean = CW$one->equal ($two)

o $two (Glib::Variant)

integer = CW$value->get_handle

integer = CW$value->hash

integer = CW$value->get_int16

integer = CW$value->get_int32

64 bit integer = CW$value->get_int64

boolean = CW$value->is_container

boolean = CW$value->is_normal_form

boolean = CW$string->is_object_path

boolean = CW$value->is_of_type ($type)

o $type (Glib::VariantType)

boolean = CW$string->is_signature

variant = CW$dictionary->lookup_value ($key, CW$expected_type)

o $key (string)
o $expected_type (Glib::VariantType)

variant = CW$value->get_maybe

unsigned = CW$value->n_children

variant = CW$value->get_normal_form

variant = Glib::Variant::parse ($type, CW$text)

o $type (Glib::VariantType)
o $text (string)
May croak with a Glib::Error in $@ on failure.

string = CW$value->print ($type_annotate)

o $type_annotate (boolean)

unsigned = CW$value->get_size

string = CW$value->get_string

varianttype = CW$value->get_type

string = CW$value->get_type_string

unsigned = CW$value->get_uint16

unsigned = CW$value->get_uint32

64 bit unsigned = CW$value->get_uint64

variant = CW$value->get_variant

SEE ALSO

Glib, Glib::VariantType

COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Glib for a full notice.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GLIB::VARIANT (3) 2016-04-05

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.