2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qiodevice.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"runtime/cgo"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
type QIODevice__OpenModeFlag int
|
|
|
|
|
|
|
|
const (
|
2024-09-20 07:13:26 +00:00
|
|
|
QIODevice__NotOpen QIODevice__OpenModeFlag = 0
|
|
|
|
QIODevice__ReadOnly QIODevice__OpenModeFlag = 1
|
|
|
|
QIODevice__WriteOnly QIODevice__OpenModeFlag = 2
|
|
|
|
QIODevice__ReadWrite QIODevice__OpenModeFlag = 3
|
|
|
|
QIODevice__Append QIODevice__OpenModeFlag = 4
|
|
|
|
QIODevice__Truncate QIODevice__OpenModeFlag = 8
|
|
|
|
QIODevice__Text QIODevice__OpenModeFlag = 16
|
|
|
|
QIODevice__Unbuffered QIODevice__OpenModeFlag = 32
|
|
|
|
QIODevice__NewOnly QIODevice__OpenModeFlag = 64
|
|
|
|
QIODevice__ExistingOnly QIODevice__OpenModeFlag = 128
|
2024-09-04 06:54:22 +00:00
|
|
|
)
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QIODevice struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QIODevice
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
*QObject
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) cPointer() *C.QIODevice {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QIODevice) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQIODevice constructs the type using only CGO pointers.
|
|
|
|
func newQIODevice(h *C.QIODevice, h_QObject *C.QObject) *QIODevice {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
return &QIODevice{h: h,
|
|
|
|
QObject: newQObject(h_QObject)}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQIODevice constructs the type using only unsafe pointers.
|
|
|
|
func UnsafeNewQIODevice(h unsafe.Pointer, h_QObject unsafe.Pointer) *QIODevice {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QIODevice{h: (*C.QIODevice)(h),
|
|
|
|
QObject: UnsafeNewQObject(h_QObject)}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QIODevice_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QIODevice) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
return (unsafe.Pointer)(C.QIODevice_Metacast(this.h, param1_Cstring))
|
2024-09-20 22:32:57 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QIODevice_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QIODevice_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 06:40:03 +00:00
|
|
|
func (this *QIODevice) OpenMode() QIODevice__OpenModeFlag {
|
|
|
|
return (QIODevice__OpenModeFlag)(C.QIODevice_OpenMode(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QIODevice) SetTextModeEnabled(enabled bool) {
|
|
|
|
C.QIODevice_SetTextModeEnabled(this.h, (C.bool)(enabled))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsTextModeEnabled() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsTextModeEnabled(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsOpen() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsOpen(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsReadable() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsReadable(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsWritable() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsWritable(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsSequential() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsSequential(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ReadChannelCount() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QIODevice_ReadChannelCount(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) WriteChannelCount() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QIODevice_WriteChannelCount(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) CurrentReadChannel() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QIODevice_CurrentReadChannel(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) SetCurrentReadChannel(channel int) {
|
|
|
|
C.QIODevice_SetCurrentReadChannel(this.h, (C.int)(channel))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) CurrentWriteChannel() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QIODevice_CurrentWriteChannel(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) SetCurrentWriteChannel(channel int) {
|
|
|
|
C.QIODevice_SetCurrentWriteChannel(this.h, (C.int)(channel))
|
|
|
|
}
|
|
|
|
|
2024-09-20 06:40:03 +00:00
|
|
|
func (this *QIODevice) Open(mode QIODevice__OpenModeFlag) bool {
|
2024-09-18 01:33:50 +00:00
|
|
|
return (bool)(C.QIODevice_Open(this.h, (C.int)(mode)))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QIODevice) Close() {
|
|
|
|
C.QIODevice_Close(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Pos() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Pos(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Size() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Size(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Seek(pos int64) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_Seek(this.h, (C.longlong)(pos)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) AtEnd() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_AtEnd(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Reset() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_Reset(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) BytesAvailable() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_BytesAvailable(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) BytesToWrite() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_BytesToWrite(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Read(data string, maxlen int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Read(this.h, data_Cstring, (C.longlong)(maxlen)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) ReadWithMaxlen(maxlen int64) []byte {
|
|
|
|
var _bytearray C.struct_miqt_string = C.QIODevice_ReadWithMaxlen(this.h, (C.longlong)(maxlen))
|
|
|
|
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(_bytearray.data))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) ReadAll() []byte {
|
|
|
|
var _bytearray C.struct_miqt_string = C.QIODevice_ReadAll(this.h)
|
|
|
|
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(_bytearray.data))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ReadLine(data string, maxlen int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_ReadLine(this.h, data_Cstring, (C.longlong)(maxlen)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) ReadLine2() []byte {
|
|
|
|
var _bytearray C.struct_miqt_string = C.QIODevice_ReadLine2(this.h)
|
|
|
|
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(_bytearray.data))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) CanReadLine() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_CanReadLine(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) StartTransaction() {
|
|
|
|
C.QIODevice_StartTransaction(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) CommitTransaction() {
|
|
|
|
C.QIODevice_CommitTransaction(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) RollbackTransaction() {
|
|
|
|
C.QIODevice_RollbackTransaction(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) IsTransactionStarted() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_IsTransactionStarted(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Write(data string, lenVal int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Write(this.h, data_Cstring, (C.longlong)(lenVal)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) WriteWithData(data string) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_WriteWithData(this.h, data_Cstring))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) Write2(data []byte) int64 {
|
|
|
|
data_alias := C.struct_miqt_string{}
|
|
|
|
data_alias.data = (*C.char)(unsafe.Pointer(&data[0]))
|
|
|
|
data_alias.len = C.size_t(len(data))
|
|
|
|
return (int64)(C.QIODevice_Write2(this.h, data_alias))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Peek(data string, maxlen int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Peek(this.h, data_Cstring, (C.longlong)(maxlen)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) PeekWithMaxlen(maxlen int64) []byte {
|
|
|
|
var _bytearray C.struct_miqt_string = C.QIODevice_PeekWithMaxlen(this.h, (C.longlong)(maxlen))
|
|
|
|
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(_bytearray.data))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) Skip(maxSize int64) int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QIODevice_Skip(this.h, (C.longlong)(maxSize)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) WaitForReadyRead(msecs int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_WaitForReadyRead(this.h, (C.int)(msecs)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) WaitForBytesWritten(msecs int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_WaitForBytesWritten(this.h, (C.int)(msecs)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-11 05:43:04 +00:00
|
|
|
func (this *QIODevice) UngetChar(c int8) {
|
2024-08-25 04:08:24 +00:00
|
|
|
C.QIODevice_UngetChar(this.h, (C.char)(c))
|
|
|
|
}
|
|
|
|
|
2024-10-11 05:43:04 +00:00
|
|
|
func (this *QIODevice) PutChar(c int8) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_PutChar(this.h, (C.char)(c)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) GetChar(c string) bool {
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QIODevice_GetChar(this.h, c_Cstring))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ErrorString() string {
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_ErrorString(this.h)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ReadyRead() {
|
|
|
|
C.QIODevice_ReadyRead(this.h)
|
|
|
|
}
|
|
|
|
func (this *QIODevice) OnReadyRead(slot func()) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_ReadyRead(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QIODevice_ReadyRead
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_ReadyRead(cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
gofunc()
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ChannelReadyRead(channel int) {
|
|
|
|
C.QIODevice_ChannelReadyRead(this.h, (C.int)(channel))
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QIODevice) OnChannelReadyRead(slot func(channel int)) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_ChannelReadyRead(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QIODevice_ChannelReadyRead
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_ChannelReadyRead(cb C.intptr_t, channel C.int) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(channel int))
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval1 := (int)(channel)
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) BytesWritten(bytes int64) {
|
2024-08-29 07:01:51 +00:00
|
|
|
C.QIODevice_BytesWritten(this.h, (C.longlong)(bytes))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QIODevice) OnBytesWritten(slot func(bytes int64)) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_BytesWritten(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QIODevice_BytesWritten
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_BytesWritten(cb C.intptr_t, bytes C.longlong) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(bytes int64))
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval1 := (int64)(bytes)
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ChannelBytesWritten(channel int, bytes int64) {
|
2024-08-29 07:01:51 +00:00
|
|
|
C.QIODevice_ChannelBytesWritten(this.h, (C.int)(channel), (C.longlong)(bytes))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QIODevice) OnChannelBytesWritten(slot func(channel int, bytes int64)) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_ChannelBytesWritten(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QIODevice_ChannelBytesWritten
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_ChannelBytesWritten(cb C.intptr_t, channel C.int, bytes C.longlong) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(channel int, bytes int64))
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval1 := (int)(channel)
|
2024-09-14 22:29:05 +00:00
|
|
|
|
2024-09-17 07:30:27 +00:00
|
|
|
slotval2 := (int64)(bytes)
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
gofunc(slotval1, slotval2)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) AboutToClose() {
|
|
|
|
C.QIODevice_AboutToClose(this.h)
|
|
|
|
}
|
|
|
|
func (this *QIODevice) OnAboutToClose(slot func()) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_AboutToClose(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QIODevice_AboutToClose
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_AboutToClose(cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
gofunc()
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QIODevice) ReadChannelFinished() {
|
|
|
|
C.QIODevice_ReadChannelFinished(this.h)
|
|
|
|
}
|
|
|
|
func (this *QIODevice) OnReadChannelFinished(slot func()) {
|
2024-10-13 06:06:06 +00:00
|
|
|
C.QIODevice_connect_ReadChannelFinished(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
2024-09-14 22:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QIODevice_ReadChannelFinished
|
2024-10-13 06:06:06 +00:00
|
|
|
func miqt_exec_callback_QIODevice_ReadChannelFinished(cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func())
|
2024-09-14 22:29:05 +00:00
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
gofunc()
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QIODevice_Tr2(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QIODevice_Tr3(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QIODevice_TrUtf82(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QIODevice_TrUtf83(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QIODevice_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
func (this *QIODevice) ReadLine1(maxlen int64) []byte {
|
|
|
|
var _bytearray C.struct_miqt_string = C.QIODevice_ReadLine1(this.h, (C.longlong)(maxlen))
|
|
|
|
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(_bytearray.data))
|
|
|
|
return _ret
|
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 *QIODevice) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QIODevice_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 *QIODevice) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QIODevice) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|