miqt/qt6/gen_qsemaphore.cpp
Jacek Sieka a0c6344ecd Avoid dependency on exported go header
The expected type of the callback is already known from the AST - this
change reduces dependency on cgo specifics and makes the generated C ABI
entirely cgo-independent - in particular, there is no need to include
`_cgo_export.h` any more.
2025-01-07 12:55:40 +01:00

106 lines
2.3 KiB
C++

#include <QSemaphore>
#include <QSemaphoreReleaser>
#include <qsemaphore.h>
#include "gen_qsemaphore.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* extern C */
#endif
QSemaphore* QSemaphore_new() {
return new QSemaphore();
}
QSemaphore* QSemaphore_new2(int n) {
return new QSemaphore(static_cast<int>(n));
}
void QSemaphore_Acquire(QSemaphore* self) {
self->acquire();
}
bool QSemaphore_TryAcquire(QSemaphore* self) {
return self->tryAcquire();
}
bool QSemaphore_TryAcquire2(QSemaphore* self, int n, int timeout) {
return self->tryAcquire(static_cast<int>(n), static_cast<int>(timeout));
}
void QSemaphore_Release(QSemaphore* self) {
self->release();
}
int QSemaphore_Available(const QSemaphore* self) {
return self->available();
}
bool QSemaphore_TryAcquire3(QSemaphore* self) {
return self->try_acquire();
}
void QSemaphore_Acquire1(QSemaphore* self, int n) {
self->acquire(static_cast<int>(n));
}
bool QSemaphore_TryAcquire1(QSemaphore* self, int n) {
return self->tryAcquire(static_cast<int>(n));
}
void QSemaphore_Release1(QSemaphore* self, int n) {
self->release(static_cast<int>(n));
}
void QSemaphore_Delete(QSemaphore* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QSemaphore*>( self );
} else {
delete self;
}
}
QSemaphoreReleaser* QSemaphoreReleaser_new() {
return new QSemaphoreReleaser();
}
QSemaphoreReleaser* QSemaphoreReleaser_new2(QSemaphore* sem) {
return new QSemaphoreReleaser(*sem);
}
QSemaphoreReleaser* QSemaphoreReleaser_new3(QSemaphore* sem) {
return new QSemaphoreReleaser(sem);
}
QSemaphoreReleaser* QSemaphoreReleaser_new4(QSemaphore* sem, int n) {
return new QSemaphoreReleaser(*sem, static_cast<int>(n));
}
QSemaphoreReleaser* QSemaphoreReleaser_new5(QSemaphore* sem, int n) {
return new QSemaphoreReleaser(sem, static_cast<int>(n));
}
void QSemaphoreReleaser_Swap(QSemaphoreReleaser* self, QSemaphoreReleaser* other) {
self->swap(*other);
}
QSemaphore* QSemaphoreReleaser_Semaphore(const QSemaphoreReleaser* self) {
return self->semaphore();
}
QSemaphore* QSemaphoreReleaser_Cancel(QSemaphoreReleaser* self) {
return self->cancel();
}
void QSemaphoreReleaser_Delete(QSemaphoreReleaser* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QSemaphoreReleaser*>( self );
} else {
delete self;
}
}