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"
|
|
|
|
#include "gen_qmimedata.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QMimeData* QMimeData_new() {
|
|
|
|
return new QMimeData();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QMimeData_MetaObject(const QMimeData* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
void* QMimeData_Metacast(QMimeData* self, const char* param1) {
|
|
|
|
return self->qt_metacast(param1);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_Tr(const char* s) {
|
|
|
|
QString _ret = QMimeData::tr(s);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_TrUtf8(const char* s) {
|
|
|
|
QString _ret = QMimeData::trUtf8(s);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QMimeData_Urls(const QMimeData* self) {
|
|
|
|
QList<QUrl> _ret = self->urls();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QUrl** _arr = static_cast<QUrl**>(malloc(sizeof(QUrl*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QUrl(_ret[i]);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-16 07:33:40 +00:00
|
|
|
void QMimeData_SetUrls(QMimeData* self, struct miqt_array* /* of QUrl* */ urls) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QList<QUrl> urls_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
urls_QList.reserve(urls->len);
|
|
|
|
QUrl** urls_arr = static_cast<QUrl**>(urls->data);
|
|
|
|
for(size_t i = 0; i < urls->len; ++i) {
|
|
|
|
urls_QList.push_back(*(urls_arr[i]));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
self->setUrls(urls_QList);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QMimeData_HasUrls(const QMimeData* self) {
|
|
|
|
return self->hasUrls();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_Text(const QMimeData* self) {
|
|
|
|
QString _ret = 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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QMimeData_SetText(QMimeData* self, struct miqt_string* text) {
|
|
|
|
QString text_QString = QString::fromUtf8(&text->data, text->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setText(text_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QMimeData_HasText(const QMimeData* self) {
|
|
|
|
return self->hasText();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_Html(const QMimeData* self) {
|
|
|
|
QString _ret = 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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QMimeData_SetHtml(QMimeData* self, struct miqt_string* html) {
|
|
|
|
QString html_QString = QString::fromUtf8(&html->data, html->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setHtml(html_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QMimeData_HasHtml(const QMimeData* self) {
|
|
|
|
return self->hasHtml();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QVariant* QMimeData_ImageData(const QMimeData* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->imageData());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetImageData(QMimeData* self, QVariant* image) {
|
|
|
|
self->setImageData(*image);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QMimeData_HasImage(const QMimeData* self) {
|
|
|
|
return self->hasImage();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QVariant* QMimeData_ColorData(const QMimeData* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->colorData());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_SetColorData(QMimeData* self, QVariant* color) {
|
|
|
|
self->setColorData(*color);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QMimeData_HasColor(const QMimeData* self) {
|
|
|
|
return self->hasColor();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray* QMimeData_Data(const QMimeData* self, struct miqt_string* mimetype) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(&mimetype->data, mimetype->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QByteArray(self->data(mimetype_QString));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QMimeData_SetData(QMimeData* self, struct miqt_string* mimetype, QByteArray* data) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(&mimetype->data, mimetype->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setData(mimetype_QString, *data);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QMimeData_RemoveFormat(QMimeData* self, struct miqt_string* mimetype) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(&mimetype->data, mimetype->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->removeFormat(mimetype_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
bool QMimeData_HasFormat(const QMimeData* self, struct miqt_string* mimetype) {
|
|
|
|
QString mimetype_QString = QString::fromUtf8(&mimetype->data, mimetype->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->hasFormat(mimetype_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QMimeData_Formats(const QMimeData* self) {
|
|
|
|
QStringList _ret = self->formats();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string** _arr = static_cast<struct miqt_string**>(malloc(sizeof(struct miqt_string*) * _ret.length()));
|
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
|
|
|
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Clear(QMimeData* self) {
|
|
|
|
self->clear();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_Tr2(const char* s, const char* c) {
|
|
|
|
QString _ret = QMimeData::tr(s, c);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_Tr3(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QMimeData::tr(s, c, static_cast<int>(n));
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_TrUtf82(const char* s, const char* c) {
|
|
|
|
QString _ret = QMimeData::trUtf8(s, c);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeData_TrUtf83(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QMimeData::trUtf8(s, c, static_cast<int>(n));
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QMimeData_Delete(QMimeData* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|