2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QChar>
|
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QTextCodec>
|
2024-08-29 07:01:51 +00:00
|
|
|
#define WORKAROUND_INNER_CLASS_DEFINITION_QTextCodec__ConverterState
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QTextDecoder>
|
|
|
|
#include <QTextEncoder>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qtextcodec.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qtextcodec.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForName(struct miqt_string name) {
|
|
|
|
QByteArray name_QByteArray(name.data, name.len);
|
|
|
|
return QTextCodec::codecForName(name_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForNameWithName(const char* name) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return QTextCodec::codecForName(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCodec* QTextCodec_CodecForMib(int mib) {
|
|
|
|
return QTextCodec::codecForMib(static_cast<int>(mib));
|
|
|
|
}
|
|
|
|
|
2024-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of struct miqt_string */ QTextCodec_AvailableCodecs() {
|
2024-09-14 22:29:05 +00:00
|
|
|
QList<QByteArray> _ret = QTextCodec::availableCodecs();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QByteArray _lv_qb = _ret[i];
|
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_qb.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of int */ QTextCodec_AvailableMibs() {
|
2024-09-14 22:29:05 +00:00
|
|
|
QList<int> _ret = QTextCodec::availableMibs();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
|
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
_arr[i] = _ret[i];
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QTextCodec* QTextCodec_CodecForLocale() {
|
|
|
|
return QTextCodec::codecForLocale();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCodec_SetCodecForLocale(QTextCodec* c) {
|
|
|
|
QTextCodec::setCodecForLocale(c);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForHtml(struct miqt_string ba) {
|
|
|
|
QByteArray ba_QByteArray(ba.data, ba.len);
|
|
|
|
return QTextCodec::codecForHtml(ba_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForHtml2(struct miqt_string ba, QTextCodec* defaultCodec) {
|
|
|
|
QByteArray ba_QByteArray(ba.data, ba.len);
|
|
|
|
return QTextCodec::codecForHtml(ba_QByteArray, defaultCodec);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForUtfText(struct miqt_string ba) {
|
|
|
|
QByteArray ba_QByteArray(ba.data, ba.len);
|
|
|
|
return QTextCodec::codecForUtfText(ba_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QTextCodec* QTextCodec_CodecForUtfText2(struct miqt_string ba, QTextCodec* defaultCodec) {
|
|
|
|
QByteArray ba_QByteArray(ba.data, ba.len);
|
|
|
|
return QTextCodec::codecForUtfText(ba_QByteArray, defaultCodec);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextCodec_CanEncode(const QTextCodec* self, QChar* param1) {
|
|
|
|
return self->canEncode(*param1);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QTextCodec_CanEncodeWithQString(const QTextCodec* self, struct miqt_string param1) {
|
|
|
|
QString param1_QString = QString::fromUtf8(param1.data, param1.len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->canEncode(param1_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_ToUnicode(const QTextCodec* self, struct miqt_string param1) {
|
|
|
|
QByteArray param1_QByteArray(param1.data, param1.len);
|
|
|
|
QString _ret = self->toUnicode(param1_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_ToUnicodeWithChars(const QTextCodec* self, const char* chars) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toUnicode(chars);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_FromUnicode(const QTextCodec* self, struct miqt_string uc) {
|
|
|
|
QString uc_QString = QString::fromUtf8(uc.data, uc.len);
|
|
|
|
QByteArray _qb = self->fromUnicode(uc_QString);
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_ToUnicode2(const QTextCodec* self, const char* in, int length) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toUnicode(in, static_cast<int>(length));
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_FromUnicode2(const QTextCodec* self, QChar* in, int length) {
|
|
|
|
QByteArray _qb = self->fromUnicode(in, static_cast<int>(length));
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextDecoder* QTextCodec_MakeDecoder(const QTextCodec* self) {
|
|
|
|
return self->makeDecoder();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextEncoder* QTextCodec_MakeEncoder(const QTextCodec* self) {
|
|
|
|
return self->makeEncoder();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_Name(const QTextCodec* self) {
|
|
|
|
QByteArray _qb = self->name();
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of struct miqt_string */ QTextCodec_Aliases(const QTextCodec* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QList<QByteArray> _ret = self->aliases();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QByteArray _lv_qb = _ret[i];
|
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_qb.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTextCodec_MibEnum(const QTextCodec* self) {
|
|
|
|
return self->mibEnum();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_ToUnicode3(const QTextCodec* self, const char* in, int length, QTextCodec__ConverterState* state) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toUnicode(in, static_cast<int>(length), state);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextCodec_FromUnicode3(const QTextCodec* self, QChar* in, int length, QTextCodec__ConverterState* state) {
|
|
|
|
QByteArray _qb = self->fromUnicode(in, static_cast<int>(length), state);
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextDecoder* QTextCodec_MakeDecoder1(const QTextCodec* self, int flags) {
|
|
|
|
return self->makeDecoder(static_cast<QTextCodec::ConversionFlags>(flags));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QTextEncoder* QTextCodec_MakeEncoder1(const QTextCodec* self, int flags) {
|
|
|
|
return self->makeEncoder(static_cast<QTextCodec::ConversionFlags>(flags));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QTextEncoder* QTextEncoder_new(QTextCodec* codec) {
|
|
|
|
return new QTextEncoder(codec);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextEncoder* QTextEncoder_new2(QTextCodec* codec, int flags) {
|
|
|
|
return new QTextEncoder(codec, static_cast<QTextCodec::ConversionFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextEncoder_FromUnicode(QTextEncoder* self, struct miqt_string str) {
|
|
|
|
QString str_QString = QString::fromUtf8(str.data, str.len);
|
|
|
|
QByteArray _qb = self->fromUnicode(str_QString);
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextEncoder_FromUnicode2(QTextEncoder* self, QChar* uc, int lenVal) {
|
|
|
|
QByteArray _qb = self->fromUnicode(uc, static_cast<int>(lenVal));
|
|
|
|
struct miqt_string _ms;
|
|
|
|
_ms.len = _qb.length();
|
|
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
|
|
return _ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextEncoder_HasFailure(const QTextEncoder* self) {
|
|
|
|
return self->hasFailure();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextEncoder_Delete(QTextEncoder* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDecoder* QTextDecoder_new(QTextCodec* codec) {
|
|
|
|
return new QTextDecoder(codec);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextDecoder* QTextDecoder_new2(QTextCodec* codec, int flags) {
|
|
|
|
return new QTextDecoder(codec, static_cast<QTextCodec::ConversionFlags>(flags));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextDecoder_ToUnicode(QTextDecoder* self, const char* chars, int lenVal) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toUnicode(chars, static_cast<int>(lenVal));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QTextDecoder_ToUnicodeWithBa(QTextDecoder* self, struct miqt_string ba) {
|
|
|
|
QByteArray ba_QByteArray(ba.data, ba.len);
|
|
|
|
QString _ret = self->toUnicode(ba_QByteArray);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextDecoder_HasFailure(const QTextDecoder* self) {
|
|
|
|
return self->hasFailure();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTextDecoder_NeedsMoreData(const QTextDecoder* self) {
|
|
|
|
return self->needsMoreData();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextDecoder_Delete(QTextDecoder* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QTextCodec__ConverterState* QTextCodec__ConverterState_new() {
|
|
|
|
return new QTextCodec::ConverterState();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextCodec__ConverterState* QTextCodec__ConverterState_new2(int f) {
|
|
|
|
return new QTextCodec::ConverterState(static_cast<QTextCodec::ConversionFlags>(f));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextCodec__ConverterState_Delete(QTextCodec__ConverterState* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|