miqt/qt/gen_qbuffer.cpp

164 lines
4.4 KiB
C++
Raw Normal View History

#include <QBuffer>
#include <QByteArray>
#include <QMetaObject>
#include <QObject>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include <qbuffer.h>
2024-08-29 07:01:51 +00:00
#include "gen_qbuffer.h"
#include "_cgo_export.h"
QBuffer* QBuffer_new() {
return new QBuffer();
}
QBuffer* QBuffer_new2(QObject* parent) {
return new QBuffer(parent);
}
QMetaObject* QBuffer_MetaObject(const QBuffer* self) {
return (QMetaObject*) self->metaObject();
}
void* QBuffer_Metacast(QBuffer* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QBuffer_Tr(const char* s) {
QString _ret = QBuffer::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 QBuffer_TrUtf8(const char* s) {
QString _ret = QBuffer::trUtf8(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 QBuffer_Buffer(QBuffer* self) {
QByteArray _qb = self->buffer();
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;
}
struct miqt_string QBuffer_Buffer2(const QBuffer* self) {
const QByteArray _qb = self->buffer();
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;
}
void QBuffer_SetData(QBuffer* self, struct miqt_string data) {
QByteArray data_QByteArray(data.data, data.len);
self->setData(data_QByteArray);
}
2024-08-29 07:01:51 +00:00
void QBuffer_SetData2(QBuffer* self, const char* data, int lenVal) {
self->setData(data, static_cast<int>(lenVal));
}
struct miqt_string QBuffer_Data(const QBuffer* self) {
const QByteArray _qb = self->data();
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
bool QBuffer_Open(QBuffer* self, int openMode) {
return self->open(static_cast<QIODevice::OpenMode>(openMode));
}
void QBuffer_Close(QBuffer* self) {
self->close();
}
long long QBuffer_Size(const QBuffer* self) {
qint64 _ret = self->size();
return static_cast<long long>(_ret);
}
long long QBuffer_Pos(const QBuffer* self) {
qint64 _ret = self->pos();
return static_cast<long long>(_ret);
}
2024-08-29 07:01:51 +00:00
bool QBuffer_Seek(QBuffer* self, long long off) {
return self->seek(static_cast<qint64>(off));
}
bool QBuffer_AtEnd(const QBuffer* self) {
return self->atEnd();
}
bool QBuffer_CanReadLine(const QBuffer* self) {
return self->canReadLine();
}
struct miqt_string QBuffer_Tr2(const char* s, const char* c) {
QString _ret = QBuffer::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 QBuffer_Tr3(const char* s, const char* c, int n) {
QString _ret = QBuffer::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 QBuffer_TrUtf82(const char* s, const char* c) {
QString _ret = QBuffer::trUtf8(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 QBuffer_TrUtf83(const char* s, const char* c, int n) {
QString _ret = QBuffer::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();
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;
}
void QBuffer_Delete(QBuffer* self) {
delete self;
}