miqt/qt/gen_qthreadpool.cpp

425 lines
12 KiB
C++
Raw Normal View History

2024-11-19 06:29:06 +00:00
#include <QChildEvent>
#include <QEvent>
#include <QMetaMethod>
#include <QMetaObject>
#include <QObject>
#include <QRunnable>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include <QThread>
#include <QThreadPool>
2024-11-19 06:29:06 +00:00
#include <QTimerEvent>
#include <qthreadpool.h>
2024-08-29 07:01:51 +00:00
#include "gen_qthreadpool.h"
#include "_cgo_export.h"
2024-11-19 06:29:06 +00:00
class MiqtVirtualQThreadPool : public virtual QThreadPool {
public:
MiqtVirtualQThreadPool(): QThreadPool() {};
MiqtVirtualQThreadPool(QObject* parent): QThreadPool(parent) {};
virtual ~MiqtVirtualQThreadPool() = default;
// cgo.Handle value for overwritten implementation
intptr_t handle__Event = 0;
// Subclass to allow providing a Go implementation
virtual bool event(QEvent* event) override {
if (handle__Event == 0) {
return QThreadPool::event(event);
}
QEvent* sigval1 = event;
bool callback_return_value = miqt_exec_callback_QThreadPool_Event(this, handle__Event, sigval1);
return callback_return_value;
}
// Wrapper to allow calling protected method
bool virtualbase_Event(QEvent* event) {
return QThreadPool::event(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__EventFilter = 0;
// Subclass to allow providing a Go implementation
virtual bool eventFilter(QObject* watched, QEvent* event) override {
if (handle__EventFilter == 0) {
return QThreadPool::eventFilter(watched, event);
}
QObject* sigval1 = watched;
QEvent* sigval2 = event;
bool callback_return_value = miqt_exec_callback_QThreadPool_EventFilter(this, handle__EventFilter, sigval1, sigval2);
return callback_return_value;
}
// Wrapper to allow calling protected method
bool virtualbase_EventFilter(QObject* watched, QEvent* event) {
return QThreadPool::eventFilter(watched, event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__TimerEvent = 0;
// Subclass to allow providing a Go implementation
virtual void timerEvent(QTimerEvent* event) override {
if (handle__TimerEvent == 0) {
QThreadPool::timerEvent(event);
return;
}
QTimerEvent* sigval1 = event;
miqt_exec_callback_QThreadPool_TimerEvent(this, handle__TimerEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_TimerEvent(QTimerEvent* event) {
QThreadPool::timerEvent(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__ChildEvent = 0;
// Subclass to allow providing a Go implementation
virtual void childEvent(QChildEvent* event) override {
if (handle__ChildEvent == 0) {
QThreadPool::childEvent(event);
return;
}
QChildEvent* sigval1 = event;
miqt_exec_callback_QThreadPool_ChildEvent(this, handle__ChildEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_ChildEvent(QChildEvent* event) {
QThreadPool::childEvent(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__CustomEvent = 0;
// Subclass to allow providing a Go implementation
virtual void customEvent(QEvent* event) override {
if (handle__CustomEvent == 0) {
QThreadPool::customEvent(event);
return;
}
QEvent* sigval1 = event;
miqt_exec_callback_QThreadPool_CustomEvent(this, handle__CustomEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_CustomEvent(QEvent* event) {
QThreadPool::customEvent(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__ConnectNotify = 0;
// Subclass to allow providing a Go implementation
virtual void connectNotify(const QMetaMethod& signal) override {
if (handle__ConnectNotify == 0) {
QThreadPool::connectNotify(signal);
return;
}
const QMetaMethod& signal_ret = signal;
// Cast returned reference into pointer
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
miqt_exec_callback_QThreadPool_ConnectNotify(this, handle__ConnectNotify, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_ConnectNotify(QMetaMethod* signal) {
QThreadPool::connectNotify(*signal);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__DisconnectNotify = 0;
// Subclass to allow providing a Go implementation
virtual void disconnectNotify(const QMetaMethod& signal) override {
if (handle__DisconnectNotify == 0) {
QThreadPool::disconnectNotify(signal);
return;
}
const QMetaMethod& signal_ret = signal;
// Cast returned reference into pointer
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
miqt_exec_callback_QThreadPool_DisconnectNotify(this, handle__DisconnectNotify, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_DisconnectNotify(QMetaMethod* signal) {
QThreadPool::disconnectNotify(*signal);
}
};
void QThreadPool_new(QThreadPool** outptr_QThreadPool, QObject** outptr_QObject) {
MiqtVirtualQThreadPool* ret = new MiqtVirtualQThreadPool();
*outptr_QThreadPool = ret;
*outptr_QObject = static_cast<QObject*>(ret);
}
2024-11-19 06:29:06 +00:00
void QThreadPool_new2(QObject* parent, QThreadPool** outptr_QThreadPool, QObject** outptr_QObject) {
MiqtVirtualQThreadPool* ret = new MiqtVirtualQThreadPool(parent);
*outptr_QThreadPool = ret;
*outptr_QObject = static_cast<QObject*>(ret);
}
QMetaObject* QThreadPool_MetaObject(const QThreadPool* self) {
return (QMetaObject*) self->metaObject();
}
void* QThreadPool_Metacast(QThreadPool* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QThreadPool_Tr(const char* s) {
QString _ret = QThreadPool::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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
struct miqt_string QThreadPool_TrUtf8(const char* s) {
QString _ret = QThreadPool::trUtf8(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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
QThreadPool* QThreadPool_GlobalInstance() {
return QThreadPool::globalInstance();
}
void QThreadPool_Start(QThreadPool* self, QRunnable* runnable) {
self->start(runnable);
}
bool QThreadPool_TryStart(QThreadPool* self, QRunnable* runnable) {
return self->tryStart(runnable);
}
int QThreadPool_ExpiryTimeout(const QThreadPool* self) {
return self->expiryTimeout();
}
void QThreadPool_SetExpiryTimeout(QThreadPool* self, int expiryTimeout) {
self->setExpiryTimeout(static_cast<int>(expiryTimeout));
}
int QThreadPool_MaxThreadCount(const QThreadPool* self) {
return self->maxThreadCount();
}
void QThreadPool_SetMaxThreadCount(QThreadPool* self, int maxThreadCount) {
self->setMaxThreadCount(static_cast<int>(maxThreadCount));
}
int QThreadPool_ActiveThreadCount(const QThreadPool* self) {
return self->activeThreadCount();
}
void QThreadPool_SetStackSize(QThreadPool* self, unsigned int stackSize) {
self->setStackSize(static_cast<uint>(stackSize));
}
unsigned int QThreadPool_StackSize(const QThreadPool* self) {
uint _ret = self->stackSize();
return static_cast<unsigned int>(_ret);
}
void QThreadPool_ReserveThread(QThreadPool* self) {
self->reserveThread();
}
void QThreadPool_ReleaseThread(QThreadPool* self) {
self->releaseThread();
}
bool QThreadPool_WaitForDone(QThreadPool* self) {
return self->waitForDone();
}
void QThreadPool_Clear(QThreadPool* self) {
self->clear();
}
bool QThreadPool_Contains(const QThreadPool* self, QThread* thread) {
return self->contains(thread);
}
void QThreadPool_Cancel(QThreadPool* self, QRunnable* runnable) {
self->cancel(runnable);
}
bool QThreadPool_TryTake(QThreadPool* self, QRunnable* runnable) {
return self->tryTake(runnable);
}
struct miqt_string QThreadPool_Tr2(const char* s, const char* c) {
QString _ret = QThreadPool::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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
struct miqt_string QThreadPool_Tr3(const char* s, const char* c, int n) {
QString _ret = QThreadPool::tr(s, c, static_cast<int>(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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
struct miqt_string QThreadPool_TrUtf82(const char* s, const char* c) {
QString _ret = QThreadPool::trUtf8(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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
struct miqt_string QThreadPool_TrUtf83(const char* s, const char* c, int n) {
QString _ret = QThreadPool::trUtf8(s, c, static_cast<int>(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<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
void QThreadPool_Start2(QThreadPool* self, QRunnable* runnable, int priority) {
self->start(runnable, static_cast<int>(priority));
}
bool QThreadPool_WaitForDone1(QThreadPool* self, int msecs) {
return self->waitForDone(static_cast<int>(msecs));
}
2024-11-19 06:29:06 +00:00
void QThreadPool_override_virtual_Event(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__Event = slot;
}
bool QThreadPool_virtualbase_Event(void* self, QEvent* event) {
return ( (MiqtVirtualQThreadPool*)(self) )->virtualbase_Event(event);
}
void QThreadPool_override_virtual_EventFilter(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__EventFilter = slot;
}
bool QThreadPool_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event) {
return ( (MiqtVirtualQThreadPool*)(self) )->virtualbase_EventFilter(watched, event);
}
void QThreadPool_override_virtual_TimerEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__TimerEvent = slot;
}
void QThreadPool_virtualbase_TimerEvent(void* self, QTimerEvent* event) {
( (MiqtVirtualQThreadPool*)(self) )->virtualbase_TimerEvent(event);
}
void QThreadPool_override_virtual_ChildEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__ChildEvent = slot;
}
void QThreadPool_virtualbase_ChildEvent(void* self, QChildEvent* event) {
( (MiqtVirtualQThreadPool*)(self) )->virtualbase_ChildEvent(event);
}
void QThreadPool_override_virtual_CustomEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__CustomEvent = slot;
}
void QThreadPool_virtualbase_CustomEvent(void* self, QEvent* event) {
( (MiqtVirtualQThreadPool*)(self) )->virtualbase_CustomEvent(event);
}
void QThreadPool_override_virtual_ConnectNotify(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__ConnectNotify = slot;
}
void QThreadPool_virtualbase_ConnectNotify(void* self, QMetaMethod* signal) {
( (MiqtVirtualQThreadPool*)(self) )->virtualbase_ConnectNotify(signal);
}
void QThreadPool_override_virtual_DisconnectNotify(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQThreadPool*>( (QThreadPool*)(self) )->handle__DisconnectNotify = slot;
}
void QThreadPool_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal) {
( (MiqtVirtualQThreadPool*)(self) )->virtualbase_DisconnectNotify(signal);
}
void QThreadPool_Delete(QThreadPool* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<MiqtVirtualQThreadPool*>( self );
} else {
delete self;
}
}