miqt/qt6/gen_qthreadstorage.go

70 lines
1.5 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qthreadstorage.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QThreadStorageData struct {
2024-11-19 06:29:06 +00:00
h *C.QThreadStorageData
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QThreadStorageData) cPointer() *C.QThreadStorageData {
if this == nil {
return nil
}
return this.h
}
func (this *QThreadStorageData) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQThreadStorageData constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQThreadStorageData(h *C.QThreadStorageData) *QThreadStorageData {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QThreadStorageData{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQThreadStorageData constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQThreadStorageData(h unsafe.Pointer) *QThreadStorageData {
2024-12-07 04:15:57 +00:00
return newQThreadStorageData((*C.QThreadStorageData)(h))
2024-10-20 05:21:03 +00:00
}
// NewQThreadStorageData constructs a new QThreadStorageData object.
func NewQThreadStorageData(param1 *QThreadStorageData) *QThreadStorageData {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQThreadStorageData(C.QThreadStorageData_new(param1.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// Delete this object from C++ memory.
func (this *QThreadStorageData) Delete() {
2024-11-19 06:29:06 +00:00
C.QThreadStorageData_Delete(this.h, C.bool(this.isSubclass))
2024-10-20 05:21:03 +00:00
}
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
// from C++ memory once it is unreachable from Go memory.
func (this *QThreadStorageData) GoGC() {
runtime.SetFinalizer(this, func(this *QThreadStorageData) {
this.Delete()
runtime.KeepAlive(this.h)
})
}