2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QFileInfo>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QIODevice>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMimeDatabase>
|
|
|
|
#include <QMimeType>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QUrl>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qmimedatabase.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qmimedatabase.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QMimeDatabase* QMimeDatabase_new() {
|
|
|
|
return new QMimeDatabase();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForName(const QMimeDatabase* self, struct miqt_string* nameOrAlias) {
|
|
|
|
QString nameOrAlias_QString = QString::fromUtf8(&nameOrAlias->data, nameOrAlias->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForName(nameOrAlias_QString));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFile(const QMimeDatabase* self, struct miqt_string* fileName) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFile(fileName_QString));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFileWithFileInfo(const QMimeDatabase* self, QFileInfo* fileInfo) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFile(*fileInfo));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QMimeDatabase_MimeTypesForFileName(const QMimeDatabase* self, struct miqt_string* fileName) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
|
|
QList<QMimeType> _ret = self->mimeTypesForFileName(fileName_QString);
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QMimeType** _arr = static_cast<QMimeType**>(malloc(sizeof(QMimeType*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QMimeType(_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-11 05:41:09 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForData(const QMimeDatabase* self, QByteArray* data) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForData(*data));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForDataWithDevice(const QMimeDatabase* self, QIODevice* device) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForData(device));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForUrl(const QMimeDatabase* self, QUrl* url) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForUrl(*url));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFileNameAndData(const QMimeDatabase* self, struct miqt_string* fileName, QIODevice* device) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFileNameAndData(fileName_QString, device));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFileNameAndData2(const QMimeDatabase* self, struct miqt_string* fileName, QByteArray* data) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFileNameAndData(fileName_QString, *data));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QMimeDatabase_SuffixForFileName(const QMimeDatabase* self, struct miqt_string* fileName) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
|
|
QString _ret = self->suffixForFileName(fileName_QString);
|
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* QMimeDatabase_AllMimeTypes(const QMimeDatabase* self) {
|
|
|
|
QList<QMimeType> _ret = self->allMimeTypes();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QMimeType** _arr = static_cast<QMimeType**>(malloc(sizeof(QMimeType*) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = new QMimeType(_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-18 00:12:02 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFile2(const QMimeDatabase* self, struct miqt_string* fileName, int mode) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFile(fileName_QString, static_cast<QMimeDatabase::MatchMode>(mode)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QMimeType* QMimeDatabase_MimeTypeForFile22(const QMimeDatabase* self, QFileInfo* fileInfo, int mode) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QMimeType(self->mimeTypeForFile(*fileInfo, static_cast<QMimeDatabase::MatchMode>(mode)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QMimeDatabase_Delete(QMimeDatabase* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|