### ----------------------------------------------------
### -- Gnome::Glib
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Glib/Variant.rakumod
### ----------------------------------------------------
### -- Chunk 3 of 4
method lookup-value (
  Str $key, N-GObject $expected_type --> N-GObject
) {
  my $no = $expected_type;
  $no .= _get-native-object-no-reffing unless $no ~~ N-GObject;

  g_variant_lookup_value(
    self._get-native-object-no-reffing, $key, $no
  );
}

sub g_variant_lookup_value (
  N-GObject $dictionary, gchar-ptr $key, N-GObject $expected_type
  --> N-GObject
) is native(&glib-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:0:n-children:
=begin pod
=head2 n-children



  method n-children ( --> UInt )


=end pod

method n-children ( --> UInt ) {

  g_variant_n_children(
    self._get-native-object-no-reffing,
  );
}

sub g_variant_n_children ( N-GObject $value --> gsize )
  is native(&glib-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_g_variant_parse:
#`{{
=begin pod
=head2 parse

Parses a GVariant from a text representation.

In the event that the parsing is successful, the resulting GVariant is returned.

In case of any error, NULL will be returned. If error is non-NULL then it will be set to reflect the error that occurred.

There may be implementation specific restrictions on deeply nested values, which would result in a G_VARIANT_PARSE_ERROR_RECURSION error. GVariant is guaranteed to handle nesting up to at least 64 levels.

  method g_variant_parse ( Str $type-string, Str $text --> List )

=item Str $type-string; String like it is used to create a Gnome::Glib::VariantType. May be undefined.
=item Str $text; Textual representation of data.

The returned List has members
=item N-GObject object. A native variant object
=item Gnome::Glib::Error. The error object. Test for C<.is-valid() ~~ False> to see if parsing went ok and that the variant object is defined.

=end pod
}}

sub _g_variant_parse ( Str :$type-string = '', Str:D :$parse --> List ) {

  my N-GObject $nvt;
  if ?$type-string {
    $nvt = Gnome::Glib::VariantType.new(
      :$type-string
    )._get-native-object-no-reffing;
  }

  else {
    $nvt = N-GObject;
  }

  my Gnome::Glib::Error $parse-error;
  my CArray[N-GError] $ne .= new(N-GError);
  my N-GObject $v = g_variant_parse( $nvt, $parse, Str, gchar-pptr, $ne);

  if ?$v {
    $parse-error = Gnome::Glib::Error.new(:native-object(N-GError))
  }

  else {
    $parse-error = Gnome::Glib::Error.new(:native-object($ne[0]))
  }

  ( $v, $parse-error)
}

sub g_variant_parse (
  N-GObject $type, gchar-ptr $text, gchar-ptr $limit,
  gchar-pptr $endptr, CArray[N-GError] $error --> N-GObject
) is native(&glib-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:0:parse-error-print-context:
=begin pod
=head2 parse-error-print-context



  method parse-error-print-context ( N-GError $error,  Str  $source_str -->  Str  )

=item N-GError $error;
=item  Str  $source_str;

=end pod

method parse-error-print-context ( N-GError $error,  Str  $source_str -->  Str  ) {

  g_variant_parse_error_print_context(
    self._get-native-object-no-reffing, $error, $source_str
  );
}

sub g_variant_parse_error_print_context ( N-GError $error, gchar-ptr $source_str --> gchar-ptr )
  is native(&glib-lib)
  { * }
}}
#`{{
#-------------------------------------------------------------------------------
# TM:0:parse-error-quark:
=begin pod
=head2 parse-error-quark

Error domain for GVariant text format parsing. Specific error codes are not currently defined for this domain. See GError for information on error

  method parse-error-quark ( --> UInt )


=end pod

method parse-error-quark ( --> UInt ) {

  g_variant_parse_error_quark(
    self._get-native-object-no-reffing,
  );
}

