2024-11-26 19:55:18 +13:00
|
|
|
#include <QScriptProgram>
|
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include <qscriptprogram.h>
|
|
|
|
#include "gen_qscriptprogram.h"
|
2024-12-11 19:55:47 +13:00
|
|
|
|
2025-01-07 11:30:33 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern C */
|
2024-12-11 19:55:47 +13:00
|
|
|
#endif
|
2024-11-26 19:55:18 +13:00
|
|
|
|
2024-12-07 17:15:57 +13:00
|
|
|
QScriptProgram* QScriptProgram_new() {
|
|
|
|
return new QScriptProgram();
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|
2024-12-07 17:15:57 +13:00
|
|
|
QScriptProgram* QScriptProgram_new2(struct miqt_string sourceCode) {
|
2024-11-26 19:55:18 +13:00
|
|
|
QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len);
|
2024-12-07 17:15:57 +13:00
|
|
|
return new QScriptProgram(sourceCode_QString);
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|
2024-12-07 17:15:57 +13:00
|
|
|
QScriptProgram* QScriptProgram_new3(QScriptProgram* other) {
|
|
|
|
return new QScriptProgram(*other);
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|
2024-12-07 17:15:57 +13:00
|
|
|
QScriptProgram* QScriptProgram_new4(struct miqt_string sourceCode, struct miqt_string fileName) {
|
2024-11-26 19:55:18 +13:00
|
|
|
QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len);
|
|
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
2024-12-07 17:15:57 +13:00
|
|
|
return new QScriptProgram(sourceCode_QString, fileName_QString);
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|
2024-12-07 17:15:57 +13:00
|
|
|
QScriptProgram* QScriptProgram_new5(struct miqt_string sourceCode, struct miqt_string fileName, int firstLineNumber) {
|
2024-11-26 19:55:18 +13:00
|
|
|
QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len);
|
|
|
|
QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len);
|
2024-12-07 17:15:57 +13:00
|
|
|
return new QScriptProgram(sourceCode_QString, fileName_QString, static_cast<int>(firstLineNumber));
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
void QScriptProgram_OperatorAssign(QScriptProgram* self, QScriptProgram* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QScriptProgram_IsNull(const QScriptProgram* self) {
|
|
|
|
return self->isNull();
|
|
|
|
}
|
|
|
|
|
|
|
|
struct miqt_string QScriptProgram_SourceCode(const QScriptProgram* self) {
|
|
|
|
QString _ret = self->sourceCode();
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct miqt_string QScriptProgram_FileName(const QScriptProgram* self) {
|
|
|
|
QString _ret = self->fileName();
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray _b = _ret.toUtf8();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int QScriptProgram_FirstLineNumber(const QScriptProgram* self) {
|
|
|
|
return self->firstLineNumber();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QScriptProgram_OperatorEqual(const QScriptProgram* self, QScriptProgram* other) {
|
|
|
|
return (*self == *other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QScriptProgram_OperatorNotEqual(const QScriptProgram* self, QScriptProgram* other) {
|
|
|
|
return (*self != *other);
|
|
|
|
}
|
|
|
|
|
2025-01-18 17:42:41 +13:00
|
|
|
void QScriptProgram_Delete(QScriptProgram* self) {
|
|
|
|
delete self;
|
2024-11-26 19:55:18 +13:00
|
|
|
}
|
|
|
|
|