2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qbitarray.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QBitArray struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QBitArray
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) cPointer() *C.QBitArray {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QBitArray) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQBitArray constructs the type using only CGO pointers.
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQBitArray(h *C.QBitArray) *QBitArray {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QBitArray{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQBitArray constructs the type using only unsafe pointers.
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQBitArray(h unsafe.Pointer) *QBitArray {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQBitArray((*C.QBitArray)(h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBitArray constructs a new QBitArray object.
|
|
|
|
func NewQBitArray() *QBitArray {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBitArray(C.QBitArray_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBitArray2 constructs a new QBitArray object.
|
|
|
|
func NewQBitArray2(size int) *QBitArray {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBitArray(C.QBitArray_new2((C.int)(size)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBitArray3 constructs a new QBitArray object.
|
|
|
|
func NewQBitArray3(other *QBitArray) *QBitArray {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBitArray(C.QBitArray_new3(other.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBitArray4 constructs a new QBitArray object.
|
|
|
|
func NewQBitArray4(size int, val bool) *QBitArray {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBitArray(C.QBitArray_new4((C.int)(size), (C.bool)(val)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorAssign(other *QBitArray) {
|
|
|
|
C.QBitArray_OperatorAssign(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Swap(other *QBitArray) {
|
|
|
|
C.QBitArray_Swap(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Size() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QBitArray_Size(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Count() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QBitArray_Count(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) CountWithOn(on bool) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QBitArray_CountWithOn(this.h, (C.bool)(on)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) IsEmpty() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_IsEmpty(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) IsNull() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_IsNull(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Resize(size int) {
|
|
|
|
C.QBitArray_Resize(this.h, (C.int)(size))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Detach() {
|
|
|
|
C.QBitArray_Detach(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) IsDetached() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_IsDetached(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Clear() {
|
|
|
|
C.QBitArray_Clear(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) TestBit(i int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_TestBit(this.h, (C.int)(i)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) SetBit(i int) {
|
|
|
|
C.QBitArray_SetBit(this.h, (C.int)(i))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) SetBit2(i int, val bool) {
|
|
|
|
C.QBitArray_SetBit2(this.h, (C.int)(i), (C.bool)(val))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) ClearBit(i int) {
|
|
|
|
C.QBitArray_ClearBit(this.h, (C.int)(i))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) ToggleBit(i int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_ToggleBit(this.h, (C.int)(i)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) At(i int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_At(this.h, (C.int)(i)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorSubscript(i int) *QBitRef {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQBitRef(C.QBitArray_OperatorSubscript(this.h, (C.int)(i)))
|
2024-09-14 22:29:05 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorSubscriptWithInt(i int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_OperatorSubscriptWithInt(this.h, (C.int)(i)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorSubscriptWithUint(i uint) *QBitRef {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQBitRef(C.QBitArray_OperatorSubscriptWithUint(this.h, (C.uint)(i)))
|
2024-09-14 22:29:05 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorSubscript2(i uint) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_OperatorSubscript2(this.h, (C.uint)(i)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorBitwiseAndAssign(param1 *QBitArray) {
|
|
|
|
C.QBitArray_OperatorBitwiseAndAssign(this.h, param1.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorBitwiseOrAssign(param1 *QBitArray) {
|
|
|
|
C.QBitArray_OperatorBitwiseOrAssign(this.h, param1.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorBitwiseNotAssign(param1 *QBitArray) {
|
|
|
|
C.QBitArray_OperatorBitwiseNotAssign(this.h, param1.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorEqual(other *QBitArray) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_OperatorEqual(this.h, other.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) OperatorNotEqual(other *QBitArray) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_OperatorNotEqual(this.h, other.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Fill(val bool) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_Fill(this.h, (C.bool)(val)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Fill2(val bool, first int, last int) {
|
|
|
|
C.QBitArray_Fill2(this.h, (C.bool)(val), (C.int)(first), (C.int)(last))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Truncate(pos int) {
|
|
|
|
C.QBitArray_Truncate(this.h, (C.int)(pos))
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QBitArray) Bits() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QBitArray_Bits(this.h)
|
2024-10-18 23:53:33 +00:00
|
|
|
return C.GoString(_ret)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-11 05:43:04 +00:00
|
|
|
func QBitArray_FromBits(data string, lenVal int64) *QBitArray {
|
2024-08-25 04:08:24 +00:00
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQBitArray(C.QBitArray_FromBits(data_Cstring, (C.ptrdiff_t)(lenVal)))
|
2024-09-14 22:29:05 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitArray) Fill22(val bool, size int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitArray_Fill22(this.h, (C.bool)(val), (C.int)(size)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QBitArray) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QBitArray_Delete(this.h, C.bool(this.isSubclass))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +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 *QBitArray) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QBitArray) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QBitRef struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QBitRef
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitRef) cPointer() *C.QBitRef {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QBitRef) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQBitRef constructs the type using only CGO pointers.
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQBitRef(h *C.QBitRef) *QBitRef {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QBitRef{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQBitRef constructs the type using only unsafe pointers.
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQBitRef(h unsafe.Pointer) *QBitRef {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQBitRef((*C.QBitRef)(h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBitRef constructs a new QBitRef object.
|
|
|
|
func NewQBitRef(param1 *QBitRef) *QBitRef {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBitRef(C.QBitRef_new(param1.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitRef) OperatorNot() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QBitRef_OperatorNot(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitRef) OperatorAssign(val *QBitRef) {
|
|
|
|
C.QBitRef_OperatorAssign(this.h, val.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBitRef) OperatorAssignWithVal(val bool) {
|
|
|
|
C.QBitRef_OperatorAssignWithVal(this.h, (C.bool)(val))
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QBitRef) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QBitRef_Delete(this.h, C.bool(this.isSubclass))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +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 *QBitRef) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QBitRef) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|