miqt/qt/gen_qplugin.go

71 lines
1.4 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qplugin.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QStaticPlugin struct {
2024-11-19 06:29:06 +00:00
h *C.QStaticPlugin
isSubclass bool
}
func (this *QStaticPlugin) cPointer() *C.QStaticPlugin {
if this == nil {
return nil
}
return this.h
}
func (this *QStaticPlugin) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQStaticPlugin constructs the type using only CGO pointers.
func newQStaticPlugin(h *C.QStaticPlugin) *QStaticPlugin {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QStaticPlugin{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQStaticPlugin constructs the type using only unsafe pointers.
func UnsafeNewQStaticPlugin(h unsafe.Pointer) *QStaticPlugin {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QStaticPlugin{h: (*C.QStaticPlugin)(h)}
}
func (this *QStaticPlugin) MetaData() *QJsonObject {
_goptr := newQJsonObject(C.QStaticPlugin_MetaData(this.h))
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
// Delete this object from C++ memory.
func (this *QStaticPlugin) Delete() {
2024-11-19 06:29:06 +00:00
C.QStaticPlugin_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 *QStaticPlugin) GoGC() {
runtime.SetFinalizer(this, func(this *QStaticPlugin) {
this.Delete()
runtime.KeepAlive(this.h)
})
}