miqt/qt6/gen_qtranslator.cpp
2024-10-21 19:10:31 +13:00

185 lines
7.5 KiB
C++

#include <QLocale>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <QTranslator>
#include <qtranslator.h>
#include "gen_qtranslator.h"
#include "_cgo_export.h"
QTranslator* QTranslator_new() {
return new QTranslator();
}
QTranslator* QTranslator_new2(QObject* parent) {
return new QTranslator(parent);
}
QMetaObject* QTranslator_MetaObject(const QTranslator* self) {
return (QMetaObject*) self->metaObject();
}
void* QTranslator_Metacast(QTranslator* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QTranslator_Tr(const char* s) {
QString _ret = QTranslator::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 QTranslator_Translate(const QTranslator* self, const char* context, const char* sourceText) {
QString _ret = self->translate(context, sourceText);
// 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 QTranslator_IsEmpty(const QTranslator* self) {
return self->isEmpty();
}
struct miqt_string QTranslator_Language(const QTranslator* self) {
QString _ret = self->language();
// 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 QTranslator_FilePath(const QTranslator* self) {
QString _ret = self->filePath();
// 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 QTranslator_Load(QTranslator* self, struct miqt_string filename) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
return self->load(filename_QString);
}
bool QTranslator_Load2(QTranslator* self, QLocale* locale, struct miqt_string filename) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
return self->load(*locale, filename_QString);
}
bool QTranslator_Load3(QTranslator* self, const unsigned char* data, int lenVal) {
return self->load(static_cast<const uchar*>(data), static_cast<int>(lenVal));
}
struct miqt_string QTranslator_Tr2(const char* s, const char* c) {
QString _ret = QTranslator::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 QTranslator_Tr3(const char* s, const char* c, int n) {
QString _ret = QTranslator::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;
}
struct miqt_string QTranslator_Translate3(const QTranslator* self, const char* context, const char* sourceText, const char* disambiguation) {
QString _ret = self->translate(context, sourceText, disambiguation);
// 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 QTranslator_Translate4(const QTranslator* self, const char* context, const char* sourceText, const char* disambiguation, int n) {
QString _ret = self->translate(context, sourceText, disambiguation, 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 QTranslator_Load22(QTranslator* self, struct miqt_string filename, struct miqt_string directory) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
return self->load(filename_QString, directory_QString);
}
bool QTranslator_Load32(QTranslator* self, struct miqt_string filename, struct miqt_string directory, struct miqt_string search_delimiters) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
QString search_delimiters_QString = QString::fromUtf8(search_delimiters.data, search_delimiters.len);
return self->load(filename_QString, directory_QString, search_delimiters_QString);
}
bool QTranslator_Load4(QTranslator* self, struct miqt_string filename, struct miqt_string directory, struct miqt_string search_delimiters, struct miqt_string suffix) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
QString search_delimiters_QString = QString::fromUtf8(search_delimiters.data, search_delimiters.len);
QString suffix_QString = QString::fromUtf8(suffix.data, suffix.len);
return self->load(filename_QString, directory_QString, search_delimiters_QString, suffix_QString);
}
bool QTranslator_Load33(QTranslator* self, QLocale* locale, struct miqt_string filename, struct miqt_string prefix) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString prefix_QString = QString::fromUtf8(prefix.data, prefix.len);
return self->load(*locale, filename_QString, prefix_QString);
}
bool QTranslator_Load42(QTranslator* self, QLocale* locale, struct miqt_string filename, struct miqt_string prefix, struct miqt_string directory) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString prefix_QString = QString::fromUtf8(prefix.data, prefix.len);
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
return self->load(*locale, filename_QString, prefix_QString, directory_QString);
}
bool QTranslator_Load5(QTranslator* self, QLocale* locale, struct miqt_string filename, struct miqt_string prefix, struct miqt_string directory, struct miqt_string suffix) {
QString filename_QString = QString::fromUtf8(filename.data, filename.len);
QString prefix_QString = QString::fromUtf8(prefix.data, prefix.len);
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
QString suffix_QString = QString::fromUtf8(suffix.data, suffix.len);
return self->load(*locale, filename_QString, prefix_QString, directory_QString, suffix_QString);
}
bool QTranslator_Load34(QTranslator* self, const unsigned char* data, int lenVal, struct miqt_string directory) {
QString directory_QString = QString::fromUtf8(directory.data, directory.len);
return self->load(static_cast<const uchar*>(data), static_cast<int>(lenVal), directory_QString);
}
void QTranslator_Delete(QTranslator* self) {
delete self;
}