1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
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/glib"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// The type of value transformation functions which can be registered with
16// [func@GObject.Value.register_transform_func].
17//
18// @dest_value will be initialized to the correct destination type.
19type ValueTransform func(*Value, *Value)
20
21// An opaque structure used to hold different types of values.
22//
23// Before it can be used, a `GValue` has to be initialized to a specific type by
24// calling [method@GObject.Value.init] on it.
25//
26// Many types which are stored within a `GValue` need to allocate data on the
27// heap, so [method@GObject.Value.unset] must always be called on a `GValue` to
28// free any such data once you’re finished with the `GValue`, even if the
29// `GValue` itself is stored on the stack.
30//
31// The data within the structure has protected scope: it is accessible only
32// to functions within a [struct@GObject.TypeValueTable] structure, or
33// implementations of the `g_value_*()` API. That is, code which implements new
34// fundamental types.
35//
36// `GValue` users cannot make any assumptions about how data is stored
37// within the 2 element @data union, and the @g_type member should
38// only be accessed through the [func@GObject.VALUE_TYPE] macro and related
39// macros.
40type Value struct {
41 _ structs.HostLayout
42
43 GType types.GType
44
45 Data [2]uint64
46}
47
48var xValueGLibType func() types.GType
49
50func ValueGLibType() types.GType {
51 return xValueGLibType()
52}
53
54func (x *Value) GoPointer() uintptr {
55 return uintptr(unsafe.Pointer(x))
56}
57
58var xValueCopy func(uintptr, *Value)
59
60// Copies the value of @src_value into @dest_value.
61func (x *Value) Copy(DestValueVar *Value) {
62
63 xValueCopy(x.GoPointer(), DestValueVar)
64
65}
66
67var xValueDupBoxed func(uintptr) uintptr
68
69// Get the contents of a %G_TYPE_BOXED derived #GValue. Upon getting,
70// the boxed value is duplicated and needs to be later freed with
71// g_boxed_free(), e.g. like: g_boxed_free (G_VALUE_TYPE (@value),
72// return_value);
73func (x *Value) DupBoxed() uintptr {
74
75 cret := xValueDupBoxed(x.GoPointer())
76 return cret
77}
78
79var xValueDupObject func(uintptr) uintptr
80
81// Get the contents of a %G_TYPE_OBJECT derived #GValue, increasing
82// its reference count. If the contents of the #GValue are %NULL, then
83// %NULL will be returned.
84func (x *Value) DupObject() *Object {
85 var cls *Object
86
87 cret := xValueDupObject(x.GoPointer())
88
89 if cret == 0 {
90 return nil
91 }
92 cls = &Object{}
93 cls.Ptr = cret
94 return cls
95}
96
97var xValueDupParam func(uintptr) uintptr
98
99// Get the contents of a %G_TYPE_PARAM #GValue, increasing its
100// reference count.
101func (x *Value) DupParam() *ParamSpec {
102 var cls *ParamSpec
103
104 cret := xValueDupParam(x.GoPointer())
105
106 if cret == 0 {
107 return nil
108 }
109 cls = &ParamSpec{}
110 cls.Ptr = cret
111 return cls
112}
113
114var xValueDupString func(uintptr) string
115
116// Get a copy the contents of a %G_TYPE_STRING #GValue.
117func (x *Value) DupString() string {
118
119 cret := xValueDupString(x.GoPointer())
120 return cret
121}
122
123var xValueDupVariant func(uintptr) *glib.Variant
124
125// Get the contents of a variant #GValue, increasing its refcount. The returned
126// #GVariant is never floating.
127func (x *Value) DupVariant() *glib.Variant {
128
129 cret := xValueDupVariant(x.GoPointer())
130 return cret
131}
132
133var xValueFitsPointer func(uintptr) bool
134
135// Determines if @value will fit inside the size of a pointer value.
136//
137// This is an internal function introduced mainly for C marshallers.
138func (x *Value) FitsPointer() bool {
139
140 cret := xValueFitsPointer(x.GoPointer())
141 return cret
142}
143
144var xValueGetBoolean func(uintptr) bool
145
146// Get the contents of a %G_TYPE_BOOLEAN #GValue.
147func (x *Value) GetBoolean() bool {
148
149 cret := xValueGetBoolean(x.GoPointer())
150 return cret
151}
152
153var xValueGetBoxed func(uintptr) uintptr
154
155// Get the contents of a %G_TYPE_BOXED derived #GValue.
156func (x *Value) GetBoxed() uintptr {
157
158 cret := xValueGetBoxed(x.GoPointer())
159 return cret
160}
161
162var xValueGetChar func(uintptr) byte
163
164// Do not use this function; it is broken on platforms where the %char
165// type is unsigned, such as ARM and PowerPC. See g_value_get_schar().
166//
167// Get the contents of a %G_TYPE_CHAR #GValue.
168func (x *Value) GetChar() byte {
169
170 cret := xValueGetChar(x.GoPointer())
171 return cret
172}
173
174var xValueGetDouble func(uintptr) float64
175
176// Get the contents of a %G_TYPE_DOUBLE #GValue.
177func (x *Value) GetDouble() float64 {
178
179 cret := xValueGetDouble(x.GoPointer())
180 return cret
181}
182
183var xValueGetEnum func(uintptr) int
184
185// Get the contents of a %G_TYPE_ENUM #GValue.
186func (x *Value) GetEnum() int {
187
188 cret := xValueGetEnum(x.GoPointer())
189 return cret
190}
191
192var xValueGetFlags func(uintptr) uint
193
194// Get the contents of a %G_TYPE_FLAGS #GValue.
195func (x *Value) GetFlags() uint {
196
197 cret := xValueGetFlags(x.GoPointer())
198 return cret
199}
200
201var xValueGetFloat func(uintptr) float32
202
203// Get the contents of a %G_TYPE_FLOAT #GValue.
204func (x *Value) GetFloat() float32 {
205
206 cret := xValueGetFloat(x.GoPointer())
207 return cret
208}
209
210var xValueGetGtype func(uintptr) types.GType
211
212// Get the contents of a %G_TYPE_GTYPE #GValue.
213func (x *Value) GetGtype() types.GType {
214
215 cret := xValueGetGtype(x.GoPointer())
216 return cret
217}
218
219var xValueGetInt func(uintptr) int
220
221// Get the contents of a %G_TYPE_INT #GValue.
222func (x *Value) GetInt() int {
223
224 cret := xValueGetInt(x.GoPointer())
225 return cret
226}
227
228var xValueGetInt64 func(uintptr) int64
229
230// Get the contents of a %G_TYPE_INT64 #GValue.
231func (x *Value) GetInt64() int64 {
232
233 cret := xValueGetInt64(x.GoPointer())
234 return cret
235}
236
237var xValueGetLong func(uintptr) int
238
239// Get the contents of a %G_TYPE_LONG #GValue.
240func (x *Value) GetLong() int {
241
242 cret := xValueGetLong(x.GoPointer())
243 return cret
244}
245
246var xValueGetObject func(uintptr) uintptr
247
248// Get the contents of a %G_TYPE_OBJECT derived #GValue.
249func (x *Value) GetObject() *Object {
250 var cls *Object
251
252 cret := xValueGetObject(x.GoPointer())
253
254 if cret == 0 {
255 return nil
256 }
257 IncreaseRef(cret)
258 cls = &Object{}
259 cls.Ptr = cret
260 return cls
261}
262
263var xValueGetParam func(uintptr) uintptr
264
265// Get the contents of a %G_TYPE_PARAM #GValue.
266func (x *Value) GetParam() *ParamSpec {
267 var cls *ParamSpec
268
269 cret := xValueGetParam(x.GoPointer())
270
271 if cret == 0 {
272 return nil
273 }
274 IncreaseRef(cret)
275 cls = &ParamSpec{}
276 cls.Ptr = cret
277 return cls
278}
279
280var xValueGetPointer func(uintptr) uintptr
281
282// Get the contents of a pointer #GValue.
283func (x *Value) GetPointer() uintptr {
284
285 cret := xValueGetPointer(x.GoPointer())
286 return cret
287}
288
289var xValueGetSchar func(uintptr) int8
290
291// Get the contents of a %G_TYPE_CHAR #GValue.
292func (x *Value) GetSchar() int8 {
293
294 cret := xValueGetSchar(x.GoPointer())
295 return cret
296}
297
298var xValueGetString func(uintptr) string
299
300// Get the contents of a %G_TYPE_STRING #GValue.
301func (x *Value) GetString() string {
302
303 cret := xValueGetString(x.GoPointer())
304 return cret
305}
306
307var xValueGetUchar func(uintptr) byte
308
309// Get the contents of a %G_TYPE_UCHAR #GValue.
310func (x *Value) GetUchar() byte {
311
312 cret := xValueGetUchar(x.GoPointer())
313 return cret
314}
315
316var xValueGetUint func(uintptr) uint
317
318// Get the contents of a %G_TYPE_UINT #GValue.
319func (x *Value) GetUint() uint {
320
321 cret := xValueGetUint(x.GoPointer())
322 return cret
323}
324
325var xValueGetUint64 func(uintptr) uint64
326
327// Get the contents of a %G_TYPE_UINT64 #GValue.
328func (x *Value) GetUint64() uint64 {
329
330 cret := xValueGetUint64(x.GoPointer())
331 return cret
332}
333
334var xValueGetUlong func(uintptr) uint
335
336// Get the contents of a %G_TYPE_ULONG #GValue.
337func (x *Value) GetUlong() uint {
338
339 cret := xValueGetUlong(x.GoPointer())
340 return cret
341}
342
343var xValueGetVariant func(uintptr) *glib.Variant
344
345// Get the contents of a variant #GValue.
346func (x *Value) GetVariant() *glib.Variant {
347
348 cret := xValueGetVariant(x.GoPointer())
349 return cret
350}
351
352var xValueInit func(uintptr, types.GType) *Value
353
354// Initializes @value to store values of the given @type, and sets its value
355// to the default for @type.
356//
357// This must be called before any other methods on a [struct@GObject.Value], so
358// the value knows what type it’s meant to store.
359//
360// ```c
361//
362// GValue value = G_VALUE_INIT;
363//
364// g_value_init (&value, SOME_G_TYPE);
365// …
366// g_value_unset (&value);
367//
368// ```
369func (x *Value) Init(GTypeVar types.GType) *Value {
370
371 cret := xValueInit(x.GoPointer(), GTypeVar)
372 return cret
373}
374
375var xValueInitFromInstance func(uintptr, *TypeInstance)
376
377// Initializes and sets @value from an instantiatable type.
378//
379// This calls the [callback@GObject.TypeValueCollectFunc] function for the type
380// the [struct@GObject.Value] contains.
381//
382// Note: The @value will be initialised with the exact type of
383// @instance. If you wish to set the @value’s type to a different
384// [type@GObject.Type] (such as a parent class type), you need to manually call
385// [method@GObject.Value.init] and [method@GObject.Value.set_instance].
386func (x *Value) InitFromInstance(InstanceVar *TypeInstance) {
387
388 xValueInitFromInstance(x.GoPointer(), InstanceVar)
389
390}
391
392var xValuePeekPointer func(uintptr) uintptr
393
394// Returns the value contents as a pointer.
395//
396// This function asserts that [method@GObject.Value.fits_pointer] returned true
397// for the passed in value.
398//
399// This is an internal function introduced mainly for C marshallers.
400func (x *Value) PeekPointer() uintptr {
401
402 cret := xValuePeekPointer(x.GoPointer())
403 return cret
404}
405
406var xValueReset func(uintptr) *Value
407
408// Clears the current value in @value and resets it to the default value
409// (as if the value had just been initialized using
410// [method@GObject.Value.init]).
411func (x *Value) Reset() *Value {
412
413 cret := xValueReset(x.GoPointer())
414 return cret
415}
416
417var xValueSetBoolean func(uintptr, bool)
418
419// Set the contents of a %G_TYPE_BOOLEAN #GValue to @v_boolean.
420func (x *Value) SetBoolean(VBooleanVar bool) {
421
422 xValueSetBoolean(x.GoPointer(), VBooleanVar)
423
424}
425
426var xValueSetBoxed func(uintptr, uintptr)
427
428// Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
429func (x *Value) SetBoxed(VBoxedVar uintptr) {
430
431 xValueSetBoxed(x.GoPointer(), VBoxedVar)
432
433}
434
435var xValueSetBoxedTakeOwnership func(uintptr, uintptr)
436
437// This is an internal function introduced mainly for C marshallers.
438func (x *Value) SetBoxedTakeOwnership(VBoxedVar uintptr) {
439
440 xValueSetBoxedTakeOwnership(x.GoPointer(), VBoxedVar)
441
442}
443
444var xValueSetChar func(uintptr, byte)
445
446// Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
447func (x *Value) SetChar(VCharVar byte) {
448
449 xValueSetChar(x.GoPointer(), VCharVar)
450
451}
452
453var xValueSetDouble func(uintptr, float64)
454
455// Set the contents of a %G_TYPE_DOUBLE #GValue to @v_double.
456func (x *Value) SetDouble(VDoubleVar float64) {
457
458 xValueSetDouble(x.GoPointer(), VDoubleVar)
459
460}
461
462var xValueSetEnum func(uintptr, int)
463
464// Set the contents of a %G_TYPE_ENUM #GValue to @v_enum.
465func (x *Value) SetEnum(VEnumVar int) {
466
467 xValueSetEnum(x.GoPointer(), VEnumVar)
468
469}
470
471var xValueSetFlags func(uintptr, uint)
472
473// Set the contents of a %G_TYPE_FLAGS #GValue to @v_flags.
474func (x *Value) SetFlags(VFlagsVar uint) {
475
476 xValueSetFlags(x.GoPointer(), VFlagsVar)
477
478}
479
480var xValueSetFloat func(uintptr, float32)
481
482// Set the contents of a %G_TYPE_FLOAT #GValue to @v_float.
483func (x *Value) SetFloat(VFloatVar float32) {
484
485 xValueSetFloat(x.GoPointer(), VFloatVar)
486
487}
488
489var xValueSetGtype func(uintptr, types.GType)
490
491// Set the contents of a %G_TYPE_GTYPE #GValue to @v_gtype.
492func (x *Value) SetGtype(VGtypeVar types.GType) {
493
494 xValueSetGtype(x.GoPointer(), VGtypeVar)
495
496}
497
498var xValueSetInstance func(uintptr, uintptr)
499
500// Sets @value from an instantiatable type.
501//
502// This calls the [callback@GObject.TypeValueCollectFunc] function for the type
503// the [struct@GObject.Value] contains.
504func (x *Value) SetInstance(InstanceVar uintptr) {
505
506 xValueSetInstance(x.GoPointer(), InstanceVar)
507
508}
509
510var xValueSetInt func(uintptr, int)
511
512// Set the contents of a %G_TYPE_INT #GValue to @v_int.
513func (x *Value) SetInt(VIntVar int) {
514
515 xValueSetInt(x.GoPointer(), VIntVar)
516
517}
518
519var xValueSetInt64 func(uintptr, int64)
520
521// Set the contents of a %G_TYPE_INT64 #GValue to @v_int64.
522func (x *Value) SetInt64(VInt64Var int64) {
523
524 xValueSetInt64(x.GoPointer(), VInt64Var)
525
526}
527
528var xValueSetInternedString func(uintptr, uintptr)
529
530// Set the contents of a %G_TYPE_STRING #GValue to @v_string. The string is
531// assumed to be static and interned (canonical, for example from
532// g_intern_string()), and is thus not duplicated when setting the #GValue.
533func (x *Value) SetInternedString(VStringVar *string) {
534
535 VStringVarPtr := core.GStrdupNullable(VStringVar)
536 defer core.GFreeNullable(VStringVarPtr)
537
538 xValueSetInternedString(x.GoPointer(), VStringVarPtr)
539
540}
541
542var xValueSetLong func(uintptr, int)
543
544// Set the contents of a %G_TYPE_LONG #GValue to @v_long.
545func (x *Value) SetLong(VLongVar int) {
546
547 xValueSetLong(x.GoPointer(), VLongVar)
548
549}
550
551var xValueSetObject func(uintptr, uintptr)
552
553// Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object.
554//
555// g_value_set_object() increases the reference count of @v_object
556// (the #GValue holds a reference to @v_object). If you do not wish
557// to increase the reference count of the object (i.e. you wish to
558// pass your current reference to the #GValue because you no longer
559// need it), use g_value_take_object() instead.
560//
561// It is important that your #GValue holds a reference to @v_object (either its
562// own, or one it has taken) to ensure that the object won't be destroyed while
563// the #GValue still exists).
564func (x *Value) SetObject(VObjectVar *Object) {
565
566 xValueSetObject(x.GoPointer(), VObjectVar.GoPointer())
567
568}
569
570var xValueSetObjectTakeOwnership func(uintptr, uintptr)
571
572// This is an internal function introduced mainly for C marshallers.
573func (x *Value) SetObjectTakeOwnership(VObjectVar uintptr) {
574
575 xValueSetObjectTakeOwnership(x.GoPointer(), VObjectVar)
576
577}
578
579var xValueSetParam func(uintptr, uintptr)
580
581// Set the contents of a %G_TYPE_PARAM #GValue to @param.
582func (x *Value) SetParam(ParamVar *ParamSpec) {
583
584 xValueSetParam(x.GoPointer(), ParamVar.GoPointer())
585
586}
587
588var xValueSetParamTakeOwnership func(uintptr, uintptr)
589
590// This is an internal function introduced mainly for C marshallers.
591func (x *Value) SetParamTakeOwnership(ParamVar *ParamSpec) {
592
593 xValueSetParamTakeOwnership(x.GoPointer(), ParamVar.GoPointer())
594
595}
596
597var xValueSetPointer func(uintptr, uintptr)
598
599// Set the contents of a pointer #GValue to @v_pointer.
600func (x *Value) SetPointer(VPointerVar uintptr) {
601
602 xValueSetPointer(x.GoPointer(), VPointerVar)
603
604}
605
606var xValueSetSchar func(uintptr, int8)
607
608// Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
609func (x *Value) SetSchar(VCharVar int8) {
610
611 xValueSetSchar(x.GoPointer(), VCharVar)
612
613}
614
615var xValueSetStaticBoxed func(uintptr, uintptr)
616
617// Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
618//
619// The boxed value is assumed to be static, and is thus not duplicated
620// when setting the #GValue.
621func (x *Value) SetStaticBoxed(VBoxedVar uintptr) {
622
623 xValueSetStaticBoxed(x.GoPointer(), VBoxedVar)
624
625}
626
627var xValueSetStaticString func(uintptr, uintptr)
628
629// Set the contents of a %G_TYPE_STRING #GValue to @v_string.
630// The string is assumed to be static, and is thus not duplicated
631// when setting the #GValue.
632//
633// If the the string is a canonical string, using g_value_set_interned_string()
634// is more appropriate.
635func (x *Value) SetStaticString(VStringVar *string) {
636
637 VStringVarPtr := core.GStrdupNullable(VStringVar)
638 defer core.GFreeNullable(VStringVarPtr)
639
640 xValueSetStaticString(x.GoPointer(), VStringVarPtr)
641
642}
643
644var xValueSetString func(uintptr, uintptr)
645
646// Set the contents of a %G_TYPE_STRING #GValue to a copy of @v_string.
647func (x *Value) SetString(VStringVar *string) {
648
649 VStringVarPtr := core.GStrdupNullable(VStringVar)
650 defer core.GFreeNullable(VStringVarPtr)
651
652 xValueSetString(x.GoPointer(), VStringVarPtr)
653
654}
655
656var xValueSetStringTakeOwnership func(uintptr, uintptr)
657
658// This is an internal function introduced mainly for C marshallers.
659func (x *Value) SetStringTakeOwnership(VStringVar *string) {
660
661 VStringVarPtr := core.GStrdupNullable(VStringVar)
662 defer core.GFreeNullable(VStringVarPtr)
663
664 xValueSetStringTakeOwnership(x.GoPointer(), VStringVarPtr)
665
666}
667
668var xValueSetUchar func(uintptr, byte)
669
670// Set the contents of a %G_TYPE_UCHAR #GValue to @v_uchar.
671func (x *Value) SetUchar(VUcharVar byte) {
672
673 xValueSetUchar(x.GoPointer(), VUcharVar)
674
675}
676
677var xValueSetUint func(uintptr, uint)
678
679// Set the contents of a %G_TYPE_UINT #GValue to @v_uint.
680func (x *Value) SetUint(VUintVar uint) {
681
682 xValueSetUint(x.GoPointer(), VUintVar)
683
684}
685
686var xValueSetUint64 func(uintptr, uint64)
687
688// Set the contents of a %G_TYPE_UINT64 #GValue to @v_uint64.
689func (x *Value) SetUint64(VUint64Var uint64) {
690
691 xValueSetUint64(x.GoPointer(), VUint64Var)
692
693}
694
695var xValueSetUlong func(uintptr, uint)
696
697// Set the contents of a %G_TYPE_ULONG #GValue to @v_ulong.
698func (x *Value) SetUlong(VUlongVar uint) {
699
700 xValueSetUlong(x.GoPointer(), VUlongVar)
701
702}
703
704var xValueSetVariant func(uintptr, *glib.Variant)
705
706// Set the contents of a variant #GValue to @variant.
707// If the variant is floating, it is consumed.
708func (x *Value) SetVariant(VariantVar *glib.Variant) {
709
710 xValueSetVariant(x.GoPointer(), VariantVar)
711
712}
713
714var xValueStealString func(uintptr) string
715
716// Steal ownership on contents of a %G_TYPE_STRING #GValue.
717// As a result of this operation the value's contents will be reset to %NULL.
718//
719// The purpose of this call is to provide a way to avoid an extra copy
720// when some object have been serialized into string through #GValue API.
721//
722// NOTE: for safety and compatibility purposes, if #GValue contains
723// static string, or an interned one, this function will return a copy
724// of the string. Otherwise the transfer notation would be ambiguous.
725func (x *Value) StealString() string {
726
727 cret := xValueStealString(x.GoPointer())
728 return cret
729}
730
731var xValueTakeBoxed func(uintptr, uintptr)
732
733// Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed
734// and takes over the ownership of the caller’s reference to @v_boxed;
735// the caller doesn’t have to unref it any more.
736func (x *Value) TakeBoxed(VBoxedVar uintptr) {
737
738 xValueTakeBoxed(x.GoPointer(), VBoxedVar)
739
740}
741
742var xValueTakeObject func(uintptr, uintptr)
743
744// Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object
745// and takes over the ownership of the caller’s reference to @v_object;
746// the caller doesn’t have to unref it any more (i.e. the reference
747// count of the object is not increased).
748//
749// If you want the #GValue to hold its own reference to @v_object, use
750// g_value_set_object() instead.
751func (x *Value) TakeObject(VObjectVar uintptr) {
752
753 xValueTakeObject(x.GoPointer(), VObjectVar)
754
755}
756
757var xValueTakeParam func(uintptr, uintptr)
758
759// Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes
760// over the ownership of the caller’s reference to @param; the caller
761// doesn’t have to unref it any more.
762func (x *Value) TakeParam(ParamVar *ParamSpec) {
763
764 xValueTakeParam(x.GoPointer(), ParamVar.GoPointer())
765
766}
767
768var xValueTakeString func(uintptr, uintptr)
769
770// Sets the contents of a %G_TYPE_STRING #GValue to @v_string.
771func (x *Value) TakeString(VStringVar *string) {
772
773 xValueTakeString(x.GoPointer(), core.GStrdupNullable(VStringVar))
774
775}
776
777var xValueTakeVariant func(uintptr, *glib.Variant)
778
779// Set the contents of a variant #GValue to @variant, and takes over
780// the ownership of the caller's reference to @variant;
781// the caller doesn't have to unref it any more (i.e. the reference
782// count of the variant is not increased).
783//
784// If @variant was floating then its floating reference is converted to
785// a hard reference.
786//
787// If you want the #GValue to hold its own reference to @variant, use
788// g_value_set_variant() instead.
789//
790// This is an internal function introduced mainly for C marshallers.
791func (x *Value) TakeVariant(VariantVar *glib.Variant) {
792
793 xValueTakeVariant(x.GoPointer(), VariantVar)
794
795}
796
797var xValueTransform func(uintptr, *Value) bool
798
799// Tries to cast the contents of @src_value into a type appropriate
800// to store in @dest_value.
801//
802// If a transformation is not possible, @dest_value is not modified.
803//
804// For example, this could transform a `G_TYPE_INT` value into a `G_TYPE_FLOAT`
805// value.
806//
807// Performing transformations between value types might incur precision loss.
808// Especially transformations into strings might reveal seemingly arbitrary
809// results and the format of particular transformations to strings is not
810// guaranteed over time.
811func (x *Value) Transform(DestValueVar *Value) bool {
812
813 cret := xValueTransform(x.GoPointer(), DestValueVar)
814 return cret
815}
816
817var xValueUnset func(uintptr)
818
819// Clears the current value in @value (if any) and ‘unsets’ the type.
820//
821// This releases all resources associated with this [struct@GObject.Value]. An
822// unset value is the same as a cleared (zero-filled)
823// [struct@GObject.Value] structure set to `G_VALUE_INIT`.
824func (x *Value) Unset() {
825
826 xValueUnset(x.GoPointer())
827
828}
829
830const (
831 // Flag to indicate that a string in a [struct@GObject.Value] is canonical and
832 // will exist for the duration of the process.
833 //
834 // See [method@GObject.Value.set_interned_string].
835 //
836 // This flag should be checked by implementations of
837 // [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc]
838 // and [callback@GObject.TypeValueLCopyFunc].
839 VALUE_INTERNED_STRING int = 268435456
840 // Flag to indicate that allocated data in a [struct@GObject.Value] shouldn’t be
841 // copied.
842 //
843 // If passed to [func@GObject.VALUE_COLLECT], allocated data won’t be copied
844 // but used verbatim. This does not affect ref-counted types like objects.
845 //
846 // This does not affect usage of [method@GObject.Value.copy]: the data will
847 // be copied if it is not ref-counted.
848 //
849 // This flag should be checked by implementations of
850 // [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc]
851 // and [callback@GObject.TypeValueLCopyFunc].
852 VALUE_NOCOPY_CONTENTS int = 134217728
853)
854
855var xValueRegisterTransformFunc func(types.GType, types.GType, uintptr)
856
857// Registers a value transformation function for use in
858// [method@GObject.Value.transform].
859//
860// Any previously registered transformation function for @src_type and
861// @dest_type will be replaced.
862func ValueRegisterTransformFunc(SrcTypeVar types.GType, DestTypeVar types.GType, TransformFuncVar *ValueTransform) {
863
864 var TransformFuncVarRef uintptr
865 if TransformFuncVar != nil {
866 TransformFuncVarPtr := uintptr(unsafe.Pointer(TransformFuncVar))
867 if cbRefPtr, ok := glib.GetCallback(TransformFuncVarPtr); ok {
868 TransformFuncVarRef = cbRefPtr
869 } else {
870 fcb := func(arg0 *Value, arg1 *Value) {
871 cbFn := *TransformFuncVar
872 cbFn(arg0, arg1)
873 }
874 TransformFuncVarRef = purego.NewCallback(fcb)
875 glib.SaveCallbackWithClosure(TransformFuncVarPtr, TransformFuncVarRef, TransformFuncVar)
876 }
877 }
878
879 xValueRegisterTransformFunc(SrcTypeVar, DestTypeVar, TransformFuncVarRef)
880
881}
882
883var xValueTypeCompatible func(types.GType, types.GType) bool
884
885// Checks whether a [method@GObject.Value.copy] is able to copy values of type
886// @src_type into values of type @dest_type.
887func ValueTypeCompatible(SrcTypeVar types.GType, DestTypeVar types.GType) bool {
888
889 cret := xValueTypeCompatible(SrcTypeVar, DestTypeVar)
890 return cret
891}
892
893var xValueTypeTransformable func(types.GType, types.GType) bool
894
895// Checks whether [method@GObject.Value.transform] is able to transform values
896// of type @src_type into values of type @dest_type.
897//
898// Note that for the types to be transformable, they must be compatible or a
899// transformation function must be registered using
900// [func@GObject.Value.register_transform_func].
901func ValueTypeTransformable(SrcTypeVar types.GType, DestTypeVar types.GType) bool {
902
903 cret := xValueTypeTransformable(SrcTypeVar, DestTypeVar)
904 return cret
905}
906
907func init() {
908 core.SetPackageName("GOBJECT", "gobject-2.0")
909 core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
910 var libs []uintptr
911 for _, libPath := range core.GetPaths("GOBJECT") {
912 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
913 if err != nil {
914 panic(err)
915 }
916 libs = append(libs, lib)
917 }
918
919 core.PuregoSafeRegister(&xValueRegisterTransformFunc, libs, "g_value_register_transform_func")
920 core.PuregoSafeRegister(&xValueTypeCompatible, libs, "g_value_type_compatible")
921 core.PuregoSafeRegister(&xValueTypeTransformable, libs, "g_value_type_transformable")
922
923 core.PuregoSafeRegister(&xValueGLibType, libs, "g_value_get_type")
924
925 core.PuregoSafeRegister(&xValueCopy, libs, "g_value_copy")
926 core.PuregoSafeRegister(&xValueDupBoxed, libs, "g_value_dup_boxed")
927 core.PuregoSafeRegister(&xValueDupObject, libs, "g_value_dup_object")
928 core.PuregoSafeRegister(&xValueDupParam, libs, "g_value_dup_param")
929 core.PuregoSafeRegister(&xValueDupString, libs, "g_value_dup_string")
930 core.PuregoSafeRegister(&xValueDupVariant, libs, "g_value_dup_variant")
931 core.PuregoSafeRegister(&xValueFitsPointer, libs, "g_value_fits_pointer")
932 core.PuregoSafeRegister(&xValueGetBoolean, libs, "g_value_get_boolean")
933 core.PuregoSafeRegister(&xValueGetBoxed, libs, "g_value_get_boxed")
934 core.PuregoSafeRegister(&xValueGetChar, libs, "g_value_get_char")
935 core.PuregoSafeRegister(&xValueGetDouble, libs, "g_value_get_double")
936 core.PuregoSafeRegister(&xValueGetEnum, libs, "g_value_get_enum")
937 core.PuregoSafeRegister(&xValueGetFlags, libs, "g_value_get_flags")
938 core.PuregoSafeRegister(&xValueGetFloat, libs, "g_value_get_float")
939 core.PuregoSafeRegister(&xValueGetGtype, libs, "g_value_get_gtype")
940 core.PuregoSafeRegister(&xValueGetInt, libs, "g_value_get_int")
941 core.PuregoSafeRegister(&xValueGetInt64, libs, "g_value_get_int64")
942 core.PuregoSafeRegister(&xValueGetLong, libs, "g_value_get_long")
943 core.PuregoSafeRegister(&xValueGetObject, libs, "g_value_get_object")
944 core.PuregoSafeRegister(&xValueGetParam, libs, "g_value_get_param")
945 core.PuregoSafeRegister(&xValueGetPointer, libs, "g_value_get_pointer")
946 core.PuregoSafeRegister(&xValueGetSchar, libs, "g_value_get_schar")
947 core.PuregoSafeRegister(&xValueGetString, libs, "g_value_get_string")
948 core.PuregoSafeRegister(&xValueGetUchar, libs, "g_value_get_uchar")
949 core.PuregoSafeRegister(&xValueGetUint, libs, "g_value_get_uint")
950 core.PuregoSafeRegister(&xValueGetUint64, libs, "g_value_get_uint64")
951 core.PuregoSafeRegister(&xValueGetUlong, libs, "g_value_get_ulong")
952 core.PuregoSafeRegister(&xValueGetVariant, libs, "g_value_get_variant")
953 core.PuregoSafeRegister(&xValueInit, libs, "g_value_init")
954 core.PuregoSafeRegister(&xValueInitFromInstance, libs, "g_value_init_from_instance")
955 core.PuregoSafeRegister(&xValuePeekPointer, libs, "g_value_peek_pointer")
956 core.PuregoSafeRegister(&xValueReset, libs, "g_value_reset")
957 core.PuregoSafeRegister(&xValueSetBoolean, libs, "g_value_set_boolean")
958 core.PuregoSafeRegister(&xValueSetBoxed, libs, "g_value_set_boxed")
959 core.PuregoSafeRegister(&xValueSetBoxedTakeOwnership, libs, "g_value_set_boxed_take_ownership")
960 core.PuregoSafeRegister(&xValueSetChar, libs, "g_value_set_char")
961 core.PuregoSafeRegister(&xValueSetDouble, libs, "g_value_set_double")
962 core.PuregoSafeRegister(&xValueSetEnum, libs, "g_value_set_enum")
963 core.PuregoSafeRegister(&xValueSetFlags, libs, "g_value_set_flags")
964 core.PuregoSafeRegister(&xValueSetFloat, libs, "g_value_set_float")
965 core.PuregoSafeRegister(&xValueSetGtype, libs, "g_value_set_gtype")
966 core.PuregoSafeRegister(&xValueSetInstance, libs, "g_value_set_instance")
967 core.PuregoSafeRegister(&xValueSetInt, libs, "g_value_set_int")
968 core.PuregoSafeRegister(&xValueSetInt64, libs, "g_value_set_int64")
969 core.PuregoSafeRegister(&xValueSetInternedString, libs, "g_value_set_interned_string")
970 core.PuregoSafeRegister(&xValueSetLong, libs, "g_value_set_long")
971 core.PuregoSafeRegister(&xValueSetObject, libs, "g_value_set_object")
972 core.PuregoSafeRegister(&xValueSetObjectTakeOwnership, libs, "g_value_set_object_take_ownership")
973 core.PuregoSafeRegister(&xValueSetParam, libs, "g_value_set_param")
974 core.PuregoSafeRegister(&xValueSetParamTakeOwnership, libs, "g_value_set_param_take_ownership")
975 core.PuregoSafeRegister(&xValueSetPointer, libs, "g_value_set_pointer")
976 core.PuregoSafeRegister(&xValueSetSchar, libs, "g_value_set_schar")
977 core.PuregoSafeRegister(&xValueSetStaticBoxed, libs, "g_value_set_static_boxed")
978 core.PuregoSafeRegister(&xValueSetStaticString, libs, "g_value_set_static_string")
979 core.PuregoSafeRegister(&xValueSetString, libs, "g_value_set_string")
980 core.PuregoSafeRegister(&xValueSetStringTakeOwnership, libs, "g_value_set_string_take_ownership")
981 core.PuregoSafeRegister(&xValueSetUchar, libs, "g_value_set_uchar")
982 core.PuregoSafeRegister(&xValueSetUint, libs, "g_value_set_uint")
983 core.PuregoSafeRegister(&xValueSetUint64, libs, "g_value_set_uint64")
984 core.PuregoSafeRegister(&xValueSetUlong, libs, "g_value_set_ulong")
985 core.PuregoSafeRegister(&xValueSetVariant, libs, "g_value_set_variant")
986 core.PuregoSafeRegister(&xValueStealString, libs, "g_value_steal_string")
987 core.PuregoSafeRegister(&xValueTakeBoxed, libs, "g_value_take_boxed")
988 core.PuregoSafeRegister(&xValueTakeObject, libs, "g_value_take_object")
989 core.PuregoSafeRegister(&xValueTakeParam, libs, "g_value_take_param")
990 core.PuregoSafeRegister(&xValueTakeString, libs, "g_value_take_string")
991 core.PuregoSafeRegister(&xValueTakeVariant, libs, "g_value_take_variant")
992 core.PuregoSafeRegister(&xValueTransform, libs, "g_value_transform")
993 core.PuregoSafeRegister(&xValueUnset, libs, "g_value_unset")
994
995}