sub g_variant_parse_error_quark (  --> GQuark )
  is native(&glib-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:print:
=begin pod
=head2 print

Pretty-prints I<value> in the format understood by C<parse()>. If I<$type_annotate> is C<True>, then type information is included in the output.

Returns: a newly-allocated string holding the result.

  method print ( Bool $type_annotate = False --> Str )

=item Int $type_annotate; C<True> if type information should be included in the output

=end pod

method print ( Bool $type_annotate = False --> Str ) {

  g_variant_print(
    self._get-native-object-no-reffing, $type_annotate.Int
  );
}

sub g_variant_print ( N-GObject $value, gboolean $type_annotate --> gchar-ptr )
  is native(&glib-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:0:print-string:
=begin pod
=head2 print-string

Behaves as C<g_variant_print()>, but operates on a B<GString>.  If I<string> is non-C<Any> then it is appended to and returned.  Else, a new empty B<GString> is allocated and it is returned.

Returns: a B<GString> containing the string

  method print-string ( N-GObject $string, Int $type_annotate --> N-GObject )

=item N-GObject $string; (nullable) (default NULL): a B<GString>, or C<Any>
=item Int $type_annotate; C<1> if type information should be included in the output

=end pod

method print-string ( $string, Int $type_annotate --> N-GObject ) {
  my $no = …;
  $no .= _get-native-object-no-reffing unless $no ~~ N-GObject;

  g_variant_print_string(
    self._get-native-object-no-reffing, $string, $type_annotate
  );
}

sub g_variant_print_string ( N-GObject $value, N-GObject $string, gboolean $type_annotate --> N-GObject )
  is native(&glib-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_g_variant_ref:
sub _g_variant_ref ( N-GObject $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_ref')
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:ref-sink:
=begin pod
=head2 ref-sink

  method ref-sink ( --> N-GObject )


=end pod

method ref-sink ( --> N-GObject ) {

  g_variant_ref_sink(
    self._get-native-object-no-reffing,
  );
}

sub g_variant_ref_sink ( N-GObject $value --> N-GObject )
  is native(&glib-lib)
  { * }
}}
#`{{
#-------------------------------------------------------------------------------
# TM:0:store:
=begin pod
=head2 store

  method store ( Pointer $data )

=item Pointer $data;

=end pod

method store ( Pointer $data ) {

  g_variant_store(
    self._get-native-object-no-reffing, $data
  );
}

sub g_variant_store ( N-GObject $value, gpointer $data  )
  is native(&glib-lib)
  { * }
}}
#`{{
#-------------------------------------------------------------------------------
#TM:0:take-ref:
=begin pod
=head2 take-ref

  method take-ref ( --> N-GObject )

=end pod

method take-ref ( --> N-GObject ) {

  g_variant_take_ref(
    self._get-native-object-no-reffing,
  );
}

sub g_variant_take_ref ( N-GObject $value --> N-GObject )
  is native(&glib-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_g_variant_unref:
sub _g_variant_unref ( N-GObject $value  )
  is native(&glib-lib)
  is symbol('g_variant_unref')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new:
#`{{
=begin pod
=head2 _g_variant_new

  method _g_variant_new (  Str  $format_string --> N-GObject )

=item  Str  $format_string;

=end pod
}}

