2024-08-29 07:01:51 +00:00
|
|
|
#include <QDir>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QDirIterator>
|
|
|
|
#include <QFileInfo>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QList>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qdiriterator.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qdiriterator.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QDirIterator* QDirIterator_new(QDir* dir) {
|
|
|
|
return new QDirIterator(*dir);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new2(struct miqt_string path) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QDirIterator(path_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new3(struct miqt_string path, int filter) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QDirIterator(path_QString, static_cast<QDir::Filters>(filter));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new4(struct miqt_string path, struct miqt_array* /* of struct miqt_string */ nameFilters) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList nameFilters_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_QList.reserve(nameFilters->len);
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* nameFilters_arr = static_cast<struct miqt_string*>(nameFilters->data);
|
2024-09-14 22:29:05 +00:00
|
|
|
for(size_t i = 0; i < nameFilters->len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString nameFilters_arr_i_QString = QString::fromUtf8(nameFilters_arr[i].data, nameFilters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
nameFilters_QList.push_back(nameFilters_arr_i_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
return new QDirIterator(path_QString, nameFilters_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
QDirIterator* QDirIterator_new5(QDir* dir, int flags) {
|
|
|
|
return new QDirIterator(*dir, static_cast<QDirIterator::IteratorFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new6(struct miqt_string path, int flags) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QDirIterator(path_QString, static_cast<QDirIterator::IteratorFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new7(struct miqt_string path, int filter, int flags) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QDirIterator(path_QString, static_cast<QDir::Filters>(filter), static_cast<QDirIterator::IteratorFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new8(struct miqt_string path, struct miqt_array* /* of struct miqt_string */ nameFilters, int filters) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList nameFilters_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_QList.reserve(nameFilters->len);
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* nameFilters_arr = static_cast<struct miqt_string*>(nameFilters->data);
|
2024-09-14 22:29:05 +00:00
|
|
|
for(size_t i = 0; i < nameFilters->len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString nameFilters_arr_i_QString = QString::fromUtf8(nameFilters_arr[i].data, nameFilters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
nameFilters_QList.push_back(nameFilters_arr_i_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
return new QDirIterator(path_QString, nameFilters_QList, static_cast<QDir::Filters>(filters));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QDirIterator* QDirIterator_new9(struct miqt_string path, struct miqt_array* /* of struct miqt_string */ nameFilters, int filters, int flags) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList nameFilters_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_QList.reserve(nameFilters->len);
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* nameFilters_arr = static_cast<struct miqt_string*>(nameFilters->data);
|
2024-09-14 22:29:05 +00:00
|
|
|
for(size_t i = 0; i < nameFilters->len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString nameFilters_arr_i_QString = QString::fromUtf8(nameFilters_arr[i].data, nameFilters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
nameFilters_QList.push_back(nameFilters_arr_i_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
return new QDirIterator(path_QString, nameFilters_QList, static_cast<QDir::Filters>(filters), static_cast<QDirIterator::IteratorFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirIterator_Next(QDirIterator* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->next();
|
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-09-11 05:41:09 +00:00
|
|
|
bool QDirIterator_HasNext(const QDirIterator* self) {
|
|
|
|
return self->hasNext();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirIterator_FileName(const QDirIterator* 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 QDirIterator_FilePath(const QDirIterator* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->filePath();
|
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-09-11 05:41:09 +00:00
|
|
|
QFileInfo* QDirIterator_FileInfo(const QDirIterator* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QFileInfo(self->fileInfo());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirIterator_Path(const QDirIterator* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->path();
|
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 QDirIterator_Delete(QDirIterator* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|