miqt/qt-restricted-extras/qscintilla/gen_qscicommandset.cpp
Jacek Sieka a0c6344ecd Avoid dependency on exported go header
The expected type of the callback is already known from the AST - this
change reduces dependency on cgo specifics and makes the generated C ABI
entirely cgo-independent - in particular, there is no need to include
`_cgo_export.h` any more.
2025-01-07 12:55:40 +01:00

59 lines
1.6 KiB
C++

#include <QList>
#include <QSettings>
#include <qscicommandset.h>
#include "gen_qscicommandset.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* extern C */
#endif
bool QsciCommandSet_ReadSettings(QsciCommandSet* self, QSettings* qs) {
return self->readSettings(*qs);
}
bool QsciCommandSet_WriteSettings(QsciCommandSet* self, QSettings* qs) {
return self->writeSettings(*qs);
}
struct miqt_array /* of QsciCommand* */ QsciCommandSet_Commands(QsciCommandSet* self) {
QList<QsciCommand *>& _ret = self->commands();
// Convert QList<> from C++ memory to manually-managed C memory
QsciCommand** _arr = static_cast<QsciCommand**>(malloc(sizeof(QsciCommand*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
void QsciCommandSet_ClearKeys(QsciCommandSet* self) {
self->clearKeys();
}
void QsciCommandSet_ClearAlternateKeys(QsciCommandSet* self) {
self->clearAlternateKeys();
}
QsciCommand* QsciCommandSet_BoundTo(const QsciCommandSet* self, int key) {
return self->boundTo(static_cast<int>(key));
}
QsciCommand* QsciCommandSet_Find(const QsciCommandSet* self, int command) {
return self->find(static_cast<QsciCommand::Command>(command));
}
bool QsciCommandSet_ReadSettings2(QsciCommandSet* self, QSettings* qs, const char* prefix) {
return self->readSettings(*qs, prefix);
}
bool QsciCommandSet_WriteSettings2(QsciCommandSet* self, QSettings* qs, const char* prefix) {
return self->writeSettings(*qs, prefix);
}