1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/glib"
9 "github.com/bnema/puregotk/v4/gobject"
10)
11
12var xDbusEscapeObjectPath func(string) string
13
14// This is a language binding friendly version of g_dbus_escape_object_path_bytestring().
15func DbusEscapeObjectPath(SVar string) string {
16
17 cret := xDbusEscapeObjectPath(SVar)
18 return cret
19}
20
21var xDbusEscapeObjectPathBytestring func([]byte) string
22
23// Escapes @bytes for use in a D-Bus object path component.
24// @bytes is an array of zero or more nonzero bytes in an
25// unspecified encoding, followed by a single zero byte.
26//
27// The escaping method consists of replacing all non-alphanumeric
28// characters (see g_ascii_isalnum()) with their hexadecimal value
29// preceded by an underscore (`_`). For example:
30// `foo.bar.baz` will become `foo_2ebar_2ebaz`.
31//
32// This method is appropriate to use when the input is nearly
33// a valid object path component but is not when your input
34// is far from being a valid object path component.
35// Other escaping algorithms are also valid to use with
36// D-Bus object paths.
37//
38// This can be reversed with g_dbus_unescape_object_path().
39func DbusEscapeObjectPathBytestring(BytesVar []byte) string {
40
41 cret := xDbusEscapeObjectPathBytestring(BytesVar)
42 return cret
43}
44
45var xDbusGenerateGuid func() string
46
47// Generate a D-Bus GUID that can be used with
48// e.g. g_dbus_connection_new().
49//
50// See the
51// [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#uuids)
52// regarding what strings are valid D-Bus GUIDs. The specification refers to
53// these as ‘UUIDs’ whereas GLib (for historical reasons) refers to them as
54// ‘GUIDs’. The terms are interchangeable.
55//
56// Note that D-Bus GUIDs do not follow
57// [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122).
58func DbusGenerateGuid() string {
59
60 cret := xDbusGenerateGuid()
61 return cret
62}
63
64var xDbusGvalueToGvariant func(*gobject.Value, *glib.VariantType) *glib.Variant
65
66// Converts a #GValue to a #GVariant of the type indicated by the @type
67// parameter.
68//
69// The conversion is using the following rules:
70//
71// - `G_TYPE_STRING`: 's', 'o', 'g' or 'ay'
72// - `G_TYPE_STRV`: 'as', 'ao' or 'aay'
73// - `G_TYPE_BOOLEAN`: 'b'
74// - `G_TYPE_UCHAR`: 'y'
75// - `G_TYPE_INT`: 'i', 'n'
76// - `G_TYPE_UINT`: 'u', 'q'
77// - `G_TYPE_INT64`: 'x'
78// - `G_TYPE_UINT64`: 't'
79// - `G_TYPE_DOUBLE`: 'd'
80// - `G_TYPE_VARIANT`: Any #GVariantType
81//
82// This can fail if e.g. @gvalue is of type %G_TYPE_STRING and @type
83// is 'i', i.e. %G_VARIANT_TYPE_INT32. It will also fail for any #GType
84// (including e.g. %G_TYPE_OBJECT and %G_TYPE_BOXED derived-types) not
85// in the table above.
86//
87// Note that if @gvalue is of type %G_TYPE_VARIANT and its value is
88// %NULL, the empty #GVariant instance (never %NULL) for @type is
89// returned (e.g. 0 for scalar types, the empty string for string types,
90// '/' for object path types, the empty array for any array type and so on).
91//
92// See the g_dbus_gvariant_to_gvalue() function for how to convert a
93// #GVariant to a #GValue.
94func DbusGvalueToGvariant(GvalueVar *gobject.Value, TypeVar *glib.VariantType) *glib.Variant {
95
96 cret := xDbusGvalueToGvariant(GvalueVar, TypeVar)
97 return cret
98}
99
100var xDbusGvariantToGvalue func(*glib.Variant, *gobject.Value)
101
102// Converts a #GVariant to a #GValue. If @value is floating, it is consumed.
103//
104// The rules specified in the g_dbus_gvalue_to_gvariant() function are
105// used - this function is essentially its reverse form. So, a #GVariant
106// containing any basic or string array type will be converted to a #GValue
107// containing a basic value or string array. Any other #GVariant (handle,
108// variant, tuple, dict entry) will be converted to a #GValue containing that
109// #GVariant.
110//
111// The conversion never fails - a valid #GValue is always returned in
112// @out_gvalue.
113func DbusGvariantToGvalue(ValueVar *glib.Variant, OutGvalueVar *gobject.Value) {
114
115 xDbusGvariantToGvalue(ValueVar, OutGvalueVar)
116
117}
118
119var xDbusIsErrorName func(string) bool
120
121// Check whether @string is a valid D-Bus error name.
122//
123// This function returns the same result as g_dbus_is_interface_name(),
124// because D-Bus error names are defined to have exactly the
125// same syntax as interface names.
126func DbusIsErrorName(StringVar string) bool {
127
128 cret := xDbusIsErrorName(StringVar)
129 return cret
130}
131
132var xDbusIsGuid func(string) bool
133
134// Checks if @string is a D-Bus GUID.
135//
136// See the documentation for g_dbus_generate_guid() for more information about
137// the format of a GUID.
138func DbusIsGuid(StringVar string) bool {
139
140 cret := xDbusIsGuid(StringVar)
141 return cret
142}
143
144var xDbusIsInterfaceName func(string) bool
145
146// Checks if @string is a valid D-Bus interface name.
147func DbusIsInterfaceName(StringVar string) bool {
148
149 cret := xDbusIsInterfaceName(StringVar)
150 return cret
151}
152
153var xDbusIsMemberName func(string) bool
154
155// Checks if @string is a valid D-Bus member (e.g. signal or method) name.
156func DbusIsMemberName(StringVar string) bool {
157
158 cret := xDbusIsMemberName(StringVar)
159 return cret
160}
161
162var xDbusIsName func(string) bool
163
164// Checks if @string is a valid D-Bus bus name (either unique or well-known).
165func DbusIsName(StringVar string) bool {
166
167 cret := xDbusIsName(StringVar)
168 return cret
169}
170
171var xDbusIsUniqueName func(string) bool
172
173// Checks if @string is a valid D-Bus unique bus name.
174func DbusIsUniqueName(StringVar string) bool {
175
176 cret := xDbusIsUniqueName(StringVar)
177 return cret
178}
179
180var xDbusUnescapeObjectPath func(string) uintptr
181
182// Unescapes an string that was previously escaped with
183// g_dbus_escape_object_path(). If the string is in a format that could
184// not have been returned by g_dbus_escape_object_path(), this function
185// returns %NULL.
186//
187// Encoding alphanumeric characters which do not need to be
188// encoded is not allowed (e.g `_63` is not valid, the string
189// should contain `c` instead).
190func DbusUnescapeObjectPath(SVar string) uintptr {
191
192 cret := xDbusUnescapeObjectPath(SVar)
193 return cret
194}
195
196func init() {
197 core.SetPackageName("GIO", "gio-2.0")
198 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
199 var libs []uintptr
200 for _, libPath := range core.GetPaths("GIO") {
201 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
202 if err != nil {
203 panic(err)
204 }
205 libs = append(libs, lib)
206 }
207
208 core.PuregoSafeRegister(&xDbusEscapeObjectPath, libs, "g_dbus_escape_object_path")
209 core.PuregoSafeRegister(&xDbusEscapeObjectPathBytestring, libs, "g_dbus_escape_object_path_bytestring")
210 core.PuregoSafeRegister(&xDbusGenerateGuid, libs, "g_dbus_generate_guid")
211 core.PuregoSafeRegister(&xDbusGvalueToGvariant, libs, "g_dbus_gvalue_to_gvariant")
212 core.PuregoSafeRegister(&xDbusGvariantToGvalue, libs, "g_dbus_gvariant_to_gvalue")
213 core.PuregoSafeRegister(&xDbusIsErrorName, libs, "g_dbus_is_error_name")
214 core.PuregoSafeRegister(&xDbusIsGuid, libs, "g_dbus_is_guid")
215 core.PuregoSafeRegister(&xDbusIsInterfaceName, libs, "g_dbus_is_interface_name")
216 core.PuregoSafeRegister(&xDbusIsMemberName, libs, "g_dbus_is_member_name")
217 core.PuregoSafeRegister(&xDbusIsName, libs, "g_dbus_is_name")
218 core.PuregoSafeRegister(&xDbusIsUniqueName, libs, "g_dbus_is_unique_name")
219 core.PuregoSafeRegister(&xDbusUnescapeObjectPath, libs, "g_dbus_unescape_object_path")
220
221}