v0.2.1 c0399be

gvaluearray.go RawHistoryFolder

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// A `GValueArray` is a container structure to hold an array of generic values.
16//
17// The prime purpose of a `GValueArray` is for it to be used as an
18// object property that holds an array of values. A `GValueArray` wraps
19// an array of `GValue` elements in order for it to be used as a boxed
20// type through `G_TYPE_VALUE_ARRAY`.
21//
22// `GValueArray` is deprecated in favour of `GArray` since GLib 2.32.
23// It is possible to create a `GArray` that behaves like a `GValueArray`
24// by using the size of `GValue` as the element size, and by setting
25// [method@GObject.Value.unset] as the clear function using
26// [func@GLib.Array.set_clear_func], for instance, the following code:
27//
28// ```c
29//
30//	GValueArray *array = g_value_array_new (10);
31//
32// ```
33//
34// can be replaced by:
35//
36// ```c
37//
38//	GArray *array = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 10);
39//	g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
40//
41// ```
42type ValueArray struct {
43	_ structs.HostLayout
44
45	NValues uint
46
47	Values *Value
48
49	NPrealloced uint
50}
51
52var xValueArrayGLibType func() types.GType
53
54func ValueArrayGLibType() types.GType {
55	return xValueArrayGLibType()
56}
57
58func (x *ValueArray) GoPointer() uintptr {
59	return uintptr(unsafe.Pointer(x))
60}
61
62var xNewValueArray func(uint) *ValueArray
63
64// Allocate and initialize a new #GValueArray, optionally preserve space
65// for @n_prealloced elements. New arrays always contain 0 elements,
66// regardless of the value of @n_prealloced.
67func NewValueArray(NPreallocedVar uint) *ValueArray {
68
69	cret := xNewValueArray(NPreallocedVar)
70	return cret
71}
72
73var xValueArrayAppend func(uintptr, *Value) *ValueArray
74
75// Insert a copy of @value as last element of @value_array. If @value is
76// %NULL, an uninitialized value is appended.
77func (x *ValueArray) Append(ValueVar *Value) *ValueArray {
78
79	cret := xValueArrayAppend(x.GoPointer(), ValueVar)
80	return cret
81}
82
83var xValueArrayCopy func(uintptr) *ValueArray
84
85// Construct an exact copy of a #GValueArray by duplicating all its
86// contents.
87func (x *ValueArray) Copy() *ValueArray {
88
89	cret := xValueArrayCopy(x.GoPointer())
90	return cret
91}
92
93var xValueArrayFree func(uintptr)
94
95// Free a #GValueArray including its contents.
96func (x *ValueArray) Free() {
97
98	xValueArrayFree(x.GoPointer())
99
100}
101
102var xValueArrayGetNth func(uintptr, uint) *Value
103
104// Return a pointer to the value at @index_ contained in @value_array.
105func (x *ValueArray) GetNth(IndexVar uint) *Value {
106
107	cret := xValueArrayGetNth(x.GoPointer(), IndexVar)
108	return cret
109}
110
111var xValueArrayInsert func(uintptr, uint, *Value) *ValueArray
112
113// Insert a copy of @value at specified position into @value_array. If @value
114// is %NULL, an uninitialized value is inserted.
115func (x *ValueArray) Insert(IndexVar uint, ValueVar *Value) *ValueArray {
116
117	cret := xValueArrayInsert(x.GoPointer(), IndexVar, ValueVar)
118	return cret
119}
120
121var xValueArrayPrepend func(uintptr, *Value) *ValueArray
122
123// Insert a copy of @value as first element of @value_array. If @value is
124// %NULL, an uninitialized value is prepended.
125func (x *ValueArray) Prepend(ValueVar *Value) *ValueArray {
126
127	cret := xValueArrayPrepend(x.GoPointer(), ValueVar)
128	return cret
129}
130
131var xValueArrayRemove func(uintptr, uint) *ValueArray
132
133// Remove the value at position @index_ from @value_array.
134func (x *ValueArray) Remove(IndexVar uint) *ValueArray {
135
136	cret := xValueArrayRemove(x.GoPointer(), IndexVar)
137	return cret
138}
139
140var xValueArraySort func(uintptr, uintptr) *ValueArray
141
142// Sort @value_array using @compare_func to compare the elements according to
143// the semantics of #GCompareFunc.
144//
145// The current implementation uses the same sorting algorithm as standard
146// C qsort() function.
147func (x *ValueArray) Sort(CompareFuncVar *glib.CompareFunc) *ValueArray {
148
149	var CompareFuncVarRef uintptr
150	if CompareFuncVar != nil {
151		CompareFuncVarPtr := uintptr(unsafe.Pointer(CompareFuncVar))
152		if cbRefPtr, ok := glib.GetCallback(CompareFuncVarPtr); ok {
153			CompareFuncVarRef = cbRefPtr
154		} else {
155			fcb := func(arg0 uintptr, arg1 uintptr) int {
156				cbFn := *CompareFuncVar
157				return cbFn(arg0, arg1)
158			}
159			CompareFuncVarRef = purego.NewCallback(fcb)
160			glib.SaveCallbackWithClosure(CompareFuncVarPtr, CompareFuncVarRef, CompareFuncVar)
161		}
162	}
163
164	cret := xValueArraySort(x.GoPointer(), CompareFuncVarRef)
165	return cret
166}
167
168var xValueArraySortWithData func(uintptr, uintptr, uintptr) *ValueArray
169
170// Sort @value_array using @compare_func to compare the elements according
171// to the semantics of #GCompareDataFunc.
172//
173// The current implementation uses the same sorting algorithm as standard
174// C qsort() function.
175func (x *ValueArray) SortWithData(CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr) *ValueArray {
176
177	var CompareFuncVarRef uintptr
178	if CompareFuncVar != nil {
179		CompareFuncVarPtr := uintptr(unsafe.Pointer(CompareFuncVar))
180		if cbRefPtr, ok := glib.GetCallback(CompareFuncVarPtr); ok {
181			CompareFuncVarRef = cbRefPtr
182		} else {
183			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int {
184				cbFn := *CompareFuncVar
185				return cbFn(arg0, arg1, arg2)
186			}
187			CompareFuncVarRef = purego.NewCallback(fcb)
188			glib.SaveCallbackWithClosure(CompareFuncVarPtr, CompareFuncVarRef, CompareFuncVar)
189		}
190	}
191
192	cret := xValueArraySortWithData(x.GoPointer(), CompareFuncVarRef, UserDataVar)
193	return cret
194}
195
196func init() {
197	core.SetPackageName("GOBJECT", "gobject-2.0")
198	core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
199	var libs []uintptr
200	for _, libPath := range core.GetPaths("GOBJECT") {
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(&xValueArrayGLibType, libs, "g_value_array_get_type")
209
210	core.PuregoSafeRegister(&xNewValueArray, libs, "g_value_array_new")
211
212	core.PuregoSafeRegister(&xValueArrayAppend, libs, "g_value_array_append")
213	core.PuregoSafeRegister(&xValueArrayCopy, libs, "g_value_array_copy")
214	core.PuregoSafeRegister(&xValueArrayFree, libs, "g_value_array_free")
215	core.PuregoSafeRegister(&xValueArrayGetNth, libs, "g_value_array_get_nth")
216	core.PuregoSafeRegister(&xValueArrayInsert, libs, "g_value_array_insert")
217	core.PuregoSafeRegister(&xValueArrayPrepend, libs, "g_value_array_prepend")
218	core.PuregoSafeRegister(&xValueArrayRemove, libs, "g_value_array_remove")
219	core.PuregoSafeRegister(&xValueArraySort, libs, "g_value_array_sort")
220	core.PuregoSafeRegister(&xValueArraySortWithData, libs, "g_value_array_sort_with_data")
221
222}

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