v0.2.2 9100209

gvariant.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GVariant` is a variant datatype; it can contain one or more values
15// along with information about the type of the values.
16//
17// A `GVariant` may contain simple types, like an integer, or a boolean value;
18// or complex types, like an array of two strings, or a dictionary of key
19// value pairs. A `GVariant` is also immutable: once it’s been created neither
20// its type nor its content can be modified further.
21//
22// `GVariant` is useful whenever data needs to be serialized, for example when
23// sending method parameters in D-Bus, or when saving settings using
24// [`GSettings`](../gio/class.Settings.html).
25//
26// When creating a new `GVariant`, you pass the data you want to store in it
27// along with a string representing the type of data you wish to pass to it.
28//
29// For instance, if you want to create a `GVariant` holding an integer value you
30// can use:
31//
32// ```c
33// GVariant *v = g_variant_new ("u", 40);
34// ```
35//
36// The string `u` in the first argument tells `GVariant` that the data passed to
37// the constructor (`40`) is going to be an unsigned integer.
38//
39// More advanced examples of `GVariant` in use can be found in documentation for
40// [`GVariant` format strings](gvariant-format-strings.html#pointers).
41//
42// The range of possible values is determined by the type.
43//
44// The type system used by `GVariant` is [type@GLib.VariantType].
45//
46// `GVariant` instances always have a type and a value (which are given
47// at construction time).  The type and value of a `GVariant` instance
48// can never change other than by the `GVariant` itself being
49// destroyed.  A `GVariant` cannot contain a pointer.
50//
51// `GVariant` is reference counted using [method@GLib.Variant.ref] and
52// [method@GLib.Variant.unref].  `GVariant` also has floating reference counts —
53// see [method@GLib.Variant.ref_sink].
54//
55// `GVariant` is completely threadsafe.  A `GVariant` instance can be
56// concurrently accessed in any way from any number of threads without
57// problems.
58//
59// `GVariant` is heavily optimised for dealing with data in serialized
60// form.  It works particularly well with data located in memory-mapped
61// files.  It can perform nearly all deserialization operations in a
62// small constant time, usually touching only a single memory page.
63// Serialized `GVariant` data can also be sent over the network.
64//
65// `GVariant` is largely compatible with D-Bus.  Almost all types of
66// `GVariant` instances can be sent over D-Bus.  See [type@GLib.VariantType] for
67// exceptions.  (However, `GVariant`’s serialization format is not the same
68// as the serialization format of a D-Bus message body: use
69// [GDBusMessage](../gio/class.DBusMessage.html), in the GIO library, for those.)
70//
71// For space-efficiency, the `GVariant` serialization format does not
72// automatically include the variant’s length, type or endianness,
73// which must either be implied from context (such as knowledge that a
74// particular file format always contains a little-endian
75// `G_VARIANT_TYPE_VARIANT` which occupies the whole length of the file)
76// or supplied out-of-band (for instance, a length, type and/or endianness
77// indicator could be placed at the beginning of a file, network message
78// or network stream).
79//
80// A `GVariant`’s size is limited mainly by any lower level operating
81// system constraints, such as the number of bits in `gsize`.  For
82// example, it is reasonable to have a 2GB file mapped into memory
83// with [struct@GLib.MappedFile], and call [ctor@GLib.Variant.new_from_data] on
84// it.
85//
86// For convenience to C programmers, `GVariant` features powerful
87// varargs-based value construction and destruction.  This feature is
88// designed to be embedded in other libraries.
89//
90// There is a Python-inspired text language for describing `GVariant`
91// values.  `GVariant` includes a printer for this language and a parser
92// with type inferencing.
93//
94// ## Memory Use
95//
96// `GVariant` tries to be quite efficient with respect to memory use.
97// This section gives a rough idea of how much memory is used by the
98// current implementation.  The information here is subject to change
99// in the future.
100//
101// The memory allocated by `GVariant` can be grouped into 4 broad
102// purposes: memory for serialized data, memory for the type
103// information cache, buffer management memory and memory for the
104// `GVariant` structure itself.
105//
106// ## Serialized Data Memory
107//
108// This is the memory that is used for storing `GVariant` data in
109// serialized form.  This is what would be sent over the network or
110// what would end up on disk, not counting any indicator of the
111// endianness, or of the length or type of the top-level variant.
112//
113// The amount of memory required to store a boolean is 1 byte. 16,
114// 32 and 64 bit integers and double precision floating point numbers
115// use their ‘natural’ size.  Strings (including object path and
116// signature strings) are stored with a nul terminator, and as such
117// use the length of the string plus 1 byte.
118//
119// ‘Maybe’ types use no space at all to represent the null value and
120// use the same amount of space (sometimes plus one byte) as the
121// equivalent non-maybe-typed value to represent the non-null case.
122//
123// Arrays use the amount of space required to store each of their
124// members, concatenated.  Additionally, if the items stored in an
125// array are not of a fixed-size (ie: strings, other arrays, etc)
126// then an additional framing offset is stored for each item.  The
127// size of this offset is either 1, 2 or 4 bytes depending on the
128// overall size of the container.  Additionally, extra padding bytes
129// are added as required for alignment of child values.
130//
131// Tuples (including dictionary entries) use the amount of space
132// required to store each of their members, concatenated, plus one
133// framing offset (as per arrays) for each non-fixed-sized item in
134// the tuple, except for the last one.  Additionally, extra padding
135// bytes are added as required for alignment of child values.
136//
137// Variants use the same amount of space as the item inside of the
138// variant, plus 1 byte, plus the length of the type string for the
139// item inside the variant.
140//
141// As an example, consider a dictionary mapping strings to variants.
142// In the case that the dictionary is empty, 0 bytes are required for
143// the serialization.
144//
145// If we add an item ‘width’ that maps to the int32 value of 500 then
146// we will use 4 bytes to store the int32 (so 6 for the variant
147// containing it) and 6 bytes for the string.  The variant must be
148// aligned to 8 after the 6 bytes of the string, so that’s 2 extra
149// bytes.  6 (string) + 2 (padding) + 6 (variant) is 14 bytes used
150// for the dictionary entry.  An additional 1 byte is added to the
151// array as a framing offset making a total of 15 bytes.
152//
153// If we add another entry, ‘title’ that maps to a nullable string
154// that happens to have a value of null, then we use 0 bytes for the
155// null value (and 3 bytes for the variant to contain it along with
156// its type string) plus 6 bytes for the string.  Again, we need 2
157// padding bytes.  That makes a total of 6 + 2 + 3 = 11 bytes.
158//
159// We now require extra padding between the two items in the array.
160// After the 14 bytes of the first item, that’s 2 bytes required.
161// We now require 2 framing offsets for an extra two
162// bytes. 14 + 2 + 11 + 2 = 29 bytes to encode the entire two-item
163// dictionary.
164//
165// ## Type Information Cache
166//
167// For each `GVariant` type that currently exists in the program a type
168// information structure is kept in the type information cache.  The
169// type information structure is required for rapid deserialization.
170//
171// Continuing with the above example, if a `GVariant` exists with the
172// type `a{sv}` then a type information struct will exist for
173// `a{sv}`, `{sv}`, `s`, and `v`.  Multiple uses of the same type
174// will share the same type information.  Additionally, all
175// single-digit types are stored in read-only static memory and do
176// not contribute to the writable memory footprint of a program using
177// `GVariant`.
178//
179// Aside from the type information structures stored in read-only
180// memory, there are two forms of type information.  One is used for
181// container types where there is a single element type: arrays and
182// maybe types.  The other is used for container types where there
183// are multiple element types: tuples and dictionary entries.
184//
185// Array type info structures are `6 * sizeof (void *)`, plus the
186// memory required to store the type string itself.  This means that
187// on 32-bit systems, the cache entry for `a{sv}` would require 30
188// bytes of memory (plus allocation overhead).
189//
190// Tuple type info structures are `6 * sizeof (void *)`, plus `4 *
191// sizeof (void *)` for each item in the tuple, plus the memory
192// required to store the type string itself.  A 2-item tuple, for
193// example, would have a type information structure that consumed
194// writable memory in the size of `14 * sizeof (void *)` (plus type
195// string)  This means that on 32-bit systems, the cache entry for
196// `{sv}` would require 61 bytes of memory (plus allocation overhead).
197//
198// This means that in total, for our `a{sv}` example, 91 bytes of
199// type information would be allocated.
200//
201// The type information cache, additionally, uses a [struct@GLib.HashTable] to
202// store and look up the cached items and stores a pointer to this
203// hash table in static storage.  The hash table is freed when there
204// are zero items in the type cache.
205//
206// Although these sizes may seem large it is important to remember
207// that a program will probably only have a very small number of
208// different types of values in it and that only one type information
209// structure is required for many different values of the same type.
210//
211// ## Buffer Management Memory
212//
213// `GVariant` uses an internal buffer management structure to deal
214// with the various different possible sources of serialized data
215// that it uses.  The buffer is responsible for ensuring that the
216// correct call is made when the data is no longer in use by
217// `GVariant`.  This may involve a [func@GLib.free] or
218// even [method@GLib.MappedFile.unref].
219//
220// One buffer management structure is used for each chunk of
221// serialized data.  The size of the buffer management structure
222// is `4 * (void *)`.  On 32-bit systems, that’s 16 bytes.
223//
224// ## GVariant structure
225//
226// The size of a `GVariant` structure is `6 * (void *)`.  On 32-bit
227// systems, that’s 24 bytes.
228//
229// `GVariant` structures only exist if they are explicitly created
230// with API calls.  For example, if a `GVariant` is constructed out of
231// serialized data for the example given above (with the dictionary)
232// then although there are 9 individual values that comprise the
233// entire dictionary (two keys, two values, two variants containing
234// the values, two dictionary entries, plus the dictionary itself),
235// only 1 `GVariant` instance exists — the one referring to the
236// dictionary.
237//
238// If calls are made to start accessing the other values then
239// `GVariant` instances will exist for those values only for as long
240// as they are in use (ie: until you call [method@GLib.Variant.unref]).  The
241// type information is shared.  The serialized data and the buffer
242// management structure for that serialized data is shared by the
243// child.
244//
245// ## Summary
246//
247// To put the entire example together, for our dictionary mapping
248// strings to variants (with two entries, as given above), we are
249// using 91 bytes of memory for type information, 29 bytes of memory
250// for the serialized data, 16 bytes for buffer management and 24
251// bytes for the `GVariant` instance, or a total of 160 bytes, plus
252// allocation overhead.  If we were to use [method@GLib.Variant.get_child_value]
253// to access the two dictionary entries, we would use an additional 48
254// bytes.  If we were to have other dictionaries of the same type, we
255// would use more memory for the serialized data and buffer
256// management for those dictionaries, but the type information would
257// be shared.
258type Variant struct {
259	_ structs.HostLayout
260}
261
262var xVariantGLibType func() types.GType
263
264func VariantGLibType() types.GType {
265	return xVariantGLibType()
266}
267
268func (x *Variant) GoPointer() uintptr {
269	return uintptr(unsafe.Pointer(x))
270}
271
272var xNewVariant func(string, ...interface{}) *Variant
273
274// Creates a new #GVariant instance.
275//
276// Think of this function as an analogue to g_strdup_printf().
277//
278// The type of the created instance and the arguments that are expected
279// by this function are determined by @format_string. See the section on
280// [GVariant format strings](gvariant-format-strings.html). Please note that
281// the syntax of the format string is very likely to be extended in the
282// future.
283//
284// The first character of the format string must not be '*' '?' '@' or
285// 'r'; in essence, a new #GVariant must always be constructed by this
286// function (and not merely passed through it unmodified).
287//
288// Note that the arguments must be of the correct width for their types
289// specified in @format_string. This can be achieved by casting them. See
290// the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
291//
292// |[<!-- language="C" -->
293// MyFlags some_flags = FLAG_ONE | FLAG_TWO;
294// const gchar *some_strings[] = { "a", "b", "c", NULL };
295// GVariant *new_variant;
296//
297// new_variant = g_variant_new ("(t^as)",
298//
299//	// This cast is required.
300//	(guint64) some_flags,
301//	some_strings);
302//
303// ]|
304func NewVariant(FormatStringVar string, varArgs ...interface{}) *Variant {
305
306	cret := xNewVariant(FormatStringVar, varArgs...)
307	return cret
308}
309
310var xNewVariantArray func(*VariantType, uintptr, uint) *Variant
311
312// Creates a new #GVariant array from @children.
313//
314// @child_type must be non-%NULL if @n_children is zero.  Otherwise, the
315// child type is determined by inspecting the first element of the
316// @children array.  If @child_type is non-%NULL then it must be a
317// definite type.
318//
319// The items of the array are taken from the @children array.  No entry
320// in the @children array may be %NULL.
321//
322// All items in the array must have the same type, which must be the
323// same as @child_type, if given.
324//
325// If the @children are floating references (see g_variant_ref_sink()), the
326// new instance takes ownership of them as if via g_variant_ref_sink().
327func NewVariantArray(ChildTypeVar *VariantType, ChildrenVar uintptr, NChildrenVar uint) *Variant {
328
329	cret := xNewVariantArray(ChildTypeVar, ChildrenVar, NChildrenVar)
330	return cret
331}
332
333var xNewVariantBoolean func(bool) *Variant
334
335// Creates a new boolean #GVariant instance -- either %TRUE or %FALSE.
336func NewVariantBoolean(ValueVar bool) *Variant {
337
338	cret := xNewVariantBoolean(ValueVar)
339	return cret
340}
341
342var xNewVariantByte func(byte) *Variant
343
344// Creates a new byte #GVariant instance.
345func NewVariantByte(ValueVar byte) *Variant {
346
347	cret := xNewVariantByte(ValueVar)
348	return cret
349}
350
351var xNewVariantBytestring func([]byte) *Variant
352
353// Creates an array-of-bytes #GVariant with the contents of @string.
354// This function is just like g_variant_new_string() except that the
355// string need not be valid UTF-8.
356//
357// The nul terminator character at the end of the string is stored in
358// the array.
359func NewVariantBytestring(StringVar []byte) *Variant {
360
361	cret := xNewVariantBytestring(StringVar)
362	return cret
363}
364
365var xNewVariantBytestringArray func([]string, int) *Variant
366
367// Constructs an array of bytestring #GVariant from the given array of
368// strings.
369//
370// If @length is -1 then @strv is %NULL-terminated.
371func NewVariantBytestringArray(StrvVar []string, LengthVar int) *Variant {
372
373	cret := xNewVariantBytestringArray(StrvVar, LengthVar)
374	return cret
375}
376
377var xNewVariantDictEntry func(*Variant, *Variant) *Variant
378
379// Creates a new dictionary entry #GVariant. @key and @value must be
380// non-%NULL. @key must be a value of a basic type (ie: not a container).
381//
382// If the @key or @value are floating references (see g_variant_ref_sink()),
383// the new instance takes ownership of them as if via g_variant_ref_sink().
384func NewVariantDictEntry(KeyVar *Variant, ValueVar *Variant) *Variant {
385
386	cret := xNewVariantDictEntry(KeyVar, ValueVar)
387	return cret
388}
389
390var xNewVariantDouble func(float64) *Variant
391
392// Creates a new double #GVariant instance.
393func NewVariantDouble(ValueVar float64) *Variant {
394
395	cret := xNewVariantDouble(ValueVar)
396	return cret
397}
398
399var xNewVariantFixedArray func(*VariantType, uintptr, uint, uint) *Variant
400
401// Constructs a new array #GVariant instance, where the elements are
402// of @element_type type.
403//
404// @elements must be an array with fixed-sized elements.  Numeric types are
405// fixed-size as are tuples containing only other fixed-sized types.
406//
407// @element_size must be the size of a single element in the array.
408// For example, if calling this function for an array of 32-bit integers,
409// you might say sizeof(gint32). This value isn't used except for the purpose
410// of a double-check that the form of the serialized data matches the caller's
411// expectation.
412//
413// @n_elements must be the length of the @elements array.
414func NewVariantFixedArray(ElementTypeVar *VariantType, ElementsVar uintptr, NElementsVar uint, ElementSizeVar uint) *Variant {
415
416	cret := xNewVariantFixedArray(ElementTypeVar, ElementsVar, NElementsVar, ElementSizeVar)
417	return cret
418}
419
420var xNewVariantFromBytes func(*VariantType, *Bytes, bool) *Variant
421
422// Constructs a new serialized-mode #GVariant instance.  This is the
423// inner interface for creation of new serialized values that gets
424// called from various functions in gvariant.c.
425//
426// A reference is taken on @bytes.
427//
428// The data in @bytes must be aligned appropriately for the @type being loaded.
429// Otherwise this function will internally create a copy of the memory (since
430// GLib 2.60) or (in older versions) fail and exit the process.
431func NewVariantFromBytes(TypeVar *VariantType, BytesVar *Bytes, TrustedVar bool) *Variant {
432
433	cret := xNewVariantFromBytes(TypeVar, BytesVar, TrustedVar)
434	return cret
435}
436
437var xNewVariantFromData func(*VariantType, []byte, uint, bool, uintptr, uintptr) *Variant
438
439// Creates a new #GVariant instance from serialized data.
440//
441// @type is the type of #GVariant instance that will be constructed.
442// The interpretation of @data depends on knowing the type.
443//
444// @data is not modified by this function and must remain valid with an
445// unchanging value until such a time as @notify is called with
446// @user_data.  If the contents of @data change before that time then
447// the result is undefined.
448//
449// If @data is trusted to be serialized data in normal form then
450// @trusted should be %TRUE.  This applies to serialized data created
451// within this process or read from a trusted location on the disk (such
452// as a file installed in /usr/lib alongside your application).  You
453// should set trusted to %FALSE if @data is read from the network, a
454// file in the user's home directory, etc.
455//
456// If @data was not stored in this machine's native endianness, any multi-byte
457// numeric values in the returned variant will also be in non-native
458// endianness. g_variant_byteswap() can be used to recover the original values.
459//
460// @notify will be called with @user_data when @data is no longer
461// needed.  The exact time of this call is unspecified and might even be
462// before this function returns.
463//
464// Note: @data must be backed by memory that is aligned appropriately for the
465// @type being loaded. Otherwise this function will internally create a copy of
466// the memory (since GLib 2.60) or (in older versions) fail and exit the
467// process.
468func NewVariantFromData(TypeVar *VariantType, DataVar []byte, SizeVar uint, TrustedVar bool, NotifyVar *DestroyNotify, UserDataVar uintptr) *Variant {
469
470	var NotifyVarRef uintptr
471	if NotifyVar != nil {
472		NotifyVarPtr := uintptr(unsafe.Pointer(NotifyVar))
473		if cbRefPtr, ok := GetCallback(NotifyVarPtr); ok {
474			NotifyVarRef = cbRefPtr
475		} else {
476			fcb := func(arg0 uintptr) {
477				cbFn := *NotifyVar
478				cbFn(arg0)
479			}
480			NotifyVarRef = purego.NewCallback(fcb)
481			SaveCallbackWithClosure(NotifyVarPtr, NotifyVarRef, NotifyVar)
482		}
483	}
484
485	cret := xNewVariantFromData(TypeVar, DataVar, SizeVar, TrustedVar, NotifyVarRef, UserDataVar)
486	return cret
487}
488
489var xNewVariantHandle func(int32) *Variant
490
491// Creates a new handle #GVariant instance.
492//
493// By convention, handles are indexes into an array of file descriptors
494// that are sent alongside a D-Bus message.  If you're not interacting
495// with D-Bus, you probably don't need them.
496func NewVariantHandle(ValueVar int32) *Variant {
497
498	cret := xNewVariantHandle(ValueVar)
499	return cret
500}
501
502var xNewVariantInt16 func(int16) *Variant
503
504// Creates a new int16 #GVariant instance.
505func NewVariantInt16(ValueVar int16) *Variant {
506
507	cret := xNewVariantInt16(ValueVar)
508	return cret
509}
510
511var xNewVariantInt32 func(int32) *Variant
512
513// Creates a new int32 #GVariant instance.
514func NewVariantInt32(ValueVar int32) *Variant {
515
516	cret := xNewVariantInt32(ValueVar)
517	return cret
518}
519
520var xNewVariantInt64 func(int64) *Variant
521
522// Creates a new int64 #GVariant instance.
523func NewVariantInt64(ValueVar int64) *Variant {
524
525	cret := xNewVariantInt64(ValueVar)
526	return cret
527}
528
529var xNewVariantMaybe func(*VariantType, *Variant) *Variant
530
531// Depending on if @child is %NULL, either wraps @child inside of a
532// maybe container or creates a Nothing instance for the given @type.
533//
534// At least one of @child_type and @child must be non-%NULL.
535// If @child_type is non-%NULL then it must be a definite type.
536// If they are both non-%NULL then @child_type must be the type
537// of @child.
538//
539// If @child is a floating reference (see g_variant_ref_sink()), the new
540// instance takes ownership of @child.
541func NewVariantMaybe(ChildTypeVar *VariantType, ChildVar *Variant) *Variant {
542
543	cret := xNewVariantMaybe(ChildTypeVar, ChildVar)
544	return cret
545}
546
547var xNewVariantObjectPath func(string) *Variant
548
549// Creates a D-Bus object path #GVariant with the contents of @object_path.
550// @object_path must be a valid D-Bus object path.  Use
551// g_variant_is_object_path() if you're not sure.
552func NewVariantObjectPath(ObjectPathVar string) *Variant {
553
554	cret := xNewVariantObjectPath(ObjectPathVar)
555	return cret
556}
557
558var xNewVariantObjv func([]string, int) *Variant
559
560// Constructs an array of object paths #GVariant from the given array of
561// strings.
562//
563// Each string must be a valid #GVariant object path; see
564// g_variant_is_object_path().
565//
566// If @length is -1 then @strv is %NULL-terminated.
567func NewVariantObjv(StrvVar []string, LengthVar int) *Variant {
568
569	cret := xNewVariantObjv(StrvVar, LengthVar)
570	return cret
571}
572
573var xNewVariantParsed func(string, ...interface{}) *Variant
574
575// Parses @format and returns the result.
576//
577// @format must be a text format #GVariant with one extension: at any
578// point that a value may appear in the text, a '%' character followed
579// by a GVariant format string (as per g_variant_new()) may appear.  In
580// that case, the same arguments are collected from the argument list as
581// g_variant_new() would have collected.
582//
583// Note that the arguments must be of the correct width for their types
584// specified in @format. This can be achieved by casting them. See
585// the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
586//
587// Consider this simple example:
588// |[<!-- language="C" -->
589//
590//	g_variant_new_parsed ("[('one', 1), ('two', %i), (%s, 3)]", 2, "three");
591//
592// ]|
593//
594// In the example, the variable argument parameters are collected and
595// filled in as if they were part of the original string to produce the
596// result of
597// |[<!-- language="C" -->
598// [('one', 1), ('two', 2), ('three', 3)]
599// ]|
600//
601// This function is intended only to be used with @format as a string
602// literal.  Any parse error is fatal to the calling process.  If you
603// want to parse data from untrusted sources, use g_variant_parse().
604//
605// You may not use this function to return, unmodified, a single
606// #GVariant pointer from the argument list.  ie: @format may not solely
607// be anything along the lines of "%*", "%?", "\%r", or anything starting
608// with "%@".
609func NewVariantParsed(FormatVar string, varArgs ...interface{}) *Variant {
610
611	cret := xNewVariantParsed(FormatVar, varArgs...)
612	return cret
613}
614
615var xNewVariantParsedVa func(string, []interface{}) *Variant
616
617// Parses @format and returns the result.
618//
619// This is the version of g_variant_new_parsed() intended to be used
620// from libraries.
621//
622// The return value will be floating if it was a newly created GVariant
623// instance.  In the case that @format simply specified the collection
624// of a #GVariant pointer (eg: @format was "%*") then the collected
625// #GVariant pointer will be returned unmodified, without adding any
626// additional references.
627//
628// Note that the arguments in @app must be of the correct width for their types
629// specified in @format when collected into the #va_list. See
630// the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
631//
632// In order to behave correctly in all cases it is necessary for the
633// calling function to g_variant_ref_sink() the return result before
634// returning control to the user that originally provided the pointer.
635// At this point, the caller will have their own full reference to the
636// result.  This can also be done by adding the result to a container,
637// or by passing it to another g_variant_new() call.
638func NewVariantParsedVa(FormatVar string, AppVar []interface{}) *Variant {
639
640	cret := xNewVariantParsedVa(FormatVar, AppVar)
641	return cret
642}
643
644var xNewVariantPrintf func(string, ...interface{}) *Variant
645
646// Creates a string-type GVariant using printf formatting.
647//
648// This is similar to calling g_strdup_printf() and then
649// g_variant_new_string() but it saves a temporary variable and an
650// unnecessary copy.
651func NewVariantPrintf(FormatStringVar string, varArgs ...interface{}) *Variant {
652
653	cret := xNewVariantPrintf(FormatStringVar, varArgs...)
654	return cret
655}
656
657var xNewVariantSignature func(string) *Variant
658
659// Creates a D-Bus type signature #GVariant with the contents of
660// @string.  @string must be a valid D-Bus type signature.  Use
661// g_variant_is_signature() if you're not sure.
662func NewVariantSignature(SignatureVar string) *Variant {
663
664	cret := xNewVariantSignature(SignatureVar)
665	return cret
666}
667
668var xNewVariantString func(string) *Variant
669
670// Creates a string #GVariant with the contents of @string.
671//
672// @string must be valid UTF-8, and must not be %NULL. To encode
673// potentially-%NULL strings, use g_variant_new() with `ms` as the
674// [format string](gvariant-format-strings.html#maybe-types).
675func NewVariantString(StringVar string) *Variant {
676
677	cret := xNewVariantString(StringVar)
678	return cret
679}
680
681var xNewVariantStrv func([]string, int) *Variant
682
683// Constructs an array of strings #GVariant from the given array of
684// strings.
685//
686// If @length is -1 then @strv is %NULL-terminated.
687func NewVariantStrv(StrvVar []string, LengthVar int) *Variant {
688
689	cret := xNewVariantStrv(StrvVar, LengthVar)
690	return cret
691}
692
693var xNewVariantTakeString func(string) *Variant
694
695// Creates a string #GVariant with the contents of @string.
696//
697// @string must be valid UTF-8, and must not be %NULL. To encode
698// potentially-%NULL strings, use this with g_variant_new_maybe().
699//
700// After this call, @string belongs to the #GVariant and may no longer be
701// modified by the caller. The memory of @data has to be dynamically
702// allocated and will eventually be freed with g_free().
703//
704// You must not modify or access @string in any other way after passing
705// it to this function.  It is even possible that @string is immediately
706// freed.
707func NewVariantTakeString(StringVar string) *Variant {
708
709	cret := xNewVariantTakeString(StringVar)
710	return cret
711}
712
713var xNewVariantTuple func(uintptr, uint) *Variant
714
715// Creates a new tuple #GVariant out of the items in @children.  The
716// type is determined from the types of @children.  No entry in the
717// @children array may be %NULL.
718//
719// If @n_children is 0 then the unit tuple is constructed.
720//
721// If the @children are floating references (see g_variant_ref_sink()), the
722// new instance takes ownership of them as if via g_variant_ref_sink().
723func NewVariantTuple(ChildrenVar uintptr, NChildrenVar uint) *Variant {
724
725	cret := xNewVariantTuple(ChildrenVar, NChildrenVar)
726	return cret
727}
728
729var xNewVariantUint16 func(uint16) *Variant
730
731// Creates a new uint16 #GVariant instance.
732func NewVariantUint16(ValueVar uint16) *Variant {
733
734	cret := xNewVariantUint16(ValueVar)
735	return cret
736}
737
738var xNewVariantUint32 func(uint32) *Variant
739
740// Creates a new uint32 #GVariant instance.
741func NewVariantUint32(ValueVar uint32) *Variant {
742
743	cret := xNewVariantUint32(ValueVar)
744	return cret
745}
746
747var xNewVariantUint64 func(uint64) *Variant
748
749// Creates a new uint64 #GVariant instance.
750func NewVariantUint64(ValueVar uint64) *Variant {
751
752	cret := xNewVariantUint64(ValueVar)
753	return cret
754}
755
756var xNewVariantVa func(string, uintptr, []interface{}) *Variant
757
758// This function is intended to be used by libraries based on
759// #GVariant that want to provide g_variant_new()-like functionality
760// to their users.
761//
762// The API is more general than g_variant_new() to allow a wider range
763// of possible uses.
764//
765// @format_string must still point to a valid format string, but it only
766// needs to be nul-terminated if @endptr is %NULL.  If @endptr is
767// non-%NULL then it is updated to point to the first character past the
768// end of the format string.
769//
770// @app is a pointer to a #va_list.  The arguments, according to
771// @format_string, are collected from this #va_list and the list is left
772// pointing to the argument following the last.
773//
774// Note that the arguments in @app must be of the correct width for their
775// types specified in @format_string when collected into the #va_list.
776// See the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
777//
778// These two generalisations allow mixing of multiple calls to
779// g_variant_new_va() and g_variant_get_va() within a single actual
780// varargs call by the user.
781//
782// The return value will be floating if it was a newly created GVariant
783// instance (for example, if the format string was "(ii)").  In the case
784// that the format_string was '*', '?', 'r', or a format starting with
785// '@' then the collected #GVariant pointer will be returned unmodified,
786// without adding any additional references.
787//
788// In order to behave correctly in all cases it is necessary for the
789// calling function to g_variant_ref_sink() the return result before
790// returning control to the user that originally provided the pointer.
791// At this point, the caller will have their own full reference to the
792// result.  This can also be done by adding the result to a container,
793// or by passing it to another g_variant_new() call.
794func NewVariantVa(FormatStringVar string, EndptrVar *string, AppVar []interface{}) *Variant {
795
796	EndptrVarPtr := core.GStrdupNullable(EndptrVar)
797	defer core.GFreeNullable(EndptrVarPtr)
798
799	cret := xNewVariantVa(FormatStringVar, EndptrVarPtr, AppVar)
800	return cret
801}
802
803var xNewVariantVariant func(*Variant) *Variant
804
805// Boxes @value.  The result is a #GVariant instance representing a
806// variant containing the original value.
807//
808// If @child is a floating reference (see g_variant_ref_sink()), the new
809// instance takes ownership of @child.
810func NewVariantVariant(ValueVar *Variant) *Variant {
811
812	cret := xNewVariantVariant(ValueVar)
813	return cret
814}
815
816var xVariantByteswap func(uintptr) *Variant
817
818// Performs a byteswapping operation on the contents of @value.  The
819// result is that all multi-byte numeric data contained in @value is
820// byteswapped.  That includes 16, 32, and 64bit signed and unsigned
821// integers as well as file handles and double precision floating point
822// values.
823//
824// This function is an identity mapping on any value that does not
825// contain multi-byte numeric data.  That include strings, booleans,
826// bytes and containers containing only these things (recursively).
827//
828// While this function can safely handle untrusted, non-normal data, it is
829// recommended to check whether the input is in normal form beforehand, using
830// g_variant_is_normal_form(), and to reject non-normal inputs if your
831// application can be strict about what inputs it rejects.
832//
833// The returned value is always in normal form and is marked as trusted.
834// A full, not floating, reference is returned.
835func (x *Variant) Byteswap() *Variant {
836
837	cret := xVariantByteswap(x.GoPointer())
838	return cret
839}
840
841var xVariantCheckFormatString func(uintptr, string, bool) bool
842
843// Checks if calling g_variant_get() with @format_string on @value would
844// be valid from a type-compatibility standpoint.  @format_string is
845// assumed to be a valid format string (from a syntactic standpoint).
846//
847// If @copy_only is %TRUE then this function additionally checks that it
848// would be safe to call g_variant_unref() on @value immediately after
849// the call to g_variant_get() without invalidating the result.  This is
850// only possible if deep copies are made (ie: there are no pointers to
851// the data inside of the soon-to-be-freed #GVariant instance).  If this
852// check fails then a g_critical() is printed and %FALSE is returned.
853//
854// This function is meant to be used by functions that wish to provide
855// varargs accessors to #GVariant values of uncertain values (eg:
856// g_variant_lookup() or g_menu_model_get_item_attribute()).
857func (x *Variant) CheckFormatString(FormatStringVar string, CopyOnlyVar bool) bool {
858
859	cret := xVariantCheckFormatString(x.GoPointer(), FormatStringVar, CopyOnlyVar)
860	return cret
861}
862
863var xVariantClassify func(uintptr) VariantClass
864
865// Classifies @value according to its top-level type.
866func (x *Variant) Classify() VariantClass {
867
868	cret := xVariantClassify(x.GoPointer())
869	return cret
870}
871
872var xVariantCompare func(uintptr, uintptr) int
873
874// Compares @one and @two.
875//
876// The types of @one and @two are #gconstpointer only to allow use of
877// this function with #GTree, #GPtrArray, etc.  They must each be a
878// #GVariant.
879//
880// Comparison is only defined for basic types (ie: booleans, numbers,
881// strings).  For booleans, %FALSE is less than %TRUE.  Numbers are
882// ordered in the usual way.  Strings are in ASCII lexographical order.
883//
884// It is a programmer error to attempt to compare container values or
885// two values that have types that are not exactly equal.  For example,
886// you cannot compare a 32-bit signed integer with a 32-bit unsigned
887// integer.  Also note that this function is not particularly
888// well-behaved when it comes to comparison of doubles; in particular,
889// the handling of incomparable values (ie: NaN) is undefined.
890//
891// If you only require an equality comparison, g_variant_equal() is more
892// general.
893func (x *Variant) Compare(TwoVar uintptr) int {
894
895	cret := xVariantCompare(x.GoPointer(), TwoVar)
896	return cret
897}
898
899var xVariantDupBytestring func(uintptr, *uint) uintptr
900
901// Similar to g_variant_get_bytestring() except that instead of
902// returning a constant string, the string is duplicated.
903//
904// The return value must be freed using g_free().
905func (x *Variant) DupBytestring(LengthVar *uint) uintptr {
906
907	cret := xVariantDupBytestring(x.GoPointer(), LengthVar)
908	return cret
909}
910
911var xVariantDupBytestringArray func(uintptr, *uint) []string
912
913// Gets the contents of an array of array of bytes #GVariant.  This call
914// makes a deep copy; the return result should be released with
915// g_strfreev().
916//
917// If @length is non-%NULL then the number of elements in the result is
918// stored there.  In any case, the resulting array will be
919// %NULL-terminated.
920//
921// For an empty array, @length will be set to 0 and a pointer to a
922// %NULL pointer will be returned.
923func (x *Variant) DupBytestringArray(LengthVar *uint) []string {
924
925	cret := xVariantDupBytestringArray(x.GoPointer(), LengthVar)
926	return cret
927}
928
929var xVariantDupObjv func(uintptr, *uint) []string
930
931// Gets the contents of an array of object paths #GVariant.  This call
932// makes a deep copy; the return result should be released with
933// g_strfreev().
934//
935// If @length is non-%NULL then the number of elements in the result
936// is stored there.  In any case, the resulting array will be
937// %NULL-terminated.
938//
939// For an empty array, @length will be set to 0 and a pointer to a
940// %NULL pointer will be returned.
941func (x *Variant) DupObjv(LengthVar *uint) []string {
942
943	cret := xVariantDupObjv(x.GoPointer(), LengthVar)
944	return cret
945}
946
947var xVariantDupString func(uintptr, *uint) string
948
949// Similar to g_variant_get_string() except that instead of returning
950// a constant string, the string is duplicated.
951//
952// The string will always be UTF-8 encoded.
953//
954// The return value must be freed using g_free().
955func (x *Variant) DupString(LengthVar *uint) string {
956
957	cret := xVariantDupString(x.GoPointer(), LengthVar)
958	return cret
959}
960
961var xVariantDupStrv func(uintptr, *uint) []string
962
963// Gets the contents of an array of strings #GVariant.  This call
964// makes a deep copy; the return result should be released with
965// g_strfreev().
966//
967// If @length is non-%NULL then the number of elements in the result
968// is stored there.  In any case, the resulting array will be
969// %NULL-terminated.
970//
971// For an empty array, @length will be set to 0 and a pointer to a
972// %NULL pointer will be returned.
973func (x *Variant) DupStrv(LengthVar *uint) []string {
974
975	cret := xVariantDupStrv(x.GoPointer(), LengthVar)
976	return cret
977}
978
979var xVariantEqual func(uintptr, uintptr) bool
980
981// Checks if @one and @two have the same type and value.
982//
983// The types of @one and @two are #gconstpointer only to allow use of
984// this function with #GHashTable.  They must each be a #GVariant.
985func (x *Variant) Equal(TwoVar uintptr) bool {
986
987	cret := xVariantEqual(x.GoPointer(), TwoVar)
988	return cret
989}
990
991var xVariantGet func(uintptr, string, ...interface{})
992
993// Deconstructs a #GVariant instance.
994//
995// Think of this function as an analogue to scanf().
996//
997// The arguments that are expected by this function are entirely
998// determined by @format_string.  @format_string also restricts the
999// permissible types of @value.  It is an error to give a value with
1000// an incompatible type.  See the section on
1001// [GVariant format strings](gvariant-format-strings.html).
1002// Please note that the syntax of the format string is very likely to be
1003// extended in the future.
1004//
1005// @format_string determines the C types that are used for unpacking
1006// the values and also determines if the values are copied or borrowed,
1007// see the section on
1008// [`GVariant` format strings](gvariant-format-strings.html#pointers).
1009func (x *Variant) Get(FormatStringVar string, varArgs ...interface{}) {
1010
1011	xVariantGet(x.GoPointer(), FormatStringVar, varArgs...)
1012
1013}
1014
1015var xVariantGetBoolean func(uintptr) bool
1016
1017// Returns the boolean value of @value.
1018//
1019// It is an error to call this function with a @value of any type
1020// other than %G_VARIANT_TYPE_BOOLEAN.
1021func (x *Variant) GetBoolean() bool {
1022
1023	cret := xVariantGetBoolean(x.GoPointer())
1024	return cret
1025}
1026
1027var xVariantGetByte func(uintptr) byte
1028
1029// Returns the byte value of @value.
1030//
1031// It is an error to call this function with a @value of any type
1032// other than %G_VARIANT_TYPE_BYTE.
1033func (x *Variant) GetByte() byte {
1034
1035	cret := xVariantGetByte(x.GoPointer())
1036	return cret
1037}
1038
1039var xVariantGetBytestring func(uintptr) uintptr
1040
1041// Returns the string value of a #GVariant instance with an
1042// array-of-bytes type.  The string has no particular encoding.
1043//
1044// If the array does not end with a nul terminator character, the empty
1045// string is returned.  For this reason, you can always trust that a
1046// non-%NULL nul-terminated string will be returned by this function.
1047//
1048// If the array contains a nul terminator character somewhere other than
1049// the last byte then the returned string is the string, up to the first
1050// such nul character.
1051//
1052// g_variant_get_fixed_array() should be used instead if the array contains
1053// arbitrary data that could not be nul-terminated or could contain nul bytes.
1054//
1055// It is an error to call this function with a @value that is not an
1056// array of bytes.
1057//
1058// The return value remains valid as long as @value exists.
1059func (x *Variant) GetBytestring() uintptr {
1060
1061	cret := xVariantGetBytestring(x.GoPointer())
1062	return cret
1063}
1064
1065var xVariantGetBytestringArray func(uintptr, *uint) []string
1066
1067// Gets the contents of an array of array of bytes #GVariant.  This call
1068// makes a shallow copy; the return result should be released with
1069// g_free(), but the individual strings must not be modified.
1070//
1071// If @length is non-%NULL then the number of elements in the result is
1072// stored there.  In any case, the resulting array will be
1073// %NULL-terminated.
1074//
1075// For an empty array, @length will be set to 0 and a pointer to a
1076// %NULL pointer will be returned.
1077func (x *Variant) GetBytestringArray(LengthVar *uint) []string {
1078
1079	cret := xVariantGetBytestringArray(x.GoPointer(), LengthVar)
1080	return cret
1081}
1082
1083var xVariantGetChild func(uintptr, uint, string, ...interface{})
1084
1085// Reads a child item out of a container #GVariant instance and
1086// deconstructs it according to @format_string.  This call is
1087// essentially a combination of g_variant_get_child_value() and
1088// g_variant_get().
1089//
1090// @format_string determines the C types that are used for unpacking
1091// the values and also determines if the values are copied or borrowed,
1092// see the section on
1093// [`GVariant` format strings](gvariant-format-strings.html#pointers).
1094func (x *Variant) GetChild(IndexVar uint, FormatStringVar string, varArgs ...interface{}) {
1095
1096	xVariantGetChild(x.GoPointer(), IndexVar, FormatStringVar, varArgs...)
1097
1098}
1099
1100var xVariantGetChildValue func(uintptr, uint) *Variant
1101
1102// Reads a child item out of a container #GVariant instance.  This
1103// includes variants, maybes, arrays, tuples and dictionary
1104// entries.  It is an error to call this function on any other type of
1105// #GVariant.
1106//
1107// It is an error if @index_ is greater than the number of child items
1108// in the container.  See g_variant_n_children().
1109//
1110// The returned value is never floating.  You should free it with
1111// g_variant_unref() when you're done with it.
1112//
1113// Note that values borrowed from the returned child are not guaranteed to
1114// still be valid after the child is freed even if you still hold a reference
1115// to @value, if @value has not been serialized at the time this function is
1116// called. To avoid this, you can serialize @value by calling
1117// g_variant_get_data() and optionally ignoring the return value.
1118//
1119// There may be implementation specific restrictions on deeply nested values,
1120// which would result in the unit tuple being returned as the child value,
1121// instead of further nested children. #GVariant is guaranteed to handle
1122// nesting up to at least 64 levels.
1123//
1124// This function is O(1).
1125func (x *Variant) GetChildValue(IndexVar uint) *Variant {
1126
1127	cret := xVariantGetChildValue(x.GoPointer(), IndexVar)
1128	return cret
1129}
1130
1131var xVariantGetData func(uintptr) uintptr
1132
1133// Returns a pointer to the serialized form of a #GVariant instance.
1134// The returned data may not be in fully-normalised form if read from an
1135// untrusted source.  The returned data must not be freed; it remains
1136// valid for as long as @value exists.
1137//
1138// If @value is a fixed-sized value that was deserialized from a
1139// corrupted serialized container then %NULL may be returned.  In this
1140// case, the proper thing to do is typically to use the appropriate
1141// number of nul bytes in place of @value.  If @value is not fixed-sized
1142// then %NULL is never returned.
1143//
1144// In the case that @value is already in serialized form, this function
1145// is O(1).  If the value is not already in serialized form,
1146// serialization occurs implicitly and is approximately O(n) in the size
1147// of the result.
1148//
1149// To deserialize the data returned by this function, in addition to the
1150// serialized data, you must know the type of the #GVariant, and (if the
1151// machine might be different) the endianness of the machine that stored
1152// it. As a result, file formats or network messages that incorporate
1153// serialized #GVariants must include this information either
1154// implicitly (for instance "the file always contains a
1155// %G_VARIANT_TYPE_VARIANT and it is always in little-endian order") or
1156// explicitly (by storing the type and/or endianness in addition to the
1157// serialized data).
1158func (x *Variant) GetData() uintptr {
1159
1160	cret := xVariantGetData(x.GoPointer())
1161	return cret
1162}
1163
1164var xVariantGetDataAsBytes func(uintptr) *Bytes
1165
1166// Returns a pointer to the serialized form of a #GVariant instance.
1167// The semantics of this function are exactly the same as
1168// g_variant_get_data(), except that the returned #GBytes holds
1169// a reference to the variant data.
1170func (x *Variant) GetDataAsBytes() *Bytes {
1171
1172	cret := xVariantGetDataAsBytes(x.GoPointer())
1173	return cret
1174}
1175
1176var xVariantGetDouble func(uintptr) float64
1177
1178// Returns the double precision floating point value of @value.
1179//
1180// It is an error to call this function with a @value of any type
1181// other than %G_VARIANT_TYPE_DOUBLE.
1182func (x *Variant) GetDouble() float64 {
1183
1184	cret := xVariantGetDouble(x.GoPointer())
1185	return cret
1186}
1187
1188var xVariantGetFixedArray func(uintptr, *uint, uint) uintptr
1189
1190// Provides access to the serialized data for an array of fixed-sized
1191// items.
1192//
1193// @value must be an array with fixed-sized elements.  Numeric types are
1194// fixed-size, as are tuples containing only other fixed-sized types.
1195//
1196// @element_size must be the size of a single element in the array,
1197// as given by the section on
1198// [serialized data memory](struct.Variant.html#serialized-data-memory).
1199//
1200// In particular, arrays of these fixed-sized types can be interpreted
1201// as an array of the given C type, with @element_size set to the size
1202// the appropriate type:
1203// - %G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.)
1204// - %G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!)
1205// - %G_VARIANT_TYPE_BYTE: #guint8
1206// - %G_VARIANT_TYPE_HANDLE: #guint32
1207// - %G_VARIANT_TYPE_DOUBLE: #gdouble
1208//
1209// For example, if calling this function for an array of 32-bit integers,
1210// you might say `sizeof(gint32)`. This value isn't used except for the purpose
1211// of a double-check that the form of the serialized data matches the caller's
1212// expectation.
1213//
1214// @n_elements, which must be non-%NULL, is set equal to the number of
1215// items in the array.
1216func (x *Variant) GetFixedArray(NElementsVar *uint, ElementSizeVar uint) uintptr {
1217
1218	cret := xVariantGetFixedArray(x.GoPointer(), NElementsVar, ElementSizeVar)
1219	return cret
1220}
1221
1222var xVariantGetHandle func(uintptr) int32
1223
1224// Returns the 32-bit signed integer value of @value.
1225//
1226// It is an error to call this function with a @value of any type other
1227// than %G_VARIANT_TYPE_HANDLE.
1228//
1229// By convention, handles are indexes into an array of file descriptors
1230// that are sent alongside a D-Bus message.  If you're not interacting
1231// with D-Bus, you probably don't need them.
1232func (x *Variant) GetHandle() int32 {
1233
1234	cret := xVariantGetHandle(x.GoPointer())
1235	return cret
1236}
1237
1238var xVariantGetInt16 func(uintptr) int16
1239
1240// Returns the 16-bit signed integer value of @value.
1241//
1242// It is an error to call this function with a @value of any type
1243// other than %G_VARIANT_TYPE_INT16.
1244func (x *Variant) GetInt16() int16 {
1245
1246	cret := xVariantGetInt16(x.GoPointer())
1247	return cret
1248}
1249
1250var xVariantGetInt32 func(uintptr) int32
1251
1252// Returns the 32-bit signed integer value of @value.
1253//
1254// It is an error to call this function with a @value of any type
1255// other than %G_VARIANT_TYPE_INT32.
1256func (x *Variant) GetInt32() int32 {
1257
1258	cret := xVariantGetInt32(x.GoPointer())
1259	return cret
1260}
1261
1262var xVariantGetInt64 func(uintptr) int64
1263
1264// Returns the 64-bit signed integer value of @value.
1265//
1266// It is an error to call this function with a @value of any type
1267// other than %G_VARIANT_TYPE_INT64.
1268func (x *Variant) GetInt64() int64 {
1269
1270	cret := xVariantGetInt64(x.GoPointer())
1271	return cret
1272}
1273
1274var xVariantGetMaybe func(uintptr) *Variant
1275
1276// Given a maybe-typed #GVariant instance, extract its value.  If the
1277// value is Nothing, then this function returns %NULL.
1278func (x *Variant) GetMaybe() *Variant {
1279
1280	cret := xVariantGetMaybe(x.GoPointer())
1281	return cret
1282}
1283
1284var xVariantGetNormalForm func(uintptr) *Variant
1285
1286// Gets a #GVariant instance that has the same value as @value and is
1287// trusted to be in normal form.
1288//
1289// If @value is already trusted to be in normal form then a new
1290// reference to @value is returned.
1291//
1292// If @value is not already trusted, then it is scanned to check if it
1293// is in normal form.  If it is found to be in normal form then it is
1294// marked as trusted and a new reference to it is returned.
1295//
1296// If @value is found not to be in normal form then a new trusted
1297// #GVariant is created with the same value as @value. The non-normal parts of
1298// @value will be replaced with default values which are guaranteed to be in
1299// normal form.
1300//
1301// It makes sense to call this function if you've received #GVariant
1302// data from untrusted sources and you want to ensure your serialized
1303// output is definitely in normal form.
1304//
1305// If @value is already in normal form, a new reference will be returned
1306// (which will be floating if @value is floating). If it is not in normal form,
1307// the newly created #GVariant will be returned with a single non-floating
1308// reference. Typically, g_variant_take_ref() should be called on the return
1309// value from this function to guarantee ownership of a single non-floating
1310// reference to it.
1311func (x *Variant) GetNormalForm() *Variant {
1312
1313	cret := xVariantGetNormalForm(x.GoPointer())
1314	return cret
1315}
1316
1317var xVariantGetObjv func(uintptr, *uint) []string
1318
1319// Gets the contents of an array of object paths #GVariant.  This call
1320// makes a shallow copy; the return result should be released with
1321// g_free(), but the individual strings must not be modified.
1322//
1323// If @length is non-%NULL then the number of elements in the result
1324// is stored there.  In any case, the resulting array will be
1325// %NULL-terminated.
1326//
1327// For an empty array, @length will be set to 0 and a pointer to a
1328// %NULL pointer will be returned.
1329func (x *Variant) GetObjv(LengthVar *uint) []string {
1330
1331	cret := xVariantGetObjv(x.GoPointer(), LengthVar)
1332	return cret
1333}
1334
1335var xVariantGetSize func(uintptr) uint
1336
1337// Determines the number of bytes that would be required to store @value
1338// with g_variant_store().
1339//
1340// If @value has a fixed-sized type then this function always returned
1341// that fixed size.
1342//
1343// In the case that @value is already in serialized form or the size has
1344// already been calculated (ie: this function has been called before)
1345// then this function is O(1).  Otherwise, the size is calculated, an
1346// operation which is approximately O(n) in the number of values
1347// involved.
1348func (x *Variant) GetSize() uint {
1349
1350	cret := xVariantGetSize(x.GoPointer())
1351	return cret
1352}
1353
1354var xVariantGetString func(uintptr, *uint) string
1355
1356// Returns the string value of a #GVariant instance with a string
1357// type.  This includes the types %G_VARIANT_TYPE_STRING,
1358// %G_VARIANT_TYPE_OBJECT_PATH and %G_VARIANT_TYPE_SIGNATURE.
1359//
1360// The string will always be UTF-8 encoded, will never be %NULL, and will never
1361// contain nul bytes.
1362//
1363// If @length is non-%NULL then the length of the string (in bytes) is
1364// returned there.  For trusted values, this information is already
1365// known.  Untrusted values will be validated and, if valid, a strlen() will be
1366// performed. If invalid, a default value will be returned — for
1367// %G_VARIANT_TYPE_OBJECT_PATH, this is `"/"`, and for other types it is the
1368// empty string.
1369//
1370// It is an error to call this function with a @value of any type
1371// other than those three.
1372//
1373// The return value remains valid as long as @value exists.
1374func (x *Variant) GetString(LengthVar *uint) string {
1375
1376	cret := xVariantGetString(x.GoPointer(), LengthVar)
1377	return cret
1378}
1379
1380var xVariantGetStrv func(uintptr, *uint) []string
1381
1382// Gets the contents of an array of strings #GVariant.  This call
1383// makes a shallow copy; the return result should be released with
1384// g_free(), but the individual strings must not be modified.
1385//
1386// If @length is non-%NULL then the number of elements in the result
1387// is stored there.  In any case, the resulting array will be
1388// %NULL-terminated.
1389//
1390// For an empty array, @length will be set to 0 and a pointer to a
1391// %NULL pointer will be returned.
1392func (x *Variant) GetStrv(LengthVar *uint) []string {
1393
1394	cret := xVariantGetStrv(x.GoPointer(), LengthVar)
1395	return cret
1396}
1397
1398var xVariantGetType func(uintptr) *VariantType
1399
1400// Determines the type of @value.
1401//
1402// The return value is valid for the lifetime of @value and must not
1403// be freed.
1404func (x *Variant) GetType() *VariantType {
1405
1406	cret := xVariantGetType(x.GoPointer())
1407	return cret
1408}
1409
1410var xVariantGetTypeString func(uintptr) string
1411
1412// Returns the type string of @value.  Unlike the result of calling
1413// g_variant_type_peek_string(), this string is nul-terminated.  This
1414// string belongs to #GVariant and must not be freed.
1415func (x *Variant) GetTypeString() string {
1416
1417	cret := xVariantGetTypeString(x.GoPointer())
1418	return cret
1419}
1420
1421var xVariantGetUint16 func(uintptr) uint16
1422
1423// Returns the 16-bit unsigned integer value of @value.
1424//
1425// It is an error to call this function with a @value of any type
1426// other than %G_VARIANT_TYPE_UINT16.
1427func (x *Variant) GetUint16() uint16 {
1428
1429	cret := xVariantGetUint16(x.GoPointer())
1430	return cret
1431}
1432
1433var xVariantGetUint32 func(uintptr) uint32
1434
1435// Returns the 32-bit unsigned integer value of @value.
1436//
1437// It is an error to call this function with a @value of any type
1438// other than %G_VARIANT_TYPE_UINT32.
1439func (x *Variant) GetUint32() uint32 {
1440
1441	cret := xVariantGetUint32(x.GoPointer())
1442	return cret
1443}
1444
1445var xVariantGetUint64 func(uintptr) uint64
1446
1447// Returns the 64-bit unsigned integer value of @value.
1448//
1449// It is an error to call this function with a @value of any type
1450// other than %G_VARIANT_TYPE_UINT64.
1451func (x *Variant) GetUint64() uint64 {
1452
1453	cret := xVariantGetUint64(x.GoPointer())
1454	return cret
1455}
1456
1457var xVariantGetVa func(uintptr, string, uintptr, []interface{})
1458
1459// This function is intended to be used by libraries based on #GVariant
1460// that want to provide g_variant_get()-like functionality to their
1461// users.
1462//
1463// The API is more general than g_variant_get() to allow a wider range
1464// of possible uses.
1465//
1466// @format_string must still point to a valid format string, but it only
1467// need to be nul-terminated if @endptr is %NULL.  If @endptr is
1468// non-%NULL then it is updated to point to the first character past the
1469// end of the format string.
1470//
1471// @app is a pointer to a #va_list.  The arguments, according to
1472// @format_string, are collected from this #va_list and the list is left
1473// pointing to the argument following the last.
1474//
1475// These two generalisations allow mixing of multiple calls to
1476// g_variant_new_va() and g_variant_get_va() within a single actual
1477// varargs call by the user.
1478//
1479// @format_string determines the C types that are used for unpacking
1480// the values and also determines if the values are copied or borrowed,
1481// see the section on
1482// [`GVariant` format strings](gvariant-format-strings.html#pointers).
1483func (x *Variant) GetVa(FormatStringVar string, EndptrVar *string, AppVar []interface{}) {
1484
1485	EndptrVarPtr := core.GStrdupNullable(EndptrVar)
1486	defer core.GFreeNullable(EndptrVarPtr)
1487
1488	xVariantGetVa(x.GoPointer(), FormatStringVar, EndptrVarPtr, AppVar)
1489
1490}
1491
1492var xVariantGetVariant func(uintptr) *Variant
1493
1494// Unboxes @value.  The result is the #GVariant instance that was
1495// contained in @value.
1496func (x *Variant) GetVariant() *Variant {
1497
1498	cret := xVariantGetVariant(x.GoPointer())
1499	return cret
1500}
1501
1502var xVariantHash func(uintptr) uint
1503
1504// Generates a hash value for a #GVariant instance.
1505//
1506// The output of this function is guaranteed to be the same for a given
1507// value only per-process.  It may change between different processor
1508// architectures or even different versions of GLib.  Do not use this
1509// function as a basis for building protocols or file formats.
1510//
1511// The type of @value is #gconstpointer only to allow use of this
1512// function with #GHashTable.  @value must be a #GVariant.
1513func (x *Variant) Hash() uint {
1514
1515	cret := xVariantHash(x.GoPointer())
1516	return cret
1517}
1518
1519var xVariantIsContainer func(uintptr) bool
1520
1521// Checks if @value is a container.
1522func (x *Variant) IsContainer() bool {
1523
1524	cret := xVariantIsContainer(x.GoPointer())
1525	return cret
1526}
1527
1528var xVariantIsFloating func(uintptr) bool
1529
1530// Checks whether @value has a floating reference count.
1531//
1532// This function should only ever be used to assert that a given variant
1533// is or is not floating, or for debug purposes. To acquire a reference
1534// to a variant that might be floating, always use g_variant_ref_sink()
1535// or g_variant_take_ref().
1536//
1537// See g_variant_ref_sink() for more information about floating reference
1538// counts.
1539func (x *Variant) IsFloating() bool {
1540
1541	cret := xVariantIsFloating(x.GoPointer())
1542	return cret
1543}
1544
1545var xVariantIsNormalForm func(uintptr) bool
1546
1547// Checks if @value is in normal form.
1548//
1549// The main reason to do this is to detect if a given chunk of
1550// serialized data is in normal form: load the data into a #GVariant
1551// using g_variant_new_from_data() and then use this function to
1552// check.
1553//
1554// If @value is found to be in normal form then it will be marked as
1555// being trusted.  If the value was already marked as being trusted then
1556// this function will immediately return %TRUE.
1557//
1558// There may be implementation specific restrictions on deeply nested values.
1559// GVariant is guaranteed to handle nesting up to at least 64 levels.
1560func (x *Variant) IsNormalForm() bool {
1561
1562	cret := xVariantIsNormalForm(x.GoPointer())
1563	return cret
1564}
1565
1566var xVariantIsOfType func(uintptr, *VariantType) bool
1567
1568// Checks if a value has a type matching the provided type.
1569func (x *Variant) IsOfType(TypeVar *VariantType) bool {
1570
1571	cret := xVariantIsOfType(x.GoPointer(), TypeVar)
1572	return cret
1573}
1574
1575var xVariantIterNew func(uintptr) *VariantIter
1576
1577// Creates a heap-allocated #GVariantIter for iterating over the items
1578// in @value.
1579//
1580// Use g_variant_iter_free() to free the return value when you no longer
1581// need it.
1582//
1583// A reference is taken to @value and will be released only when
1584// g_variant_iter_free() is called.
1585func (x *Variant) IterNew() *VariantIter {
1586
1587	cret := xVariantIterNew(x.GoPointer())
1588	return cret
1589}
1590
1591var xVariantLookup func(uintptr, string, string, ...interface{}) bool
1592
1593// Looks up a value in a dictionary #GVariant.
1594//
1595// This function is a wrapper around g_variant_lookup_value() and
1596// g_variant_get().  In the case that %NULL would have been returned,
1597// this function returns %FALSE.  Otherwise, it unpacks the returned
1598// value and returns %TRUE.
1599//
1600// @format_string determines the C types that are used for unpacking
1601// the values and also determines if the values are copied or borrowed,
1602// see the section on
1603// [`GVariant` format strings](gvariant-format-strings.html#pointers).
1604//
1605// This function is currently implemented with a linear scan.  If you
1606// plan to do many lookups then #GVariantDict may be more efficient.
1607func (x *Variant) Lookup(KeyVar string, FormatStringVar string, varArgs ...interface{}) bool {
1608
1609	cret := xVariantLookup(x.GoPointer(), KeyVar, FormatStringVar, varArgs...)
1610	return cret
1611}
1612
1613var xVariantLookupValue func(uintptr, string, *VariantType) *Variant
1614
1615// Looks up a value in a dictionary #GVariant.
1616//
1617// This function works with dictionaries of the type a{s*} (and equally
1618// well with type a{o*}, but we only further discuss the string case
1619// for sake of clarity).
1620//
1621// In the event that @dictionary has the type a{sv}, the @expected_type
1622// string specifies what type of value is expected to be inside of the
1623// variant. If the value inside the variant has a different type then
1624// %NULL is returned. In the event that @dictionary has a value type other
1625// than v then @expected_type must directly match the value type and it is
1626// used to unpack the value directly or an error occurs.
1627//
1628// In either case, if @key is not found in @dictionary, %NULL is returned.
1629//
1630// If the key is found and the value has the correct type, it is
1631// returned.  If @expected_type was specified then any non-%NULL return
1632// value will have this type.
1633//
1634// This function is currently implemented with a linear scan.  If you
1635// plan to do many lookups then #GVariantDict may be more efficient.
1636func (x *Variant) LookupValue(KeyVar string, ExpectedTypeVar *VariantType) *Variant {
1637
1638	cret := xVariantLookupValue(x.GoPointer(), KeyVar, ExpectedTypeVar)
1639	return cret
1640}
1641
1642var xVariantNChildren func(uintptr) uint
1643
1644// Determines the number of children in a container #GVariant instance.
1645// This includes variants, maybes, arrays, tuples and dictionary
1646// entries.  It is an error to call this function on any other type of
1647// #GVariant.
1648//
1649// For variants, the return value is always 1.  For values with maybe
1650// types, it is always zero or one.  For arrays, it is the length of the
1651// array.  For tuples it is the number of tuple items (which depends
1652// only on the type).  For dictionary entries, it is always 2
1653//
1654// This function is O(1).
1655func (x *Variant) NChildren() uint {
1656
1657	cret := xVariantNChildren(x.GoPointer())
1658	return cret
1659}
1660
1661var xVariantPrint func(uintptr, bool) string
1662
1663// Pretty-prints @value in the format understood by g_variant_parse().
1664//
1665// The format is described [here](gvariant-text-format.html).
1666//
1667// If @type_annotate is %TRUE, then type information is included in
1668// the output.
1669func (x *Variant) Print(TypeAnnotateVar bool) string {
1670
1671	cret := xVariantPrint(x.GoPointer(), TypeAnnotateVar)
1672	return cret
1673}
1674
1675var xVariantPrintString func(uintptr, *String, bool) *String
1676
1677// Behaves as g_variant_print(), but operates on a #GString.
1678//
1679// If @string is non-%NULL then it is appended to and returned.  Else,
1680// a new empty #GString is allocated and it is returned.
1681func (x *Variant) PrintString(StringVar *String, TypeAnnotateVar bool) *String {
1682
1683	cret := xVariantPrintString(x.GoPointer(), StringVar, TypeAnnotateVar)
1684	return cret
1685}
1686
1687var xVariantRef func(uintptr) *Variant
1688
1689// Increases the reference count of @value.
1690func (x *Variant) Ref() *Variant {
1691
1692	cret := xVariantRef(x.GoPointer())
1693	return cret
1694}
1695
1696var xVariantRefSink func(uintptr) *Variant
1697
1698// #GVariant uses a floating reference count system.  All functions with
1699// names starting with `g_variant_new_` return floating
1700// references.
1701//
1702// Calling g_variant_ref_sink() on a #GVariant with a floating reference
1703// will convert the floating reference into a full reference.  Calling
1704// g_variant_ref_sink() on a non-floating #GVariant results in an
1705// additional normal reference being added.
1706//
1707// In other words, if the @value is floating, then this call "assumes
1708// ownership" of the floating reference, converting it to a normal
1709// reference.  If the @value is not floating, then this call adds a
1710// new normal reference increasing the reference count by one.
1711//
1712// All calls that result in a #GVariant instance being inserted into a
1713// container will call g_variant_ref_sink() on the instance.  This means
1714// that if the value was just created (and has only its floating
1715// reference) then the container will assume sole ownership of the value
1716// at that point and the caller will not need to unreference it.  This
1717// makes certain common styles of programming much easier while still
1718// maintaining normal refcounting semantics in situations where values
1719// are not floating.
1720func (x *Variant) RefSink() *Variant {
1721
1722	cret := xVariantRefSink(x.GoPointer())
1723	return cret
1724}
1725
1726var xVariantStore func(uintptr, uintptr)
1727
1728// Stores the serialized form of @value at @data.  @data should be
1729// large enough.  See g_variant_get_size().
1730//
1731// The stored data is in machine native byte order but may not be in
1732// fully-normalised form if read from an untrusted source.  See
1733// g_variant_get_normal_form() for a solution.
1734//
1735// As with g_variant_get_data(), to be able to deserialize the
1736// serialized variant successfully, its type and (if the destination
1737// machine might be different) its endianness must also be available.
1738//
1739// This function is approximately O(n) in the size of @data.
1740func (x *Variant) Store(DataVar uintptr) {
1741
1742	xVariantStore(x.GoPointer(), DataVar)
1743
1744}
1745
1746var xVariantTakeRef func(uintptr) *Variant
1747
1748// If @value is floating, sink it.  Otherwise, do nothing.
1749//
1750// Typically you want to use g_variant_ref_sink() in order to
1751// automatically do the correct thing with respect to floating or
1752// non-floating references, but there is one specific scenario where
1753// this function is helpful.
1754//
1755// The situation where this function is helpful is when creating an API
1756// that allows the user to provide a callback function that returns a
1757// #GVariant.  We certainly want to allow the user the flexibility to
1758// return a non-floating reference from this callback (for the case
1759// where the value that is being returned already exists).
1760//
1761// At the same time, the style of the #GVariant API makes it likely that
1762// for newly-created #GVariant instances, the user can be saved some
1763// typing if they are allowed to return a #GVariant with a floating
1764// reference.
1765//
1766// Using this function on the return value of the user's callback allows
1767// the user to do whichever is more convenient for them.  The caller
1768// will always receives exactly one full reference to the value: either
1769// the one that was returned in the first place, or a floating reference
1770// that has been converted to a full reference.
1771//
1772// This function has an odd interaction when combined with
1773// g_variant_ref_sink() running at the same time in another thread on
1774// the same #GVariant instance.  If g_variant_ref_sink() runs first then
1775// the result will be that the floating reference is converted to a hard
1776// reference.  If g_variant_take_ref() runs first then the result will
1777// be that the floating reference is converted to a hard reference and
1778// an additional reference on top of that one is added.  It is best to
1779// avoid this situation.
1780func (x *Variant) TakeRef() *Variant {
1781
1782	cret := xVariantTakeRef(x.GoPointer())
1783	return cret
1784}
1785
1786var xVariantUnref func(uintptr)
1787
1788// Decreases the reference count of @value.  When its reference count
1789// drops to 0, the memory used by the variant is freed.
1790func (x *Variant) Unref() {
1791
1792	xVariantUnref(x.GoPointer())
1793
1794}
1795
1796// A utility type for constructing container-type #GVariant instances.
1797//
1798// This is an opaque structure and may only be accessed using the
1799// following functions.
1800//
1801// #GVariantBuilder is not threadsafe in any way.  Do not attempt to
1802// access it from more than one thread.
1803type VariantBuilder struct {
1804	_ structs.HostLayout
1805}
1806
1807var xVariantBuilderGLibType func() types.GType
1808
1809func VariantBuilderGLibType() types.GType {
1810	return xVariantBuilderGLibType()
1811}
1812
1813func (x *VariantBuilder) GoPointer() uintptr {
1814	return uintptr(unsafe.Pointer(x))
1815}
1816
1817var xNewVariantBuilder func(*VariantType) *VariantBuilder
1818
1819// Allocates and initialises a new #GVariantBuilder.
1820//
1821// You should call g_variant_builder_unref() on the return value when it
1822// is no longer needed.  The memory will not be automatically freed by
1823// any other call.
1824//
1825// In most cases it is easier to place a #GVariantBuilder directly on
1826// the stack of the calling function and initialise it with
1827// g_variant_builder_init_static().
1828func NewVariantBuilder(TypeVar *VariantType) *VariantBuilder {
1829
1830	cret := xNewVariantBuilder(TypeVar)
1831	return cret
1832}
1833
1834var xVariantBuilderAdd func(uintptr, string, ...interface{})
1835
1836// Adds to a #GVariantBuilder.
1837//
1838// This call is a convenience wrapper that is exactly equivalent to
1839// calling g_variant_new() followed by g_variant_builder_add_value().
1840//
1841// Note that the arguments must be of the correct width for their types
1842// specified in @format_string. This can be achieved by casting them. See
1843// the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
1844//
1845// This function might be used as follows:
1846//
1847// |[<!-- language="C" -->
1848// GVariant *
1849// make_pointless_dictionary (void)
1850//
1851//	{
1852//	  GVariantBuilder builder;
1853//	  int i;
1854//
1855//	  g_variant_builder_init_static (&builder, G_VARIANT_TYPE_ARRAY);
1856//	  for (i = 0; i < 16; i++)
1857//	    {
1858//	      gchar buf[3];
1859//
1860//	      sprintf (buf, "%d", i);
1861//	      g_variant_builder_add (&builder, "{is}", i, buf);
1862//	    }
1863//
1864//	  return g_variant_builder_end (&builder);
1865//	}
1866//
1867// ]|
1868func (x *VariantBuilder) Add(FormatStringVar string, varArgs ...interface{}) {
1869
1870	xVariantBuilderAdd(x.GoPointer(), FormatStringVar, varArgs...)
1871
1872}
1873
1874var xVariantBuilderAddParsed func(uintptr, string, ...interface{})
1875
1876// Adds to a #GVariantBuilder.
1877//
1878// This call is a convenience wrapper that is exactly equivalent to
1879// calling g_variant_new_parsed() followed by
1880// g_variant_builder_add_value().
1881//
1882// Note that the arguments must be of the correct width for their types
1883// specified in @format_string. This can be achieved by casting them. See
1884// the [GVariant varargs documentation](gvariant-format-strings.html#varargs).
1885//
1886// This function might be used as follows:
1887//
1888// |[<!-- language="C" -->
1889// GVariant *
1890// make_pointless_dictionary (void)
1891//
1892//	{
1893//	  GVariantBuilder builder;
1894//	  int i;
1895//
1896//	  g_variant_builder_init_static (&builder, G_VARIANT_TYPE_ARRAY);
1897//	  g_variant_builder_add_parsed (&builder, "{'width', <%i>}", 600);
1898//	  g_variant_builder_add_parsed (&builder, "{'title', <%s>}", "foo");
1899//	  g_variant_builder_add_parsed (&builder, "{'transparency', <0.5>}");
1900//	  return g_variant_builder_end (&builder);
1901//	}
1902//
1903// ]|
1904func (x *VariantBuilder) AddParsed(FormatVar string, varArgs ...interface{}) {
1905
1906	xVariantBuilderAddParsed(x.GoPointer(), FormatVar, varArgs...)
1907
1908}
1909
1910var xVariantBuilderAddValue func(uintptr, *Variant)
1911
1912// Adds @value to @builder.
1913//
1914// It is an error to call this function in any way that would create an
1915// inconsistent value to be constructed.  Some examples of this are
1916// putting different types of items into an array, putting the wrong
1917// types or number of items in a tuple, putting more than one value into
1918// a variant, etc.
1919//
1920// If @value is a floating reference (see g_variant_ref_sink()),
1921// the @builder instance takes ownership of @value.
1922func (x *VariantBuilder) AddValue(ValueVar *Variant) {
1923
1924	xVariantBuilderAddValue(x.GoPointer(), ValueVar)
1925
1926}
1927
1928var xVariantBuilderClear func(uintptr)
1929
1930// Releases all memory associated with a #GVariantBuilder without
1931// freeing the #GVariantBuilder structure itself.
1932//
1933// It typically only makes sense to do this on a stack-allocated
1934// #GVariantBuilder if you want to abort building the value part-way
1935// through.  This function need not be called if you call
1936// g_variant_builder_end() and it also doesn't need to be called on
1937// builders allocated with g_variant_builder_new() (see
1938// g_variant_builder_unref() for that).
1939//
1940// This function leaves the #GVariantBuilder structure set to all-zeros.
1941// It is valid to call this function on either an initialised
1942// #GVariantBuilder or one that is set to all-zeros but it is not valid
1943// to call this function on uninitialised memory.
1944func (x *VariantBuilder) Clear() {
1945
1946	xVariantBuilderClear(x.GoPointer())
1947
1948}
1949
1950var xVariantBuilderClose func(uintptr)
1951
1952// Closes the subcontainer inside the given @builder that was opened by
1953// the most recent call to g_variant_builder_open().
1954//
1955// It is an error to call this function in any way that would create an
1956// inconsistent value to be constructed (ie: too few values added to the
1957// subcontainer).
1958func (x *VariantBuilder) Close() {
1959
1960	xVariantBuilderClose(x.GoPointer())
1961
1962}
1963
1964var xVariantBuilderEnd func(uintptr) *Variant
1965
1966// Ends the builder process and returns the constructed value.
1967//
1968// It is not permissible to use @builder in any way after this call
1969// except for reference counting operations (in the case of a
1970// heap-allocated #GVariantBuilder) or by reinitialising it with
1971// g_variant_builder_init() (in the case of stack-allocated). This
1972// means that for the stack-allocated builders there is no need to
1973// call g_variant_builder_clear() after the call to
1974// g_variant_builder_end().
1975//
1976// It is an error to call this function in any way that would create an
1977// inconsistent value to be constructed (ie: insufficient number of
1978// items added to a container with a specific number of children
1979// required).  It is also an error to call this function if the builder
1980// was created with an indefinite array or maybe type and no children
1981// have been added; in this case it is impossible to infer the type of
1982// the empty array.
1983func (x *VariantBuilder) End() *Variant {
1984
1985	cret := xVariantBuilderEnd(x.GoPointer())
1986	return cret
1987}
1988
1989var xVariantBuilderInit func(uintptr, *VariantType)
1990
1991// Initialises a #GVariantBuilder structure.
1992//
1993// @type must be non-%NULL.  It specifies the type of container to
1994// construct.  It can be an indefinite type such as
1995// %G_VARIANT_TYPE_ARRAY or a definite type such as "as" or "(ii)".
1996// Maybe, array, tuple, dictionary entry and variant-typed values may be
1997// constructed.
1998//
1999// If using a static type such as one of the `G_VARIANT_TYPE_*` constants
2000// or a `G_VARIANT_TYPE ("(ii)")` macro, it is more performant to use
2001// g_variant_builder_init_static() rather than g_variant_builder_init().
2002//
2003// After the builder is initialised, values are added using
2004// g_variant_builder_add_value() or g_variant_builder_add().
2005//
2006// After all the child values are added, g_variant_builder_end() frees
2007// the memory associated with the builder and returns the #GVariant that
2008// was created.
2009//
2010// This function completely ignores the previous contents of @builder.
2011// On one hand this means that it is valid to pass in completely
2012// uninitialised memory.  On the other hand, this means that if you are
2013// initialising over top of an existing #GVariantBuilder you need to
2014// first call g_variant_builder_clear() in order to avoid leaking
2015// memory.
2016//
2017// You must not call g_variant_builder_ref() or
2018// g_variant_builder_unref() on a #GVariantBuilder that was initialised
2019// with this function.  If you ever pass a reference to a
2020// #GVariantBuilder outside of the control of your own code then you
2021// should assume that the person receiving that reference may try to use
2022// reference counting; you should use g_variant_builder_new() instead of
2023// this function.
2024func (x *VariantBuilder) Init(TypeVar *VariantType) {
2025
2026	xVariantBuilderInit(x.GoPointer(), TypeVar)
2027
2028}
2029
2030var xVariantBuilderInitStatic func(uintptr, *VariantType)
2031
2032// Initialises a #GVariantBuilder structure.
2033//
2034// This function works exactly like g_variant_builder_init() but does
2035// not make a copy of @type. Therefore, @type must remain valid for the
2036// lifetime of @builder. This is always true of type constants like
2037// `G_VARIANT_TYPE_*` or `G_VARIANT_TYPE ("(ii)")`.
2038func (x *VariantBuilder) InitStatic(TypeVar *VariantType) {
2039
2040	xVariantBuilderInitStatic(x.GoPointer(), TypeVar)
2041
2042}
2043
2044var xVariantBuilderOpen func(uintptr, *VariantType)
2045
2046// Opens a subcontainer inside the given @builder.  When done adding
2047// items to the subcontainer, g_variant_builder_close() must be called. @type
2048// is the type of the container: so to build a tuple of several values, @type
2049// must include the tuple itself.
2050//
2051// It is an error to call this function in any way that would cause an
2052// inconsistent value to be constructed (ie: adding too many values or
2053// a value of an incorrect type).
2054//
2055// Example of building a nested variant:
2056// |[<!-- language="C" -->
2057// GVariantBuilder builder;
2058// guint32 some_number = get_number ();
2059// g_autoptr (GHashTable) some_dict = get_dict ();
2060// GHashTableIter iter;
2061// const gchar *key;
2062// const GVariant *value;
2063// g_autoptr (GVariant) output = NULL;
2064//
2065// g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ua{sv})"));
2066// g_variant_builder_add (&builder, "u", some_number);
2067// g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
2068//
2069// g_hash_table_iter_init (&iter, some_dict);
2070// while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value))
2071//
2072//	{
2073//	  g_variant_builder_open (&builder, G_VARIANT_TYPE ("{sv}"));
2074//	  g_variant_builder_add (&builder, "s", key);
2075//	  g_variant_builder_add (&builder, "v", value);
2076//	  g_variant_builder_close (&builder);
2077//	}
2078//
2079// g_variant_builder_close (&builder);
2080//
2081// output = g_variant_builder_end (&builder);
2082// ]|
2083func (x *VariantBuilder) Open(TypeVar *VariantType) {
2084
2085	xVariantBuilderOpen(x.GoPointer(), TypeVar)
2086
2087}
2088
2089var xVariantBuilderRef func(uintptr) *VariantBuilder
2090
2091// Increases the reference count on @builder.
2092//
2093// Don't call this on stack-allocated #GVariantBuilder instances or bad
2094// things will happen.
2095func (x *VariantBuilder) Ref() *VariantBuilder {
2096
2097	cret := xVariantBuilderRef(x.GoPointer())
2098	return cret
2099}
2100
2101var xVariantBuilderUnref func(uintptr)
2102
2103// Decreases the reference count on @builder.
2104//
2105// In the event that there are no more references, releases all memory
2106// associated with the #GVariantBuilder.
2107//
2108// Don't call this on stack-allocated #GVariantBuilder instances or bad
2109// things will happen.
2110func (x *VariantBuilder) Unref() {
2111
2112	xVariantBuilderUnref(x.GoPointer())
2113
2114}
2115
2116// #GVariantDict is a mutable interface to #GVariant dictionaries.
2117//
2118// It can be used for doing a sequence of dictionary lookups in an
2119// efficient way on an existing #GVariant dictionary or it can be used
2120// to construct new dictionaries with a hashtable-like interface.  It
2121// can also be used for taking existing dictionaries and modifying them
2122// in order to create new ones.
2123//
2124// #GVariantDict can only be used with %G_VARIANT_TYPE_VARDICT
2125// dictionaries.
2126//
2127// It is possible to use #GVariantDict allocated on the stack or on the
2128// heap.  When using a stack-allocated #GVariantDict, you begin with a
2129// call to g_variant_dict_init() and free the resources with a call to
2130// g_variant_dict_clear().
2131//
2132// Heap-allocated #GVariantDict follows normal refcounting rules: you
2133// allocate it with g_variant_dict_new() and use g_variant_dict_ref()
2134// and g_variant_dict_unref().
2135//
2136// g_variant_dict_end() is used to convert the #GVariantDict back into a
2137// dictionary-type #GVariant.  When used with stack-allocated instances,
2138// this also implicitly frees all associated memory, but for
2139// heap-allocated instances, you must still call g_variant_dict_unref()
2140// afterwards.
2141//
2142// You will typically want to use a heap-allocated #GVariantDict when
2143// you expose it as part of an API.  For most other uses, the
2144// stack-allocated form will be more convenient.
2145//
2146// Consider the following two examples that do the same thing in each
2147// style: take an existing dictionary and look up the "count" uint32
2148// key, adding 1 to it if it is found, or returning an error if the
2149// key is not found.  Each returns the new dictionary as a floating
2150// #GVariant.
2151//
2152// ## Using a stack-allocated GVariantDict
2153//
2154// |[<!-- language="C" -->
2155//
2156//	GVariant *
2157//	add_to_count (GVariant  *orig,
2158//	              GError   **error)
2159//	{
2160//	  GVariantDict dict;
2161//	  guint32 count;
2162//
2163//	  g_variant_dict_init (&dict, orig);
2164//	  if (!g_variant_dict_lookup (&dict, "count", "u", &count))
2165//	    {
2166//	      g_set_error (...);
2167//	      g_variant_dict_clear (&dict);
2168//	      return NULL;
2169//	    }
2170//
2171//	  g_variant_dict_insert (&dict, "count", "u", count + 1);
2172//
2173//	  return g_variant_dict_end (&dict);
2174//	}
2175//
2176// ]|
2177//
2178// ## Using heap-allocated GVariantDict
2179//
2180// |[<!-- language="C" -->
2181//
2182//	GVariant *
2183//	add_to_count (GVariant  *orig,
2184//	              GError   **error)
2185//	{
2186//	  GVariantDict *dict;
2187//	  GVariant *result;
2188//	  guint32 count;
2189//
2190//	  dict = g_variant_dict_new (orig);
2191//
2192//	  if (g_variant_dict_lookup (dict, "count", "u", &count))
2193//	    {
2194//	      g_variant_dict_insert (dict, "count", "u", count + 1);
2195//	      result = g_variant_dict_end (dict);
2196//	    }
2197//	  else
2198//	    {
2199//	      g_set_error (...);
2200//	      result = NULL;
2201//	    }
2202//
2203//	  g_variant_dict_unref (dict);
2204//
2205//	  return result;
2206//	}
2207//
2208// ]|
2209type VariantDict struct {
2210	_ structs.HostLayout
2211}
2212
2213var xVariantDictGLibType func() types.GType
2214
2215func VariantDictGLibType() types.GType {
2216	return xVariantDictGLibType()
2217}
2218
2219func (x *VariantDict) GoPointer() uintptr {
2220	return uintptr(unsafe.Pointer(x))
2221}
2222
2223var xNewVariantDict func(*Variant) *VariantDict
2224
2225// Allocates and initialises a new #GVariantDict.
2226//
2227// You should call g_variant_dict_unref() on the return value when it
2228// is no longer needed.  The memory will not be automatically freed by
2229// any other call.
2230//
2231// In some cases it may be easier to place a #GVariantDict directly on
2232// the stack of the calling function and initialise it with
2233// g_variant_dict_init().  This is particularly useful when you are
2234// using #GVariantDict to construct a #GVariant.
2235func NewVariantDict(FromAsvVar *Variant) *VariantDict {
2236
2237	cret := xNewVariantDict(FromAsvVar)
2238	return cret
2239}
2240
2241var xVariantDictClear func(uintptr)
2242
2243// Releases all memory associated with a #GVariantDict without freeing
2244// the #GVariantDict structure itself.
2245//
2246// It typically only makes sense to do this on a stack-allocated
2247// #GVariantDict if you want to abort building the value part-way
2248// through.  This function need not be called if you call
2249// g_variant_dict_end() and it also doesn't need to be called on dicts
2250// allocated with g_variant_dict_new (see g_variant_dict_unref() for
2251// that).
2252//
2253// It is valid to call this function on either an initialised
2254// #GVariantDict or one that was previously cleared by an earlier call
2255// to g_variant_dict_clear() but it is not valid to call this function
2256// on uninitialised memory.
2257func (x *VariantDict) Clear() {
2258
2259	xVariantDictClear(x.GoPointer())
2260
2261}
2262
2263var xVariantDictContains func(uintptr, string) bool
2264
2265// Checks if @key exists in @dict.
2266func (x *VariantDict) Contains(KeyVar string) bool {
2267
2268	cret := xVariantDictContains(x.GoPointer(), KeyVar)
2269	return cret
2270}
2271
2272var xVariantDictEnd func(uintptr) *Variant
2273
2274// Returns the current value of @dict as a #GVariant of type
2275// %G_VARIANT_TYPE_VARDICT, clearing it in the process.
2276//
2277// It is not permissible to use @dict in any way after this call except
2278// for reference counting operations (in the case of a heap-allocated
2279// #GVariantDict) or by reinitialising it with g_variant_dict_init() (in
2280// the case of stack-allocated).
2281func (x *VariantDict) End() *Variant {
2282
2283	cret := xVariantDictEnd(x.GoPointer())
2284	return cret
2285}
2286
2287var xVariantDictInit func(uintptr, *Variant)
2288
2289// Initialises a #GVariantDict structure.
2290//
2291// If @from_asv is given, it is used to initialise the dictionary.
2292//
2293// This function completely ignores the previous contents of @dict.  On
2294// one hand this means that it is valid to pass in completely
2295// uninitialised memory.  On the other hand, this means that if you are
2296// initialising over top of an existing #GVariantDict you need to first
2297// call g_variant_dict_clear() in order to avoid leaking memory.
2298//
2299// You must not call g_variant_dict_ref() or g_variant_dict_unref() on a
2300// #GVariantDict that was initialised with this function.  If you ever
2301// pass a reference to a #GVariantDict outside of the control of your
2302// own code then you should assume that the person receiving that
2303// reference may try to use reference counting; you should use
2304// g_variant_dict_new() instead of this function.
2305func (x *VariantDict) Init(FromAsvVar *Variant) {
2306
2307	xVariantDictInit(x.GoPointer(), FromAsvVar)
2308
2309}
2310
2311var xVariantDictInsert func(uintptr, string, string, ...interface{})
2312
2313// Inserts a value into a #GVariantDict.
2314//
2315// This call is a convenience wrapper that is exactly equivalent to
2316// calling g_variant_new() followed by g_variant_dict_insert_value().
2317func (x *VariantDict) Insert(KeyVar string, FormatStringVar string, varArgs ...interface{}) {
2318
2319	xVariantDictInsert(x.GoPointer(), KeyVar, FormatStringVar, varArgs...)
2320
2321}
2322
2323var xVariantDictInsertValue func(uintptr, string, *Variant)
2324
2325// Inserts (or replaces) a key in a #GVariantDict.
2326//
2327// @value is consumed if it is floating.
2328func (x *VariantDict) InsertValue(KeyVar string, ValueVar *Variant) {
2329
2330	xVariantDictInsertValue(x.GoPointer(), KeyVar, ValueVar)
2331
2332}
2333
2334var xVariantDictLookup func(uintptr, string, string, ...interface{}) bool
2335
2336// Looks up a value in a #GVariantDict.
2337//
2338// This function is a wrapper around g_variant_dict_lookup_value() and
2339// g_variant_get().  In the case that %NULL would have been returned,
2340// this function returns %FALSE and does not modify the values of the arguments
2341// passed in to @....  Otherwise, it unpacks the returned
2342// value and returns %TRUE.
2343//
2344// @format_string determines the C types that are used for unpacking the
2345// values and also determines if the values are copied or borrowed, see the
2346// section on [`GVariant` format strings](gvariant-format-strings.html#pointers).
2347func (x *VariantDict) Lookup(KeyVar string, FormatStringVar string, varArgs ...interface{}) bool {
2348
2349	cret := xVariantDictLookup(x.GoPointer(), KeyVar, FormatStringVar, varArgs...)
2350	return cret
2351}
2352
2353var xVariantDictLookupValue func(uintptr, string, *VariantType) *Variant
2354
2355// Looks up a value in a #GVariantDict.
2356//
2357// If @key is not found in @dictionary, %NULL is returned.
2358//
2359// The @expected_type string specifies what type of value is expected.
2360// If the value associated with @key has a different type then %NULL is
2361// returned.
2362//
2363// If the key is found and the value has the correct type, it is
2364// returned.  If @expected_type was specified then any non-%NULL return
2365// value will have this type.
2366func (x *VariantDict) LookupValue(KeyVar string, ExpectedTypeVar *VariantType) *Variant {
2367
2368	cret := xVariantDictLookupValue(x.GoPointer(), KeyVar, ExpectedTypeVar)
2369	return cret
2370}
2371
2372var xVariantDictRef func(uintptr) *VariantDict
2373
2374// Increases the reference count on @dict.
2375//
2376// Don't call this on stack-allocated #GVariantDict instances or bad
2377// things will happen.
2378func (x *VariantDict) Ref() *VariantDict {
2379
2380	cret := xVariantDictRef(x.GoPointer())
2381	return cret
2382}
2383
2384var xVariantDictRemove func(uintptr, string) bool
2385
2386// Removes a key and its associated value from a #GVariantDict.
2387func (x *VariantDict) Remove(KeyVar string) bool {
2388
2389	cret := xVariantDictRemove(x.GoPointer(), KeyVar)
2390	return cret
2391}
2392
2393var xVariantDictUnref func(uintptr)
2394
2395// Decreases the reference count on @dict.
2396//
2397// In the event that there are no more references, releases all memory
2398// associated with the #GVariantDict.
2399//
2400// Don't call this on stack-allocated #GVariantDict instances or bad
2401// things will happen.
2402func (x *VariantDict) Unref() {
2403
2404	xVariantDictUnref(x.GoPointer())
2405
2406}
2407
2408// #GVariantIter is an opaque data structure and can only be accessed
2409// using the following functions.
2410type VariantIter struct {
2411	_ structs.HostLayout
2412
2413	X [16]uintptr
2414}
2415
2416func (x *VariantIter) GoPointer() uintptr {
2417	return uintptr(unsafe.Pointer(x))
2418}
2419
2420var xVariantIterCopy func(uintptr) *VariantIter
2421
2422// Creates a new heap-allocated #GVariantIter to iterate over the
2423// container that was being iterated over by @iter.  Iteration begins on
2424// the new iterator from the current position of the old iterator but
2425// the two copies are independent past that point.
2426//
2427// Use g_variant_iter_free() to free the return value when you no longer
2428// need it.
2429//
2430// A reference is taken to the container that @iter is iterating over
2431// and will be related only when g_variant_iter_free() is called.
2432func (x *VariantIter) Copy() *VariantIter {
2433
2434	cret := xVariantIterCopy(x.GoPointer())
2435	return cret
2436}
2437
2438var xVariantIterFree func(uintptr)
2439
2440// Frees a heap-allocated #GVariantIter.  Only call this function on
2441// iterators that were returned by g_variant_iter_new() or
2442// g_variant_iter_copy().
2443func (x *VariantIter) Free() {
2444
2445	xVariantIterFree(x.GoPointer())
2446
2447}
2448
2449var xVariantIterInit func(uintptr, *Variant) uint
2450
2451// Initialises (without allocating) a #GVariantIter.  @iter may be
2452// completely uninitialised prior to this call; its old value is
2453// ignored.
2454//
2455// The iterator remains valid for as long as @value exists, and need not
2456// be freed in any way.
2457func (x *VariantIter) Init(ValueVar *Variant) uint {
2458
2459	cret := xVariantIterInit(x.GoPointer(), ValueVar)
2460	return cret
2461}
2462
2463var xVariantIterLoop func(uintptr, string, ...interface{}) bool
2464
2465// Gets the next item in the container and unpacks it into the variable
2466// argument list according to @format_string, returning %TRUE.
2467//
2468// If no more items remain then %FALSE is returned.
2469//
2470// On the first call to this function, the pointers appearing on the
2471// variable argument list are assumed to point at uninitialised memory.
2472// On the second and later calls, it is assumed that the same pointers
2473// will be given and that they will point to the memory as set by the
2474// previous call to this function.  This allows the previous values to
2475// be freed, as appropriate.
2476//
2477// This function is intended to be used with a while loop as
2478// demonstrated in the following example.  This function can only be
2479// used when iterating over an array.  It is only valid to call this
2480// function with a string constant for the format string and the same
2481// string constant must be used each time.  Mixing calls to this
2482// function and g_variant_iter_next() or g_variant_iter_next_value() on
2483// the same iterator causes undefined behavior.
2484//
2485// If you break out of a such a while loop using g_variant_iter_loop() then
2486// you must free or unreference all the unpacked values as you would with
2487// g_variant_get(). Failure to do so will cause a memory leak.
2488//
2489// Here is an example for memory management with g_variant_iter_loop():
2490// |[<!-- language="C" -->
2491//
2492//	// Iterates a dictionary of type 'a{sv}'
2493//	void
2494//	iterate_dictionary (GVariant *dictionary)
2495//	{
2496//	  GVariantIter iter;
2497//	  GVariant *value;
2498//	  gchar *key;
2499//
2500//	  g_variant_iter_init (&iter, dictionary);
2501//	  while (g_variant_iter_loop (&iter, "{sv}", &key, &value))
2502//	    {
2503//	      g_print ("Item '%s' has type '%s'\n", key,
2504//	               g_variant_get_type_string (value));
2505//
2506//	      // no need to free 'key' and 'value' here
2507//	      // unless breaking out of this loop
2508//	    }
2509//	}
2510//
2511// ]|
2512//
2513// For most cases you should use g_variant_iter_next().
2514//
2515// This function is really only useful when unpacking into #GVariant or
2516// #GVariantIter in order to allow you to skip the call to
2517// g_variant_unref() or g_variant_iter_free().
2518//
2519// For example, if you are only looping over simple integer and string
2520// types, g_variant_iter_next() is definitely preferred.  For string
2521// types, use the '&' prefix to avoid allocating any memory at all (and
2522// thereby avoiding the need to free anything as well).
2523//
2524// @format_string determines the C types that are used for unpacking
2525// the values and also determines if the values are copied or borrowed.
2526//
2527// See the section on
2528// [`GVariant` format strings](gvariant-format-strings.html#pointers).
2529func (x *VariantIter) Loop(FormatStringVar string, varArgs ...interface{}) bool {
2530
2531	cret := xVariantIterLoop(x.GoPointer(), FormatStringVar, varArgs...)
2532	return cret
2533}
2534
2535var xVariantIterNChildren func(uintptr) uint
2536
2537// Queries the number of child items in the container that we are
2538// iterating over.  This is the total number of items -- not the number
2539// of items remaining.
2540//
2541// This function might be useful for preallocation of arrays.
2542func (x *VariantIter) NChildren() uint {
2543
2544	cret := xVariantIterNChildren(x.GoPointer())
2545	return cret
2546}
2547
2548var xVariantIterNext func(uintptr, string, ...interface{}) bool
2549
2550// Gets the next item in the container and unpacks it into the variable
2551// argument list according to @format_string, returning %TRUE.
2552//
2553// If no more items remain then %FALSE is returned.
2554//
2555// All of the pointers given on the variable arguments list of this
2556// function are assumed to point at uninitialised memory.  It is the
2557// responsibility of the caller to free all of the values returned by
2558// the unpacking process.
2559//
2560// Here is an example for memory management with g_variant_iter_next():
2561// |[<!-- language="C" -->
2562//
2563//	// Iterates a dictionary of type 'a{sv}'
2564//	void
2565//	iterate_dictionary (GVariant *dictionary)
2566//	{
2567//	  GVariantIter iter;
2568//	  GVariant *value;
2569//	  gchar *key;
2570//
2571//	  g_variant_iter_init (&iter, dictionary);
2572//	  while (g_variant_iter_next (&iter, "{sv}", &key, &value))
2573//	    {
2574//	      g_print ("Item '%s' has type '%s'\n", key,
2575//	               g_variant_get_type_string (value));
2576//
2577//	      // must free data for ourselves
2578//	      g_variant_unref (value);
2579//	      g_free (key);
2580//	    }
2581//	}
2582//
2583// ]|
2584//
2585// For a solution that is likely to be more convenient to C programmers
2586// when dealing with loops, see g_variant_iter_loop().
2587//
2588// @format_string determines the C types that are used for unpacking
2589// the values and also determines if the values are copied or borrowed.
2590//
2591// See the section on
2592// [`GVariant` format strings](gvariant-format-strings.html#pointers).
2593func (x *VariantIter) Next(FormatStringVar string, varArgs ...interface{}) bool {
2594
2595	cret := xVariantIterNext(x.GoPointer(), FormatStringVar, varArgs...)
2596	return cret
2597}
2598
2599var xVariantIterNextValue func(uintptr) *Variant
2600
2601// Gets the next item in the container.  If no more items remain then
2602// %NULL is returned.
2603//
2604// Use g_variant_unref() to drop your reference on the return value when
2605// you no longer need it.
2606//
2607// Here is an example for iterating with g_variant_iter_next_value():
2608// |[<!-- language="C" -->
2609//
2610//	// recursively iterate a container
2611//	void
2612//	iterate_container_recursive (GVariant *container)
2613//	{
2614//	  GVariantIter iter;
2615//	  GVariant *child;
2616//
2617//	  g_variant_iter_init (&iter, container);
2618//	  while ((child = g_variant_iter_next_value (&iter)))
2619//	    {
2620//	      g_print ("type '%s'\n", g_variant_get_type_string (child));
2621//
2622//	      if (g_variant_is_container (child))
2623//	        iterate_container_recursive (child);
2624//
2625//	      g_variant_unref (child);
2626//	    }
2627//	}
2628//
2629// ]|
2630func (x *VariantIter) NextValue() *Variant {
2631
2632	cret := xVariantIterNextValue(x.GoPointer())
2633	return cret
2634}
2635
2636// The range of possible top-level types of #GVariant instances.
2637type VariantClass int
2638
2639const (
2640
2641	// The #GVariant is a boolean.
2642	GVariantClassBooleanValue VariantClass = 98
2643	// The #GVariant is a byte.
2644	GVariantClassByteValue VariantClass = 121
2645	// The #GVariant is a signed 16 bit integer.
2646	GVariantClassInt16Value VariantClass = 110
2647	// The #GVariant is an unsigned 16 bit integer.
2648	GVariantClassUint16Value VariantClass = 113
2649	// The #GVariant is a signed 32 bit integer.
2650	GVariantClassInt32Value VariantClass = 105
2651	// The #GVariant is an unsigned 32 bit integer.
2652	GVariantClassUint32Value VariantClass = 117
2653	// The #GVariant is a signed 64 bit integer.
2654	GVariantClassInt64Value VariantClass = 120
2655	// The #GVariant is an unsigned 64 bit integer.
2656	GVariantClassUint64Value VariantClass = 116
2657	// The #GVariant is a file handle index.
2658	GVariantClassHandleValue VariantClass = 104
2659	// The #GVariant is a double precision floating
2660	//                          point value.
2661	GVariantClassDoubleValue VariantClass = 100
2662	// The #GVariant is a normal string.
2663	GVariantClassStringValue VariantClass = 115
2664	// The #GVariant is a D-Bus object path
2665	//                               string.
2666	GVariantClassObjectPathValue VariantClass = 111
2667	// The #GVariant is a D-Bus signature string.
2668	GVariantClassSignatureValue VariantClass = 103
2669	// The #GVariant is a variant.
2670	GVariantClassVariantValue VariantClass = 118
2671	// The #GVariant is a maybe-typed value.
2672	GVariantClassMaybeValue VariantClass = 109
2673	// The #GVariant is an array.
2674	GVariantClassArrayValue VariantClass = 97
2675	// The #GVariant is a tuple.
2676	GVariantClassTupleValue VariantClass = 40
2677	// The #GVariant is a dictionary entry.
2678	GVariantClassDictEntryValue VariantClass = 123
2679)
2680
2681// Error codes returned by parsing text-format GVariants.
2682type VariantParseError int
2683
2684const (
2685
2686	// generic error (unused)
2687	GVariantParseErrorFailedValue VariantParseError = 0
2688	// a non-basic #GVariantType was given where a basic type was expected
2689	GVariantParseErrorBasicTypeExpectedValue VariantParseError = 1
2690	// cannot infer the #GVariantType
2691	GVariantParseErrorCannotInferTypeValue VariantParseError = 2
2692	// an indefinite #GVariantType was given where a definite type was expected
2693	GVariantParseErrorDefiniteTypeExpectedValue VariantParseError = 3
2694	// extra data after parsing finished
2695	GVariantParseErrorInputNotAtEndValue VariantParseError = 4
2696	// invalid character in number or unicode escape
2697	GVariantParseErrorInvalidCharacterValue VariantParseError = 5
2698	// not a valid #GVariant format string
2699	GVariantParseErrorInvalidFormatStringValue VariantParseError = 6
2700	// not a valid object path
2701	GVariantParseErrorInvalidObjectPathValue VariantParseError = 7
2702	// not a valid type signature
2703	GVariantParseErrorInvalidSignatureValue VariantParseError = 8
2704	// not a valid #GVariant type string
2705	GVariantParseErrorInvalidTypeStringValue VariantParseError = 9
2706	// could not find a common type for array entries
2707	GVariantParseErrorNoCommonTypeValue VariantParseError = 10
2708	// the numerical value is out of range of the given type
2709	GVariantParseErrorNumberOutOfRangeValue VariantParseError = 11
2710	// the numerical value is out of range for any type
2711	GVariantParseErrorNumberTooBigValue VariantParseError = 12
2712	// cannot parse as variant of the specified type
2713	GVariantParseErrorTypeErrorValue VariantParseError = 13
2714	// an unexpected token was encountered
2715	GVariantParseErrorUnexpectedTokenValue VariantParseError = 14
2716	// an unknown keyword was encountered
2717	GVariantParseErrorUnknownKeywordValue VariantParseError = 15
2718	// unterminated string constant
2719	GVariantParseErrorUnterminatedStringConstantValue VariantParseError = 16
2720	// no value given
2721	GVariantParseErrorValueExpectedValue VariantParseError = 17
2722	// variant was too deeply nested; #GVariant is only guaranteed to handle nesting up to 64 levels (Since: 2.64)
2723	GVariantParseErrorRecursionValue VariantParseError = 18
2724)
2725
2726var xVariantIsObjectPath func(string) bool
2727
2728// Determines if a given string is a valid D-Bus object path.  You
2729// should ensure that a string is a valid D-Bus object path before
2730// passing it to g_variant_new_object_path().
2731//
2732// A valid object path starts with `/` followed by zero or more
2733// sequences of characters separated by `/` characters.  Each sequence
2734// must contain only the characters `[A-Z][a-z][0-9]_`.  No sequence
2735// (including the one following the final `/` character) may be empty.
2736func VariantIsObjectPath(StringVar string) bool {
2737
2738	cret := xVariantIsObjectPath(StringVar)
2739
2740	return cret
2741}
2742
2743var xVariantIsSignature func(string) bool
2744
2745// Determines if a given string is a valid D-Bus type signature.  You
2746// should ensure that a string is a valid D-Bus type signature before
2747// passing it to g_variant_new_signature().
2748//
2749// D-Bus type signatures consist of zero or more definite #GVariantType
2750// strings in sequence.
2751func VariantIsSignature(StringVar string) bool {
2752
2753	cret := xVariantIsSignature(StringVar)
2754
2755	return cret
2756}
2757
2758var xVariantParse func(*VariantType, string, uintptr, uintptr, **Error) *Variant
2759
2760// Parses a #GVariant from a text representation.
2761//
2762// A single #GVariant is parsed from the content of @text.
2763//
2764// The format is described [here](gvariant-text-format.html).
2765//
2766// The memory at @limit will never be accessed and the parser behaves as
2767// if the character at @limit is the nul terminator.  This has the
2768// effect of bounding @text.
2769//
2770// If @endptr is non-%NULL then @text is permitted to contain data
2771// following the value that this function parses and @endptr will be
2772// updated to point to the first character past the end of the text
2773// parsed by this function.  If @endptr is %NULL and there is extra data
2774// then an error is returned.
2775//
2776// If @type is non-%NULL then the value will be parsed to have that
2777// type.  This may result in additional parse errors (in the case that
2778// the parsed value doesn't fit the type) but may also result in fewer
2779// errors (in the case that the type would have been ambiguous, such as
2780// with empty arrays).
2781//
2782// In the event that the parsing is successful, the resulting #GVariant
2783// is returned. It is never floating, and must be freed with
2784// [method@GLib.Variant.unref].
2785//
2786// In case of any error, %NULL will be returned.  If @error is non-%NULL
2787// then it will be set to reflect the error that occurred.
2788//
2789// Officially, the language understood by the parser is “any string
2790// produced by [method@GLib.Variant.print]”. This explicitly includes
2791// `g_variant_print()`’s annotated types like `int64 -1000`.
2792//
2793// There may be implementation specific restrictions on deeply nested values,
2794// which would result in a %G_VARIANT_PARSE_ERROR_RECURSION error. #GVariant is
2795// guaranteed to handle nesting up to at least 64 levels.
2796func VariantParse(TypeVar *VariantType, TextVar string, LimitVar *string, EndptrVar *string) (*Variant, error) {
2797	var cerr *Error
2798
2799	LimitVarPtr := core.GStrdupNullable(LimitVar)
2800	defer core.GFreeNullable(LimitVarPtr)
2801
2802	EndptrVarPtr := core.GStrdupNullable(EndptrVar)
2803	defer core.GFreeNullable(EndptrVarPtr)
2804
2805	cret := xVariantParse(TypeVar, TextVar, LimitVarPtr, EndptrVarPtr, &cerr)
2806
2807	if cerr == nil {
2808		return cret, nil
2809	}
2810	return cret, cerr
2811
2812}
2813
2814var xVariantParseErrorPrintContext func(*Error, string) string
2815
2816// Pretty-prints a message showing the context of a #GVariant parse
2817// error within the string for which parsing was attempted.
2818//
2819// The resulting string is suitable for output to the console or other
2820// monospace media where newlines are treated in the usual way.
2821//
2822// The message will typically look something like one of the following:
2823//
2824// |[
2825// unterminated string constant:
2826//
2827//	(1, 2, 3, 'abc
2828//	          ^^^^
2829//
2830// ]|
2831//
2832// or
2833//
2834// |[
2835// unable to find a common type:
2836//
2837//	[1, 2, 3, 'str']
2838//	 ^        ^^^^^
2839//
2840// ]|
2841//
2842// The format of the message may change in a future version.
2843//
2844// @error must have come from a failed attempt to g_variant_parse() and
2845// @source_str must be exactly the same string that caused the error.
2846// If @source_str was not nul-terminated when you passed it to
2847// g_variant_parse() then you must add nul termination before using this
2848// function.
2849func VariantParseErrorPrintContext(ErrorVar *Error, SourceStrVar string) string {
2850
2851	cret := xVariantParseErrorPrintContext(ErrorVar, SourceStrVar)
2852
2853	return cret
2854}
2855
2856func init() {
2857	core.SetPackageName("GLIB", "glib-2.0")
2858	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
2859	var libs []uintptr
2860	for _, libPath := range core.GetPaths("GLIB") {
2861		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
2862		if err != nil {
2863			panic(err)
2864		}
2865		libs = append(libs, lib)
2866	}
2867
2868	core.PuregoSafeRegister(&xVariantIsObjectPath, libs, "g_variant_is_object_path")
2869	core.PuregoSafeRegister(&xVariantIsSignature, libs, "g_variant_is_signature")
2870	core.PuregoSafeRegister(&xVariantParse, libs, "g_variant_parse")
2871	core.PuregoSafeRegister(&xVariantParseErrorPrintContext, libs, "g_variant_parse_error_print_context")
2872
2873	core.PuregoSafeRegister(&xVariantGLibType, libs, "intern")
2874
2875	core.PuregoSafeRegister(&xNewVariant, libs, "g_variant_new")
2876	core.PuregoSafeRegister(&xNewVariantArray, libs, "g_variant_new_array")
2877	core.PuregoSafeRegister(&xNewVariantBoolean, libs, "g_variant_new_boolean")
2878	core.PuregoSafeRegister(&xNewVariantByte, libs, "g_variant_new_byte")
2879	core.PuregoSafeRegister(&xNewVariantBytestring, libs, "g_variant_new_bytestring")
2880	core.PuregoSafeRegister(&xNewVariantBytestringArray, libs, "g_variant_new_bytestring_array")
2881	core.PuregoSafeRegister(&xNewVariantDictEntry, libs, "g_variant_new_dict_entry")
2882	core.PuregoSafeRegister(&xNewVariantDouble, libs, "g_variant_new_double")
2883	core.PuregoSafeRegister(&xNewVariantFixedArray, libs, "g_variant_new_fixed_array")
2884	core.PuregoSafeRegister(&xNewVariantFromBytes, libs, "g_variant_new_from_bytes")
2885	core.PuregoSafeRegister(&xNewVariantFromData, libs, "g_variant_new_from_data")
2886	core.PuregoSafeRegister(&xNewVariantHandle, libs, "g_variant_new_handle")
2887	core.PuregoSafeRegister(&xNewVariantInt16, libs, "g_variant_new_int16")
2888	core.PuregoSafeRegister(&xNewVariantInt32, libs, "g_variant_new_int32")
2889	core.PuregoSafeRegister(&xNewVariantInt64, libs, "g_variant_new_int64")
2890	core.PuregoSafeRegister(&xNewVariantMaybe, libs, "g_variant_new_maybe")
2891	core.PuregoSafeRegister(&xNewVariantObjectPath, libs, "g_variant_new_object_path")
2892	core.PuregoSafeRegister(&xNewVariantObjv, libs, "g_variant_new_objv")
2893	core.PuregoSafeRegister(&xNewVariantParsed, libs, "g_variant_new_parsed")
2894	core.PuregoSafeRegister(&xNewVariantParsedVa, libs, "g_variant_new_parsed_va")
2895	core.PuregoSafeRegister(&xNewVariantPrintf, libs, "g_variant_new_printf")
2896	core.PuregoSafeRegister(&xNewVariantSignature, libs, "g_variant_new_signature")
2897	core.PuregoSafeRegister(&xNewVariantString, libs, "g_variant_new_string")
2898	core.PuregoSafeRegister(&xNewVariantStrv, libs, "g_variant_new_strv")
2899	core.PuregoSafeRegister(&xNewVariantTakeString, libs, "g_variant_new_take_string")
2900	core.PuregoSafeRegister(&xNewVariantTuple, libs, "g_variant_new_tuple")
2901	core.PuregoSafeRegister(&xNewVariantUint16, libs, "g_variant_new_uint16")
2902	core.PuregoSafeRegister(&xNewVariantUint32, libs, "g_variant_new_uint32")
2903	core.PuregoSafeRegister(&xNewVariantUint64, libs, "g_variant_new_uint64")
2904	core.PuregoSafeRegister(&xNewVariantVa, libs, "g_variant_new_va")
2905	core.PuregoSafeRegister(&xNewVariantVariant, libs, "g_variant_new_variant")
2906
2907	core.PuregoSafeRegister(&xVariantByteswap, libs, "g_variant_byteswap")
2908	core.PuregoSafeRegister(&xVariantCheckFormatString, libs, "g_variant_check_format_string")
2909	core.PuregoSafeRegister(&xVariantClassify, libs, "g_variant_classify")
2910	core.PuregoSafeRegister(&xVariantCompare, libs, "g_variant_compare")
2911	core.PuregoSafeRegister(&xVariantDupBytestring, libs, "g_variant_dup_bytestring")
2912	core.PuregoSafeRegister(&xVariantDupBytestringArray, libs, "g_variant_dup_bytestring_array")
2913	core.PuregoSafeRegister(&xVariantDupObjv, libs, "g_variant_dup_objv")
2914	core.PuregoSafeRegister(&xVariantDupString, libs, "g_variant_dup_string")
2915	core.PuregoSafeRegister(&xVariantDupStrv, libs, "g_variant_dup_strv")
2916	core.PuregoSafeRegister(&xVariantEqual, libs, "g_variant_equal")
2917	core.PuregoSafeRegister(&xVariantGet, libs, "g_variant_get")
2918	core.PuregoSafeRegister(&xVariantGetBoolean, libs, "g_variant_get_boolean")
2919	core.PuregoSafeRegister(&xVariantGetByte, libs, "g_variant_get_byte")
2920	core.PuregoSafeRegister(&xVariantGetBytestring, libs, "g_variant_get_bytestring")
2921	core.PuregoSafeRegister(&xVariantGetBytestringArray, libs, "g_variant_get_bytestring_array")
2922	core.PuregoSafeRegister(&xVariantGetChild, libs, "g_variant_get_child")
2923	core.PuregoSafeRegister(&xVariantGetChildValue, libs, "g_variant_get_child_value")
2924	core.PuregoSafeRegister(&xVariantGetData, libs, "g_variant_get_data")
2925	core.PuregoSafeRegister(&xVariantGetDataAsBytes, libs, "g_variant_get_data_as_bytes")
2926	core.PuregoSafeRegister(&xVariantGetDouble, libs, "g_variant_get_double")
2927	core.PuregoSafeRegister(&xVariantGetFixedArray, libs, "g_variant_get_fixed_array")
2928	core.PuregoSafeRegister(&xVariantGetHandle, libs, "g_variant_get_handle")
2929	core.PuregoSafeRegister(&xVariantGetInt16, libs, "g_variant_get_int16")
2930	core.PuregoSafeRegister(&xVariantGetInt32, libs, "g_variant_get_int32")
2931	core.PuregoSafeRegister(&xVariantGetInt64, libs, "g_variant_get_int64")
2932	core.PuregoSafeRegister(&xVariantGetMaybe, libs, "g_variant_get_maybe")
2933	core.PuregoSafeRegister(&xVariantGetNormalForm, libs, "g_variant_get_normal_form")
2934	core.PuregoSafeRegister(&xVariantGetObjv, libs, "g_variant_get_objv")
2935	core.PuregoSafeRegister(&xVariantGetSize, libs, "g_variant_get_size")
2936	core.PuregoSafeRegister(&xVariantGetString, libs, "g_variant_get_string")
2937	core.PuregoSafeRegister(&xVariantGetStrv, libs, "g_variant_get_strv")
2938	core.PuregoSafeRegister(&xVariantGetType, libs, "g_variant_get_type")
2939	core.PuregoSafeRegister(&xVariantGetTypeString, libs, "g_variant_get_type_string")
2940	core.PuregoSafeRegister(&xVariantGetUint16, libs, "g_variant_get_uint16")
2941	core.PuregoSafeRegister(&xVariantGetUint32, libs, "g_variant_get_uint32")
2942	core.PuregoSafeRegister(&xVariantGetUint64, libs, "g_variant_get_uint64")
2943	core.PuregoSafeRegister(&xVariantGetVa, libs, "g_variant_get_va")
2944	core.PuregoSafeRegister(&xVariantGetVariant, libs, "g_variant_get_variant")
2945	core.PuregoSafeRegister(&xVariantHash, libs, "g_variant_hash")
2946	core.PuregoSafeRegister(&xVariantIsContainer, libs, "g_variant_is_container")
2947	core.PuregoSafeRegister(&xVariantIsFloating, libs, "g_variant_is_floating")
2948	core.PuregoSafeRegister(&xVariantIsNormalForm, libs, "g_variant_is_normal_form")
2949	core.PuregoSafeRegister(&xVariantIsOfType, libs, "g_variant_is_of_type")
2950	core.PuregoSafeRegister(&xVariantIterNew, libs, "g_variant_iter_new")
2951	core.PuregoSafeRegister(&xVariantLookup, libs, "g_variant_lookup")
2952	core.PuregoSafeRegister(&xVariantLookupValue, libs, "g_variant_lookup_value")
2953	core.PuregoSafeRegister(&xVariantNChildren, libs, "g_variant_n_children")
2954	core.PuregoSafeRegister(&xVariantPrint, libs, "g_variant_print")
2955	core.PuregoSafeRegister(&xVariantPrintString, libs, "g_variant_print_string")
2956	core.PuregoSafeRegister(&xVariantRef, libs, "g_variant_ref")
2957	core.PuregoSafeRegister(&xVariantRefSink, libs, "g_variant_ref_sink")
2958	core.PuregoSafeRegister(&xVariantStore, libs, "g_variant_store")
2959	core.PuregoSafeRegister(&xVariantTakeRef, libs, "g_variant_take_ref")
2960	core.PuregoSafeRegister(&xVariantUnref, libs, "g_variant_unref")
2961
2962	core.PuregoSafeRegister(&xVariantBuilderGLibType, libs, "g_variant_builder_get_type")
2963
2964	core.PuregoSafeRegister(&xNewVariantBuilder, libs, "g_variant_builder_new")
2965
2966	core.PuregoSafeRegister(&xVariantBuilderAdd, libs, "g_variant_builder_add")
2967	core.PuregoSafeRegister(&xVariantBuilderAddParsed, libs, "g_variant_builder_add_parsed")
2968	core.PuregoSafeRegister(&xVariantBuilderAddValue, libs, "g_variant_builder_add_value")
2969	core.PuregoSafeRegister(&xVariantBuilderClear, libs, "g_variant_builder_clear")
2970	core.PuregoSafeRegister(&xVariantBuilderClose, libs, "g_variant_builder_close")
2971	core.PuregoSafeRegister(&xVariantBuilderEnd, libs, "g_variant_builder_end")
2972	core.PuregoSafeRegister(&xVariantBuilderInit, libs, "g_variant_builder_init")
2973	core.PuregoSafeRegister(&xVariantBuilderInitStatic, libs, "g_variant_builder_init_static")
2974	core.PuregoSafeRegister(&xVariantBuilderOpen, libs, "g_variant_builder_open")
2975	core.PuregoSafeRegister(&xVariantBuilderRef, libs, "g_variant_builder_ref")
2976	core.PuregoSafeRegister(&xVariantBuilderUnref, libs, "g_variant_builder_unref")
2977
2978	core.PuregoSafeRegister(&xVariantDictGLibType, libs, "g_variant_dict_get_type")
2979
2980	core.PuregoSafeRegister(&xNewVariantDict, libs, "g_variant_dict_new")
2981
2982	core.PuregoSafeRegister(&xVariantDictClear, libs, "g_variant_dict_clear")
2983	core.PuregoSafeRegister(&xVariantDictContains, libs, "g_variant_dict_contains")
2984	core.PuregoSafeRegister(&xVariantDictEnd, libs, "g_variant_dict_end")
2985	core.PuregoSafeRegister(&xVariantDictInit, libs, "g_variant_dict_init")
2986	core.PuregoSafeRegister(&xVariantDictInsert, libs, "g_variant_dict_insert")
2987	core.PuregoSafeRegister(&xVariantDictInsertValue, libs, "g_variant_dict_insert_value")
2988	core.PuregoSafeRegister(&xVariantDictLookup, libs, "g_variant_dict_lookup")
2989	core.PuregoSafeRegister(&xVariantDictLookupValue, libs, "g_variant_dict_lookup_value")
2990	core.PuregoSafeRegister(&xVariantDictRef, libs, "g_variant_dict_ref")
2991	core.PuregoSafeRegister(&xVariantDictRemove, libs, "g_variant_dict_remove")
2992	core.PuregoSafeRegister(&xVariantDictUnref, libs, "g_variant_dict_unref")
2993
2994	core.PuregoSafeRegister(&xVariantIterCopy, libs, "g_variant_iter_copy")
2995	core.PuregoSafeRegister(&xVariantIterFree, libs, "g_variant_iter_free")
2996	core.PuregoSafeRegister(&xVariantIterInit, libs, "g_variant_iter_init")
2997	core.PuregoSafeRegister(&xVariantIterLoop, libs, "g_variant_iter_loop")
2998	core.PuregoSafeRegister(&xVariantIterNChildren, libs, "g_variant_iter_n_children")
2999	core.PuregoSafeRegister(&xVariantIterNext, libs, "g_variant_iter_next")
3000	core.PuregoSafeRegister(&xVariantIterNextValue, libs, "g_variant_iter_next_value")
3001
3002}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close