miqt/qt6/gen_qsemaphore.go

213 lines
5.1 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qsemaphore.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QSemaphore struct {
2024-11-19 06:29:06 +00:00
h *C.QSemaphore
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QSemaphore) cPointer() *C.QSemaphore {
if this == nil {
return nil
}
return this.h
}
func (this *QSemaphore) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQSemaphore constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQSemaphore(h *C.QSemaphore) *QSemaphore {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QSemaphore{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQSemaphore constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQSemaphore(h unsafe.Pointer) *QSemaphore {
2024-12-07 04:15:57 +00:00
return newQSemaphore((*C.QSemaphore)(h))
2024-10-20 05:21:03 +00:00
}
// NewQSemaphore constructs a new QSemaphore object.
func NewQSemaphore() *QSemaphore {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphore(C.QSemaphore_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQSemaphore2 constructs a new QSemaphore object.
func NewQSemaphore2(n int) *QSemaphore {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphore(C.QSemaphore_new2((C.int)(n)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
func (this *QSemaphore) Acquire() {
C.QSemaphore_Acquire(this.h)
}
func (this *QSemaphore) TryAcquire() bool {
return (bool)(C.QSemaphore_TryAcquire(this.h))
}
func (this *QSemaphore) TryAcquire2(n int, timeout int) bool {
return (bool)(C.QSemaphore_TryAcquire2(this.h, (C.int)(n), (C.int)(timeout)))
}
func (this *QSemaphore) Release() {
C.QSemaphore_Release(this.h)
}
func (this *QSemaphore) Available() int {
return (int)(C.QSemaphore_Available(this.h))
}
func (this *QSemaphore) TryAcquire3() bool {
return (bool)(C.QSemaphore_TryAcquire3(this.h))
}
func (this *QSemaphore) Acquire1(n int) {
C.QSemaphore_Acquire1(this.h, (C.int)(n))
}
func (this *QSemaphore) TryAcquire1(n int) bool {
return (bool)(C.QSemaphore_TryAcquire1(this.h, (C.int)(n)))
}
func (this *QSemaphore) Release1(n int) {
C.QSemaphore_Release1(this.h, (C.int)(n))
}
// Delete this object from C++ memory.
func (this *QSemaphore) Delete() {
2024-11-19 06:29:06 +00:00
C.QSemaphore_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 *QSemaphore) GoGC() {
runtime.SetFinalizer(this, func(this *QSemaphore) {
this.Delete()
runtime.KeepAlive(this.h)
})
}
type QSemaphoreReleaser struct {
2024-11-19 06:29:06 +00:00
h *C.QSemaphoreReleaser
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QSemaphoreReleaser) cPointer() *C.QSemaphoreReleaser {
if this == nil {
return nil
}
return this.h
}
func (this *QSemaphoreReleaser) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQSemaphoreReleaser constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQSemaphoreReleaser(h *C.QSemaphoreReleaser) *QSemaphoreReleaser {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QSemaphoreReleaser{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQSemaphoreReleaser constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQSemaphoreReleaser(h unsafe.Pointer) *QSemaphoreReleaser {
2024-12-07 04:15:57 +00:00
return newQSemaphoreReleaser((*C.QSemaphoreReleaser)(h))
2024-10-20 05:21:03 +00:00
}
// NewQSemaphoreReleaser constructs a new QSemaphoreReleaser object.
func NewQSemaphoreReleaser() *QSemaphoreReleaser {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphoreReleaser(C.QSemaphoreReleaser_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQSemaphoreReleaser2 constructs a new QSemaphoreReleaser object.
func NewQSemaphoreReleaser2(sem *QSemaphore) *QSemaphoreReleaser {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphoreReleaser(C.QSemaphoreReleaser_new2(sem.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQSemaphoreReleaser3 constructs a new QSemaphoreReleaser object.
func NewQSemaphoreReleaser3(sem *QSemaphore) *QSemaphoreReleaser {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphoreReleaser(C.QSemaphoreReleaser_new3(sem.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQSemaphoreReleaser4 constructs a new QSemaphoreReleaser object.
func NewQSemaphoreReleaser4(sem *QSemaphore, n int) *QSemaphoreReleaser {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphoreReleaser(C.QSemaphoreReleaser_new4(sem.cPointer(), (C.int)(n)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQSemaphoreReleaser5 constructs a new QSemaphoreReleaser object.
func NewQSemaphoreReleaser5(sem *QSemaphore, n int) *QSemaphoreReleaser {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQSemaphoreReleaser(C.QSemaphoreReleaser_new5(sem.cPointer(), (C.int)(n)))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
func (this *QSemaphoreReleaser) Swap(other *QSemaphoreReleaser) {
C.QSemaphoreReleaser_Swap(this.h, other.cPointer())
}
func (this *QSemaphoreReleaser) Semaphore() *QSemaphore {
return newQSemaphore(C.QSemaphoreReleaser_Semaphore(this.h))
2024-10-20 05:21:03 +00:00
}
func (this *QSemaphoreReleaser) Cancel() *QSemaphore {
return newQSemaphore(C.QSemaphoreReleaser_Cancel(this.h))
2024-10-20 05:21:03 +00:00
}
// Delete this object from C++ memory.
func (this *QSemaphoreReleaser) Delete() {
2024-11-19 06:29:06 +00:00
C.QSemaphoreReleaser_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 *QSemaphoreReleaser) GoGC() {
runtime.SetFinalizer(this, func(this *QSemaphoreReleaser) {
this.Delete()
runtime.KeepAlive(this.h)
})
}