miqt/qt/gen_qshareddata.go

78 lines
1.5 KiB
Go
Raw Permalink Normal View History

package qt
/*
#include "gen_qshareddata.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QSharedData struct {
2024-11-19 06:29:06 +00:00
h *C.QSharedData
isSubclass bool
}
func (this *QSharedData) cPointer() *C.QSharedData {
if this == nil {
return nil
}
return this.h
}
func (this *QSharedData) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQSharedData constructs the type using only CGO pointers.
func newQSharedData(h *C.QSharedData) *QSharedData {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
return &QSharedData{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQSharedData constructs the type using only unsafe pointers.
func UnsafeNewQSharedData(h unsafe.Pointer) *QSharedData {
2024-12-07 04:15:57 +00:00
return newQSharedData((*C.QSharedData)(h))
}
// NewQSharedData constructs a new QSharedData object.
func NewQSharedData() *QSharedData {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSharedData(C.QSharedData_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
}
// NewQSharedData2 constructs a new QSharedData object.
func NewQSharedData2(param1 *QSharedData) *QSharedData {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSharedData(C.QSharedData_new2(param1.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
}
// Delete this object from C++ memory.
func (this *QSharedData) Delete() {
2024-11-19 06:29:06 +00:00
C.QSharedData_Delete(this.h, C.bool(this.isSubclass))
}
// 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 *QSharedData) GoGC() {
runtime.SetFinalizer(this, func(this *QSharedData) {
this.Delete()
runtime.KeepAlive(this.h)
})
}