#include #include #include #include #include #include #include #include #include #include #include #include "gen_qudpsocket.h" #include "_cgo_export.h" QUdpSocket* QUdpSocket_new() { return new QUdpSocket(); } QUdpSocket* QUdpSocket_new2(QObject* parent) { return new QUdpSocket(parent); } QMetaObject* QUdpSocket_MetaObject(const QUdpSocket* self) { return (QMetaObject*) self->metaObject(); } void* QUdpSocket_Metacast(QUdpSocket* self, const char* param1) { return self->qt_metacast(param1); } struct miqt_string QUdpSocket_Tr(const char* s) { QString _ret = QUdpSocket::tr(s); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray _b = _ret.toUtf8(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } bool QUdpSocket_Bind(QUdpSocket* self, int addr) { return self->bind(static_cast(addr)); } bool QUdpSocket_JoinMulticastGroup(QUdpSocket* self, QHostAddress* groupAddress) { return self->joinMulticastGroup(*groupAddress); } bool QUdpSocket_JoinMulticastGroup2(QUdpSocket* self, QHostAddress* groupAddress, QNetworkInterface* iface) { return self->joinMulticastGroup(*groupAddress, *iface); } bool QUdpSocket_LeaveMulticastGroup(QUdpSocket* self, QHostAddress* groupAddress) { return self->leaveMulticastGroup(*groupAddress); } bool QUdpSocket_LeaveMulticastGroup2(QUdpSocket* self, QHostAddress* groupAddress, QNetworkInterface* iface) { return self->leaveMulticastGroup(*groupAddress, *iface); } QNetworkInterface* QUdpSocket_MulticastInterface(const QUdpSocket* self) { return new QNetworkInterface(self->multicastInterface()); } void QUdpSocket_SetMulticastInterface(QUdpSocket* self, QNetworkInterface* iface) { self->setMulticastInterface(*iface); } bool QUdpSocket_HasPendingDatagrams(const QUdpSocket* self) { return self->hasPendingDatagrams(); } long long QUdpSocket_PendingDatagramSize(const QUdpSocket* self) { qint64 _ret = self->pendingDatagramSize(); return static_cast(_ret); } QNetworkDatagram* QUdpSocket_ReceiveDatagram(QUdpSocket* self) { return new QNetworkDatagram(self->receiveDatagram()); } long long QUdpSocket_ReadDatagram(QUdpSocket* self, char* data, long long maxlen) { qint64 _ret = self->readDatagram(data, static_cast(maxlen)); return static_cast(_ret); } long long QUdpSocket_WriteDatagram(QUdpSocket* self, QNetworkDatagram* datagram) { qint64 _ret = self->writeDatagram(*datagram); return static_cast(_ret); } long long QUdpSocket_WriteDatagram2(QUdpSocket* self, const char* data, long long lenVal, QHostAddress* host, uint16_t port) { qint64 _ret = self->writeDatagram(data, static_cast(lenVal), *host, static_cast(port)); return static_cast(_ret); } long long QUdpSocket_WriteDatagram3(QUdpSocket* self, struct miqt_string datagram, QHostAddress* host, uint16_t port) { QByteArray datagram_QByteArray(datagram.data, datagram.len); qint64 _ret = self->writeDatagram(datagram_QByteArray, *host, static_cast(port)); return static_cast(_ret); } struct miqt_string QUdpSocket_Tr2(const char* s, const char* c) { QString _ret = QUdpSocket::tr(s, c); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray _b = _ret.toUtf8(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } struct miqt_string QUdpSocket_Tr3(const char* s, const char* c, int n) { QString _ret = QUdpSocket::tr(s, c, static_cast(n)); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray _b = _ret.toUtf8(); struct miqt_string _ms; _ms.len = _b.length(); _ms.data = static_cast(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } bool QUdpSocket_Bind2(QUdpSocket* self, int addr, uint16_t port) { return self->bind(static_cast(addr), static_cast(port)); } bool QUdpSocket_Bind3(QUdpSocket* self, int addr, uint16_t port, int mode) { return self->bind(static_cast(addr), static_cast(port), static_cast(mode)); } QNetworkDatagram* QUdpSocket_ReceiveDatagram1(QUdpSocket* self, long long maxSize) { return new QNetworkDatagram(self->receiveDatagram(static_cast(maxSize))); } long long QUdpSocket_ReadDatagram3(QUdpSocket* self, char* data, long long maxlen, QHostAddress* host) { qint64 _ret = self->readDatagram(data, static_cast(maxlen), host); return static_cast(_ret); } long long QUdpSocket_ReadDatagram4(QUdpSocket* self, char* data, long long maxlen, QHostAddress* host, uint16_t* port) { qint64 _ret = self->readDatagram(data, static_cast(maxlen), host, static_cast(port)); return static_cast(_ret); } void QUdpSocket_Delete(QUdpSocket* self) { delete self; }