miqt/qt-restricted-extras/qscintilla6/gen_qsciabstractapis.cpp

120 lines
4.5 KiB
C++
Raw Normal View History

2024-11-06 05:30:07 +00:00
#include <QList>
#include <QMetaObject>
2024-11-19 06:29:06 +00:00
#include <QObject>
2024-11-06 05:30:07 +00:00
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qsciabstractapis.h>
#include "gen_qsciabstractapis.h"
#include "_cgo_export.h"
QMetaObject* QsciAbstractAPIs_MetaObject(const QsciAbstractAPIs* self) {
return (QMetaObject*) self->metaObject();
}
void* QsciAbstractAPIs_Metacast(QsciAbstractAPIs* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QsciAbstractAPIs_Tr(const char* s) {
QString _ret = QsciAbstractAPIs::tr(s);
// 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;
}
QsciLexer* QsciAbstractAPIs_Lexer(const QsciAbstractAPIs* self) {
return self->lexer();
}
void QsciAbstractAPIs_UpdateAutoCompletionList(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, struct miqt_array /* of struct miqt_string */ list) {
2024-11-06 05:30:07 +00:00
QStringList context_QList;
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QStringList list_QList;
list_QList.reserve(list.len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(list_arr[i].data, list_arr[i].len);
list_QList.push_back(list_arr_i_QString);
}
self->updateAutoCompletionList(context_QList, list_QList);
}
void QsciAbstractAPIs_AutoCompletionSelected(QsciAbstractAPIs* self, struct miqt_string selection) {
QString selection_QString = QString::fromUtf8(selection.data, selection.len);
self->autoCompletionSelected(selection_QString);
}
struct miqt_array /* of struct miqt_string */ QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, int commas, int style, struct miqt_array /* of int */ shifts) {
2024-11-06 05:30:07 +00:00
QStringList context_QList;
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QList<int> shifts_QList;
shifts_QList.reserve(shifts.len);
int* shifts_arr = static_cast<int*>(shifts.data);
for(size_t i = 0; i < shifts.len; ++i) {
shifts_QList.push_back(static_cast<int>(shifts_arr[i]));
}
QStringList _ret = self->callTips(context_QList, static_cast<int>(commas), static_cast<QsciScintilla::CallTipsStyle>(style), shifts_QList);
// Convert QList<> from C++ memory to manually-managed C memory
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];
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _lv_b = _lv_ret.toUtf8();
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;
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_string QsciAbstractAPIs_Tr2(const char* s, const char* c) {
QString _ret = QsciAbstractAPIs::tr(s, c);
// 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 QsciAbstractAPIs_Tr3(const char* s, const char* c, int n) {
QString _ret = QsciAbstractAPIs::tr(s, c, static_cast<int>(n));
// 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;
}
2024-11-19 06:29:06 +00:00
void QsciAbstractAPIs_Delete(QsciAbstractAPIs* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QsciAbstractAPIs*>( self );
} else {
delete self;
}
2024-11-06 05:30:07 +00:00
}