2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QList>
|
|
|
|
#include <QLocale>
|
|
|
|
#include <QResource>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qresource.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qresource.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QResource* QResource_new() {
|
|
|
|
return new QResource();
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QResource* QResource_new2(struct miqt_string file) {
|
|
|
|
QString file_QString = QString::fromUtf8(file.data, file.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QResource(file_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QResource* QResource_new3(struct miqt_string file, QLocale* locale) {
|
|
|
|
QString file_QString = QString::fromUtf8(file.data, file.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QResource(file_QString, *locale);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QResource_SetFileName(QResource* self, struct miqt_string file) {
|
|
|
|
QString file_QString = QString::fromUtf8(file.data, file.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setFileName(file_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QResource_FileName(const QResource* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->fileName();
|
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();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _b.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QResource_AbsoluteFilePath(const QResource* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->absoluteFilePath();
|
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();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _b.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QResource_SetLocale(QResource* self, QLocale* locale) {
|
|
|
|
self->setLocale(*locale);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QLocale* QResource_Locale(const QResource* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QLocale(self->locale());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QResource_IsValid(const QResource* self) {
|
|
|
|
return self->isValid();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QResource_CompressionAlgorithm(const QResource* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QResource::Compression _ret = self->compressionAlgorithm();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
long long QResource_Size(const QResource* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qint64 _ret = self->size();
|
|
|
|
return static_cast<long long>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
const unsigned char* QResource_Data(const QResource* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
const uchar* _ret = self->data();
|
|
|
|
return static_cast<const unsigned char*>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
long long QResource_UncompressedSize(const QResource* self) {
|
2024-09-18 00:12:02 +00:00
|
|
|
qint64 _ret = self->uncompressedSize();
|
|
|
|
return static_cast<long long>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QResource_UncompressedData(const QResource* self) {
|
|
|
|
QByteArray _qb = self->uncompressedData();
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QDateTime* QResource_LastModified(const QResource* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QDateTime(self->lastModified());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QResource_AddSearchPath(struct miqt_string path) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
QResource::addSearchPath(path_QString);
|
|
|
|
}
|
|
|
|
|
2024-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of struct miqt_string */ QResource_SearchPaths() {
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = QResource::searchPaths();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QResource_IsCompressed(const QResource* self) {
|
|
|
|
return self->isCompressed();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_RegisterResource(struct miqt_string rccFilename) {
|
|
|
|
QString rccFilename_QString = QString::fromUtf8(rccFilename.data, rccFilename.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return QResource::registerResource(rccFilename_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_UnregisterResource(struct miqt_string rccFilename) {
|
|
|
|
QString rccFilename_QString = QString::fromUtf8(rccFilename.data, rccFilename.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return QResource::unregisterResource(rccFilename_QString);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QResource_RegisterResourceWithRccData(const unsigned char* rccData) {
|
|
|
|
return QResource::registerResource(static_cast<const uchar*>(rccData));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QResource_UnregisterResourceWithRccData(const unsigned char* rccData) {
|
|
|
|
return QResource::unregisterResource(static_cast<const uchar*>(rccData));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_RegisterResource2(struct miqt_string rccFilename, struct miqt_string resourceRoot) {
|
|
|
|
QString rccFilename_QString = QString::fromUtf8(rccFilename.data, rccFilename.len);
|
|
|
|
QString resourceRoot_QString = QString::fromUtf8(resourceRoot.data, resourceRoot.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return QResource::registerResource(rccFilename_QString, resourceRoot_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_UnregisterResource2(struct miqt_string rccFilename, struct miqt_string resourceRoot) {
|
|
|
|
QString rccFilename_QString = QString::fromUtf8(rccFilename.data, rccFilename.len);
|
|
|
|
QString resourceRoot_QString = QString::fromUtf8(resourceRoot.data, resourceRoot.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return QResource::unregisterResource(rccFilename_QString, resourceRoot_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_RegisterResource22(const unsigned char* rccData, struct miqt_string resourceRoot) {
|
|
|
|
QString resourceRoot_QString = QString::fromUtf8(resourceRoot.data, resourceRoot.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return QResource::registerResource(static_cast<const uchar*>(rccData), resourceRoot_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QResource_UnregisterResource22(const unsigned char* rccData, struct miqt_string resourceRoot) {
|
|
|
|
QString resourceRoot_QString = QString::fromUtf8(resourceRoot.data, resourceRoot.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return QResource::unregisterResource(static_cast<const uchar*>(rccData), resourceRoot_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QResource_Delete(QResource* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|