#include #include #include #include #include #include "qstringmatcher.h" #include "gen_qstringmatcher.h" extern "C" { extern void miqt_exec_callback(void* cb, int argc, void* argv); } QStringMatcher* QStringMatcher_new() { return new QStringMatcher(); } QStringMatcher* QStringMatcher_new2(const char* pattern, size_t pattern_Strlen) { QString pattern_QString = QString::fromUtf8(pattern, pattern_Strlen); return new QStringMatcher(pattern_QString); } QStringMatcher* QStringMatcher_new3(QChar* uc, int lenVal) { return new QStringMatcher(uc, static_cast(lenVal)); } QStringMatcher* QStringMatcher_new4(QStringMatcher* other) { return new QStringMatcher(*other); } QStringMatcher* QStringMatcher_new5(const char* pattern, size_t pattern_Strlen, uintptr_t cs) { QString pattern_QString = QString::fromUtf8(pattern, pattern_Strlen); return new QStringMatcher(pattern_QString, static_cast(cs)); } QStringMatcher* QStringMatcher_new6(QChar* uc, int lenVal, uintptr_t cs) { return new QStringMatcher(uc, static_cast(lenVal), static_cast(cs)); } void QStringMatcher_OperatorAssign(QStringMatcher* self, QStringMatcher* other) { self->operator=(*other); } void QStringMatcher_SetPattern(QStringMatcher* self, const char* pattern, size_t pattern_Strlen) { QString pattern_QString = QString::fromUtf8(pattern, pattern_Strlen); self->setPattern(pattern_QString); } void QStringMatcher_SetCaseSensitivity(QStringMatcher* self, uintptr_t cs) { self->setCaseSensitivity(static_cast(cs)); } int QStringMatcher_IndexIn(QStringMatcher* self, const char* str, size_t str_Strlen) { QString str_QString = QString::fromUtf8(str, str_Strlen); return const_cast(self)->indexIn(str_QString); } int QStringMatcher_IndexIn2(QStringMatcher* self, QChar* str, int length) { return const_cast(self)->indexIn(str, static_cast(length)); } void QStringMatcher_Pattern(QStringMatcher* self, char** _out, int* _out_Strlen) { QString ret = const_cast(self)->pattern(); // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory QByteArray b = ret.toUtf8(); *_out = static_cast(malloc(b.length())); memcpy(*_out, b.data(), b.length()); *_out_Strlen = b.length(); } uintptr_t QStringMatcher_CaseSensitivity(QStringMatcher* self) { Qt::CaseSensitivity ret = const_cast(self)->caseSensitivity(); return static_cast(ret); } int QStringMatcher_IndexIn22(QStringMatcher* self, const char* str, size_t str_Strlen, int from) { QString str_QString = QString::fromUtf8(str, str_Strlen); return const_cast(self)->indexIn(str_QString, static_cast(from)); } int QStringMatcher_IndexIn3(QStringMatcher* self, QChar* str, int length, int from) { return const_cast(self)->indexIn(str, static_cast(length), static_cast(from)); } void QStringMatcher_Delete(QStringMatcher* self) { delete self; }