miqt/qt/gen_qfloat16.go

98 lines
1.8 KiB
Go
Raw Normal View History

2024-08-29 07:01:51 +00:00
package qt
/*
#include "gen_qfloat16.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
2024-08-29 07:01:51 +00:00
"unsafe"
)
type qfloat16 struct {
2024-11-19 06:29:06 +00:00
h *C.qfloat16
isSubclass bool
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) cPointer() *C.qfloat16 {
if this == nil {
return nil
}
return this.h
}
func (this *qfloat16) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newqfloat16 constructs the type using only CGO pointers.
2024-08-29 07:01:51 +00:00
func newqfloat16(h *C.qfloat16) *qfloat16 {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-08-29 07:01:51 +00:00
return &qfloat16{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewqfloat16 constructs the type using only unsafe pointers.
func UnsafeNewqfloat16(h unsafe.Pointer) *qfloat16 {
2024-12-07 04:15:57 +00:00
return newqfloat16((*C.qfloat16)(h))
2024-08-29 07:01:51 +00:00
}
// Newqfloat16 constructs a new qfloat16 object.
func Newqfloat16() *qfloat16 {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newqfloat16(C.qfloat16_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-08-29 07:01:51 +00:00
}
// Newqfloat162 constructs a new qfloat16 object.
func Newqfloat162(f float32) *qfloat16 {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newqfloat16(C.qfloat16_new2((C.float)(f)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) IsInf() bool {
return (bool)(C.qfloat16_IsInf(this.h))
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) IsNaN() bool {
return (bool)(C.qfloat16_IsNaN(this.h))
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) IsFinite() bool {
return (bool)(C.qfloat16_IsFinite(this.h))
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) FpClassify() int {
return (int)(C.qfloat16_FpClassify(this.h))
2024-08-29 07:01:51 +00:00
}
func (this *qfloat16) IsNormal() bool {
return (bool)(C.qfloat16_IsNormal(this.h))
2024-08-29 07:01:51 +00:00
}
// Delete this object from C++ memory.
2024-08-29 07:01:51 +00:00
func (this *qfloat16) Delete() {
2024-11-19 06:29:06 +00:00
C.qfloat16_Delete(this.h, C.bool(this.isSubclass))
2024-08-29 07:01:51 +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 *qfloat16) GoGC() {
runtime.SetFinalizer(this, func(this *qfloat16) {
this.Delete()
runtime.KeepAlive(this.h)
})
}