miqt/qt/gen_qstandardpaths.cpp

124 lines
5.9 KiB
C++
Raw Normal View History

#include <QList>
#include <QStandardPaths>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include "qstandardpaths.h"
#include "gen_qstandardpaths.h"
#include "_cgo_export.h"
struct miqt_string* QStandardPaths_WritableLocation(uintptr_t typeVal) {
QString _ret = QStandardPaths::writableLocation(static_cast<QStandardPaths::StandardLocation>(typeVal));
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
struct miqt_array* QStandardPaths_StandardLocations(uintptr_t typeVal) {
QStringList _ret = QStandardPaths::standardLocations(static_cast<QStandardPaths::StandardLocation>(typeVal));
// 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];
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
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;
2024-08-29 07:01:51 +00:00
}
struct miqt_string* QStandardPaths_Locate(uintptr_t typeVal, struct miqt_string* fileName) {
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
QString _ret = QStandardPaths::locate(static_cast<QStandardPaths::StandardLocation>(typeVal), fileName_QString);
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
struct miqt_array* QStandardPaths_LocateAll(uintptr_t typeVal, struct miqt_string* fileName) {
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
QStringList _ret = QStandardPaths::locateAll(static_cast<QStandardPaths::StandardLocation>(typeVal), fileName_QString);
// 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];
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
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;
2024-08-29 07:01:51 +00:00
}
struct miqt_string* QStandardPaths_DisplayName(uintptr_t typeVal) {
QString _ret = QStandardPaths::displayName(static_cast<QStandardPaths::StandardLocation>(typeVal));
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
struct miqt_string* QStandardPaths_FindExecutable(struct miqt_string* executableName) {
QString executableName_QString = QString::fromUtf8(&executableName->data, executableName->len);
QString _ret = QStandardPaths::findExecutable(executableName_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());
}
void QStandardPaths_EnableTestMode(bool testMode) {
QStandardPaths::enableTestMode(testMode);
}
void QStandardPaths_SetTestModeEnabled(bool testMode) {
QStandardPaths::setTestModeEnabled(testMode);
}
bool QStandardPaths_IsTestModeEnabled() {
return QStandardPaths::isTestModeEnabled();
}
struct miqt_string* QStandardPaths_Locate3(uintptr_t typeVal, struct miqt_string* fileName, int options) {
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
QString _ret = QStandardPaths::locate(static_cast<QStandardPaths::StandardLocation>(typeVal), fileName_QString, static_cast<QStandardPaths::LocateOptions>(options));
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
struct miqt_array* QStandardPaths_LocateAll3(uintptr_t typeVal, struct miqt_string* fileName, int options) {
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
QStringList _ret = QStandardPaths::locateAll(static_cast<QStandardPaths::StandardLocation>(typeVal), fileName_QString, static_cast<QStandardPaths::LocateOptions>(options));
// 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];
2024-08-29 07:01:51 +00:00
// 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());
2024-08-29 07:01:51 +00:00
}
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;
2024-08-29 07:01:51 +00:00
}
struct miqt_string* QStandardPaths_FindExecutable2(struct miqt_string* executableName, struct miqt_array* /* of struct miqt_string* */ paths) {
QString executableName_QString = QString::fromUtf8(&executableName->data, executableName->len);
QList<QString> paths_QList;
paths_QList.reserve(paths->len);
miqt_string** paths_arr = static_cast<miqt_string**>(paths->data);
for(size_t i = 0; i < paths->len; ++i) {
paths_QList.push_back(QString::fromUtf8(& paths_arr[i]->data, paths_arr[i]->len));
}
QString _ret = QStandardPaths::findExecutable(executableName_QString, paths_QList);
// 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());
}