miqt/qt6/gen_qcontiguouscache.go

70 lines
1.6 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qcontiguouscache.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QContiguousCacheData struct {
2024-11-19 06:29:06 +00:00
h *C.QContiguousCacheData
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QContiguousCacheData) cPointer() *C.QContiguousCacheData {
if this == nil {
return nil
}
return this.h
}
func (this *QContiguousCacheData) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQContiguousCacheData constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQContiguousCacheData(h *C.QContiguousCacheData) *QContiguousCacheData {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QContiguousCacheData{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQContiguousCacheData constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQContiguousCacheData(h unsafe.Pointer) *QContiguousCacheData {
2024-12-07 04:15:57 +00:00
return newQContiguousCacheData((*C.QContiguousCacheData)(h))
2024-10-20 05:21:03 +00:00
}
func QContiguousCacheData_AllocateData(size int64, alignment int64) *QContiguousCacheData {
return newQContiguousCacheData(C.QContiguousCacheData_AllocateData((C.ptrdiff_t)(size), (C.ptrdiff_t)(alignment)))
2024-10-20 05:21:03 +00:00
}
func QContiguousCacheData_FreeData(data *QContiguousCacheData) {
C.QContiguousCacheData_FreeData(data.cPointer())
}
// Delete this object from C++ memory.
func (this *QContiguousCacheData) Delete() {
2024-11-19 06:29:06 +00:00
C.QContiguousCacheData_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 *QContiguousCacheData) GoGC() {
runtime.SetFinalizer(this, func(this *QContiguousCacheData) {
this.Delete()
runtime.KeepAlive(this.h)
})
}