2024-08-25 04:08:24 +00:00
|
|
|
#include <QList>
|
|
|
|
#include <QRegExp>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qregexp.h"
|
|
|
|
#include "gen_qregexp.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QRegExp* QRegExp_new() {
|
|
|
|
return new QRegExp();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QRegExp* QRegExp_new2(struct miqt_string* pattern) {
|
|
|
|
QString pattern_QString = QString::fromUtf8(&pattern->data, pattern->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRegExp(pattern_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegExp* QRegExp_new3(QRegExp* rx) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QRegExp(*rx);
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QRegExp* QRegExp_new4(struct miqt_string* pattern, int cs) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString pattern_QString = QString::fromUtf8(&pattern->data, pattern->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRegExp(pattern_QString, static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QRegExp* QRegExp_new5(struct miqt_string* pattern, int cs, int syntax) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString pattern_QString = QString::fromUtf8(&pattern->data, pattern->len);
|
2024-08-29 07:01:51 +00:00
|
|
|
return new QRegExp(pattern_QString, static_cast<Qt::CaseSensitivity>(cs), static_cast<QRegExp::PatternSyntax>(syntax));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QRegExp_OperatorAssign(QRegExp* self, QRegExp* rx) {
|
|
|
|
self->operator=(*rx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QRegExp_Swap(QRegExp* self, QRegExp* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRegExp_OperatorEqual(const QRegExp* self, QRegExp* rx) {
|
|
|
|
return self->operator==(*rx);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRegExp_OperatorNotEqual(const QRegExp* self, QRegExp* rx) {
|
|
|
|
return self->operator!=(*rx);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRegExp_IsEmpty(const QRegExp* self) {
|
|
|
|
return self->isEmpty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRegExp_IsValid(const QRegExp* self) {
|
|
|
|
return self->isValid();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRegExp_Pattern(const QRegExp* self) {
|
|
|
|
QString _ret = self->pattern();
|
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 QRegExp_SetPattern(QRegExp* self, struct miqt_string* pattern) {
|
|
|
|
QString pattern_QString = QString::fromUtf8(&pattern->data, pattern->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setPattern(pattern_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRegExp_CaseSensitivity(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
Qt::CaseSensitivity _ret = self->caseSensitivity();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QRegExp_SetCaseSensitivity(QRegExp* self, int cs) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->setCaseSensitivity(static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRegExp_PatternSyntax(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QRegExp::PatternSyntax _ret = self->patternSyntax();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QRegExp_SetPatternSyntax(QRegExp* self, int syntax) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->setPatternSyntax(static_cast<QRegExp::PatternSyntax>(syntax));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QRegExp_IsMinimal(const QRegExp* self) {
|
|
|
|
return self->isMinimal();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QRegExp_SetMinimal(QRegExp* self, bool minimal) {
|
|
|
|
self->setMinimal(minimal);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
bool QRegExp_ExactMatch(const QRegExp* self, struct miqt_string* str) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->exactMatch(str_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
int QRegExp_IndexIn(const QRegExp* self, struct miqt_string* str) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->indexIn(str_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
int QRegExp_LastIndexIn(const QRegExp* self, struct miqt_string* str) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->lastIndexIn(str_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QRegExp_MatchedLength(const QRegExp* self) {
|
|
|
|
return self->matchedLength();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QRegExp_CaptureCount(const QRegExp* self) {
|
|
|
|
return self->captureCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRegExp_CapturedTexts(const QRegExp* self) {
|
|
|
|
QStringList _ret = self->capturedTexts();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string** _arr = static_cast<struct miqt_string**>(malloc(sizeof(struct miqt_string*) * _ret.length()));
|
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
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 _lv_b = _lv_ret.toUtf8();
|
|
|
|
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
|
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-14 22:29:05 +00:00
|
|
|
struct miqt_array* QRegExp_CapturedTexts2(QRegExp* self) {
|
|
|
|
QStringList _ret = self->capturedTexts();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string** _arr = static_cast<struct miqt_string**>(malloc(sizeof(struct miqt_string*) * _ret.length()));
|
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
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 _lv_b = _lv_ret.toUtf8();
|
|
|
|
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
|
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-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRegExp_Cap(const QRegExp* self) {
|
|
|
|
QString _ret = self->cap();
|
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* QRegExp_Cap2(QRegExp* self) {
|
|
|
|
QString _ret = self->cap();
|
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
|
|
|
int QRegExp_Pos(const QRegExp* self) {
|
|
|
|
return self->pos();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QRegExp_Pos2(QRegExp* self) {
|
|
|
|
return self->pos();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRegExp_ErrorString(const QRegExp* self) {
|
|
|
|
QString _ret = self->errorString();
|
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* QRegExp_ErrorString2(QRegExp* self) {
|
|
|
|
QString _ret = self->errorString();
|
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* QRegExp_Escape(struct miqt_string* str) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
|
|
|
QString _ret = QRegExp::escape(str_QString);
|
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
|
|
|
int QRegExp_IndexIn2(const QRegExp* self, struct miqt_string* str, int offset) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->indexIn(str_QString, static_cast<int>(offset));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRegExp_IndexIn3(const QRegExp* self, struct miqt_string* str, int offset, int caretMode) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->indexIn(str_QString, static_cast<int>(offset), static_cast<QRegExp::CaretMode>(caretMode));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
int QRegExp_LastIndexIn2(const QRegExp* self, struct miqt_string* str, int offset) {
|
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->lastIndexIn(str_QString, static_cast<int>(offset));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QRegExp_LastIndexIn3(const QRegExp* self, struct miqt_string* str, int offset, int caretMode) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString str_QString = QString::fromUtf8(&str->data, str->len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->lastIndexIn(str_QString, static_cast<int>(offset), static_cast<QRegExp::CaretMode>(caretMode));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QRegExp_Cap1(const QRegExp* self, int nth) {
|
|
|
|
QString _ret = self->cap(static_cast<int>(nth));
|
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* QRegExp_Cap1WithNth(QRegExp* self, int nth) {
|
|
|
|
QString _ret = self->cap(static_cast<int>(nth));
|
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
|
|
|
int QRegExp_Pos1(const QRegExp* self, int nth) {
|
|
|
|
return self->pos(static_cast<int>(nth));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int QRegExp_Pos1WithNth(QRegExp* self, int nth) {
|
|
|
|
return self->pos(static_cast<int>(nth));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QRegExp_Delete(QRegExp* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|