miqt/qt/gen_qobjectcleanuphandler.cpp

97 lines
3.2 KiB
C++

#include <QMetaObject>
#include <QObject>
#include <QObjectCleanupHandler>
#include <QString>
#include <QByteArray>
#include <cstring>
#include "qobjectcleanuphandler.h"
#include "gen_qobjectcleanuphandler.h"
extern "C" {
extern void miqt_exec_callback(void* cb, int argc, void* argv);
}
QObjectCleanupHandler* QObjectCleanupHandler_new() {
return new QObjectCleanupHandler();
}
QMetaObject* QObjectCleanupHandler_MetaObject(const QObjectCleanupHandler* self) {
return (QMetaObject*) self->metaObject();
}
void QObjectCleanupHandler_Tr(const char* s, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::tr(s);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray b = ret.toUtf8();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
void QObjectCleanupHandler_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::trUtf8(s);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray b = ret.toUtf8();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
QObject* QObjectCleanupHandler_Add(QObjectCleanupHandler* self, QObject* object) {
return self->add(object);
}
void QObjectCleanupHandler_Remove(QObjectCleanupHandler* self, QObject* object) {
self->remove(object);
}
bool QObjectCleanupHandler_IsEmpty(const QObjectCleanupHandler* self) {
return self->isEmpty();
}
void QObjectCleanupHandler_Clear(QObjectCleanupHandler* self) {
self->clear();
}
void QObjectCleanupHandler_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::tr(s, c);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray b = ret.toUtf8();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
void QObjectCleanupHandler_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::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();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
void QObjectCleanupHandler_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::trUtf8(s, c);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray b = ret.toUtf8();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
void QObjectCleanupHandler_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
QString ret = QObjectCleanupHandler::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();
*_out = static_cast<char*>(malloc(b.length()));
memcpy(*_out, b.data(), b.length());
*_out_Strlen = b.length();
}
void QObjectCleanupHandler_Delete(QObjectCleanupHandler* self) {
delete self;
}