2024-08-29 07:01:51 +00:00
|
|
|
#include <QDateTime>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QFileDevice>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qfiledevice.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qfiledevice.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QMetaObject* QFileDevice_MetaObject(QFileDevice* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QFileDevice*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QFileDevice_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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 QFileDevice_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
uintptr_t QFileDevice_Error(QFileDevice* self) {
|
|
|
|
QFileDevice::FileError ret = const_cast<const QFileDevice*>(self)->error();
|
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QFileDevice_UnsetError(QFileDevice* self) {
|
|
|
|
self->unsetError();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QFileDevice_Close(QFileDevice* self) {
|
|
|
|
self->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_IsSequential(QFileDevice* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QFileDevice*>(self)->isSequential();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QFileDevice_Handle(QFileDevice* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QFileDevice*>(self)->handle();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QFileDevice_FileName(QFileDevice* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QFileDevice*>(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
|
|
|
|
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
|
|
|
long long QFileDevice_Pos(QFileDevice* self) {
|
|
|
|
return const_cast<const QFileDevice*>(self)->pos();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QFileDevice_Seek(QFileDevice* self, long long offset) {
|
|
|
|
return self->seek(static_cast<qint64>(offset));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_AtEnd(QFileDevice* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QFileDevice*>(self)->atEnd();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_Flush(QFileDevice* self) {
|
|
|
|
return self->flush();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
long long QFileDevice_Size(QFileDevice* self) {
|
|
|
|
return const_cast<const QFileDevice*>(self)->size();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QFileDevice_Resize(QFileDevice* self, long long sz) {
|
|
|
|
return self->resize(static_cast<qint64>(sz));
|
|
|
|
}
|
|
|
|
|
|
|
|
int QFileDevice_Permissions(QFileDevice* self) {
|
|
|
|
QFileDevice::Permissions ret = const_cast<const QFileDevice*>(self)->permissions();
|
|
|
|
return static_cast<int>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_SetPermissions(QFileDevice* self, int permissionSpec) {
|
|
|
|
return self->setPermissions(static_cast<QFileDevice::Permissions>(permissionSpec));
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char* QFileDevice_Map(QFileDevice* self, long long offset, long long size) {
|
|
|
|
return self->map(static_cast<qint64>(offset), static_cast<qint64>(size));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_Unmap(QFileDevice* self, unsigned char* address) {
|
|
|
|
return self->unmap(static_cast<uchar*>(address));
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QDateTime* QFileDevice_FileTime(QFileDevice* self, uintptr_t time) {
|
|
|
|
QDateTime ret = const_cast<const QFileDevice*>(self)->fileTime(static_cast<QFileDevice::FileTime>(time));
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QDateTime*>(new QDateTime(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QFileDevice_SetFileTime(QFileDevice* self, QDateTime* newDate, uintptr_t fileTime) {
|
|
|
|
return self->setFileTime(*newDate, static_cast<QFileDevice::FileTime>(fileTime));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QFileDevice_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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 QFileDevice_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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 QFileDevice_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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 QFileDevice_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QFileDevice::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();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
unsigned char* QFileDevice_Map3(QFileDevice* self, long long offset, long long size, uintptr_t flags) {
|
|
|
|
return self->map(static_cast<qint64>(offset), static_cast<qint64>(size), static_cast<QFileDevice::MemoryMapFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QFileDevice_Delete(QFileDevice* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|