v0.2.2 9100209

gdataset.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11)
12
13// Specifies the type of function passed to g_dataset_foreach(). It is
14// called with each #GQuark id and associated data element, together
15// with the @user_data parameter supplied to g_dataset_foreach().
16type DataForeachFunc func(Quark, uintptr, uintptr)
17
18// The type of functions that are used to 'duplicate' an object.
19// What this means depends on the context, it could just be
20// incrementing the reference count, if @data is a ref-counted
21// object.
22type DuplicateFunc func(uintptr, uintptr) uintptr
23
24// An opaque data structure that represents a keyed data list.
25//
26// See also: [Keyed data lists](datalist-and-dataset.html).
27type Data struct {
28	_ structs.HostLayout
29}
30
31func (x *Data) GoPointer() uintptr {
32	return uintptr(unsafe.Pointer(x))
33}
34
35const (
36	// A bitmask that restricts the possible flags passed to
37	// g_datalist_set_flags(). Passing a flags value where
38	// flags & ~G_DATALIST_FLAGS_MASK != 0 is an error.
39	DATALIST_FLAGS_MASK int = 3
40)
41
42var xDatalistClear func(**Data)
43
44// Frees all the data elements of the datalist.
45// The data elements' destroy functions are called
46// if they have been set.
47func DatalistClear(DatalistVar **Data) {
48
49	xDatalistClear(DatalistVar)
50
51}
52
53var xDatalistForeach func(**Data, uintptr, uintptr)
54
55// Calls the given function for each data element of the datalist. The
56// function is called with each data element's #GQuark id and data,
57// together with the given @user_data parameter. Note that this
58// function is NOT thread-safe. So unless @datalist can be protected
59// from any modifications during invocation of this function, it should
60// not be called.
61//
62// @func can make changes to @datalist, but the iteration will not
63// reflect changes made during the g_datalist_foreach() call, other
64// than skipping over elements that are removed.
65func DatalistForeach(DatalistVar **Data, FuncVar *DataForeachFunc, UserDataVar uintptr) {
66
67	var FuncVarRef uintptr
68	if FuncVar != nil {
69		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
70		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
71			FuncVarRef = cbRefPtr
72		} else {
73			fcb := func(arg0 Quark, arg1 uintptr, arg2 uintptr) {
74				cbFn := *FuncVar
75				cbFn(arg0, arg1, arg2)
76			}
77			FuncVarRef = purego.NewCallback(fcb)
78			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
79		}
80	}
81
82	xDatalistForeach(DatalistVar, FuncVarRef, UserDataVar)
83
84}
85
86var xDatalistGetData func(**Data, string) uintptr
87
88// Gets a data element, using its string identifier. This is slower than
89// g_datalist_id_get_data() because it compares strings.
90func DatalistGetData(DatalistVar **Data, KeyVar string) uintptr {
91
92	cret := xDatalistGetData(DatalistVar, KeyVar)
93
94	return cret
95}
96
97var xDatalistGetFlags func(**Data) uint
98
99// Gets flags values packed in together with the datalist.
100// See g_datalist_set_flags().
101func DatalistGetFlags(DatalistVar **Data) uint {
102
103	cret := xDatalistGetFlags(DatalistVar)
104
105	return cret
106}
107
108var xDatalistIdDupData func(**Data, Quark, uintptr, uintptr) uintptr
109
110// This is a variant of g_datalist_id_get_data() which
111// returns a 'duplicate' of the value. @dup_func defines the
112// meaning of 'duplicate' in this context, it could e.g.
113// take a reference on a ref-counted object.
114//
115// If the @key_id is not set in the datalist then @dup_func
116// will be called with a %NULL argument.
117//
118// Note that @dup_func is called while the datalist is locked, so it
119// is not allowed to read or modify the datalist.
120//
121// This function can be useful to avoid races when multiple
122// threads are using the same datalist and the same key.
123func DatalistIdDupData(DatalistVar **Data, KeyIdVar Quark, DupFuncVar *DuplicateFunc, UserDataVar uintptr) uintptr {
124
125	var DupFuncVarRef uintptr
126	if DupFuncVar != nil {
127		DupFuncVarPtr := uintptr(unsafe.Pointer(DupFuncVar))
128		if cbRefPtr, ok := GetCallback(DupFuncVarPtr); ok {
129			DupFuncVarRef = cbRefPtr
130		} else {
131			fcb := func(arg0 uintptr, arg1 uintptr) uintptr {
132				cbFn := *DupFuncVar
133				return cbFn(arg0, arg1)
134			}
135			DupFuncVarRef = purego.NewCallback(fcb)
136			SaveCallbackWithClosure(DupFuncVarPtr, DupFuncVarRef, DupFuncVar)
137		}
138	}
139
140	cret := xDatalistIdDupData(DatalistVar, KeyIdVar, DupFuncVarRef, UserDataVar)
141
142	return cret
143}
144
145var xDatalistIdGetData func(**Data, Quark) uintptr
146
147// Retrieves the data element corresponding to @key_id.
148func DatalistIdGetData(DatalistVar **Data, KeyIdVar Quark) uintptr {
149
150	cret := xDatalistIdGetData(DatalistVar, KeyIdVar)
151
152	return cret
153}
154
155var xDatalistIdRemoveMultiple func(**Data, []Quark, uint)
156
157// Removes multiple keys from a datalist.
158//
159// This is more efficient than calling g_datalist_id_remove_data()
160// multiple times in a row.
161//
162// Before 2.80, @n_keys had to be not larger than 16.
163// Since 2.84, performance is improved for larger number of keys.
164func DatalistIdRemoveMultiple(DatalistVar **Data, KeysVar []Quark, NKeysVar uint) {
165
166	xDatalistIdRemoveMultiple(DatalistVar, KeysVar, NKeysVar)
167
168}
169
170var xDatalistIdRemoveNoNotify func(**Data, Quark) uintptr
171
172// Removes an element, without calling its destroy notification
173// function.
174func DatalistIdRemoveNoNotify(DatalistVar **Data, KeyIdVar Quark) uintptr {
175
176	cret := xDatalistIdRemoveNoNotify(DatalistVar, KeyIdVar)
177
178	return cret
179}
180
181var xDatalistIdReplaceData func(**Data, Quark, uintptr, uintptr, uintptr, *DestroyNotify) bool
182
183// Compares the member that is associated with @key_id in
184// @datalist to @oldval, and if they are the same, replace
185// @oldval with @newval.
186//
187// This is like a typical atomic compare-and-exchange
188// operation, for a member of @datalist.
189//
190// If the previous value was replaced then ownership of the
191// old value (@oldval) is passed to the caller, including
192// the registered destroy notify for it (passed out in @old_destroy).
193// Its up to the caller to free this as they wish, which may
194// or may not include using @old_destroy as sometimes replacement
195// should not destroy the object in the normal way.
196func DatalistIdReplaceData(DatalistVar **Data, KeyIdVar Quark, OldvalVar uintptr, NewvalVar uintptr, DestroyVar *DestroyNotify, OldDestroyVar *DestroyNotify) bool {
197
198	var DestroyVarRef uintptr
199	if DestroyVar != nil {
200		DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
201		if cbRefPtr, ok := GetCallback(DestroyVarPtr); ok {
202			DestroyVarRef = cbRefPtr
203		} else {
204			fcb := func(arg0 uintptr) {
205				cbFn := *DestroyVar
206				cbFn(arg0)
207			}
208			DestroyVarRef = purego.NewCallback(fcb)
209			SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
210		}
211	}
212
213	cret := xDatalistIdReplaceData(DatalistVar, KeyIdVar, OldvalVar, NewvalVar, DestroyVarRef, OldDestroyVar)
214
215	return cret
216}
217
218var xDatalistIdSetDataFull func(**Data, Quark, uintptr, uintptr)
219
220// Sets the data corresponding to the given #GQuark id, and the
221// function to be called when the element is removed from the datalist.
222// Any previous data with the same key is removed, and its destroy
223// function is called.
224func DatalistIdSetDataFull(DatalistVar **Data, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar *DestroyNotify) {
225
226	var DestroyFuncVarRef uintptr
227	if DestroyFuncVar != nil {
228		DestroyFuncVarPtr := uintptr(unsafe.Pointer(DestroyFuncVar))
229		if cbRefPtr, ok := GetCallback(DestroyFuncVarPtr); ok {
230			DestroyFuncVarRef = cbRefPtr
231		} else {
232			fcb := func(arg0 uintptr) {
233				cbFn := *DestroyFuncVar
234				cbFn(arg0)
235			}
236			DestroyFuncVarRef = purego.NewCallback(fcb)
237			SaveCallbackWithClosure(DestroyFuncVarPtr, DestroyFuncVarRef, DestroyFuncVar)
238		}
239	}
240
241	xDatalistIdSetDataFull(DatalistVar, KeyIdVar, DataVar, DestroyFuncVarRef)
242
243}
244
245var xDatalistInit func(**Data)
246
247// Resets the datalist to %NULL. It does not free any memory or call
248// any destroy functions.
249func DatalistInit(DatalistVar **Data) {
250
251	xDatalistInit(DatalistVar)
252
253}
254
255var xDatalistSetFlags func(**Data, uint)
256
257// Turns on flag values for a data list. This function is used
258// to keep a small number of boolean flags in an object with
259// a data list without using any additional space. It is
260// not generally useful except in circumstances where space
261// is very tight. (It is used in the base #GObject type, for
262// example.)
263func DatalistSetFlags(DatalistVar **Data, FlagsVar uint) {
264
265	xDatalistSetFlags(DatalistVar, FlagsVar)
266
267}
268
269var xDatalistUnsetFlags func(**Data, uint)
270
271// Turns off flag values for a data list. See g_datalist_unset_flags()
272func DatalistUnsetFlags(DatalistVar **Data, FlagsVar uint) {
273
274	xDatalistUnsetFlags(DatalistVar, FlagsVar)
275
276}
277
278var xDatasetDestroy func(uintptr)
279
280// Destroys the dataset, freeing all memory allocated, and calling any
281// destroy functions set for data elements.
282func DatasetDestroy(DatasetLocationVar uintptr) {
283
284	xDatasetDestroy(DatasetLocationVar)
285
286}
287
288var xDatasetForeach func(uintptr, uintptr, uintptr)
289
290// Calls the given function for each data element which is associated
291// with the given location. Note that this function is NOT thread-safe.
292// So unless @dataset_location can be protected from any modifications
293// during invocation of this function, it should not be called.
294//
295// @func can make changes to the dataset, but the iteration will not
296// reflect changes made during the g_dataset_foreach() call, other
297// than skipping over elements that are removed.
298func DatasetForeach(DatasetLocationVar uintptr, FuncVar *DataForeachFunc, UserDataVar uintptr) {
299
300	var FuncVarRef uintptr
301	if FuncVar != nil {
302		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
303		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
304			FuncVarRef = cbRefPtr
305		} else {
306			fcb := func(arg0 Quark, arg1 uintptr, arg2 uintptr) {
307				cbFn := *FuncVar
308				cbFn(arg0, arg1, arg2)
309			}
310			FuncVarRef = purego.NewCallback(fcb)
311			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
312		}
313	}
314
315	xDatasetForeach(DatasetLocationVar, FuncVarRef, UserDataVar)
316
317}
318
319var xDatasetIdGetData func(uintptr, Quark) uintptr
320
321// Gets the data element corresponding to a #GQuark.
322func DatasetIdGetData(DatasetLocationVar uintptr, KeyIdVar Quark) uintptr {
323
324	cret := xDatasetIdGetData(DatasetLocationVar, KeyIdVar)
325
326	return cret
327}
328
329var xDatasetIdRemoveNoNotify func(uintptr, Quark) uintptr
330
331// Removes an element, without calling its destroy notification
332// function.
333func DatasetIdRemoveNoNotify(DatasetLocationVar uintptr, KeyIdVar Quark) uintptr {
334
335	cret := xDatasetIdRemoveNoNotify(DatasetLocationVar, KeyIdVar)
336
337	return cret
338}
339
340var xDatasetIdSetDataFull func(uintptr, Quark, uintptr, uintptr)
341
342// Sets the data element associated with the given #GQuark id, and also
343// the function to call when the data element is destroyed. Any
344// previous data with the same key is removed, and its destroy function
345// is called.
346func DatasetIdSetDataFull(DatasetLocationVar uintptr, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar *DestroyNotify) {
347
348	var DestroyFuncVarRef uintptr
349	if DestroyFuncVar != nil {
350		DestroyFuncVarPtr := uintptr(unsafe.Pointer(DestroyFuncVar))
351		if cbRefPtr, ok := GetCallback(DestroyFuncVarPtr); ok {
352			DestroyFuncVarRef = cbRefPtr
353		} else {
354			fcb := func(arg0 uintptr) {
355				cbFn := *DestroyFuncVar
356				cbFn(arg0)
357			}
358			DestroyFuncVarRef = purego.NewCallback(fcb)
359			SaveCallbackWithClosure(DestroyFuncVarPtr, DestroyFuncVarRef, DestroyFuncVar)
360		}
361	}
362
363	xDatasetIdSetDataFull(DatasetLocationVar, KeyIdVar, DataVar, DestroyFuncVarRef)
364
365}
366
367func init() {
368	core.SetPackageName("GLIB", "glib-2.0")
369	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
370	var libs []uintptr
371	for _, libPath := range core.GetPaths("GLIB") {
372		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
373		if err != nil {
374			panic(err)
375		}
376		libs = append(libs, lib)
377	}
378
379	core.PuregoSafeRegister(&xDatalistClear, libs, "g_datalist_clear")
380	core.PuregoSafeRegister(&xDatalistForeach, libs, "g_datalist_foreach")
381	core.PuregoSafeRegister(&xDatalistGetData, libs, "g_datalist_get_data")
382	core.PuregoSafeRegister(&xDatalistGetFlags, libs, "g_datalist_get_flags")
383	core.PuregoSafeRegister(&xDatalistIdDupData, libs, "g_datalist_id_dup_data")
384	core.PuregoSafeRegister(&xDatalistIdGetData, libs, "g_datalist_id_get_data")
385	core.PuregoSafeRegister(&xDatalistIdRemoveMultiple, libs, "g_datalist_id_remove_multiple")
386	core.PuregoSafeRegister(&xDatalistIdRemoveNoNotify, libs, "g_datalist_id_remove_no_notify")
387	core.PuregoSafeRegister(&xDatalistIdReplaceData, libs, "g_datalist_id_replace_data")
388	core.PuregoSafeRegister(&xDatalistIdSetDataFull, libs, "g_datalist_id_set_data_full")
389	core.PuregoSafeRegister(&xDatalistInit, libs, "g_datalist_init")
390	core.PuregoSafeRegister(&xDatalistSetFlags, libs, "g_datalist_set_flags")
391	core.PuregoSafeRegister(&xDatalistUnsetFlags, libs, "g_datalist_unset_flags")
392	core.PuregoSafeRegister(&xDatasetDestroy, libs, "g_dataset_destroy")
393	core.PuregoSafeRegister(&xDatasetForeach, libs, "g_dataset_foreach")
394	core.PuregoSafeRegister(&xDatasetIdGetData, libs, "g_dataset_id_get_data")
395	core.PuregoSafeRegister(&xDatasetIdRemoveNoNotify, libs, "g_dataset_id_remove_no_notify")
396	core.PuregoSafeRegister(&xDatasetIdSetDataFull, libs, "g_dataset_id_set_data_full")
397
398}

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