miqt/qt6/gen_qpluginloader.cpp

159 lines
4.9 KiB
C++
Raw Permalink Normal View History

2024-10-20 05:21:03 +00:00
#include <QJsonObject>
#include <QList>
#include <QMetaObject>
#include <QObject>
#include <QPluginLoader>
#include <QStaticPlugin>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qpluginloader.h>
#include "gen_qpluginloader.h"
#include "_cgo_export.h"
QPluginLoader* QPluginLoader_new() {
return new QPluginLoader();
}
QPluginLoader* QPluginLoader_new2(struct miqt_string fileName) {
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
return new QPluginLoader(fileName_QString);
}
QPluginLoader* QPluginLoader_new3(QObject* parent) {
return new QPluginLoader(parent);
}
QPluginLoader* QPluginLoader_new4(struct miqt_string fileName, QObject* parent) {
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
return new QPluginLoader(fileName_QString, parent);
}
QMetaObject* QPluginLoader_MetaObject(const QPluginLoader* self) {
return (QMetaObject*) self->metaObject();
}
void* QPluginLoader_Metacast(QPluginLoader* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QPluginLoader_Tr(const char* s) {
QString _ret = QPluginLoader::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;
}
QObject* QPluginLoader_Instance(QPluginLoader* self) {
return self->instance();
}
QJsonObject* QPluginLoader_MetaData(const QPluginLoader* self) {
return new QJsonObject(self->metaData());
}
struct miqt_array* QPluginLoader_StaticInstances() {
QObjectList _ret = QPluginLoader::staticInstances();
// Convert QList<> from C++ memory to manually-managed C memory
QObject** _arr = static_cast<QObject**>(malloc(sizeof(QObject*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QPluginLoader_StaticPlugins() {
QList<QStaticPlugin> _ret = QPluginLoader::staticPlugins();
// Convert QList<> from C++ memory to manually-managed C memory
QStaticPlugin** _arr = static_cast<QStaticPlugin**>(malloc(sizeof(QStaticPlugin*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QStaticPlugin(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
return _out;
}
bool QPluginLoader_Load(QPluginLoader* self) {
return self->load();
}
bool QPluginLoader_Unload(QPluginLoader* self) {
return self->unload();
}
bool QPluginLoader_IsLoaded(const QPluginLoader* self) {
return self->isLoaded();
}
void QPluginLoader_SetFileName(QPluginLoader* self, struct miqt_string fileName) {
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
self->setFileName(fileName_QString);
}
struct miqt_string QPluginLoader_FileName(const QPluginLoader* self) {
QString _ret = self->fileName();
// 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 QPluginLoader_ErrorString(const QPluginLoader* self) {
QString _ret = self->errorString();
// 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 QPluginLoader_SetLoadHints(QPluginLoader* self, int loadHints) {
self->setLoadHints(static_cast<QLibrary::LoadHints>(loadHints));
}
int QPluginLoader_LoadHints(const QPluginLoader* self) {
QLibrary::LoadHints _ret = self->loadHints();
return static_cast<int>(_ret);
}
struct miqt_string QPluginLoader_Tr2(const char* s, const char* c) {
QString _ret = QPluginLoader::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 QPluginLoader_Tr3(const char* s, const char* c, int n) {
QString _ret = QPluginLoader::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;
}
void QPluginLoader_Delete(QPluginLoader* self) {
delete self;
}