2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QMetaObject>
|
2024-08-29 07:01:51 +00:00
|
|
|
#define WORKAROUND_INNER_CLASS_DEFINITION_QPagedPaintDevice__Margins
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QPdfWriter>
|
|
|
|
#include <QSizeF>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qpdfwriter.h"
|
|
|
|
#include "gen_qpdfwriter.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QPdfWriter* QPdfWriter_new(struct miqt_string* filename) {
|
|
|
|
QString filename_QString = QString::fromUtf8(&filename->data, filename->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QPdfWriter(filename_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QPdfWriter* QPdfWriter_new2(QIODevice* device) {
|
|
|
|
return new QPdfWriter(device);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QPdfWriter_MetaObject(const QPdfWriter* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_Tr(const char* s) {
|
|
|
|
QString _ret = QPdfWriter::tr(s);
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_TrUtf8(const char* s) {
|
|
|
|
QString _ret = QPdfWriter::trUtf8(s);
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QPdfWriter_SetPdfVersion(QPdfWriter* self, uintptr_t version) {
|
|
|
|
self->setPdfVersion(static_cast<QPagedPaintDevice::PdfVersion>(version));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QPdfWriter_PdfVersion(const QPdfWriter* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QPagedPaintDevice::PdfVersion _ret = self->pdfVersion();
|
|
|
|
return static_cast<uintptr_t>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_Title(const QPdfWriter* self) {
|
|
|
|
QString _ret = self->title();
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QPdfWriter_SetTitle(QPdfWriter* self, struct miqt_string* title) {
|
|
|
|
QString title_QString = QString::fromUtf8(&title->data, title->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setTitle(title_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_Creator(const QPdfWriter* self) {
|
|
|
|
QString _ret = self->creator();
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QPdfWriter_SetCreator(QPdfWriter* self, struct miqt_string* creator) {
|
|
|
|
QString creator_QString = QString::fromUtf8(&creator->data, creator->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setCreator(creator_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QPdfWriter_NewPage(QPdfWriter* self) {
|
|
|
|
return self->newPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QPdfWriter_SetResolution(QPdfWriter* self, int resolution) {
|
|
|
|
self->setResolution(static_cast<int>(resolution));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QPdfWriter_Resolution(const QPdfWriter* self) {
|
|
|
|
return self->resolution();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QPdfWriter_SetDocumentXmpMetadata(QPdfWriter* self, QByteArray* xmpMetadata) {
|
|
|
|
self->setDocumentXmpMetadata(*xmpMetadata);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QByteArray* QPdfWriter_DocumentXmpMetadata(const QPdfWriter* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _ret = self->documentXmpMetadata();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
2024-09-14 22:29:05 +00:00
|
|
|
return static_cast<QByteArray*>(new QByteArray(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QPdfWriter_AddFileAttachment(QPdfWriter* self, struct miqt_string* fileName, QByteArray* data) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->addFileAttachment(fileName_QString, *data);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QPdfWriter_SetPageSize(QPdfWriter* self, uintptr_t size) {
|
|
|
|
self->setPageSize(static_cast<QPagedPaintDevice::PageSize>(size));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QPdfWriter_SetPageSizeMM(QPdfWriter* self, QSizeF* size) {
|
|
|
|
self->setPageSizeMM(*size);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QPdfWriter_SetMargins(QPdfWriter* self, QPagedPaintDevice__Margins* m) {
|
|
|
|
self->setMargins(*m);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_Tr2(const char* s, const char* c) {
|
|
|
|
QString _ret = QPdfWriter::tr(s, c);
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_Tr3(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QPdfWriter::tr(s, c, static_cast<int>(n));
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_TrUtf82(const char* s, const char* c) {
|
|
|
|
QString _ret = QPdfWriter::trUtf8(s, c);
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QPdfWriter_TrUtf83(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QPdfWriter::trUtf8(s, c, static_cast<int>(n));
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QPdfWriter_AddFileAttachment3(QPdfWriter* self, struct miqt_string* fileName, QByteArray* data, struct miqt_string* mimeType) {
|
|
|
|
QString fileName_QString = QString::fromUtf8(&fileName->data, fileName->len);
|
|
|
|
QString mimeType_QString = QString::fromUtf8(&mimeType->data, mimeType->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->addFileAttachment(fileName_QString, *data, mimeType_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QPdfWriter_Delete(QPdfWriter* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|