summaryrefslogtreecommitdiff
path: root/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go
blob: e68200836a7d9cb2b4518011ef048f3bcf417337 (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"

/*
 * GVariantDict
 */

// VariantDict is a representation of GLib's VariantDict.
type VariantDict struct {
	GVariantDict *C.GVariantDict
}

func (v *VariantDict) toGVariantDict() *C.GVariantDict {
	if v == nil {
		return nil
	}
	return v.native()
}

func (v *VariantDict) toVariantDict() *VariantDict {
	return v
}

// newVariantDict creates a new VariantDict from a GVariantDict pointer.
func newVariantDict(p *C.GVariantDict) *VariantDict {
	return &VariantDict{GVariantDict: p}
}

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

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