sub _g_variant_new ( Str $type-string, *@values --> N-GObject ) {

  my @parameterList = ();
  @parameterList.push: Parameter.new(type => Str);         # $type_string

  my @n-values = ();
  my Bool $in-array = False;
  my Bool $in-tupple = False;
  my Bool $in-dict = False;

#note "call val: ", @values.perl;
  for $type-string.split('') {
#note "ts: $_";

    # split returns empty strings on either side -> ignore these
    when '' { }

    # Used for building or deconstructing boolean, byte and numeric types.
    when G_VARIANT_CLASS_BOOLEAN {
      @parameterList.push: Parameter.new(type => int32) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_BYTE {
      @parameterList.push: Parameter.new(type => int8) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_INT16 {
      @parameterList.push: Parameter.new(type => int16) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_UINT16 {
      @parameterList.push: Parameter.new(type => uint16) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_INT32 {
      @parameterList.push: Parameter.new(type => int32) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_UINT32 {
      @parameterList.push: Parameter.new(type => uint32) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_INT64 {
      @parameterList.push: Parameter.new(type => int64) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    when G_VARIANT_CLASS_UINT64 {
      @parameterList.push: Parameter.new(type => uint64) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

#`{{
    when G_VARIANT_CLASS_HANDLE {
      @parameterList.push: Parameter.new(type => int32);
      @n-values.push: shift @values;
    }
}}

    when G_VARIANT_CLASS_DOUBLE {
      @parameterList.push: Parameter.new(type => num64) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }

    # Used for building or deconstructing string types.
    when G_VARIANT_CLASS_STRING {
      @parameterList.push: Parameter.new(type => Str) unless $in-array;
      @n-values.push: shift @values unless $in-array;
    }


#`{{

    when G_VARIANT_CLASS_OBJECT_PATH {
      @parameterList.push: Parameter.new(type => Str);
      @n-values.push: shift @values;
    }

    when G_VARIANT_CLASS_SIGNATURE {
      @parameterList.push: Parameter.new(type => Str);
      @n-values.push: shift @values;
    }

    # Used for building or deconstructing variant types
    when G_VARIANT_CLASS_VARIANT {
      @parameterList.push: Parameter.new(type => Pointer);
      @n-values.push: shift @values;
    }

    # Used for building or deconstructing maybe types
    when G_VARIANT_CLASS_MAYBE {
      @n-values.push: shift @values;
    }
}}
#`{{

    # Used for building or deconstructing arrays
    when G_VARIANT_CLASS_ARRAY {
      @n-values.push: shift @values;
      $in-array = True;
    }

}}
#`{{
    # Used for building or deconstructing tuples
    when G_VARIANT_CLASS_TUPLE {
      @n-values.push: shift @values;
    }

    #
    when ')' {
    }

    #Used for building or deconstructing dictionary entries
    when G_VARIANT_CLASS_DICT_ENTRY {
      @n-values.push: shift @values;
    }

    when '}' {
    }

    # Used as a prefix for a GVariant type string (not a prefix for a format
    # string, so @as is a valid format string but @^as is not). Denotes that a
    # pointer to a GVariant should be used in place of the normal C type or
    # types.
    when '@' {
    }

    # Equivalent to @*, @? and @r
    when '*' {
    }

    when '?' {
    }

    when 'r' {
    }

    # Used as a prefix for a GVariant type string (not a prefix for a format
    # string, so &s is a valid format string but &@s is not). Denotes that a C
    # pointer to serialised data should be used in place of the normal C type.
    when '&' {
    }

    # Used as a prefix on some specific types of format strings.
    when '^' {
    }
}}
    default {
      die X::Gnome.new(:message("Format character '$_' not yet supported"))
    }
  }

  # create signature
  my Signature $signature .= new(
    :params(|@parameterList),
    :returns(N-GObject)
  );

  # get a pointer to the sub, then cast it to a sub with the proper
  # signature. after that, the sub can be called, returning a value.
  state $ptr = cglobal( &glib-lib, 'g_variant_new', Pointer);
  my Callable $f = nativecast( $signature, $ptr);

#note "Val: ", @n-values.perl;
#note "Sig: ", $signature.perl;

  $f( $type-string, |@n-values)
}

#sub _g_variant_new ( gchar-ptr $format_string, Any $any = Any --> N-GObject )
#  is native(&glib-lib)
#  is symbol('g_variant_new')
#  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_array:
#`{{
=begin pod
=head2 _g_variant_new_array

Creates a new B<N-GObject> array from I<children>.  I<child_type> must be non-C<Any> if I<n_children> is zero.  Otherwise, the child type is determined by inspecting the first element of the I<children> array.  If I<child_type> is non-C<Any> then it must be a definite type.  The items of the array are taken from the I<children> array.  No entry in the I<children> array may be C<Any>.  All items in the array must have the same type, which must be the same as I<child_type>, if given.  If the I<children> are floating references (see C<g_variant_ref_sink()>), the new instance takes ownership of them as if via C<g_variant_ref_sink()>.

