miqt/qt6/gen_qhashfunctions.go

92 lines
1.8 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qhashfunctions.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QHashSeed struct {
2024-11-19 06:29:06 +00:00
h *C.QHashSeed
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QHashSeed) cPointer() *C.QHashSeed {
if this == nil {
return nil
}
return this.h
}
func (this *QHashSeed) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQHashSeed constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQHashSeed(h *C.QHashSeed) *QHashSeed {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QHashSeed{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQHashSeed constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQHashSeed(h unsafe.Pointer) *QHashSeed {
2024-12-07 04:15:57 +00:00
return newQHashSeed((*C.QHashSeed)(h))
2024-10-20 05:21:03 +00:00
}
// NewQHashSeed constructs a new QHashSeed object.
func NewQHashSeed() *QHashSeed {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQHashSeed(C.QHashSeed_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQHashSeed2 constructs a new QHashSeed object.
func NewQHashSeed2(d uint64) *QHashSeed {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQHashSeed(C.QHashSeed_new2((C.size_t)(d)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
func QHashSeed_GlobalSeed() *QHashSeed {
_goptr := newQHashSeed(C.QHashSeed_GlobalSeed())
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QHashSeed_SetDeterministicGlobalSeed() {
C.QHashSeed_SetDeterministicGlobalSeed()
}
func QHashSeed_ResetRandomGlobalSeed() {
C.QHashSeed_ResetRandomGlobalSeed()
}
// Delete this object from C++ memory.
func (this *QHashSeed) Delete() {
2024-11-19 06:29:06 +00:00
C.QHashSeed_Delete(this.h, C.bool(this.isSubclass))
2024-10-20 05:21:03 +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 *QHashSeed) GoGC() {
runtime.SetFinalizer(this, func(this *QHashSeed) {
this.Delete()
runtime.KeepAlive(this.h)
})
}