mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
156 lines
5.2 KiB
C++
156 lines
5.2 KiB
C++
#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();
|
|
}
|
|
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QPluginLoader_TrUtf8(const char* s) {
|
|
QString _ret = QPluginLoader::trUtf8(s);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
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() {
|
|
QVector<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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QPluginLoader_TrUtf82(const char* s, const char* c) {
|
|
QString _ret = QPluginLoader::trUtf8(s, c);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QPluginLoader_TrUtf83(const char* s, const char* c, int n) {
|
|
QString _ret = QPluginLoader::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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
void QPluginLoader_Delete(QPluginLoader* self) {
|
|
delete self;
|
|
}
|
|
|