#include #include #include #include #include #include #include "qlibrary.h" #include "gen_qlibrary.h" extern "C" { extern void miqt_exec_callback(void* cb, int argc, void* argv); } QLibrary* QLibrary_new() { return new QLibrary(); } QLibrary* QLibrary_new2(const char* fileName, size_t fileName_Strlen) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QLibrary(fileName_QString); } QLibrary* QLibrary_new3(const char* fileName, size_t fileName_Strlen, int verNum) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QLibrary(fileName_QString, static_cast(verNum)); } QLibrary* QLibrary_new4(const char* fileName, size_t fileName_Strlen, const char* version, size_t version_Strlen) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); QString version_QString = QString::fromUtf8(version, version_Strlen); return new QLibrary(fileName_QString, version_QString); } QLibrary* QLibrary_new5(QObject* parent) { return new QLibrary(parent); } QLibrary* QLibrary_new6(const char* fileName, size_t fileName_Strlen, QObject* parent) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QLibrary(fileName_QString, parent); } QLibrary* QLibrary_new7(const char* fileName, size_t fileName_Strlen, int verNum, QObject* parent) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return new QLibrary(fileName_QString, static_cast(verNum), parent); } QLibrary* QLibrary_new8(const char* fileName, size_t fileName_Strlen, const char* version, size_t version_Strlen, QObject* parent) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); QString version_QString = QString::fromUtf8(version, version_Strlen); return new QLibrary(fileName_QString, version_QString, parent); } QMetaObject* QLibrary_MetaObject(const QLibrary* self) { return (QMetaObject*) self->metaObject(); } void QLibrary_Tr(const char* s, char** _out, int* _out_Strlen) { QString ret = QLibrary::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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_TrUtf8(const char* s, char** _out, int* _out_Strlen) { QString ret = QLibrary::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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } bool QLibrary_Load(QLibrary* self) { return self->load(); } bool QLibrary_Unload(QLibrary* self) { return self->unload(); } bool QLibrary_IsLoaded(const QLibrary* self) { return self->isLoaded(); } bool QLibrary_IsLibrary(const char* fileName, size_t fileName_Strlen) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); return QLibrary::isLibrary(fileName_QString); } void QLibrary_SetFileName(QLibrary* self, const char* fileName, size_t fileName_Strlen) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); self->setFileName(fileName_QString); } void QLibrary_FileName(const QLibrary* self, char** _out, int* _out_Strlen) { 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(); *_out = static_cast(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_SetFileNameAndVersion(QLibrary* self, const char* fileName, size_t fileName_Strlen, int verNum) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); self->setFileNameAndVersion(fileName_QString, static_cast(verNum)); } void QLibrary_SetFileNameAndVersion2(QLibrary* self, const char* fileName, size_t fileName_Strlen, const char* version, size_t version_Strlen) { QString fileName_QString = QString::fromUtf8(fileName, fileName_Strlen); QString version_QString = QString::fromUtf8(version, version_Strlen); self->setFileNameAndVersion(fileName_QString, version_QString); } void QLibrary_ErrorString(const QLibrary* self, char** _out, int* _out_Strlen) { 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(); *_out = static_cast(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_SetLoadHints(QLibrary* self, int hints) { self->setLoadHints(static_cast(hints)); } int QLibrary_LoadHints(const QLibrary* self) { QLibrary::LoadHints ret = self->loadHints(); return static_cast(ret); } void QLibrary_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) { QString ret = QLibrary::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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) { QString ret = QLibrary::tr(s, c, static_cast(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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) { QString ret = QLibrary::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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) { QString ret = QLibrary::trUtf8(s, c, static_cast(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(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } void QLibrary_Delete(QLibrary* self) { delete self; }