// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT package glib import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" ) // Contains the public fields of a // [Queue](data-structures.html#double-ended-queues). type Queue struct { _ structs.HostLayout Head *List Tail *List Length uint } func (x *Queue) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xQueueClear func(uintptr) // Removes all the elements in @queue. If queue elements contain // dynamically-allocated memory, they should be freed first. func (x *Queue) Clear() { xQueueClear(x.GoPointer()) } var xQueueClearFull func(uintptr, uintptr) // Convenience method, which frees all the memory used by a #GQueue, // and calls the provided @free_func on each item in the #GQueue. func (x *Queue) ClearFull(FreeFuncVar *DestroyNotify) { var FreeFuncVarRef uintptr if FreeFuncVar != nil { FreeFuncVarPtr := uintptr(unsafe.Pointer(FreeFuncVar)) if cbRefPtr, ok := GetCallback(FreeFuncVarPtr); ok { FreeFuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *FreeFuncVar cbFn(arg0) } FreeFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FreeFuncVarPtr, FreeFuncVarRef, FreeFuncVar) } } xQueueClearFull(x.GoPointer(), FreeFuncVarRef) } var xQueueCopy func(uintptr) *Queue // Copies a @queue. Note that is a shallow copy. If the elements in the // queue consist of pointers to data, the pointers are copied, but the // actual data is not. func (x *Queue) Copy() *Queue { cret := xQueueCopy(x.GoPointer()) return cret } var xQueueDeleteLink func(uintptr, *List) // Removes @link_ from @queue and frees it. // // @link_ must be part of @queue. func (x *Queue) DeleteLink(LinkVar *List) { xQueueDeleteLink(x.GoPointer(), LinkVar) } var xQueueFind func(uintptr, uintptr) *List // Finds the first link in @queue which contains @data. func (x *Queue) Find(DataVar uintptr) *List { cret := xQueueFind(x.GoPointer(), DataVar) return cret } var xQueueFindCustom func(uintptr, uintptr, uintptr) *List // Finds an element in a #GQueue, using a supplied function to find the // desired element. It iterates over the queue, calling the given function // which should return 0 when the desired element is found. The function // takes two gconstpointer arguments, the #GQueue element's data as the // first argument and the given user data as the second argument. func (x *Queue) FindCustom(DataVar uintptr, FuncVar *CompareFunc) *List { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr) int { cbFn := *FuncVar return cbFn(arg0, arg1) } FuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } cret := xQueueFindCustom(x.GoPointer(), DataVar, FuncVarRef) return cret } var xQueueForeach func(uintptr, uintptr, uintptr) // Calls @func for each element in the queue passing @user_data to the // function. // // It is safe for @func to remove the element from @queue, but it must // not modify any part of the queue after that element. func (x *Queue) Foreach(FuncVar *Func, UserDataVar uintptr) { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr) { cbFn := *FuncVar cbFn(arg0, arg1) } FuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } xQueueForeach(x.GoPointer(), FuncVarRef, UserDataVar) } var xQueueFree func(uintptr) // Frees the memory allocated for the #GQueue. Only call this function // if @queue was created with g_queue_new(). If queue elements contain // dynamically-allocated memory, they should be freed first. // // If queue elements contain dynamically-allocated memory, you should // either use g_queue_free_full() or free them manually first. func (x *Queue) Free() { xQueueFree(x.GoPointer()) } var xQueueFreeFull func(uintptr, uintptr) // Convenience method, which frees all the memory used by a #GQueue, // and calls the specified destroy function on every element's data. // // @free_func should not modify the queue (eg, by removing the freed // element from it). func (x *Queue) FreeFull(FreeFuncVar *DestroyNotify) { var FreeFuncVarRef uintptr if FreeFuncVar != nil { FreeFuncVarPtr := uintptr(unsafe.Pointer(FreeFuncVar)) if cbRefPtr, ok := GetCallback(FreeFuncVarPtr); ok { FreeFuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *FreeFuncVar cbFn(arg0) } FreeFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FreeFuncVarPtr, FreeFuncVarRef, FreeFuncVar) } } xQueueFreeFull(x.GoPointer(), FreeFuncVarRef) } var xQueueGetLength func(uintptr) uint // Returns the number of items in @queue. func (x *Queue) GetLength() uint { cret := xQueueGetLength(x.GoPointer()) return cret } var xQueueIndex func(uintptr, uintptr) int // Returns the position of the first element in @queue which contains @data. func (x *Queue) Index(DataVar uintptr) int { cret := xQueueIndex(x.GoPointer(), DataVar) return cret } var xQueueInit func(uintptr) // A statically-allocated #GQueue must be initialized with this function // before it can be used. Alternatively you can initialize it with // %G_QUEUE_INIT. It is not necessary to initialize queues created with // g_queue_new(). func (x *Queue) Init() { xQueueInit(x.GoPointer()) } var xQueueInsertAfter func(uintptr, *List, uintptr) // Inserts @data into @queue after @sibling. // // @sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the // data at the head of the queue. func (x *Queue) InsertAfter(SiblingVar *List, DataVar uintptr) { xQueueInsertAfter(x.GoPointer(), SiblingVar, DataVar) } var xQueueInsertAfterLink func(uintptr, *List, *List) // Inserts @link_ into @queue after @sibling. // // @sibling must be part of @queue. func (x *Queue) InsertAfterLink(SiblingVar *List, LinkVar *List) { xQueueInsertAfterLink(x.GoPointer(), SiblingVar, LinkVar) } var xQueueInsertBefore func(uintptr, *List, uintptr) // Inserts @data into @queue before @sibling. // // @sibling must be part of @queue. Since GLib 2.44 a %NULL sibling pushes the // data at the tail of the queue. func (x *Queue) InsertBefore(SiblingVar *List, DataVar uintptr) { xQueueInsertBefore(x.GoPointer(), SiblingVar, DataVar) } var xQueueInsertBeforeLink func(uintptr, *List, *List) // Inserts @link_ into @queue before @sibling. // // @sibling must be part of @queue. func (x *Queue) InsertBeforeLink(SiblingVar *List, LinkVar *List) { xQueueInsertBeforeLink(x.GoPointer(), SiblingVar, LinkVar) } var xQueueInsertSorted func(uintptr, uintptr, uintptr, uintptr) // Inserts @data into @queue using @func to determine the new position. func (x *Queue) InsertSorted(DataVar uintptr, FuncVar *CompareDataFunc, UserDataVar uintptr) { var FuncVarRef uintptr if FuncVar != nil { FuncVarPtr := uintptr(unsafe.Pointer(FuncVar)) if cbRefPtr, ok := GetCallback(FuncVarPtr); ok { FuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int { cbFn := *FuncVar return cbFn(arg0, arg1, arg2) } FuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar) } } xQueueInsertSorted(x.GoPointer(), DataVar, FuncVarRef, UserDataVar) } var xQueueIsEmpty func(uintptr) bool // Returns %TRUE if the queue is empty. func (x *Queue) IsEmpty() bool { cret := xQueueIsEmpty(x.GoPointer()) return cret } var xQueueLinkIndex func(uintptr, *List) int // Returns the position of @link_ in @queue. func (x *Queue) LinkIndex(LinkVar *List) int { cret := xQueueLinkIndex(x.GoPointer(), LinkVar) return cret } var xQueuePeekHead func(uintptr) uintptr // Returns the first element of the queue. func (x *Queue) PeekHead() uintptr { cret := xQueuePeekHead(x.GoPointer()) return cret } var xQueuePeekHeadLink func(uintptr) *List // Returns the first link in @queue. func (x *Queue) PeekHeadLink() *List { cret := xQueuePeekHeadLink(x.GoPointer()) return cret } var xQueuePeekNth func(uintptr, uint) uintptr // Returns the @n'th element of @queue. func (x *Queue) PeekNth(NVar uint) uintptr { cret := xQueuePeekNth(x.GoPointer(), NVar) return cret } var xQueuePeekNthLink func(uintptr, uint) *List // Returns the link at the given position func (x *Queue) PeekNthLink(NVar uint) *List { cret := xQueuePeekNthLink(x.GoPointer(), NVar) return cret } var xQueuePeekTail func(uintptr) uintptr // Returns the last element of the queue. func (x *Queue) PeekTail() uintptr { cret := xQueuePeekTail(x.GoPointer()) return cret } var xQueuePeekTailLink func(uintptr) *List // Returns the last link in @queue. func (x *Queue) PeekTailLink() *List { cret := xQueuePeekTailLink(x.GoPointer()) return cret } var xQueuePopHead func(uintptr) uintptr // Removes the first element of the queue and returns its data. func (x *Queue) PopHead() uintptr { cret := xQueuePopHead(x.GoPointer()) return cret } var xQueuePopHeadLink func(uintptr) *List // Removes and returns the first element of the queue. func (x *Queue) PopHeadLink() *List { cret := xQueuePopHeadLink(x.GoPointer()) return cret } var xQueuePopNth func(uintptr, uint) uintptr // Removes the @n'th element of @queue and returns its data. func (x *Queue) PopNth(NVar uint) uintptr { cret := xQueuePopNth(x.GoPointer(), NVar) return cret } var xQueuePopNthLink func(uintptr, uint) *List // Removes and returns the link at the given position. func (x *Queue) PopNthLink(NVar uint) *List { cret := xQueuePopNthLink(x.GoPointer(), NVar) return cret } var xQueuePopTail func(uintptr) uintptr // Removes the last element of the queue and returns its data. func (x *Queue) PopTail() uintptr { cret := xQueuePopTail(x.GoPointer()) return cret } var xQueuePopTailLink func(uintptr) *List // Removes and returns the last element of the queue. func (x *Queue) PopTailLink() *List { cret := xQueuePopTailLink(x.GoPointer()) return cret } var xQueuePushHead func(uintptr, uintptr) // Adds a new element at the head of the queue. func (x *Queue) PushHead(DataVar uintptr) { xQueuePushHead(x.GoPointer(), DataVar) } var xQueuePushHeadLink func(uintptr, *List) // Adds a new element at the head of the queue. func (x *Queue) PushHeadLink(LinkVar *List) { xQueuePushHeadLink(x.GoPointer(), LinkVar) } var xQueuePushNth func(uintptr, uintptr, int) // Inserts a new element into @queue at the given position. func (x *Queue) PushNth(DataVar uintptr, NVar int) { xQueuePushNth(x.GoPointer(), DataVar, NVar) } var xQueuePushNthLink func(uintptr, int, *List) // Inserts @link into @queue at the given position. func (x *Queue) PushNthLink(NVar int, LinkVar *List) { xQueuePushNthLink(x.GoPointer(), NVar, LinkVar) } var xQueuePushTail func(uintptr, uintptr) // Adds a new element at the tail of the queue. func (x *Queue) PushTail(DataVar uintptr) { xQueuePushTail(x.GoPointer(), DataVar) } var xQueuePushTailLink func(uintptr, *List) // Adds a new element at the tail of the queue. func (x *Queue) PushTailLink(LinkVar *List) { xQueuePushTailLink(x.GoPointer(), LinkVar) } var xQueueRemove func(uintptr, uintptr) bool // Removes the first element in @queue that contains @data. func (x *Queue) Remove(DataVar uintptr) bool { cret := xQueueRemove(x.GoPointer(), DataVar) return cret } var xQueueRemoveAll func(uintptr, uintptr) uint // Remove all elements whose data equals @data from @queue. func (x *Queue) RemoveAll(DataVar uintptr) uint { cret := xQueueRemoveAll(x.GoPointer(), DataVar) return cret } var xQueueReverse func(uintptr) // Reverses the order of the items in @queue. func (x *Queue) Reverse() { xQueueReverse(x.GoPointer()) } var xQueueSort func(uintptr, uintptr, uintptr) // Sorts @queue using @compare_func. func (x *Queue) Sort(CompareFuncVar *CompareDataFunc, UserDataVar uintptr) { var CompareFuncVarRef uintptr if CompareFuncVar != nil { CompareFuncVarPtr := uintptr(unsafe.Pointer(CompareFuncVar)) if cbRefPtr, ok := GetCallback(CompareFuncVarPtr); ok { CompareFuncVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) int { cbFn := *CompareFuncVar return cbFn(arg0, arg1, arg2) } CompareFuncVarRef = purego.NewCallback(fcb) SaveCallbackWithClosure(CompareFuncVarPtr, CompareFuncVarRef, CompareFuncVar) } } xQueueSort(x.GoPointer(), CompareFuncVarRef, UserDataVar) } var xQueueUnlink func(uintptr, *List) // Unlinks @link_ so that it will no longer be part of @queue. // The link is not freed. // // @link_ must be part of @queue. func (x *Queue) Unlink(LinkVar *List) { xQueueUnlink(x.GoPointer(), LinkVar) } func init() { core.SetPackageName("GLIB", "glib-2.0") core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GLIB") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xQueueClear, libs, "g_queue_clear") core.PuregoSafeRegister(&xQueueClearFull, libs, "g_queue_clear_full") core.PuregoSafeRegister(&xQueueCopy, libs, "g_queue_copy") core.PuregoSafeRegister(&xQueueDeleteLink, libs, "g_queue_delete_link") core.PuregoSafeRegister(&xQueueFind, libs, "g_queue_find") core.PuregoSafeRegister(&xQueueFindCustom, libs, "g_queue_find_custom") core.PuregoSafeRegister(&xQueueForeach, libs, "g_queue_foreach") core.PuregoSafeRegister(&xQueueFree, libs, "g_queue_free") core.PuregoSafeRegister(&xQueueFreeFull, libs, "g_queue_free_full") core.PuregoSafeRegister(&xQueueGetLength, libs, "g_queue_get_length") core.PuregoSafeRegister(&xQueueIndex, libs, "g_queue_index") core.PuregoSafeRegister(&xQueueInit, libs, "g_queue_init") core.PuregoSafeRegister(&xQueueInsertAfter, libs, "g_queue_insert_after") core.PuregoSafeRegister(&xQueueInsertAfterLink, libs, "g_queue_insert_after_link") core.PuregoSafeRegister(&xQueueInsertBefore, libs, "g_queue_insert_before") core.PuregoSafeRegister(&xQueueInsertBeforeLink, libs, "g_queue_insert_before_link") core.PuregoSafeRegister(&xQueueInsertSorted, libs, "g_queue_insert_sorted") core.PuregoSafeRegister(&xQueueIsEmpty, libs, "g_queue_is_empty") core.PuregoSafeRegister(&xQueueLinkIndex, libs, "g_queue_link_index") core.PuregoSafeRegister(&xQueuePeekHead, libs, "g_queue_peek_head") core.PuregoSafeRegister(&xQueuePeekHeadLink, libs, "g_queue_peek_head_link") core.PuregoSafeRegister(&xQueuePeekNth, libs, "g_queue_peek_nth") core.PuregoSafeRegister(&xQueuePeekNthLink, libs, "g_queue_peek_nth_link") core.PuregoSafeRegister(&xQueuePeekTail, libs, "g_queue_peek_tail") core.PuregoSafeRegister(&xQueuePeekTailLink, libs, "g_queue_peek_tail_link") core.PuregoSafeRegister(&xQueuePopHead, libs, "g_queue_pop_head") core.PuregoSafeRegister(&xQueuePopHeadLink, libs, "g_queue_pop_head_link") core.PuregoSafeRegister(&xQueuePopNth, libs, "g_queue_pop_nth") core.PuregoSafeRegister(&xQueuePopNthLink, libs, "g_queue_pop_nth_link") core.PuregoSafeRegister(&xQueuePopTail, libs, "g_queue_pop_tail") core.PuregoSafeRegister(&xQueuePopTailLink, libs, "g_queue_pop_tail_link") core.PuregoSafeRegister(&xQueuePushHead, libs, "g_queue_push_head") core.PuregoSafeRegister(&xQueuePushHeadLink, libs, "g_queue_push_head_link") core.PuregoSafeRegister(&xQueuePushNth, libs, "g_queue_push_nth") core.PuregoSafeRegister(&xQueuePushNthLink, libs, "g_queue_push_nth_link") core.PuregoSafeRegister(&xQueuePushTail, libs, "g_queue_push_tail") core.PuregoSafeRegister(&xQueuePushTailLink, libs, "g_queue_push_tail_link") core.PuregoSafeRegister(&xQueueRemove, libs, "g_queue_remove") core.PuregoSafeRegister(&xQueueRemoveAll, libs, "g_queue_remove_all") core.PuregoSafeRegister(&xQueueReverse, libs, "g_queue_reverse") core.PuregoSafeRegister(&xQueueSort, libs, "g_queue_sort") core.PuregoSafeRegister(&xQueueUnlink, libs, "g_queue_unlink") }