VariantBuilder.init

Initialises a glib.VariantBuilder structure.

type must be non-NULL. It specifies the type of container to construct. It can be an indefinite type such as G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)". Maybe, array, tuple, dictionary entry and variant-typed values may be constructed.

After the builder is initialised, values are added using Variant.builderAddValue or Variant.builderAdd.

After all the child values are added, Variant.builderEnd frees the memory associated with the builder and returns the glib.Variant that was created.

This function completely ignores the previous contents of builder. On one hand this means that it is valid to pass in completely uninitialised memory. On the other hand, this means that if you are initialising over top of an existing glib.VariantBuilder you need to first call Variant.builderClear in order to avoid leaking memory.

You must not call Variant.builderRef or Variant.builderUnref on a glib.VariantBuilder that was initialised with this function. If you ever pass a reference to a glib.VariantBuilder outside of the control of your own code then you should assume that the person receiving that reference may try to use reference counting; you should use Variant.builderNew instead of this function.

class VariantBuilder
void
init

Parameters

type VariantType

a container type

Meta

Since

2.24