2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qshareddata.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 QSharedData struct {
|
|
|
|
h *C.QSharedData
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSharedData) cPointer() *C.QSharedData {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QSharedData) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQSharedData(h *C.QSharedData) *QSharedData {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QSharedData{h: h}
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQSharedData(h unsafe.Pointer) *QSharedData {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQSharedData((*C.QSharedData)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQSharedData constructs a new QSharedData object.
|
|
|
|
func NewQSharedData() *QSharedData {
|
|
|
|
ret := C.QSharedData_new()
|
|
|
|
return newQSharedData(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQSharedData2 constructs a new QSharedData object.
|
|
|
|
func NewQSharedData2(param1 *QSharedData) *QSharedData {
|
|
|
|
ret := C.QSharedData_new2(param1.cPointer())
|
|
|
|
return newQSharedData(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 *QSharedData) Delete() {
|
|
|
|
C.QSharedData_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 *QSharedData) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QSharedData) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|