Returns: (transfer none): a floating reference to a new B<N-GObject> array

  method _g_variant_new_array ( N-GObject $child_type,  $GVariant * const *children, UInt $n_children --> N-GObject )

=item N-GObject $child_type; (nullable): the element type of the new array
=item  $GVariant * const *children; (nullable) (array length=n_children): an array of B<N-GObject> pointers, the children
=item UInt $n_children; the length of I<children>

=end pod
}}

sub _g_variant_new_array (
  N-GObject $child_type, CArray[N-GObject] $children,
  gsize $n_children --> N-GObject
) is native(&glib-lib)
  is symbol('g_variant_new_array')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_boolean:
#`{{
=begin pod
=head2 _g_variant_new_boolean

Creates a new boolean B<N-GObject> instance -- either C<1> or C<0>.

Returns: (transfer none): a floating reference to a new boolean B<N-GObject> instance

  method _g_variant_new_boolean ( Int $value --> N-GObject )

=item Int $value; a B<gboolean> value

=end pod
}}

sub _g_variant_new_boolean ( gboolean $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_boolean')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_byte:
#`{{
=begin pod
=head2 _g_variant_new_byte

Creates a new byte B<N-GObject> instance.

Returns: (transfer none): a floating reference to a new byte B<N-GObject> instance

  method _g_variant_new_byte ( UInt $value --> N-GObject )

=item UInt $value; a B<guint8> value

=end pod
}}

sub _g_variant_new_byte ( guint8 $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_byte')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_bytestring:
#`{{
=begin pod
=head2 _g_variant_new_bytestring

Creates an array-of-bytes B<N-GObject> with the contents of I<string>. This function is just like C<g_variant_new_string()> except that the string need not be valid UTF-8.  The nul terminator character at the end of the string is stored in the array.

Returns: (transfer none): a floating reference to a new bytestring B<N-GObject> instance

  method _g_variant_new_bytestring (  Str  $string --> N-GObject )

=item  Str  $string; (array zero-terminated=1) (element-type guint8): a normal nul-terminated string in no particular encoding

=end pod
}}

sub _g_variant_new_bytestring ( gchar-ptr $string --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_bytestring')
  { * }


#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_bytestring_array:
#`{{
=begin pod
=head2 _g_variant_new_bytestring_array

Constructs an array of bytestring B<N-GObject> from the given array of strings.  If I<length> is -1 then I<strv> is C<Any>-terminated.

Returns: (transfer none): a new floating B<N-GObject> instance

  method _g_variant_new_bytestring_array (  CArray[Str]  $strv, Int $length --> N-GObject )

=item  CArray[Str]  $strv; (array length=length): an array of strings
=item Int $length; the length of I<strv>, or -1

=end pod
}}

sub _g_variant_new_bytestring_array (
  gchar-pptr $strv, gssize $length --> N-GObject
) is native(&glib-lib)
  is symbol('g_variant_new_bytestring_array')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_dict_entry:
#`{{

=begin pod
=head2 dict-entry

Creates a new dictionary entry B<Gnome::Glib::VariantDict>. I<key> and I<value> must be defined. I<key> must be a value of a basic type (ie: not a container).

=comment  If the I<key> or I<value> are floating references (see C<g_variant_ref_sink()>), the new instance takes ownership of them as if via C<g_variant_ref_sink()>.

Returns: a floating reference to a new dictionary entry B<Gnome::Glib::VariantDict>

  method _g_variant_new_dict_entry ( N-GObject $key, N-GObject $value --> N-GObject )

=item N-GObject $value; a B<Gnome::Glib::VariantDict>, the value

=end pod
}}

sub _g_variant_new_dict_entry (
  N-GObject $key, N-GObject $value --> N-GObject
) is native(&glib-lib)
  is symbol('g_variant_new_dict_entry')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_double:
