2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QMimeData>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QVariant>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qmimedata.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qmimedata.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QMimeData* QMimeData_new() {
|
|
|
|
return new QMimeData();
|
|
|
|
}
|
|
|
|
|
|
|
|
QMetaObject* QMimeData_MetaObject(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QMimeData*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QMimeData_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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 QMimeData_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Urls(QMimeData* self, QUrl*** _out, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QList<QUrl> ret = const_cast<const QMimeData*>(self)->urls();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
|
|
|
|
QUrl** __out = static_cast<QUrl**>(malloc(sizeof(QUrl**) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = new QUrl(ret[i]);
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetUrls(QMimeData* self, QUrl** urls, size_t urls_len) {
|
|
|
|
QList<QUrl> urls_QList;
|
|
|
|
urls_QList.reserve(urls_len);
|
|
|
|
for(size_t i = 0; i < urls_len; ++i) {
|
|
|
|
urls_QList.push_back(*(urls[i]));
|
|
|
|
}
|
|
|
|
self->setUrls(urls_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasUrls(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasUrls();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Text(QMimeData* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QMimeData*>(self)->text();
|
2024-08-25 04:08:24 +00:00
|
|
|
// 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 QMimeData_SetText(QMimeData* self, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->setText(text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasText(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasText();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Html(QMimeData* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QMimeData*>(self)->html();
|
2024-08-25 04:08:24 +00:00
|
|
|
// 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 QMimeData_SetHtml(QMimeData* self, const char* html, size_t html_Strlen) {
|
|
|
|
QString html_QString = QString::fromUtf8(html, html_Strlen);
|
|
|
|
self->setHtml(html_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasHtml(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasHtml();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QVariant* QMimeData_ImageData(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QVariant ret = const_cast<const QMimeData*>(self)->imageData();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QVariant*>(new QVariant(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetImageData(QMimeData* self, QVariant* image) {
|
|
|
|
self->setImageData(*image);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasImage(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasImage();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QVariant* QMimeData_ColorData(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QVariant ret = const_cast<const QMimeData*>(self)->colorData();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QVariant*>(new QVariant(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetColorData(QMimeData* self, QVariant* color) {
|
|
|
|
self->setColorData(*color);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasColor(QMimeData* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasColor();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QMimeData_Data(QMimeData* self, const char* mimetype, size_t mimetype_Strlen) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(mimetype, mimetype_Strlen);
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QMimeData*>(self)->data(mimetype_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetData(QMimeData* self, const char* mimetype, size_t mimetype_Strlen, QByteArray* data) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(mimetype, mimetype_Strlen);
|
|
|
|
self->setData(mimetype_QString, *data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_RemoveFormat(QMimeData* self, const char* mimetype, size_t mimetype_Strlen) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(mimetype, mimetype_Strlen);
|
|
|
|
self->removeFormat(mimetype_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QMimeData_HasFormat(QMimeData* self, const char* mimetype, size_t mimetype_Strlen) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(mimetype, mimetype_Strlen);
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QMimeData*>(self)->hasFormat(mimetype_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Formats(QMimeData* self, char*** _out, int** _out_Lengths, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QStringList ret = const_cast<const QMimeData*>(self)->formats();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QStringList from C++ memory to manually-managed C memory
|
|
|
|
char** __out = static_cast<char**>(malloc(sizeof(char*) * ret.length()));
|
|
|
|
int* __out_Lengths = static_cast<int*>(malloc(sizeof(int) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret[i].toUtf8();
|
|
|
|
__out[i] = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(__out[i], b.data(), b.length());
|
|
|
|
__out_Lengths[i] = b.length();
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_Lengths = __out_Lengths;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Clear(QMimeData* self) {
|
|
|
|
self->clear();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QMimeData_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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 QMimeData_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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 QMimeData_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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 QMimeData_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QMimeData::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 QMimeData_Delete(QMimeData* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|