2024-08-25 04:08:24 +00:00
|
|
|
#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 <QVersionNumber>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qversionnumber.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qversionnumber.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QVersionNumber* QVersionNumber_new() {
|
|
|
|
return new QVersionNumber();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QVersionNumber* QVersionNumber_new2(struct miqt_array* /* of int */ seg) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QVector<int> seg_QList;
|
2024-09-14 22:29:05 +00:00
|
|
|
seg_QList.reserve(seg->len);
|
|
|
|
int* seg_arr = static_cast<int*>(seg->data);
|
|
|
|
for(size_t i = 0; i < seg->len; ++i) {
|
2024-09-17 07:43:35 +00:00
|
|
|
seg_QList.push_back(static_cast<int>(seg_arr[i]));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
return new QVersionNumber(seg_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVersionNumber* QVersionNumber_new3(int maj) {
|
|
|
|
return new QVersionNumber(static_cast<int>(maj));
|
|
|
|
}
|
|
|
|
|
|
|
|
QVersionNumber* QVersionNumber_new4(int maj, int min) {
|
|
|
|
return new QVersionNumber(static_cast<int>(maj), static_cast<int>(min));
|
|
|
|
}
|
|
|
|
|
|
|
|
QVersionNumber* QVersionNumber_new5(int maj, int min, int mic) {
|
|
|
|
return new QVersionNumber(static_cast<int>(maj), static_cast<int>(min), static_cast<int>(mic));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QVersionNumber_IsNull(const QVersionNumber* self) {
|
|
|
|
return self->isNull();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QVersionNumber_IsNormalized(const QVersionNumber* self) {
|
|
|
|
return self->isNormalized();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QVersionNumber_MajorVersion(const QVersionNumber* self) {
|
|
|
|
return self->majorVersion();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QVersionNumber_MinorVersion(const QVersionNumber* self) {
|
|
|
|
return self->minorVersion();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QVersionNumber_MicroVersion(const QVersionNumber* self) {
|
|
|
|
return self->microVersion();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QVersionNumber* QVersionNumber_Normalized(const QVersionNumber* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVersionNumber(self->normalized());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QVersionNumber_Segments(const QVersionNumber* self) {
|
|
|
|
QVector<int> _ret = self->segments();
|
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-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QVersionNumber_SegmentAt(const QVersionNumber* self, int index) {
|
|
|
|
return self->segmentAt(static_cast<int>(index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QVersionNumber_SegmentCount(const QVersionNumber* self) {
|
|
|
|
return self->segmentCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QVersionNumber_IsPrefixOf(const QVersionNumber* self, QVersionNumber* other) {
|
|
|
|
return self->isPrefixOf(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QVersionNumber_Compare(QVersionNumber* v1, QVersionNumber* v2) {
|
|
|
|
return QVersionNumber::compare(*v1, *v2);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVersionNumber* QVersionNumber_CommonPrefix(QVersionNumber* v1, QVersionNumber* v2) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVersionNumber(QVersionNumber::commonPrefix(*v1, *v2));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QVersionNumber_ToString(const QVersionNumber* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toString();
|
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
|
|
|
QVersionNumber* QVersionNumber_FromString(struct miqt_string stringVal) {
|
|
|
|
QString stringVal_QString = QString::fromUtf8(stringVal.data, stringVal.len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVersionNumber(QVersionNumber::fromString(stringVal_QString));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QVersionNumber* QVersionNumber_FromString22(struct miqt_string stringVal, int* suffixIndex) {
|
|
|
|
QString stringVal_QString = QString::fromUtf8(stringVal.data, stringVal.len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVersionNumber(QVersionNumber::fromString(stringVal_QString, static_cast<int*>(suffixIndex)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QVersionNumber_Delete(QVersionNumber* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|