mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
156 lines
4.0 KiB
Go
156 lines
4.0 KiB
Go
package qt6
|
|
|
|
/*
|
|
|
|
#include "gen_qanystringview.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QAnyStringView struct {
|
|
h *C.QAnyStringView
|
|
}
|
|
|
|
func (this *QAnyStringView) cPointer() *C.QAnyStringView {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func (this *QAnyStringView) UnsafePointer() unsafe.Pointer {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return unsafe.Pointer(this.h)
|
|
}
|
|
|
|
func newQAnyStringView(h *C.QAnyStringView) *QAnyStringView {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QAnyStringView{h: h}
|
|
}
|
|
|
|
func UnsafeNewQAnyStringView(h unsafe.Pointer) *QAnyStringView {
|
|
return newQAnyStringView((*C.QAnyStringView)(h))
|
|
}
|
|
|
|
// NewQAnyStringView constructs a new QAnyStringView object.
|
|
func NewQAnyStringView() *QAnyStringView {
|
|
ret := C.QAnyStringView_new()
|
|
return newQAnyStringView(ret)
|
|
}
|
|
|
|
// NewQAnyStringView2 constructs a new QAnyStringView object.
|
|
func NewQAnyStringView2(str []byte) *QAnyStringView {
|
|
str_alias := C.struct_miqt_string{}
|
|
str_alias.data = (*C.char)(unsafe.Pointer(&str[0]))
|
|
str_alias.len = C.size_t(len(str))
|
|
ret := C.QAnyStringView_new2(str_alias)
|
|
return newQAnyStringView(ret)
|
|
}
|
|
|
|
// NewQAnyStringView3 constructs a new QAnyStringView object.
|
|
func NewQAnyStringView3(str string) *QAnyStringView {
|
|
str_ms := C.struct_miqt_string{}
|
|
str_ms.data = C.CString(str)
|
|
str_ms.len = C.size_t(len(str))
|
|
defer C.free(unsafe.Pointer(str_ms.data))
|
|
ret := C.QAnyStringView_new3(str_ms)
|
|
return newQAnyStringView(ret)
|
|
}
|
|
|
|
// NewQAnyStringView4 constructs a new QAnyStringView object.
|
|
func NewQAnyStringView4(c *QChar) *QAnyStringView {
|
|
ret := C.QAnyStringView_new4(c.cPointer())
|
|
return newQAnyStringView(ret)
|
|
}
|
|
|
|
// NewQAnyStringView5 constructs a new QAnyStringView object.
|
|
func NewQAnyStringView5(param1 *QAnyStringView) *QAnyStringView {
|
|
ret := C.QAnyStringView_new5(param1.cPointer())
|
|
return newQAnyStringView(ret)
|
|
}
|
|
|
|
func (this *QAnyStringView) ToString() string {
|
|
var _ms C.struct_miqt_string = C.QAnyStringView_ToString(this.h)
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QAnyStringView) Size() int64 {
|
|
return (int64)(C.QAnyStringView_Size(this.h))
|
|
}
|
|
|
|
func (this *QAnyStringView) Data() unsafe.Pointer {
|
|
return (unsafe.Pointer)(C.QAnyStringView_Data(this.h))
|
|
}
|
|
|
|
func QAnyStringView_Compare(lhs QAnyStringView, rhs QAnyStringView) int {
|
|
return (int)(C.QAnyStringView_Compare(lhs.cPointer(), rhs.cPointer()))
|
|
}
|
|
|
|
func QAnyStringView_Equal(lhs QAnyStringView, rhs QAnyStringView) bool {
|
|
return (bool)(C.QAnyStringView_Equal(lhs.cPointer(), rhs.cPointer()))
|
|
}
|
|
|
|
func (this *QAnyStringView) Front() *QChar {
|
|
_ret := C.QAnyStringView_Front(this.h)
|
|
_goptr := newQChar(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QAnyStringView) Back() *QChar {
|
|
_ret := C.QAnyStringView_Back(this.h)
|
|
_goptr := newQChar(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QAnyStringView) Empty() bool {
|
|
return (bool)(C.QAnyStringView_Empty(this.h))
|
|
}
|
|
|
|
func (this *QAnyStringView) SizeBytes() int64 {
|
|
return (int64)(C.QAnyStringView_SizeBytes(this.h))
|
|
}
|
|
|
|
func (this *QAnyStringView) IsNull() bool {
|
|
return (bool)(C.QAnyStringView_IsNull(this.h))
|
|
}
|
|
|
|
func (this *QAnyStringView) IsEmpty() bool {
|
|
return (bool)(C.QAnyStringView_IsEmpty(this.h))
|
|
}
|
|
|
|
func (this *QAnyStringView) Length() int64 {
|
|
return (int64)(C.QAnyStringView_Length(this.h))
|
|
}
|
|
|
|
func QAnyStringView_Compare3(lhs QAnyStringView, rhs QAnyStringView, cs CaseSensitivity) int {
|
|
return (int)(C.QAnyStringView_Compare3(lhs.cPointer(), rhs.cPointer(), (C.int)(cs)))
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QAnyStringView) Delete() {
|
|
C.QAnyStringView_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 *QAnyStringView) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QAnyStringView) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|