miqt/qt/gen_qobjectcleanuphandler.cpp

97 lines
3.3 KiB
C++
Raw Normal View History

#include <QMetaObject>
#include <QObject>
#include <QObjectCleanupHandler>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include "qobjectcleanuphandler.h"
2024-08-29 07:01:51 +00:00
#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(QObjectCleanupHandler* self) {
2024-08-29 07:01:51 +00:00
return (QMetaObject*) const_cast<const QObjectCleanupHandler*>(self)->metaObject();
}
2024-08-29 07:01:51 +00:00
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();
}
2024-08-29 07:01:51 +00:00
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(QObjectCleanupHandler* self) {
2024-08-29 07:01:51 +00:00
return const_cast<const QObjectCleanupHandler*>(self)->isEmpty();
}
void QObjectCleanupHandler_Clear(QObjectCleanupHandler* self) {
self->clear();
}
2024-08-29 07:01:51 +00:00
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();
}
2024-08-29 07:01:51 +00:00
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();
}
2024-08-29 07:01:51 +00:00
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();
}
2024-08-29 07:01:51 +00:00
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;
}