2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qthreadstorage.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QThreadStorageData struct {
|
|
|
|
h *C.QThreadStorageData
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QThreadStorageData) cPointer() *C.QThreadStorageData {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQThreadStorageData(h *C.QThreadStorageData) *QThreadStorageData {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QThreadStorageData{h: h}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQThreadStorageData_U(h unsafe.Pointer) *QThreadStorageData {
|
|
|
|
return newQThreadStorageData((*C.QThreadStorageData)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQThreadStorageData constructs a new QThreadStorageData object.
|
|
|
|
func NewQThreadStorageData(param1 *QThreadStorageData) *QThreadStorageData {
|
|
|
|
ret := C.QThreadStorageData_new(param1.cPointer())
|
|
|
|
return newQThreadStorageData(ret)
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QThreadStorageData) Delete() {
|
|
|
|
C.QThreadStorageData_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +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)
|
|
|
|
})
|
|
|
|
}
|