mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
257 lines
8.4 KiB
C++
257 lines
8.4 KiB
C++
#include <QByteArray>
|
|
#include <QFile>
|
|
#include <QMetaObject>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <qfile.h>
|
|
#include "gen_qfile.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QFile* QFile_new() {
|
|
return new QFile();
|
|
}
|
|
|
|
QFile* QFile_new2(struct miqt_string name) {
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
return new QFile(name_QString);
|
|
}
|
|
|
|
QFile* QFile_new3(QObject* parent) {
|
|
return new QFile(parent);
|
|
}
|
|
|
|
QFile* QFile_new4(struct miqt_string name, QObject* parent) {
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
return new QFile(name_QString, parent);
|
|
}
|
|
|
|
QMetaObject* QFile_MetaObject(const QFile* self) {
|
|
return (QMetaObject*) self->metaObject();
|
|
}
|
|
|
|
void* QFile_Metacast(QFile* self, const char* param1) {
|
|
return self->qt_metacast(param1);
|
|
}
|
|
|
|
struct miqt_string QFile_Tr(const char* s) {
|
|
QString _ret = QFile::tr(s);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
struct miqt_string QFile_FileName(const QFile* self) {
|
|
QString _ret = self->fileName();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
void QFile_SetFileName(QFile* self, struct miqt_string name) {
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
self->setFileName(name_QString);
|
|
}
|
|
|
|
struct miqt_string QFile_EncodeName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QByteArray _qb = QFile::encodeName(fileName_QString);
|
|
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;
|
|
}
|
|
|
|
struct miqt_string QFile_DecodeName(struct miqt_string localFileName) {
|
|
QByteArray localFileName_QByteArray(localFileName.data, localFileName.len);
|
|
QString _ret = QFile::decodeName(localFileName_QByteArray);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
struct miqt_string QFile_DecodeNameWithLocalFileName(const char* localFileName) {
|
|
QString _ret = QFile::decodeName(localFileName);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
bool QFile_Exists(const QFile* self) {
|
|
return self->exists();
|
|
}
|
|
|
|
bool QFile_ExistsWithFileName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
return QFile::exists(fileName_QString);
|
|
}
|
|
|
|
struct miqt_string QFile_SymLinkTarget(const QFile* self) {
|
|
QString _ret = self->symLinkTarget();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
struct miqt_string QFile_SymLinkTargetWithFileName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QString _ret = QFile::symLinkTarget(fileName_QString);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
bool QFile_Remove(QFile* self) {
|
|
return self->remove();
|
|
}
|
|
|
|
bool QFile_RemoveWithFileName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
return QFile::remove(fileName_QString);
|
|
}
|
|
|
|
bool QFile_MoveToTrash(QFile* self) {
|
|
return self->moveToTrash();
|
|
}
|
|
|
|
bool QFile_MoveToTrashWithFileName(struct miqt_string fileName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
return QFile::moveToTrash(fileName_QString);
|
|
}
|
|
|
|
bool QFile_Rename(QFile* self, struct miqt_string newName) {
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return self->rename(newName_QString);
|
|
}
|
|
|
|
bool QFile_Rename2(struct miqt_string oldName, struct miqt_string newName) {
|
|
QString oldName_QString = QString::fromUtf8(oldName.data, oldName.len);
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return QFile::rename(oldName_QString, newName_QString);
|
|
}
|
|
|
|
bool QFile_Link(QFile* self, struct miqt_string newName) {
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return self->link(newName_QString);
|
|
}
|
|
|
|
bool QFile_Link2(struct miqt_string fileName, struct miqt_string newName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return QFile::link(fileName_QString, newName_QString);
|
|
}
|
|
|
|
bool QFile_Copy(QFile* self, struct miqt_string newName) {
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return self->copy(newName_QString);
|
|
}
|
|
|
|
bool QFile_Copy2(struct miqt_string fileName, struct miqt_string newName) {
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
|
QString newName_QString = QString::fromUtf8(newName.data, newName.len);
|
|
return QFile::copy(fileName_QString, newName_QString);
|
|
}
|
|
|
|
bool QFile_Open(QFile* self, int flags) {
|
|
return self->open(static_cast<QIODeviceBase::OpenMode>(flags));
|
|
}
|
|
|
|
bool QFile_Open2(QFile* self, int flags, int permissions) {
|
|
return self->open(static_cast<QIODeviceBase::OpenMode>(flags), static_cast<QFileDevice::Permissions>(permissions));
|
|
}
|
|
|
|
bool QFile_Open4(QFile* self, int fd, int ioFlags) {
|
|
return self->open(static_cast<int>(fd), static_cast<QIODeviceBase::OpenMode>(ioFlags));
|
|
}
|
|
|
|
long long QFile_Size(const QFile* self) {
|
|
qint64 _ret = self->size();
|
|
return static_cast<long long>(_ret);
|
|
}
|
|
|
|
bool QFile_Resize(QFile* self, long long sz) {
|
|
return self->resize(static_cast<qint64>(sz));
|
|
}
|
|
|
|
bool QFile_Resize2(struct miqt_string filename, long long sz) {
|
|
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
|
|
return QFile::resize(filename_QString, static_cast<qint64>(sz));
|
|
}
|
|
|
|
int QFile_Permissions(const QFile* self) {
|
|
QFileDevice::Permissions _ret = self->permissions();
|
|
return static_cast<int>(_ret);
|
|
}
|
|
|
|
int QFile_PermissionsWithFilename(struct miqt_string filename) {
|
|
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
|
|
QFileDevice::Permissions _ret = QFile::permissions(filename_QString);
|
|
return static_cast<int>(_ret);
|
|
}
|
|
|
|
bool QFile_SetPermissions(QFile* self, int permissionSpec) {
|
|
return self->setPermissions(static_cast<QFileDevice::Permissions>(permissionSpec));
|
|
}
|
|
|
|
bool QFile_SetPermissions2(struct miqt_string filename, int permissionSpec) {
|
|
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
|
|
return QFile::setPermissions(filename_QString, static_cast<QFileDevice::Permissions>(permissionSpec));
|
|
}
|
|
|
|
struct miqt_string QFile_Tr2(const char* s, const char* c) {
|
|
QString _ret = QFile::tr(s, c);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
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;
|
|
}
|
|
|
|
struct miqt_string QFile_Tr3(const char* s, const char* c, int n) {
|
|
QString _ret = QFile::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();
|
|
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;
|
|
}
|
|
|
|
bool QFile_Open33(QFile* self, int fd, int ioFlags, int handleFlags) {
|
|
return self->open(static_cast<int>(fd), static_cast<QIODeviceBase::OpenMode>(ioFlags), static_cast<QFileDevice::FileHandleFlags>(handleFlags));
|
|
}
|
|
|
|
void QFile_Delete(QFile* self) {
|
|
delete self;
|
|
}
|
|
|