summaryrefslogtreecommitdiff
path: root/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go
blob: c18e7873176f041657c8be7d4908706432b40688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Same copyright and license as the rest of the files in this project

// GVariant : GVariant — strongly typed value datatype
// https://developer.gnome.org/glib/2.26/glib-GVariant.html

package glib

// #include <glib.h>
// #include <glib-object.h>
// #include "glib.go.h"
// #include "gvariant.go.h"
import "C"
import "unsafe"

/*
 * GVariantBuilder
 */

// VariantBuilder is a representation of GLib's VariantBuilder.
type VariantBuilder struct {
	GVariantBuilder *C.GVariantBuilder
}

func (v *VariantBuilder) toGVariantBuilder() *C.GVariantBuilder {
	if v == nil {
		return nil
	}
	return v.native()
}

func (v *VariantBuilder) toVariantBuilder() *VariantBuilder {
	return v
}

// newVariantBuilder creates a new VariantBuilder from a GVariantBuilder pointer.
func newVariantBuilder(p *C.GVariantBuilder) *VariantBuilder {
	return &VariantBuilder{GVariantBuilder: p}
}

// native returns a pointer to the underlying GVariantBuilder.
func (v *VariantBuilder) native() *C.GVariantBuilder {
	if v == nil || v.GVariantBuilder == nil {
		return nil
	}
	p := unsafe.Pointer(v.GVariantBuilder)
	return C.toGVariantBuilder(p)
}

// Native returns a pointer to the underlying GVariantBuilder.
func (v *VariantBuilder) Native() uintptr {
	return uintptr(unsafe.Pointer(v.native()))
}