miqt/qt/gen_qstate.cpp

288 lines
7.8 KiB
C++

#include <QAbstractState>
#include <QAbstractTransition>
#include <QEvent>
#include <QList>
#include <QMetaObject>
#include <QObject>
#include <QSignalTransition>
#include <QState>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <QVariant>
#include <qstate.h>
#include "gen_qstate.h"
#ifndef _Bool
#define _Bool bool
#endif
#include "_cgo_export.h"
class MiqtVirtualQState : public virtual QState {
public:
MiqtVirtualQState(): QState() {};
MiqtVirtualQState(QState::ChildMode childMode): QState(childMode) {};
MiqtVirtualQState(QState* parent): QState(parent) {};
MiqtVirtualQState(QState::ChildMode childMode, QState* parent): QState(childMode, parent) {};
virtual ~MiqtVirtualQState() = default;
// cgo.Handle value for overwritten implementation
intptr_t handle__OnEntry = 0;
// Subclass to allow providing a Go implementation
virtual void onEntry(QEvent* event) override {
if (handle__OnEntry == 0) {
QState::onEntry(event);
return;
}
QEvent* sigval1 = event;
miqt_exec_callback_QState_OnEntry(this, handle__OnEntry, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_OnEntry(QEvent* event) {
QState::onEntry(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__OnExit = 0;
// Subclass to allow providing a Go implementation
virtual void onExit(QEvent* event) override {
if (handle__OnExit == 0) {
QState::onExit(event);
return;
}
QEvent* sigval1 = event;
miqt_exec_callback_QState_OnExit(this, handle__OnExit, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_OnExit(QEvent* event) {
QState::onExit(event);
}
// cgo.Handle value for overwritten implementation
intptr_t handle__Event = 0;
// Subclass to allow providing a Go implementation
virtual bool event(QEvent* e) override {
if (handle__Event == 0) {
return QState::event(e);
}
QEvent* sigval1 = e;
bool callback_return_value = miqt_exec_callback_QState_Event(this, handle__Event, sigval1);
return callback_return_value;
}
// Wrapper to allow calling protected method
bool virtualbase_Event(QEvent* e) {
return QState::event(e);
}
};
QState* QState_new() {
return new MiqtVirtualQState();
}
QState* QState_new2(int childMode) {
return new MiqtVirtualQState(static_cast<QState::ChildMode>(childMode));
}
QState* QState_new3(QState* parent) {
return new MiqtVirtualQState(parent);
}
QState* QState_new4(int childMode, QState* parent) {
return new MiqtVirtualQState(static_cast<QState::ChildMode>(childMode), parent);
}
void QState_virtbase(QState* src, QAbstractState** outptr_QAbstractState) {
*outptr_QAbstractState = static_cast<QAbstractState*>(src);
}
QMetaObject* QState_MetaObject(const QState* self) {
return (QMetaObject*) self->metaObject();
}
void* QState_Metacast(QState* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QState_Tr(const char* s) {
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();
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 QState_TrUtf8(const char* s) {
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();
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;
}
QAbstractState* QState_ErrorState(const QState* self) {
return self->errorState();
}
void QState_SetErrorState(QState* self, QAbstractState* state) {
self->setErrorState(state);
}
void QState_AddTransition(QState* self, QAbstractTransition* transition) {
self->addTransition(transition);
}
QSignalTransition* QState_AddTransition2(QState* self, QObject* sender, const char* signal, QAbstractState* target) {
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);
}
struct miqt_array /* of QAbstractTransition* */ QState_Transitions(const QState* self) {
QList<QAbstractTransition *> _ret = self->transitions();
// Convert QList<> from C++ memory to manually-managed C memory
QAbstractTransition** _arr = static_cast<QAbstractTransition**>(malloc(sizeof(QAbstractTransition*) * _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;
}
QAbstractState* QState_InitialState(const QState* self) {
return self->initialState();
}
void QState_SetInitialState(QState* self, QAbstractState* state) {
self->setInitialState(state);
}
int QState_ChildMode(const QState* self) {
QState::ChildMode _ret = self->childMode();
return static_cast<int>(_ret);
}
void QState_SetChildMode(QState* self, int mode) {
self->setChildMode(static_cast<QState::ChildMode>(mode));
}
void QState_AssignProperty(QState* self, QObject* object, const char* name, QVariant* value) {
self->assignProperty(object, name, *value);
}
struct miqt_string QState_Tr2(const char* s, const char* c) {
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();
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 QState_Tr3(const char* s, const char* c, int n) {
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();
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 QState_TrUtf82(const char* s, const char* c) {
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();
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 QState_TrUtf83(const char* s, const char* c, int n) {
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();
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;
}
void QState_override_virtual_OnEntry(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQState*>( (QState*)(self) )->handle__OnEntry = slot;
}
void QState_virtualbase_OnEntry(void* self, QEvent* event) {
( (MiqtVirtualQState*)(self) )->virtualbase_OnEntry(event);
}
void QState_override_virtual_OnExit(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQState*>( (QState*)(self) )->handle__OnExit = slot;
}
void QState_virtualbase_OnExit(void* self, QEvent* event) {
( (MiqtVirtualQState*)(self) )->virtualbase_OnExit(event);
}
void QState_override_virtual_Event(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQState*>( (QState*)(self) )->handle__Event = slot;
}
bool QState_virtualbase_Event(void* self, QEvent* e) {
return ( (MiqtVirtualQState*)(self) )->virtualbase_Event(e);
}
void QState_Delete(QState* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<MiqtVirtualQState*>( self );
} else {
delete self;
}
}