miqt/qt6/gen_qpageranges.cpp

120 lines
3.1 KiB
C++
Raw Permalink Normal View History

2024-10-20 05:21:03 +00:00
#include <QList>
#include <QPageRanges>
#define WORKAROUND_INNER_CLASS_DEFINITION_QPageRanges__Range
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qpageranges.h>
#include "gen_qpageranges.h"
#ifndef _Bool
#define _Bool bool
#endif
2024-10-20 05:21:03 +00:00
#include "_cgo_export.h"
2024-12-07 04:15:57 +00:00
QPageRanges* QPageRanges_new() {
return new QPageRanges();
2024-10-20 05:21:03 +00:00
}
2024-12-07 04:15:57 +00:00
QPageRanges* QPageRanges_new2(QPageRanges* other) {
return new QPageRanges(*other);
2024-10-20 05:21:03 +00:00
}
void QPageRanges_OperatorAssign(QPageRanges* self, QPageRanges* other) {
self->operator=(*other);
}
void QPageRanges_Swap(QPageRanges* self, QPageRanges* other) {
self->swap(*other);
}
void QPageRanges_AddPage(QPageRanges* self, int pageNumber) {
self->addPage(static_cast<int>(pageNumber));
}
void QPageRanges_AddRange(QPageRanges* self, int from, int to) {
self->addRange(static_cast<int>(from), static_cast<int>(to));
}
struct miqt_array /* of QPageRanges__Range* */ QPageRanges_ToRangeList(const QPageRanges* self) {
2024-10-20 05:21:03 +00:00
QList<QPageRanges::Range> _ret = self->toRangeList();
// Convert QList<> from C++ memory to manually-managed C memory
QPageRanges__Range** _arr = static_cast<QPageRanges__Range**>(malloc(sizeof(QPageRanges__Range*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QPageRanges::Range(_ret[i]);
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
2024-10-20 05:21:03 +00:00
return _out;
}
void QPageRanges_Clear(QPageRanges* self) {
self->clear();
}
struct miqt_string QPageRanges_ToString(const QPageRanges* self) {
QString _ret = self->toString();
// 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;
}
QPageRanges* QPageRanges_FromString(struct miqt_string ranges) {
QString ranges_QString = QString::fromUtf8(ranges.data, ranges.len);
return new QPageRanges(QPageRanges::fromString(ranges_QString));
}
bool QPageRanges_Contains(const QPageRanges* self, int pageNumber) {
return self->contains(static_cast<int>(pageNumber));
}
bool QPageRanges_IsEmpty(const QPageRanges* self) {
return self->isEmpty();
}
int QPageRanges_FirstPage(const QPageRanges* self) {
return self->firstPage();
}
int QPageRanges_LastPage(const QPageRanges* self) {
return self->lastPage();
}
void QPageRanges_Detach(QPageRanges* self) {
self->detach();
}
2024-11-19 06:29:06 +00:00
void QPageRanges_Delete(QPageRanges* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QPageRanges*>( self );
} else {
delete self;
}
2024-10-20 05:21:03 +00:00
}
2024-12-07 04:15:57 +00:00
QPageRanges__Range* QPageRanges__Range_new() {
return new QPageRanges::Range();
2024-10-20 05:21:03 +00:00
}
2024-12-07 04:15:57 +00:00
QPageRanges__Range* QPageRanges__Range_new2(QPageRanges__Range* param1) {
return new QPageRanges::Range(*param1);
2024-10-20 05:21:03 +00:00
}
bool QPageRanges__Range_Contains(const QPageRanges__Range* self, int pageNumber) {
return self->contains(static_cast<int>(pageNumber));
}
2024-11-19 06:29:06 +00:00
void QPageRanges__Range_Delete(QPageRanges__Range* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QPageRanges::Range*>( self );
} else {
delete self;
}
2024-10-20 05:21:03 +00:00
}