mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
51 lines
909 B
Go
51 lines
909 B
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qstringliteral.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QStringDataPtr struct {
|
|
h *C.QStringDataPtr
|
|
}
|
|
|
|
func (this *QStringDataPtr) cPointer() *C.QStringDataPtr {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQStringDataPtr(h *C.QStringDataPtr) *QStringDataPtr {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QStringDataPtr{h: h}
|
|
}
|
|
|
|
func newQStringDataPtr_U(h unsafe.Pointer) *QStringDataPtr {
|
|
return newQStringDataPtr((*C.QStringDataPtr)(h))
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QStringDataPtr) Delete() {
|
|
C.QStringDataPtr_Delete(this.h)
|
|
}
|
|
|
|
// 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)
|
|
})
|
|
}
|