mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
131 lines
3.3 KiB
C++
131 lines
3.3 KiB
C++
#include <QBuffer>
|
|
#include <QByteArray>
|
|
#include <QMetaObject>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <qbuffer.h>
|
|
#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_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);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
bool QBuffer_Open(QBuffer* self, int openMode) {
|
|
return self->open(static_cast<QIODeviceBase::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);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
void QBuffer_Delete(QBuffer* self) {
|
|
delete self;
|
|
}
|
|
|