miqt/qt/gen_qfileselector.cpp

130 lines
4.8 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();
}
void* QFileSelector_Metacast(QFileSelector* self, const char* param1) {
return self->qt_metacast(param1);
}
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) {
return new QUrl(self->select(*filePath));
}
struct miqt_array* QFileSelector_ExtraSelectors(const QFileSelector* self) {
QStringList _ret = self->extraSelectors();
// Convert QList<> 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 struct miqt_string* */ list) {
QList<QString> list_QList;
list_QList.reserve(list->len);
struct miqt_string** list_arr = static_cast<struct miqt_string**>(list->data);
for(size_t i = 0; i < list->len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(&list_arr[i]->data, list_arr[i]->len);
list_QList.push_back(list_arr_i_QString);
}
self->setExtraSelectors(list_QList);
}
struct miqt_array* QFileSelector_AllSelectors(const QFileSelector* self) {
QStringList _ret = self->allSelectors();
// Convert QList<> 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;
}