miqt/qt/gen_qtranslator.cpp

170 lines
7.5 KiB
C++
Raw Normal View History

#include <QLocale>
#include <QMetaObject>
#include <QObject>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include <QTranslator>
2024-08-29 07:01:51 +00:00
#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();
}
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();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QTranslator_TrUtf8(const char* s) {
QString _ret = QTranslator::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* 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();
return miqt_strdup(_b.data(), _b.length());
}
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();
return miqt_strdup(_b.data(), _b.length());
}
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();
return miqt_strdup(_b.data(), _b.length());
}
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);
}
2024-08-29 07:01:51 +00:00
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();
return miqt_strdup(_b.data(), _b.length());
}
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();
return miqt_strdup(_b.data(), _b.length());
}
struct miqt_string* QTranslator_TrUtf82(const char* s, const char* c) {
QString _ret = QTranslator::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* QTranslator_TrUtf83(const char* s, const char* c, int n) {
QString _ret = QTranslator::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());
}
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();
return miqt_strdup(_b.data(), _b.length());
}
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();
return miqt_strdup(_b.data(), _b.length());
}
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);
2024-08-29 07:01:51 +00:00
return self->load(static_cast<const uchar*>(data), static_cast<int>(lenVal), directory_QString);
}
void QTranslator_Delete(QTranslator* self) {
delete self;
}