miqt/qt/gen_qfileselector.cpp

127 lines
4.7 KiB
C++

#include <QFileSelector>
#include <QList>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <QUrl>
#include "qfileselector.h"
#include "gen_qfileselector.h"
#include "_cgo_export.h"
QFileSelector* QFileSelector_new() {
return new QFileSelector();
}
QFileSelector* QFileSelector_new2(QObject* parent) {
return new QFileSelector(parent);
}
QMetaObject* QFileSelector_MetaObject(const QFileSelector* self) {
return (QMetaObject*) self->metaObject();
}
struct miqt_string* QFileSelector_Tr(const char* s) {
QString _ret = QFileSelector::tr(s);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QFileSelector_TrUtf8(const char* s) {
QString _ret = QFileSelector::trUtf8(s);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QFileSelector_Select(const QFileSelector* self, struct miqt_string* filePath) {
QString filePath_QString = QString::fromUtf8(&filePath->data, filePath->len);
QString _ret = self->select(filePath_QString);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
return miqt_strdup(_b.data(), _b.length());
}
QUrl* QFileSelector_SelectWithFilePath(const QFileSelector* self, QUrl* filePath) {
QUrl _ret = self->select(*filePath);
// Copy-construct value returned type into heap-allocated copy
return static_cast<QUrl*>(new QUrl(_ret));
}
struct miqt_array* QFileSelector_ExtraSelectors(const QFileSelector* self) {
QStringList _ret = self->extraSelectors();
// Convert QStringList from C++ memory to manually-managed C memory
struct miqt_string** _arr = static_cast<struct miqt_string**>(malloc(sizeof(struct miqt_string*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
QString _lv_ret = _ret[i];
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _lv_b = _lv_ret.toUtf8();
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
}
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;
}
void QFileSelector_SetExtraSelectors(QFileSelector* self, struct miqt_array* /* of QString */ list) {
QList<QString> list_QList;
list_QList.reserve(list->len);
miqt_string** list_arr = static_cast<miqt_string**>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.push_back(QString::fromUtf8(& list_arr[i]->data, list_arr[i]->len));
}
self->setExtraSelectors(list_QList);
}
struct miqt_array* QFileSelector_AllSelectors(const QFileSelector* self) {
QStringList _ret = self->allSelectors();
// Convert QStringList from C++ memory to manually-managed C memory
struct miqt_string** _arr = static_cast<struct miqt_string**>(malloc(sizeof(struct miqt_string*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
QString _lv_ret = _ret[i];
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _lv_b = _lv_ret.toUtf8();
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
}
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;
}
struct miqt_string* QFileSelector_Tr2(const char* s, const char* c) {
QString _ret = QFileSelector::tr(s, c);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QFileSelector_Tr3(const char* s, const char* c, int n) {
QString _ret = QFileSelector::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();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QFileSelector_TrUtf82(const char* s, const char* c) {
QString _ret = QFileSelector::trUtf8(s, c);
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QFileSelector_TrUtf83(const char* s, const char* c, int n) {
QString _ret = QFileSelector::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();
return miqt_strdup(_b.data(), _b.length());
}
void QFileSelector_Delete(QFileSelector* self) {
delete self;
}