2024-08-25 04:08:24 +00:00
|
|
|
#include <QAbstractEventDispatcher>
|
|
|
|
#include <QDeadlineTimer>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QThread>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qthread.h"
|
|
|
|
#include "gen_qthread.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QThread* QThread_new() {
|
|
|
|
return new QThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
QThread* QThread_new2(QObject* parent) {
|
|
|
|
return new QThread(parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QThread_MetaObject(const QThread* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_Tr(const char* s) {
|
|
|
|
QString _ret = QThread::tr(s);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_TrUtf8(const char* s) {
|
|
|
|
QString _ret = QThread::trUtf8(s);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QThread* QThread_CurrentThread() {
|
|
|
|
return QThread::currentThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
int QThread_IdealThreadCount() {
|
|
|
|
return QThread::idealThreadCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_YieldCurrentThread() {
|
|
|
|
QThread::yieldCurrentThread();
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QThread_SetPriority(QThread* self, int priority) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->setPriority(static_cast<QThread::Priority>(priority));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QThread_Priority(const QThread* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QThread::Priority _ret = self->priority();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QThread_IsFinished(const QThread* self) {
|
|
|
|
return self->isFinished();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QThread_IsRunning(const QThread* self) {
|
|
|
|
return self->isRunning();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_RequestInterruption(QThread* self) {
|
|
|
|
self->requestInterruption();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QThread_IsInterruptionRequested(const QThread* self) {
|
|
|
|
return self->isInterruptionRequested();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_SetStackSize(QThread* self, unsigned int stackSize) {
|
|
|
|
self->setStackSize(static_cast<uint>(stackSize));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned int QThread_StackSize(const QThread* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
uint _ret = self->stackSize();
|
|
|
|
return static_cast<unsigned int>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Exit(QThread* self) {
|
|
|
|
self->exit();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QAbstractEventDispatcher* QThread_EventDispatcher(const QThread* self) {
|
|
|
|
return self->eventDispatcher();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_SetEventDispatcher(QThread* self, QAbstractEventDispatcher* eventDispatcher) {
|
|
|
|
self->setEventDispatcher(eventDispatcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QThread_Event(QThread* self, QEvent* event) {
|
|
|
|
return self->event(event);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QThread_LoopLevel(const QThread* self) {
|
|
|
|
return self->loopLevel();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Start(QThread* self) {
|
|
|
|
self->start();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Terminate(QThread* self) {
|
|
|
|
self->terminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Quit(QThread* self) {
|
|
|
|
self->quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QThread_Wait(QThread* self) {
|
|
|
|
return self->wait();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QThread_WaitWithTime(QThread* self, unsigned long time) {
|
|
|
|
return self->wait(static_cast<unsigned long>(time));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Sleep(unsigned long param1) {
|
|
|
|
QThread::sleep(static_cast<unsigned long>(param1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Msleep(unsigned long param1) {
|
|
|
|
QThread::msleep(static_cast<unsigned long>(param1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Usleep(unsigned long param1) {
|
|
|
|
QThread::usleep(static_cast<unsigned long>(param1));
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_Tr2(const char* s, const char* c) {
|
|
|
|
QString _ret = QThread::tr(s, c);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_Tr3(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QThread::tr(s, c, static_cast<int>(n));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_TrUtf82(const char* s, const char* c) {
|
|
|
|
QString _ret = QThread::trUtf8(s, c);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QThread_TrUtf83(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QThread::trUtf8(s, c, static_cast<int>(n));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Exit1(QThread* self, int retcode) {
|
|
|
|
self->exit(static_cast<int>(retcode));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QThread_Start1(QThread* self, int param1) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->start(static_cast<QThread::Priority>(param1));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
bool QThread_Wait1(QThread* self, QDeadlineTimer* deadline) {
|
|
|
|
return self->wait(*deadline);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QThread_Delete(QThread* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|