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"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qstringview.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringView* QStringView_new() {
|
|
|
|
return new QStringView();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_ToString(QStringView* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QStringView*>(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
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_Size(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->size();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_OperatorSubscript(QStringView* self, size_t n) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->operator[](static_cast<qsizetype>(n));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QStringView_ToLatin1(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QStringView*>(self)->toLatin1();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QStringView_ToUtf8(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QStringView*>(self)->toUtf8();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray* QStringView_ToLocal8Bit(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QByteArray ret = const_cast<const QStringView*>(self)->toLocal8Bit();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QByteArray*>(new QByteArray(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_ToUcs4(QStringView* self, unsigned int** _out, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QVector<unsigned int> ret = const_cast<const QStringView*>(self)->toUcs4();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
unsigned int* __out = static_cast<unsigned int*>(malloc(sizeof(unsigned int) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = ret[i];
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_At(QStringView* self, size_t n) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->at(static_cast<qsizetype>(n));
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
int QStringView_CompareWithQChar(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->compare(*c);
|
|
|
|
}
|
|
|
|
|
|
|
|
int QStringView_Compare2(QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return const_cast<const QStringView*>(self)->compare(*c, static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_StartsWithWithQChar(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->startsWith(*c);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_StartsWith2(QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return const_cast<const QStringView*>(self)->startsWith(*c, static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_EndsWithWithQChar(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->endsWith(*c);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_EndsWith2(QStringView* self, QChar* c, uintptr_t cs) {
|
|
|
|
return const_cast<const QStringView*>(self)->endsWith(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
size_t QStringView_IndexOf(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->indexOf(*c);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QStringView_Contains(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->contains(*c);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_Count(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->count(*c);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_LastIndexOf(QStringView* self, QChar* c) {
|
|
|
|
return const_cast<const QStringView*>(self)->lastIndexOf(*c);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_IsRightToLeft(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->isRightToLeft();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_IsValidUtf16(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->isValidUtf16();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int16_t QStringView_ToShort(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toShort();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t QStringView_ToUShort(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUShort();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QStringView_ToInt(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toInt();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int QStringView_ToUInt(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUInt();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long QStringView_ToLong(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long QStringView_ToULong(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t QStringView_ToLongLong(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLongLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t QStringView_ToULongLong(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULongLong();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float QStringView_ToFloat(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toFloat();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double QStringView_ToDouble(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toDouble();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_Empty(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->empty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_Front(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->front();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_Back(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->back();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_IsNull(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->isNull();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_IsEmpty(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->isEmpty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QStringView_Length(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QStringView*>(self)->length();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_First(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->first();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QStringView_Last(QStringView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QChar ret = const_cast<const QStringView*>(self)->last();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QChar*>(new QChar(ret));
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
size_t QStringView_IndexOf2(QStringView* self, QChar* c, size_t from) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->indexOf(*c, static_cast<qsizetype>(from));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_IndexOf3(QStringView* self, QChar* c, size_t from, uintptr_t cs) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->indexOf(*c, static_cast<qsizetype>(from), static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QStringView_Contains2(QStringView* self, QChar* c, uintptr_t cs) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->contains(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_Count2(QStringView* self, QChar* c, uintptr_t cs) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->count(*c, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_LastIndexOf2(QStringView* self, QChar* c, size_t from) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->lastIndexOf(*c, static_cast<qsizetype>(from));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t QStringView_LastIndexOf3(QStringView* self, QChar* c, size_t from, uintptr_t cs) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->lastIndexOf(*c, static_cast<qsizetype>(from), static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
int16_t QStringView_ToShort1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toShort(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int16_t QStringView_ToShort2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toShort(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t QStringView_ToUShort1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUShort(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t QStringView_ToUShort2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUShort(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QStringView_ToInt1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toInt(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QStringView_ToInt2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toInt(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int QStringView_ToUInt1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUInt(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int QStringView_ToUInt2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toUInt(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long QStringView_ToLong1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
long QStringView_ToLong2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long QStringView_ToULong1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long QStringView_ToULong2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t QStringView_ToLongLong1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLongLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int64_t QStringView_ToLongLong2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toLongLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t QStringView_ToULongLong1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULongLong(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t QStringView_ToULongLong2(QStringView* self, bool* ok, int base) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toULongLong(ok, static_cast<int>(base));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float QStringView_ToFloat1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toFloat(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double QStringView_ToDouble1(QStringView* self, bool* ok) {
|
2024-09-07 03:31:00 +00:00
|
|
|
return const_cast<const QStringView*>(self)->toDouble(ok);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QStringView_Delete(QStringView* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|