#`{{
=begin pod
=head2 _g_variant_new_double

Creates a new double B<N-GObject> instance.

Returns: (transfer none): a floating reference to a new double B<N-GObject> instance

  method _g_variant_new_double ( Num $value --> N-GObject )

=item Num $value; a B<gdouble> floating point value

=end pod
}}

sub _g_variant_new_double ( gdouble $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_double')
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_fixed_array:
#`{{
=begin pod
=head2 _g_variant_new_fixed_array

Constructs a new array B<N-GObject> instance, where the elements are of I<element_type> type.  I<elements> must be an array with fixed-sized elements.  Numeric types are fixed-size as are tuples containing only other fixed-sized types.  I<element_size> must be the size of a single element in the array. For example, if calling this function for an array of 32-bit integers, you might say sizeof(gint32). This value isn't used except for the purpose of a double-check that the form of the serialised data matches the caller's expectation.  I<n_elements> must be the length of the I<elements> array.

Returns: (transfer none): a floating reference to a new array B<N-GObject> instance

  method _g_variant_new_fixed_array ( N-GObject $element_type, Pointer $elements, UInt $n_elements, UInt $element_size --> N-GObject )

=item N-GObject $element_type; the B<GVariantType> of each element
=item Pointer $elements; a pointer to the fixed array of contiguous elements
=item UInt $n_elements; the number of elements
=item UInt $element_size; the size of each element

=end pod
}}

sub _g_variant_new_fixed_array ( N-GObject $element_type, gpointer $elements, gsize $n_elements, gsize $element_size --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_fixed_array')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_from_bytes:
#`{{
=begin pod
=head2 _g_variant_new_from_bytes



  method _g_variant_new_from_bytes ( N-GObject $type, N-GBytes $bytes, Int $trusted --> N-GObject )

=item N-GObject $type;
=item N-GObject $bytes;
=item Int $trusted;

=end pod
}}

sub _g_variant_new_from_bytes ( N-GObject $type, N-GBytes $bytes, gboolean $trusted --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_from_bytes')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_from_data:
#`{{
=begin pod
=head2 _g_variant_new_from_data

Creates a new B<N-GObject> instance from serialised data.  I<type> is the type of B<N-GObject> instance that will be constructed. The interpretation of I<data> depends on knowing the type.  I<data> is not modified by this function and must remain valid with an unchanging value until such a time as I<notify> is called with I<user_data>.  If the contents of I<data> change before that time then the result is undefined.  If I<data> is trusted to be serialised data in normal form then I<trusted> should be C<1>.  This applies to serialised data created within this process or read from a trusted location on the disk (such as a file installed in /usr/lib alongside your application).  You should set trusted to C<0> if I<data> is read from the network, a file in the user's home directory, etc.  If I<data> was not stored in this machine's native endianness, any multi-byte numeric values in the returned variant will also be in non-native endianness. C<g_variant_byteswap()> can be used to recover the original values.  I<notify> will be called with I<user_data> when I<data> is no longer needed.  The exact time of this call is unspecified and might even be before this function returns.  Note: I<data> must be backed by memory that is aligned appropriately for the I<type> being loaded. Otherwise this function will internally create a copy of the memory (since GLib 2.60) or (in older versions) fail and exit the process.

Returns: (transfer none): a new floating B<N-GObject> of type I<type>

  method _g_variant_new_from_data ( N-GObject $type, Pointer $data, UInt $size, Int $trusted, GDestroyNotify $notify, Pointer $user_data --> N-GObject )

=item N-GObject $type; a definite B<GVariantType>
=item Pointer $data; (array length=size) (element-type guint8): the serialised data
=item UInt $size; the size of I<data>
=item Int $trusted; C<1> if I<data> is definitely in normal form
=item GDestroyNotify $notify; (scope async): function to call when I<data> is no longer needed
=item Pointer $user_data; data for I<notify>

=end pod
}}

