2024-08-25 04:08:24 +00:00
|
|
|
#include <QChar>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QStringMatcher>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qstringmatcher.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qstringmatcher.h"
|
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
|
|
|
QStringMatcher* QStringMatcher_new() {
|
|
|
|
return new QStringMatcher();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QStringMatcher* QStringMatcher_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 QStringMatcher(pattern_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QStringMatcher* QStringMatcher_new3(QChar* uc, int lenVal) {
|
|
|
|
return new QStringMatcher(uc, static_cast<int>(lenVal));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QStringMatcher* QStringMatcher_new4(QStringMatcher* other) {
|
|
|
|
return new QStringMatcher(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QStringMatcher* QStringMatcher_new5(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 QStringMatcher(pattern_QString, static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
QStringMatcher* QStringMatcher_new6(QChar* uc, int lenVal, int cs) {
|
|
|
|
return new QStringMatcher(uc, static_cast<int>(lenVal), static_cast<Qt::CaseSensitivity>(cs));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QStringMatcher_OperatorAssign(QStringMatcher* self, QStringMatcher* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QStringMatcher_SetPattern(QStringMatcher* 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
|
|
|
void QStringMatcher_SetCaseSensitivity(QStringMatcher* self, int cs) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->setCaseSensitivity(static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
int QStringMatcher_IndexIn(const QStringMatcher* 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-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringMatcher_IndexIn2(const QStringMatcher* self, QChar* str, int length) {
|
|
|
|
return self->indexIn(str, static_cast<int>(length));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QStringMatcher_Pattern(const QStringMatcher* 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-09-18 00:12:02 +00:00
|
|
|
int QStringMatcher_CaseSensitivity(const QStringMatcher* 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-10-18 23:53:33 +00:00
|
|
|
int QStringMatcher_IndexIn22(const QStringMatcher* self, struct miqt_string str, int from) {
|
|
|
|
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>(from));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QStringMatcher_IndexIn3(const QStringMatcher* self, QChar* str, int length, int from) {
|
|
|
|
return self->indexIn(str, static_cast<int>(length), static_cast<int>(from));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
void QStringMatcher_Delete(QStringMatcher* self, bool isSubclass) {
|
|
|
|
if (isSubclass) {
|
|
|
|
delete dynamic_cast<QStringMatcher*>( self );
|
|
|
|
} else {
|
|
|
|
delete self;
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|