v0.2.2 9100209

gqueue.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// Contains the public fields of a
14// [Queue](data-structures.html#double-ended-queues).
15type Queue struct {
16	_ structs.HostLayout
17
18	Head *List
19
20	Tail *List
21
22	Length uint
23}
24
25func (x *Queue) GoPointer() uintptr {
26	return uintptr(unsafe.Pointer(x))
27}
28
29var xQueueClear func(uintptr)
30
31// Removes all the elements in @queue. If queue elements contain
32// dynamically-allocated memory, they should be freed first.
33func (x *Queue) Clear() {
34
35	xQueueClear(x.GoPointer())
36
37}
38
39var xQueueClearFull func(uintptr, uintptr)
40
41// Convenience method, which frees all the memory used by a #GQueue,
42// and calls the provided @free_func on each item in the #GQueue.
43func (x *Queue) ClearFull(FreeFuncVar *DestroyNotify) {
44
45	var FreeFuncVarRef uintptr
46	if FreeFuncVar != nil {
47		FreeFuncVarPtr := uintptr(unsafe.Pointer(FreeFuncVar))
48		if cbRefPtr, ok := GetCallback(FreeFuncVarPtr); ok {
49			FreeFuncVarRef = cbRefPtr
50		} else {
51			fcb := func(arg0 uintptr) {
52				cbFn := *FreeFuncVar
53				cbFn(arg0)
54			}
55			FreeFuncVarRef = purego.NewCallback(fcb)
56			SaveCallbackWithClosure(FreeFuncVarPtr, FreeFuncVarRef, FreeFuncVar)
57		}
58	}
59
60	xQueueClearFull(x.GoPointer(), FreeFuncVarRef)
61
62}
63
64var xQueueCopy func(uintptr) *Queue
65
66// Copies a @queue. Note that is a shallow copy. If the elements in the
67// queue consist of pointers to data, the pointers are copied, but the
68// actual data is not.
69func (x *Queue) Copy() *Queue {
70
71	cret := xQueueCopy(x.GoPointer())
72	return cret
73}
74
75var xQueueDeleteLink func(uintptr, *List)
76
77// Removes @link_ from @queue and frees it.
78//
79// @link_ must be part of @queue.
80func (x *Queue) DeleteLink(LinkVar *List) {
81
82	xQueueDeleteLink(x.GoPointer(), LinkVar)
83
84}
85
86var xQueueFind func(uintptr, uintptr) *List
87
88// Finds the first link in @queue which contains @data.
89func (x *Queue) Find(DataVar uintptr) *List {
90
91	cret := xQueueFind(x.GoPointer(), DataVar)
92	return cret
93}
94
95var xQueueFindCustom func(uintptr, uintptr, uintptr) *List
96
97// Finds an element in a #GQueue, using a supplied function to find the
98// desired element. It iterates over the queue, calling the given function
99// which should return 0 when the desired element is found. The function
100// takes two gconstpointer arguments, the #GQueue element's data as the
101// first argument and the given user data as the second argument.
102func (x *Queue) FindCustom(DataVar uintptr, FuncVar *CompareFunc) *List {
103
104	var FuncVarRef uintptr
105	if FuncVar != nil {
106		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
107		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
108			FuncVarRef = cbRefPtr
109		} else {
110			fcb := func(arg0 uintptr, arg1 uintptr) int {
111				cbFn := *FuncVar
112				return cbFn(arg0, arg1)
113			}
114			FuncVarRef = purego.NewCallback(fcb)
115			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
116		}
117	}
118
119	cret := xQueueFindCustom(x.GoPointer(), DataVar, FuncVarRef)
120	return cret
121}
122
123var xQueueForeach func(uintptr, uintptr, uintptr)
124
125// Calls @func for each element in the queue passing @user_data to the
126// function.
127//
128// It is safe for @func to remove the element from @queue, but it must
129// not modify any part of the queue after that element.
130func (x *Queue) Foreach(FuncVar *Func, UserDataVar uintptr) {
131
132	var FuncVarRef uintptr
133	if FuncVar != nil {
134		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
135		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
136			FuncVarRef = cbRefPtr
137		} else {
138			fcb := func(arg0 uintptr, arg1 uintptr) {
139				cbFn := *FuncVar
140				cbFn(arg0, arg1)
141			}
142			FuncVarRef = purego.NewCallback(fcb)
143			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
144		}
145	}
146
147	xQueueForeach(x.GoPointer(), FuncVarRef, UserDataVar)
148
149}
150
151var xQueueFree func(uintptr)
152
153// Frees the memory allocated for the #GQueue. Only call this function
154// if @queue was created with g_queue_new(). If queue elements contain
155// dynamically-allocated memory, they should be freed first.
156//
157// If queue elements contain dynamically-allocated memory, you should
158// either use g_queue_free_full() or free them manually first.
159func (x *Queue) Free() {
160
161	xQueueFree(x.GoPointer())
162
163}
164
165var xQueueFreeFull func(uintptr, uintptr)
166
167// Convenience method, which frees all the memory used by a #GQueue,
168// and calls the specified destroy function on every element's data.
169//
170// @free_func should not modify the queue (eg, by removing the freed
171// element from it).
172func (x *Queue) FreeFull(FreeFuncVar *DestroyNotify) {
173
174	var FreeFuncVarRef uintptr
175	if FreeFuncVar != nil {
176		FreeFuncVarPtr := uintptr(unsafe.Pointer(FreeFuncVar))
177		if cbRefPtr, ok := GetCallback(FreeFuncVarPtr); ok {
178			FreeFuncVarRef = cbRefPtr
179		} else {
180			fcb := func(arg0 uintptr) {
181				cbFn := *FreeFuncVar
182				cbFn(arg0)
183			}
184			FreeFuncVarRef = purego.NewCallback(fcb)
185			SaveCallbackWithClosure(FreeFuncVarPtr, FreeFuncVarRef, FreeFuncVar)
186		}
187	}
188
189	xQueueFreeFull(x.GoPointer(), FreeFuncVarRef)
190
191}
192
193var xQueueGetLength func(uintptr) uint
194
195// Returns the number of items in @queue.
196func (x *Queue) GetLength() uint {
197
198	cret := xQueueGetLength(x.GoPointer())
199	return cret
200}
201
202var xQueueIndex func(uintptr, uintptr) int
203
204// Returns the position of the first element in @queue which contains @data.
205func (x *Queue) Index(DataVar uintptr) int {
206
207	cret := xQueueIndex(x.GoPointer(), DataVar)
208	return cret
209}
210
211var xQueueInit func(uintptr)
212
213// A statically-allocated #GQueue must be initialized with this function
214// before it can be used. Alternatively you can initialize it with
215// %G_QUEUE_INIT. It is not necessary to initialize queues created with
216// g_queue_new().
217func (x *Queue) Init() {
218
219	xQueueInit(x.GoPointer())
220
221}
222
223var xQueueInsertAfter func(uintptr, *List, uintptr)
224
225// Inserts @data into @queue after @sibling.
226//
227// @sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the
228// data at the head of the queue.
229func (x *Queue) InsertAfter(SiblingVar *List, DataVar uintptr) {
230
231	xQueueInsertAfter(x.GoPointer(), SiblingVar, DataVar)
232
233}
234
235var xQueueInsertAfterLink func(uintptr, *List, *List)
236
237// Inserts @link_ into @queue after @sibling.
238//
239// @sibling must be part of @queue.
240func (x *Queue) InsertAfterLink(SiblingVar *List, LinkVar *List) {
241
242	xQueueInsertAfterLink(x.GoPointer(), SiblingVar, LinkVar)
243
244}
245
246var xQueueInsertBefore func(uintptr, *List, uintptr)
247
248// Inserts @data into @queue before @sibling.
249//
250// @sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the
251// data at the tail of the queue.
252func (x *Queue) InsertBefore(SiblingVar *List, DataVar uintptr) {
253
254	xQueueInsertBefore(x.GoPointer(), SiblingVar, DataVar)
255
256}
257
258var xQueueInsertBeforeLink func(uintptr, *List, *List)
259
260// Inserts @link_ into @queue before @sibling.
261//
262// @sibling must be part of @queue.
263func (x *Queue) InsertBeforeLink(SiblingVar *List, LinkVar *List) {
264
265	xQueueInsertBeforeLink(x.GoPointer(), SiblingVar, LinkVar)
266
267}
268
269var xQueueInsertSorted func(uintptr, uintptr, uintptr, uintptr)
270
271// Inserts @data into @queue using @func to determine the new position.
272func (x *Queue) InsertSorted(DataVar uintptr, FuncVar *CompareDataFunc, UserDataVar uintptr) {
273
274	var FuncVarRef uintptr
275	if FuncVar != nil {
276		FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
277		if cbRefPtr, ok := GetCallback(FuncVarPtr); ok {
278			FuncVarRef = cbRefPtr
279		} else {
280			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int {
281				cbFn := *FuncVar
282				return cbFn(arg0, arg1, arg2)
283			}
284			FuncVarRef = purego.NewCallback(fcb)
285			SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
286		}
287	}
288
289	xQueueInsertSorted(x.GoPointer(), DataVar, FuncVarRef, UserDataVar)
290
291}
292
293var xQueueIsEmpty func(uintptr) bool
294
295// Returns %TRUE if the queue is empty.
296func (x *Queue) IsEmpty() bool {
297
298	cret := xQueueIsEmpty(x.GoPointer())
299	return cret
300}
301
302var xQueueLinkIndex func(uintptr, *List) int
303
304// Returns the position of @link_ in @queue.
305func (x *Queue) LinkIndex(LinkVar *List) int {
306
307	cret := xQueueLinkIndex(x.GoPointer(), LinkVar)
308	return cret
309}
310
311var xQueuePeekHead func(uintptr) uintptr
312
313// Returns the first element of the queue.
314func (x *Queue) PeekHead() uintptr {
315
316	cret := xQueuePeekHead(x.GoPointer())
317	return cret
318}
319
320var xQueuePeekHeadLink func(uintptr) *List
321
322// Returns the first link in @queue.
323func (x *Queue) PeekHeadLink() *List {
324
325	cret := xQueuePeekHeadLink(x.GoPointer())
326	return cret
327}
328
329var xQueuePeekNth func(uintptr, uint) uintptr
330
331// Returns the @n'th element of @queue.
332func (x *Queue) PeekNth(NVar uint) uintptr {
333
334	cret := xQueuePeekNth(x.GoPointer(), NVar)
335	return cret
336}
337
338var xQueuePeekNthLink func(uintptr, uint) *List
339
340// Returns the link at the given position
341func (x *Queue) PeekNthLink(NVar uint) *List {
342
343	cret := xQueuePeekNthLink(x.GoPointer(), NVar)
344	return cret
345}
346
347var xQueuePeekTail func(uintptr) uintptr
348
349// Returns the last element of the queue.
350func (x *Queue) PeekTail() uintptr {
351
352	cret := xQueuePeekTail(x.GoPointer())
353	return cret
354}
355
356var xQueuePeekTailLink func(uintptr) *List
357
358// Returns the last link in @queue.
359func (x *Queue) PeekTailLink() *List {
360
361	cret := xQueuePeekTailLink(x.GoPointer())
362	return cret
363}
364
365var xQueuePopHead func(uintptr) uintptr
366
367// Removes the first element of the queue and returns its data.
368func (x *Queue) PopHead() uintptr {
369
370	cret := xQueuePopHead(x.GoPointer())
371	return cret
372}
373
374var xQueuePopHeadLink func(uintptr) *List
375
376// Removes and returns the first element of the queue.
377func (x *Queue) PopHeadLink() *List {
378
379	cret := xQueuePopHeadLink(x.GoPointer())
380	return cret
381}
382
383var xQueuePopNth func(uintptr, uint) uintptr
384
385// Removes the @n'th element of @queue and returns its data.
386func (x *Queue) PopNth(NVar uint) uintptr {
387
388	cret := xQueuePopNth(x.GoPointer(), NVar)
389	return cret
390}
391
392var xQueuePopNthLink func(uintptr, uint) *List
393
394// Removes and returns the link at the given position.
395func (x *Queue) PopNthLink(NVar uint) *List {
396
397	cret := xQueuePopNthLink(x.GoPointer(), NVar)
398	return cret
399}
400
401var xQueuePopTail func(uintptr) uintptr
402
403// Removes the last element of the queue and returns its data.
404func (x *Queue) PopTail() uintptr {
405
406	cret := xQueuePopTail(x.GoPointer())
407	return cret
408}
409
410var xQueuePopTailLink func(uintptr) *List
411
412// Removes and returns the last element of the queue.
413func (x *Queue) PopTailLink() *List {
414
415	cret := xQueuePopTailLink(x.GoPointer())
416	return cret
417}
418
419var xQueuePushHead func(uintptr, uintptr)
420
421// Adds a new element at the head of the queue.
422func (x *Queue) PushHead(DataVar uintptr) {
423
424	xQueuePushHead(x.GoPointer(), DataVar)
425
426}
427
428var xQueuePushHeadLink func(uintptr, *List)
429
430// Adds a new element at the head of the queue.
431func (x *Queue) PushHeadLink(LinkVar *List) {
432
433	xQueuePushHeadLink(x.GoPointer(), LinkVar)
434
435}
436
437var xQueuePushNth func(uintptr, uintptr, int)
438
439// Inserts a new element into @queue at the given position.
440func (x *Queue) PushNth(DataVar uintptr, NVar int) {
441
442	xQueuePushNth(x.GoPointer(), DataVar, NVar)
443
444}
445
446var xQueuePushNthLink func(uintptr, int, *List)
447
448// Inserts @link into @queue at the given position.
449func (x *Queue) PushNthLink(NVar int, LinkVar *List) {
450
451	xQueuePushNthLink(x.GoPointer(), NVar, LinkVar)
452
453}
454
455var xQueuePushTail func(uintptr, uintptr)
456
457// Adds a new element at the tail of the queue.
458func (x *Queue) PushTail(DataVar uintptr) {
459
460	xQueuePushTail(x.GoPointer(), DataVar)
461
462}
463
464var xQueuePushTailLink func(uintptr, *List)
465
466// Adds a new element at the tail of the queue.
467func (x *Queue) PushTailLink(LinkVar *List) {
468
469	xQueuePushTailLink(x.GoPointer(), LinkVar)
470
471}
472
473var xQueueRemove func(uintptr, uintptr) bool
474
475// Removes the first element in @queue that contains @data.
476func (x *Queue) Remove(DataVar uintptr) bool {
477
478	cret := xQueueRemove(x.GoPointer(), DataVar)
479	return cret
480}
481
482var xQueueRemoveAll func(uintptr, uintptr) uint
483
484// Remove all elements whose data equals @data from @queue.
485func (x *Queue) RemoveAll(DataVar uintptr) uint {
486
487	cret := xQueueRemoveAll(x.GoPointer(), DataVar)
488	return cret
489}
490
491var xQueueReverse func(uintptr)
492
493// Reverses the order of the items in @queue.
494func (x *Queue) Reverse() {
495
496	xQueueReverse(x.GoPointer())
497
498}
499
500var xQueueSort func(uintptr, uintptr, uintptr)
501
502// Sorts @queue using @compare_func.
503func (x *Queue) Sort(CompareFuncVar *CompareDataFunc, UserDataVar uintptr) {
504
505	var CompareFuncVarRef uintptr
506	if CompareFuncVar != nil {
507		CompareFuncVarPtr := uintptr(unsafe.Pointer(CompareFuncVar))
508		if cbRefPtr, ok := GetCallback(CompareFuncVarPtr); ok {
509			CompareFuncVarRef = cbRefPtr
510		} else {
511			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int {
512				cbFn := *CompareFuncVar
513				return cbFn(arg0, arg1, arg2)
514			}
515			CompareFuncVarRef = purego.NewCallback(fcb)
516			SaveCallbackWithClosure(CompareFuncVarPtr, CompareFuncVarRef, CompareFuncVar)
517		}
518	}
519
520	xQueueSort(x.GoPointer(), CompareFuncVarRef, UserDataVar)
521
522}
523
524var xQueueUnlink func(uintptr, *List)
525
526// Unlinks @link_ so that it will no longer be part of @queue.
527// The link is not freed.
528//
529// @link_ must be part of @queue.
530func (x *Queue) Unlink(LinkVar *List) {
531
532	xQueueUnlink(x.GoPointer(), LinkVar)
533
534}
535
536func init() {
537	core.SetPackageName("GLIB", "glib-2.0")
538	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
539	var libs []uintptr
540	for _, libPath := range core.GetPaths("GLIB") {
541		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
542		if err != nil {
543			panic(err)
544		}
545		libs = append(libs, lib)
546	}
547
548	core.PuregoSafeRegister(&xQueueClear, libs, "g_queue_clear")
549	core.PuregoSafeRegister(&xQueueClearFull, libs, "g_queue_clear_full")
550	core.PuregoSafeRegister(&xQueueCopy, libs, "g_queue_copy")
551	core.PuregoSafeRegister(&xQueueDeleteLink, libs, "g_queue_delete_link")
552	core.PuregoSafeRegister(&xQueueFind, libs, "g_queue_find")
553	core.PuregoSafeRegister(&xQueueFindCustom, libs, "g_queue_find_custom")
554	core.PuregoSafeRegister(&xQueueForeach, libs, "g_queue_foreach")
555	core.PuregoSafeRegister(&xQueueFree, libs, "g_queue_free")
556	core.PuregoSafeRegister(&xQueueFreeFull, libs, "g_queue_free_full")
557	core.PuregoSafeRegister(&xQueueGetLength, libs, "g_queue_get_length")
558	core.PuregoSafeRegister(&xQueueIndex, libs, "g_queue_index")
559	core.PuregoSafeRegister(&xQueueInit, libs, "g_queue_init")
560	core.PuregoSafeRegister(&xQueueInsertAfter, libs, "g_queue_insert_after")
561	core.PuregoSafeRegister(&xQueueInsertAfterLink, libs, "g_queue_insert_after_link")
562	core.PuregoSafeRegister(&xQueueInsertBefore, libs, "g_queue_insert_before")
563	core.PuregoSafeRegister(&xQueueInsertBeforeLink, libs, "g_queue_insert_before_link")
564	core.PuregoSafeRegister(&xQueueInsertSorted, libs, "g_queue_insert_sorted")
565	core.PuregoSafeRegister(&xQueueIsEmpty, libs, "g_queue_is_empty")
566	core.PuregoSafeRegister(&xQueueLinkIndex, libs, "g_queue_link_index")
567	core.PuregoSafeRegister(&xQueuePeekHead, libs, "g_queue_peek_head")
568	core.PuregoSafeRegister(&xQueuePeekHeadLink, libs, "g_queue_peek_head_link")
569	core.PuregoSafeRegister(&xQueuePeekNth, libs, "g_queue_peek_nth")
570	core.PuregoSafeRegister(&xQueuePeekNthLink, libs, "g_queue_peek_nth_link")
571	core.PuregoSafeRegister(&xQueuePeekTail, libs, "g_queue_peek_tail")
572	core.PuregoSafeRegister(&xQueuePeekTailLink, libs, "g_queue_peek_tail_link")
573	core.PuregoSafeRegister(&xQueuePopHead, libs, "g_queue_pop_head")
574	core.PuregoSafeRegister(&xQueuePopHeadLink, libs, "g_queue_pop_head_link")
575	core.PuregoSafeRegister(&xQueuePopNth, libs, "g_queue_pop_nth")
576	core.PuregoSafeRegister(&xQueuePopNthLink, libs, "g_queue_pop_nth_link")
577	core.PuregoSafeRegister(&xQueuePopTail, libs, "g_queue_pop_tail")
578	core.PuregoSafeRegister(&xQueuePopTailLink, libs, "g_queue_pop_tail_link")
579	core.PuregoSafeRegister(&xQueuePushHead, libs, "g_queue_push_head")
580	core.PuregoSafeRegister(&xQueuePushHeadLink, libs, "g_queue_push_head_link")
581	core.PuregoSafeRegister(&xQueuePushNth, libs, "g_queue_push_nth")
582	core.PuregoSafeRegister(&xQueuePushNthLink, libs, "g_queue_push_nth_link")
583	core.PuregoSafeRegister(&xQueuePushTail, libs, "g_queue_push_tail")
584	core.PuregoSafeRegister(&xQueuePushTailLink, libs, "g_queue_push_tail_link")
585	core.PuregoSafeRegister(&xQueueRemove, libs, "g_queue_remove")
586	core.PuregoSafeRegister(&xQueueRemoveAll, libs, "g_queue_remove_all")
587	core.PuregoSafeRegister(&xQueueReverse, libs, "g_queue_reverse")
588	core.PuregoSafeRegister(&xQueueSort, libs, "g_queue_sort")
589	core.PuregoSafeRegister(&xQueueUnlink, libs, "g_queue_unlink")
590
591}

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