2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QChar>
|
|
|
|
#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 <QStringView>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qstringview.h"
|
|
|
|
#include "gen_qstringview.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QStringView* QStringView_new() {
|
|
|
|
return new QStringView();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QStringView_ToString(const QStringView* self) {
|
|
|
|
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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_Size(const QStringView* self) {
|
|
|
|
return self->size();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QStringView_OperatorSubscript(const QStringView* self, size_t n) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->operator[](static_cast<qsizetype>(n));
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QByteArray* QStringView_ToLatin1(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _ret = self->toLatin1();
|
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-11 05:41:09 +00:00
|
|
|
QByteArray* QStringView_ToUtf8(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _ret = self->toUtf8();
|
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-11 05:41:09 +00:00
|
|
|
QByteArray* QStringView_ToLocal8Bit(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _ret = self->toLocal8Bit();
|
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
|
|
|
struct miqt_array* QStringView_ToUcs4(const QStringView* self) {
|
|
|
|
QVector<unsigned int> _ret = self->toUcs4();
|
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
|
|
|
unsigned int* _arr = static_cast<unsigned int*>(malloc(sizeof(unsigned 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
|
|
|
QChar* QStringView_At(const QStringView* self, size_t n) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->at(static_cast<qsizetype>(n));
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_Truncate(QStringView* self, size_t n) {
|
|
|
|
self->truncate(static_cast<qsizetype>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_Chop(QStringView* self, size_t n) {
|
|
|
|
self->chop(static_cast<qsizetype>(n));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_CompareWithQChar(const QStringView* self, QChar* c) {
|
|
|
|
return self->compare(*c);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_Compare2(const QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return self->compare(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_StartsWithWithQChar(const QStringView* self, QChar* c) {
|
|
|
|
return self->startsWith(*c);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_StartsWith2(const QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return self->startsWith(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_EndsWithWithQChar(const QStringView* self, QChar* c) {
|
|
|
|
return self->endsWith(*c);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_EndsWith2(const QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return self->endsWith(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_IndexOf(const QStringView* self, QChar* c) {
|
|
|
|
return self->indexOf(*c);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_Contains(const QStringView* self, QChar* c) {
|
|
|
|
return self->contains(*c);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_Count(const QStringView* self, QChar* c) {
|
|
|
|
return self->count(*c);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_LastIndexOf(const QStringView* self, QChar* c) {
|
|
|
|
return self->lastIndexOf(*c);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_IsRightToLeft(const QStringView* self) {
|
|
|
|
return self->isRightToLeft();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_IsValidUtf16(const QStringView* self) {
|
|
|
|
return self->isValidUtf16();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int16_t QStringView_ToShort(const QStringView* self) {
|
|
|
|
return self->toShort();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint16_t QStringView_ToUShort(const QStringView* self) {
|
|
|
|
return self->toUShort();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_ToInt(const QStringView* self) {
|
|
|
|
return self->toInt();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned int QStringView_ToUInt(const QStringView* self) {
|
|
|
|
return self->toUInt();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
long QStringView_ToLong(const QStringView* self) {
|
|
|
|
return self->toLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned long QStringView_ToULong(const QStringView* self) {
|
|
|
|
return self->toULong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int64_t QStringView_ToLongLong(const QStringView* self) {
|
|
|
|
return self->toLongLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint64_t QStringView_ToULongLong(const QStringView* self) {
|
|
|
|
return self->toULongLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
float QStringView_ToFloat(const QStringView* self) {
|
|
|
|
return self->toFloat();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QStringView_ToDouble(const QStringView* self) {
|
|
|
|
return self->toDouble();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_Empty(const QStringView* self) {
|
|
|
|
return self->empty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QStringView_Front(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->front();
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QStringView_Back(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->back();
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_IsNull(const QStringView* self) {
|
|
|
|
return self->isNull();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_IsEmpty(const QStringView* self) {
|
|
|
|
return self->isEmpty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_Length(const QStringView* self) {
|
|
|
|
return self->length();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QStringView_First(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->first();
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QStringView_Last(const QStringView* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QChar _ret = self->last();
|
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<QChar*>(new QChar(_ret));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_IndexOf2(const QStringView* self, QChar* c, size_t from) {
|
|
|
|
return self->indexOf(*c, static_cast<qsizetype>(from));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_IndexOf3(const QStringView* self, QChar* c, size_t from, uintptr_t cs) {
|
|
|
|
return self->indexOf(*c, static_cast<qsizetype>(from), static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QStringView_Contains2(const QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return self->contains(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_Count2(const QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return self->count(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_LastIndexOf2(const QStringView* self, QChar* c, size_t from) {
|
|
|
|
return self->lastIndexOf(*c, static_cast<qsizetype>(from));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
size_t QStringView_LastIndexOf3(const QStringView* self, QChar* c, size_t from, uintptr_t cs) {
|
|
|
|
return self->lastIndexOf(*c, static_cast<qsizetype>(from), static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int16_t QStringView_ToShort1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toShort(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int16_t QStringView_ToShort2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toShort(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint16_t QStringView_ToUShort1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toUShort(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint16_t QStringView_ToUShort2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toUShort(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_ToInt1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toInt(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringView_ToInt2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toInt(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned int QStringView_ToUInt1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toUInt(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned int QStringView_ToUInt2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toUInt(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
long QStringView_ToLong1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
long QStringView_ToLong2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned long QStringView_ToULong1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toULong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
unsigned long QStringView_ToULong2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toULong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int64_t QStringView_ToLongLong1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toLongLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int64_t QStringView_ToLongLong2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toLongLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint64_t QStringView_ToULongLong1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toULongLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uint64_t QStringView_ToULongLong2(const QStringView* self, bool* ok, int base) {
|
|
|
|
return self->toULongLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
float QStringView_ToFloat1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toFloat(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
double QStringView_ToDouble1(const QStringView* self, bool* ok) {
|
|
|
|
return self->toDouble(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_Delete(QStringView* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|