2024-08-25 04:08:24 +00:00
|
|
|
#include <QAbstractState>
|
|
|
|
#include <QAbstractTransition>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSignalTransition>
|
|
|
|
#include <QState>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QVariant>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qstate.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qstate.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QState* QState_new() {
|
|
|
|
return new QState();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QState* QState_new2(uintptr_t childMode) {
|
|
|
|
return new QState(static_cast<QState::ChildMode>(childMode));
|
|
|
|
}
|
|
|
|
|
|
|
|
QState* QState_new3(QState* parent) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QState(parent);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QState* QState_new4(uintptr_t childMode, QState* parent) {
|
|
|
|
return new QState(static_cast<QState::ChildMode>(childMode), parent);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
QMetaObject* QState_MetaObject(QState* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QState*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::tr(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::trUtf8(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
QAbstractState* QState_ErrorState(QState* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QState*>(self)->errorState();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QState_SetErrorState(QState* self, QAbstractState* state) {
|
|
|
|
self->setErrorState(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_AddTransition(QState* self, QAbstractTransition* transition) {
|
|
|
|
self->addTransition(transition);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
QSignalTransition* QState_AddTransition2(QState* self, QObject* sender, const char* signal, QAbstractState* target) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return self->addTransition(sender, signal, target);
|
|
|
|
}
|
|
|
|
|
|
|
|
QAbstractTransition* QState_AddTransitionWithTarget(QState* self, QAbstractState* target) {
|
|
|
|
return self->addTransition(target);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_RemoveTransition(QState* self, QAbstractTransition* transition) {
|
|
|
|
self->removeTransition(transition);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_Transitions(QState* self, QAbstractTransition*** _out, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QList<QAbstractTransition*> ret = const_cast<const QState*>(self)->transitions();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
QAbstractTransition** __out = static_cast<QAbstractTransition**>(malloc(sizeof(QAbstractTransition*) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = ret[i];
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
QAbstractState* QState_InitialState(QState* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QState*>(self)->initialState();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QState_SetInitialState(QState* self, QAbstractState* state) {
|
|
|
|
self->setInitialState(state);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
uintptr_t QState_ChildMode(QState* self) {
|
|
|
|
QState::ChildMode ret = const_cast<const QState*>(self)->childMode();
|
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_SetChildMode(QState* self, uintptr_t mode) {
|
|
|
|
self->setChildMode(static_cast<QState::ChildMode>(mode));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_AssignProperty(QState* self, QObject* object, const char* name, QVariant* value) {
|
2024-08-25 04:08:24 +00:00
|
|
|
self->assignProperty(object, name, *value);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::tr(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::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();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::trUtf8(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QState_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QState::trUtf8(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();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QState_Delete(QState* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|