sub _g_variant_new_from_data ( N-GObject $type, gpointer $data, gsize $size, gboolean $trusted, GDestroyNotify $notify, gpointer $user_data --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_from_data')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_handle:
#`{{
=begin pod
=head2 _g_variant_new_handle

Creates a new handle B<N-GObject> instance.  By convention, handles are indexes into an array of file descriptors that are sent alongside a D-Bus message.  If you're not interacting with D-Bus, you probably don't need them.

Returns: (transfer none): a floating reference to a new handle B<N-GObject> instance

  method _g_variant_new_handle ( Int $value --> N-GObject )

=item Int $value; a B<gint32> value

=end pod
}}

sub _g_variant_new_handle ( gint32 $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_handle')
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_int16:
#`{{
=begin pod
=head2 _g_variant_new_int16

Creates a new int16 B<N-GObject> instance.

Returns: (transfer none): a floating reference to a new int16 B<N-GObject> instance

  method _g_variant_new_int16 ( Int $value --> N-GObject )

=item Int $value; a B<gint16> value

=end pod
}}

sub _g_variant_new_int16 ( gint16 $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_int16')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_int32:
#`{{
=begin pod
=head2 _g_variant_new_int32

Creates a new int32 B<N-GObject> instance.

Returns: (transfer none): a floating reference to a new int32 B<N-GObject> instance

  method _g_variant_new_int32 ( Int $value --> N-GObject )

=item Int $value; a B<gint32> value

=end pod
}}

sub _g_variant_new_int32 ( gint32 $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_int32')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_int64:
#`{{
=begin pod
=head2 _g_variant_new_int64

Creates a new int64 B<N-GObject> instance.

Returns: (transfer none): a floating reference to a new int64 B<N-GObject> instance

  method _g_variant_new_int64 ( Int $value --> N-GObject )

=item Int $value; a B<gint64> value

=end pod
}}

sub _g_variant_new_int64 ( gint64 $value --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_int64')
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_maybe:
#`{{
=begin pod
=head2 _g_variant_new_maybe

Depending on if I<child> is C<Any>, either wraps I<child> inside of a maybe container or creates a Nothing instance for the given I<type>.  At least one of I<child_type> and I<child> must be non-C<Any>. If I<child_type> is non-C<Any> then it must be a definite type. If they are both non-C<Any> then I<child_type> must be the type of I<child>.  If I<child> is a floating reference (see C<g_variant_ref_sink()>), the new instance takes ownership of I<child>.

Returns: (transfer none): a floating reference to a new B<N-GObject> maybe instance

  method _g_variant_new_maybe ( N-GObject $child_type, N-GObject $child --> N-GObject )

=item N-GObject $child_type; (nullable): the B<GVariantType> of the child, or C<Any>
=item N-GObject $child; (nullable): the child value, or C<Any>

=end pod
}}

sub _g_variant_new_maybe ( N-GObject $child_type, N-GObject $child --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_maybe')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_object_path:
#`{{
=begin pod
=head2 _g_variant_new_object_path

Creates a D-Bus object path B<N-GObject> with the contents of I<string>. I<string> must be a valid D-Bus object path.  Use C<g_variant_is_object_path()> if you're not sure.

Returns: (transfer none): a floating reference to a new object path B<N-GObject> instance

  method _g_variant_new_object_path (  Str  $object_path --> N-GObject )

=item  Str  $object_path; a normal C nul-terminated string

=end pod
}}

sub _g_variant_new_object_path ( gchar-ptr $object_path --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_object_path')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_objv:
#`{{
=begin pod
=head2 _g_variant_new_objv

Constructs an array of object paths B<N-GObject> from the given array of strings.  Each string must be a valid B<N-GObject> object path; see C<g_variant_is_object_path()>.  If I<length> is -1 then I<strv> is C<Any>-terminated.

Returns: (transfer none): a new floating B<N-GObject> instance

  method _g_variant_new_objv (  CArray[Str]  $strv, Int $length --> N-GObject )

=item  CArray[Str]  $strv; (array length=length) (element-type utf8): an array of strings
=item Int $length; the length of I<strv>, or -1

=end pod
}}

