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>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qregexp.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qregexp.h"
|
2024-12-11 06:55:47 +00:00
|
|
|
|
|
|
|
#ifndef _Bool
|
|
|
|
#define _Bool bool
|
|
|
|
#endif
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QRegExp* QRegExp_new() {
|
|
|
|
return new QRegExp();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QRegExp* QRegExp_new2(struct miqt_string pattern) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString pattern_QString = QString::fromUtf8(pattern.data, pattern.len);
|
2024-12-07 04:15:57 +00:00
|
|
|
return new QRegExp(pattern_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QRegExp* QRegExp_new3(QRegExp* rx) {
|
|
|
|
return new QRegExp(*rx);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QRegExp* QRegExp_new4(struct miqt_string pattern, int cs) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString pattern_QString = QString::fromUtf8(pattern.data, pattern.len);
|
2024-12-07 04:15:57 +00:00
|
|
|
return new QRegExp(pattern_QString, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QRegExp* QRegExp_new5(struct miqt_string pattern, int cs, int syntax) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString pattern_QString = QString::fromUtf8(pattern.data, pattern.len);
|
2024-12-07 04:15:57 +00:00
|
|
|
return new QRegExp(pattern_QString, static_cast<Qt::CaseSensitivity>(cs), static_cast<QRegExp::PatternSyntax>(syntax));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
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) {
|
2024-11-22 06:06:01 +00:00
|
|
|
return (*self == *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) {
|
2024-11-22 06:06:01 +00:00
|
|
|
return (*self != *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-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QRegExp_Pattern(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
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-10-18 23:53:33 +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-10-18 23:53:33 +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-10-18 23:53:33 +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-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of struct miqt_string */ QRegExp_CapturedTexts(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->capturedTexts();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-17 06:21:37 +00:00
|
|
|
struct miqt_array /* of struct miqt_string */ QRegExp_CapturedTexts2(QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->capturedTexts();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QRegExp_Cap(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
struct miqt_string QRegExp_Cap2(QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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-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-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QRegExp_ErrorString(const QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
struct miqt_string QRegExp_ErrorString2(QRegExp* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
struct miqt_string QRegExp_Escape(struct miqt_string str) {
|
|
|
|
QString str_QString = QString::fromUtf8(str.data, str.len);
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
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-10-18 23:53:33 +00:00
|
|
|
int QRegExp_IndexIn3(const QRegExp* self, struct miqt_string str, int offset, int caretMode) {
|
|
|
|
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-10-18 23:53:33 +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-10-18 23:53:33 +00:00
|
|
|
int QRegExp_LastIndexIn3(const QRegExp* self, struct miqt_string str, int offset, int caretMode) {
|
|
|
|
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-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QRegExp_Cap1(const QRegExp* self, int nth) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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
|
|
|
struct miqt_string QRegExp_Cap1WithNth(QRegExp* self, int nth) {
|
2024-09-14 22:29:05 +00:00
|
|
|
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();
|
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-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));
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QRegExp_Delete(QRegExp* self, bool isSubclass) {
|
|
|
|
if (isSubclass) {
|
|
|
|
delete dynamic_cast<QRegExp*>( self );
|
|
|
|
} else {
|
|
|
|
delete self;
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|