package gextras

import "github.com/diamondburned/gotk4/pkg/core/gextras"

Package gextras contains supplemental types to gotk3.

Index

Variables

var ZeroString unsafe.Pointer

ZeroString points to a null-terminated string of length 0.

Functions

func HashTableSize

func HashTableSize(ptr unsafe.Pointer) int

HashTableSize returns the size of the *GHashTable.

func ListSize

func ListSize(ptr unsafe.Pointer) int

ListSize returns the length of the list.

func MoveHashTable

func MoveHashTable(ptr unsafe.Pointer, rm bool, f func(k, v unsafe.Pointer))

MoveHashTable calls f on every value of the given *GHashTable and frees each element in the process if rm is true.

func MoveList

func MoveList(ptr unsafe.Pointer, rm bool, f func(v unsafe.Pointer))

MoveList calls f on every value of the given *GList. If rm is true, then the GList is freed.

func MoveSList

func MoveSList(ptr unsafe.Pointer, rm bool, f func(v unsafe.Pointer))

MoveSList is similar to MoveList, except it's used for singly-linked lists.

func NewStructNative

func NewStructNative(native unsafe.Pointer) unsafe.Pointer

NewStructNative creates a new Go struct from the given native pointer. The finalizer is NOT set.

func SListSize

func SListSize(ptr unsafe.Pointer) int

SListSize returns the length of the singly-linked list.

func SetStructNative

func SetStructNative(dst, native unsafe.Pointer)

SetStructNative sets the native value inside the Go struct value that the given dst pointer points to. It can be used like so:

var rec Record
SetStructNative(&rec, cvalue) // T(cvalue) = *namespace_record

func StructIntern

func StructIntern(ptr unsafe.Pointer) *struct{ C unsafe.Pointer }

StructIntern returns the given struct's internal struct pointer.

func StructNative

func StructNative(ptr unsafe.Pointer) unsafe.Pointer

StructNative returns the underlying C pointer of the given Go record struct pointer. It can be used like so:

rec := NewRecord(...) // T = *Record
c := (*namespace_record)(StructPtr(unsafe.Pointer(rec)))

Source Files

gextras.go

Version
v0.3.1 (latest)
Published
Jul 31, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
3 weeks ago

Tools for package owners.