miqt/qt6/gen_qpageranges.go
2024-10-21 19:10:31 +13:00

201 lines
4.9 KiB
Go

package qt6
/*
#include "gen_qpageranges.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QPageRanges struct {
h *C.QPageRanges
}
func (this *QPageRanges) cPointer() *C.QPageRanges {
if this == nil {
return nil
}
return this.h
}
func (this *QPageRanges) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
func newQPageRanges(h *C.QPageRanges) *QPageRanges {
if h == nil {
return nil
}
return &QPageRanges{h: h}
}
func UnsafeNewQPageRanges(h unsafe.Pointer) *QPageRanges {
return newQPageRanges((*C.QPageRanges)(h))
}
// NewQPageRanges constructs a new QPageRanges object.
func NewQPageRanges() *QPageRanges {
ret := C.QPageRanges_new()
return newQPageRanges(ret)
}
// NewQPageRanges2 constructs a new QPageRanges object.
func NewQPageRanges2(other *QPageRanges) *QPageRanges {
ret := C.QPageRanges_new2(other.cPointer())
return newQPageRanges(ret)
}
func (this *QPageRanges) OperatorAssign(other *QPageRanges) {
C.QPageRanges_OperatorAssign(this.h, other.cPointer())
}
func (this *QPageRanges) Swap(other *QPageRanges) {
C.QPageRanges_Swap(this.h, other.cPointer())
}
func (this *QPageRanges) AddPage(pageNumber int) {
C.QPageRanges_AddPage(this.h, (C.int)(pageNumber))
}
func (this *QPageRanges) AddRange(from int, to int) {
C.QPageRanges_AddRange(this.h, (C.int)(from), (C.int)(to))
}
func (this *QPageRanges) ToRangeList() []QPageRanges__Range {
var _ma *C.struct_miqt_array = C.QPageRanges_ToRangeList(this.h)
_ret := make([]QPageRanges__Range, int(_ma.len))
_outCast := (*[0xffff]*C.QPageRanges__Range)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_lv_ret := _outCast[i]
_lv_goptr := newQPageRanges__Range(_lv_ret)
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QPageRanges) Clear() {
C.QPageRanges_Clear(this.h)
}
func (this *QPageRanges) ToString() string {
var _ms C.struct_miqt_string = C.QPageRanges_ToString(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QPageRanges_FromString(ranges string) *QPageRanges {
ranges_ms := C.struct_miqt_string{}
ranges_ms.data = C.CString(ranges)
ranges_ms.len = C.size_t(len(ranges))
defer C.free(unsafe.Pointer(ranges_ms.data))
_ret := C.QPageRanges_FromString(ranges_ms)
_goptr := newQPageRanges(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QPageRanges) Contains(pageNumber int) bool {
return (bool)(C.QPageRanges_Contains(this.h, (C.int)(pageNumber)))
}
func (this *QPageRanges) IsEmpty() bool {
return (bool)(C.QPageRanges_IsEmpty(this.h))
}
func (this *QPageRanges) FirstPage() int {
return (int)(C.QPageRanges_FirstPage(this.h))
}
func (this *QPageRanges) LastPage() int {
return (int)(C.QPageRanges_LastPage(this.h))
}
func (this *QPageRanges) Detach() {
C.QPageRanges_Detach(this.h)
}
// Delete this object from C++ memory.
func (this *QPageRanges) Delete() {
C.QPageRanges_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 *QPageRanges) GoGC() {
runtime.SetFinalizer(this, func(this *QPageRanges) {
this.Delete()
runtime.KeepAlive(this.h)
})
}
type QPageRanges__Range struct {
h *C.QPageRanges__Range
}
func (this *QPageRanges__Range) cPointer() *C.QPageRanges__Range {
if this == nil {
return nil
}
return this.h
}
func (this *QPageRanges__Range) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
func newQPageRanges__Range(h *C.QPageRanges__Range) *QPageRanges__Range {
if h == nil {
return nil
}
return &QPageRanges__Range{h: h}
}
func UnsafeNewQPageRanges__Range(h unsafe.Pointer) *QPageRanges__Range {
return newQPageRanges__Range((*C.QPageRanges__Range)(h))
}
// NewQPageRanges__Range constructs a new QPageRanges::Range object.
func NewQPageRanges__Range() *QPageRanges__Range {
ret := C.QPageRanges__Range_new()
return newQPageRanges__Range(ret)
}
// NewQPageRanges__Range2 constructs a new QPageRanges::Range object.
func NewQPageRanges__Range2(param1 *QPageRanges__Range) *QPageRanges__Range {
ret := C.QPageRanges__Range_new2(param1.cPointer())
return newQPageRanges__Range(ret)
}
func (this *QPageRanges__Range) Contains(pageNumber int) bool {
return (bool)(C.QPageRanges__Range_Contains(this.h, (C.int)(pageNumber)))
}
// Delete this object from C++ memory.
func (this *QPageRanges__Range) Delete() {
C.QPageRanges__Range_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 *QPageRanges__Range) GoGC() {
runtime.SetFinalizer(this, func(this *QPageRanges__Range) {
this.Delete()
runtime.KeepAlive(this.h)
})
}