miqt/qt/gen_qstringliteral.go

65 lines
1.2 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qstringliteral.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QStringDataPtr struct {
2024-11-19 06:29:06 +00:00
h *C.QStringDataPtr
isSubclass bool
}
func (this *QStringDataPtr) cPointer() *C.QStringDataPtr {
if this == nil {
return nil
}
return this.h
}
func (this *QStringDataPtr) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQStringDataPtr constructs the type using only CGO pointers.
func newQStringDataPtr(h *C.QStringDataPtr) *QStringDataPtr {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QStringDataPtr{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQStringDataPtr constructs the type using only unsafe pointers.
func UnsafeNewQStringDataPtr(h unsafe.Pointer) *QStringDataPtr {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QStringDataPtr{h: (*C.QStringDataPtr)(h)}
}
// Delete this object from C++ memory.
func (this *QStringDataPtr) Delete() {
2024-11-19 06:29:06 +00:00
C.QStringDataPtr_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 *QStringDataPtr) GoGC() {
runtime.SetFinalizer(this, func(this *QStringDataPtr) {
this.Delete()
runtime.KeepAlive(this.h)
})
}