miqt/qt6/gen_qscopedpointer.go

70 lines
1.6 KiB
Go
Raw Permalink Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qscopedpointer.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QScopedPointerPodDeleter struct {
2024-11-19 06:29:06 +00:00
h *C.QScopedPointerPodDeleter
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QScopedPointerPodDeleter) cPointer() *C.QScopedPointerPodDeleter {
if this == nil {
return nil
}
return this.h
}
func (this *QScopedPointerPodDeleter) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQScopedPointerPodDeleter constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQScopedPointerPodDeleter(h *C.QScopedPointerPodDeleter) *QScopedPointerPodDeleter {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QScopedPointerPodDeleter{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQScopedPointerPodDeleter constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQScopedPointerPodDeleter(h unsafe.Pointer) *QScopedPointerPodDeleter {
2024-12-07 04:15:57 +00:00
return newQScopedPointerPodDeleter((*C.QScopedPointerPodDeleter)(h))
2024-10-20 05:21:03 +00:00
}
func QScopedPointerPodDeleter_Cleanup(pointer unsafe.Pointer) {
C.QScopedPointerPodDeleter_Cleanup(pointer)
}
func (this *QScopedPointerPodDeleter) OperatorCall(pointer unsafe.Pointer) {
C.QScopedPointerPodDeleter_OperatorCall(this.h, pointer)
}
// Delete this object from C++ memory.
func (this *QScopedPointerPodDeleter) Delete() {
2024-11-19 06:29:06 +00:00
C.QScopedPointerPodDeleter_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 *QScopedPointerPodDeleter) GoGC() {
runtime.SetFinalizer(this, func(this *QScopedPointerPodDeleter) {
this.Delete()
runtime.KeepAlive(this.h)
})
}