2024-11-04 09:53:04 +00:00
|
|
|
package network
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qsctpsocket.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mappu/miqt/qt6"
|
|
|
|
"runtime"
|
2024-11-19 06:29:06 +00:00
|
|
|
"runtime/cgo"
|
2024-11-04 09:53:04 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QSctpSocket struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QSctpSocket
|
|
|
|
isSubclass bool
|
2024-11-04 09:53:04 +00:00
|
|
|
*QTcpSocket
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) cPointer() *C.QSctpSocket {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQSctpSocket constructs the type using only CGO pointers.
|
2024-12-07 04:15:57 +00:00
|
|
|
func newQSctpSocket(h *C.QSctpSocket) *QSctpSocket {
|
2024-11-04 09:53:04 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
var outptr_QTcpSocket *C.QTcpSocket = nil
|
|
|
|
C.QSctpSocket_virtbase(h, &outptr_QTcpSocket)
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
return &QSctpSocket{h: h,
|
2024-12-07 04:15:57 +00:00
|
|
|
QTcpSocket: newQTcpSocket(outptr_QTcpSocket)}
|
2024-11-04 09:53:04 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQSctpSocket constructs the type using only unsafe pointers.
|
2024-12-07 04:15:57 +00:00
|
|
|
func UnsafeNewQSctpSocket(h unsafe.Pointer) *QSctpSocket {
|
|
|
|
return newQSctpSocket((*C.QSctpSocket)(h))
|
2024-11-04 09:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQSctpSocket constructs a new QSctpSocket object.
|
|
|
|
func NewQSctpSocket() *QSctpSocket {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQSctpSocket(C.QSctpSocket_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-11-04 09:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQSctpSocket2 constructs a new QSctpSocket object.
|
|
|
|
func NewQSctpSocket2(parent *qt6.QObject) *QSctpSocket {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQSctpSocket(C.QSctpSocket_new2((*C.QObject)(parent.UnsafePointer())))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-11-04 09:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) MetaObject() *qt6.QMetaObject {
|
|
|
|
return qt6.UnsafeNewQMetaObject(unsafe.Pointer(C.QSctpSocket_MetaObject(this.h)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
|
|
|
return (unsafe.Pointer)(C.QSctpSocket_Metacast(this.h, param1_Cstring))
|
|
|
|
}
|
|
|
|
|
|
|
|
func QSctpSocket_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
var _ms C.struct_miqt_string = C.QSctpSocket_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
|
|
return _ret
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) Close() {
|
|
|
|
C.QSctpSocket_Close(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) DisconnectFromHost() {
|
|
|
|
C.QSctpSocket_DisconnectFromHost(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) SetMaximumChannelCount(count int) {
|
|
|
|
C.QSctpSocket_SetMaximumChannelCount(this.h, (C.int)(count))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) MaximumChannelCount() int {
|
|
|
|
return (int)(C.QSctpSocket_MaximumChannelCount(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) IsInDatagramMode() bool {
|
|
|
|
return (bool)(C.QSctpSocket_IsInDatagramMode(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) ReadDatagram() *QNetworkDatagram {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQNetworkDatagram(C.QSctpSocket_ReadDatagram(this.h))
|
2024-11-04 09:53:04 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) WriteDatagram(datagram *QNetworkDatagram) bool {
|
|
|
|
return (bool)(C.QSctpSocket_WriteDatagram(this.h, datagram.cPointer()))
|
|
|
|
}
|
|
|
|
|
|
|
|
func QSctpSocket_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))
|
|
|
|
var _ms C.struct_miqt_string = C.QSctpSocket_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
|
|
return _ret
|
|
|
|
}
|
|
|
|
|
|
|
|
func QSctpSocket_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))
|
|
|
|
var _ms C.struct_miqt_string = C.QSctpSocket_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
|
|
return _ret
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
func (this *QSctpSocket) callVirtualBase_Close() {
|
|
|
|
|
|
|
|
C.QSctpSocket_virtualbase_Close(unsafe.Pointer(this.h))
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QSctpSocket) OnClose(slot func(super func())) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSctpSocket_override_virtual_Close(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QSctpSocket_Close
|
|
|
|
func miqt_exec_callback_QSctpSocket_Close(self *C.QSctpSocket, cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func()))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
gofunc((&QSctpSocket{h: self}).callVirtualBase_Close)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) callVirtualBase_DisconnectFromHost() {
|
|
|
|
|
|
|
|
C.QSctpSocket_virtualbase_DisconnectFromHost(unsafe.Pointer(this.h))
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QSctpSocket) OnDisconnectFromHost(slot func(super func())) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSctpSocket_override_virtual_DisconnectFromHost(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QSctpSocket_DisconnectFromHost
|
|
|
|
func miqt_exec_callback_QSctpSocket_DisconnectFromHost(self *C.QSctpSocket, cb C.intptr_t) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func()))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
gofunc((&QSctpSocket{h: self}).callVirtualBase_DisconnectFromHost)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) callVirtualBase_ReadData(data string, maxlen int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
|
|
|
|
|
|
|
return (int64)(C.QSctpSocket_virtualbase_ReadData(unsafe.Pointer(this.h), data_Cstring, (C.longlong)(maxlen)))
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QSctpSocket) OnReadData(slot func(super func(data string, maxlen int64) int64, data string, maxlen int64) int64) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSctpSocket_override_virtual_ReadData(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QSctpSocket_ReadData
|
|
|
|
func miqt_exec_callback_QSctpSocket_ReadData(self *C.QSctpSocket, cb C.intptr_t, data *C.char, maxlen C.longlong) C.longlong {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(data string, maxlen int64) int64, data string, maxlen int64) int64)
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
data_ret := data
|
|
|
|
slotval1 := C.GoString(data_ret)
|
|
|
|
|
|
|
|
slotval2 := (int64)(maxlen)
|
|
|
|
|
|
|
|
virtualReturn := gofunc((&QSctpSocket{h: self}).callVirtualBase_ReadData, slotval1, slotval2)
|
|
|
|
|
|
|
|
return (C.longlong)(virtualReturn)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QSctpSocket) callVirtualBase_ReadLineData(data string, maxlen int64) int64 {
|
|
|
|
data_Cstring := C.CString(data)
|
|
|
|
defer C.free(unsafe.Pointer(data_Cstring))
|
|
|
|
|
|
|
|
return (int64)(C.QSctpSocket_virtualbase_ReadLineData(unsafe.Pointer(this.h), data_Cstring, (C.longlong)(maxlen)))
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QSctpSocket) OnReadLineData(slot func(super func(data string, maxlen int64) int64, data string, maxlen int64) int64) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSctpSocket_override_virtual_ReadLineData(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QSctpSocket_ReadLineData
|
|
|
|
func miqt_exec_callback_QSctpSocket_ReadLineData(self *C.QSctpSocket, cb C.intptr_t, data *C.char, maxlen C.longlong) C.longlong {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(data string, maxlen int64) int64, data string, maxlen int64) int64)
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
data_ret := data
|
|
|
|
slotval1 := C.GoString(data_ret)
|
|
|
|
|
|
|
|
slotval2 := (int64)(maxlen)
|
|
|
|
|
|
|
|
virtualReturn := gofunc((&QSctpSocket{h: self}).callVirtualBase_ReadLineData, slotval1, slotval2)
|
|
|
|
|
|
|
|
return (C.longlong)(virtualReturn)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-04 09:53:04 +00:00
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QSctpSocket) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QSctpSocket_Delete(this.h, C.bool(this.isSubclass))
|
2024-11-04 09:53:04 +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 *QSctpSocket) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QSctpSocket) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|