sub _g_variant_new_objv ( gchar-pptr $strv, gssize $length --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_objv')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_parsed:
#`{{
=begin pod
=head2 _g_variant_new_parsed



  method _g_variant_new_parsed (  Str  $format --> N-GObject )

=item  Str  $format;

=end pod
}}

sub _g_variant_new_parsed ( gchar-ptr $format, Any $any = Any --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_parsed')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_parsed_va:
#`{{
=begin pod
=head2 _g_variant_new_parsed_va



  method _g_variant_new_parsed_va (  Str  $format, va_list $app --> N-GObject )

=item  Str  $format;
=item va_list $app;

=end pod
}}

sub _g_variant_new_parsed_va ( gchar-ptr $format, va_list $app --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_parsed_va')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_printf:
#`{{
=begin pod
=head2 _g_variant_new_printf

Creates a string-type GVariant using printf formatting.  This is similar to calling C<g_strdup_printf()> and then C<g_variant_new_string()> but it saves a temporary variable and an unnecessary copy.

Returns: (transfer none): a floating reference to a new string B<N-GObject> instance

  method _g_variant_new_printf (  Str  $format_string,  $2 --> N-GObject )

=item  Str  $format_string; a printf-style format string @...: arguments for I<format_string>
=item  $2;

=end pod
}}

sub _g_variant_new_printf ( gchar-ptr $format_string, Any $any = Any,  $2 --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_printf')
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
#TM:0:_g_variant_new_signature:
#`{{
=begin pod
=head2 _g_variant_new_signature

Creates a D-Bus type signature B<N-GObject> with the contents of I<string>.  I<string> must be a valid D-Bus type signature.  Use C<g_variant_is_signature()> if you're not sure.

Returns: (transfer none): a floating reference to a new signature B<N-GObject> instance

  method _g_variant_new_signature (  Str  $signature --> N-GObject )

=item  Str  $signature; a normal C nul-terminated string

=end pod
}}

sub _g_variant_new_signature ( gchar-ptr $signature --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_signature')
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_string:
#`{{
=begin pod
=head2 _g_variant_new_string

Creates a string B<N-GObject> with the contents of I<string>.  I<string> must be valid UTF-8, and must not be C<Any>. To encode potentially-C<Any> strings, use C<g_variant_new()> with `ms` as the [format string][gvariant-format-strings-maybe-types].

Returns: (transfer none): a floating reference to a new string B<N-GObject> instance

  method _g_variant_new_string (  Str  $string --> N-GObject )

=item  Str  $string; a normal UTF-8 nul-terminated string

=end pod
}}

sub _g_variant_new_string ( gchar-ptr $string --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_string')
  { * }

#-------------------------------------------------------------------------------
#TM:1:_g_variant_new_strv:
#`{{
=begin pod
=head2 _g_variant_new_strv

Constructs an array of strings B<N-GObject> from the given array of strings.  If I<length> is -1 then I<strv> is C<Any>-terminated.

Returns: (transfer none): a new floating B<N-GObject> instance

  method _g_variant_new_strv (  CArray[Str]  $strv, Int $length --> N-GObject )

=item  CArray[Str]  $strv; (array length=length) (element-type utf8): an array of strings
=item Int $length; the length of I<strv>, or -1

=end pod
}}

sub _g_variant_new_strv ( gchar-pptr $strv, gssize $length --> N-GObject )
  is native(&glib-lib)
  is symbol('g_variant_new_strv')
  { * }

#`{{
#-------------------------------------------------------------------------------
# TM:1:_g_variant_new_take_string:
#`{{
=begin pod
=head2 _g_variant_new_take_string

Creates a string B<N-GObject> with the contents of I<string>.  I<string> must be valid UTF-8, and must not be C<Any>. To encode potentially-C<Any> strings