From 2526335d5d92b600f31062d28ca1b25e9907359f Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 26 Nov 2024 19:55:18 +1300 Subject: [PATCH] qtscript: initial generation --- qt/script/cflags.go | 6 + qt/script/gen_qscriptable.cpp | 41 + qt/script/gen_qscriptable.go | 100 ++ qt/script/gen_qscriptable.h | 41 + qt/script/gen_qscriptclass.cpp | 412 +++++++++ qt/script/gen_qscriptclass.go | 387 ++++++++ qt/script/gen_qscriptclass.h | 68 ++ .../gen_qscriptclasspropertyiterator.cpp | 57 ++ qt/script/gen_qscriptclasspropertyiterator.go | 110 +++ qt/script/gen_qscriptclasspropertyiterator.h | 43 + qt/script/gen_qscriptcontext.cpp | 142 +++ qt/script/gen_qscriptcontext.go | 229 +++++ qt/script/gen_qscriptcontext.h | 55 ++ qt/script/gen_qscriptcontextinfo.cpp | 121 +++ qt/script/gen_qscriptcontextinfo.go | 174 ++++ qt/script/gen_qscriptcontextinfo.h | 48 + qt/script/gen_qscriptengine.cpp | 697 ++++++++++++++ qt/script/gen_qscriptengine.go | 863 ++++++++++++++++++ qt/script/gen_qscriptengine.h | 152 +++ qt/script/gen_qscriptengineagent.cpp | 474 ++++++++++ qt/script/gen_qscriptengineagent.go | 426 +++++++++ qt/script/gen_qscriptengineagent.h | 70 ++ qt/script/gen_qscriptextensioninterface.cpp | 97 ++ qt/script/gen_qscriptextensioninterface.go | 139 +++ qt/script/gen_qscriptextensioninterface.h | 40 + qt/script/gen_qscriptextensionplugin.cpp | 438 +++++++++ qt/script/gen_qscriptextensionplugin.go | 415 +++++++++ qt/script/gen_qscriptextensionplugin.h | 80 ++ qt/script/gen_qscriptprogram.cpp | 88 ++ qt/script/gen_qscriptprogram.go | 168 ++++ qt/script/gen_qscriptprogram.h | 41 + qt/script/gen_qscriptstring.cpp | 63 ++ qt/script/gen_qscriptstring.go | 115 +++ qt/script/gen_qscriptstring.h | 38 + qt/script/gen_qscriptvalue.cpp | 414 +++++++++ qt/script/gen_qscriptvalue.go | 637 +++++++++++++ qt/script/gen_qscriptvalue.h | 129 +++ qt/script/gen_qscriptvalueiterator.cpp | 83 ++ qt/script/gen_qscriptvalueiterator.go | 135 +++ qt/script/gen_qscriptvalueiterator.h | 47 + 40 files changed, 7883 insertions(+) create mode 100644 qt/script/cflags.go create mode 100644 qt/script/gen_qscriptable.cpp create mode 100644 qt/script/gen_qscriptable.go create mode 100644 qt/script/gen_qscriptable.h create mode 100644 qt/script/gen_qscriptclass.cpp create mode 100644 qt/script/gen_qscriptclass.go create mode 100644 qt/script/gen_qscriptclass.h create mode 100644 qt/script/gen_qscriptclasspropertyiterator.cpp create mode 100644 qt/script/gen_qscriptclasspropertyiterator.go create mode 100644 qt/script/gen_qscriptclasspropertyiterator.h create mode 100644 qt/script/gen_qscriptcontext.cpp create mode 100644 qt/script/gen_qscriptcontext.go create mode 100644 qt/script/gen_qscriptcontext.h create mode 100644 qt/script/gen_qscriptcontextinfo.cpp create mode 100644 qt/script/gen_qscriptcontextinfo.go create mode 100644 qt/script/gen_qscriptcontextinfo.h create mode 100644 qt/script/gen_qscriptengine.cpp create mode 100644 qt/script/gen_qscriptengine.go create mode 100644 qt/script/gen_qscriptengine.h create mode 100644 qt/script/gen_qscriptengineagent.cpp create mode 100644 qt/script/gen_qscriptengineagent.go create mode 100644 qt/script/gen_qscriptengineagent.h create mode 100644 qt/script/gen_qscriptextensioninterface.cpp create mode 100644 qt/script/gen_qscriptextensioninterface.go create mode 100644 qt/script/gen_qscriptextensioninterface.h create mode 100644 qt/script/gen_qscriptextensionplugin.cpp create mode 100644 qt/script/gen_qscriptextensionplugin.go create mode 100644 qt/script/gen_qscriptextensionplugin.h create mode 100644 qt/script/gen_qscriptprogram.cpp create mode 100644 qt/script/gen_qscriptprogram.go create mode 100644 qt/script/gen_qscriptprogram.h create mode 100644 qt/script/gen_qscriptstring.cpp create mode 100644 qt/script/gen_qscriptstring.go create mode 100644 qt/script/gen_qscriptstring.h create mode 100644 qt/script/gen_qscriptvalue.cpp create mode 100644 qt/script/gen_qscriptvalue.go create mode 100644 qt/script/gen_qscriptvalue.h create mode 100644 qt/script/gen_qscriptvalueiterator.cpp create mode 100644 qt/script/gen_qscriptvalueiterator.go create mode 100644 qt/script/gen_qscriptvalueiterator.h diff --git a/qt/script/cflags.go b/qt/script/cflags.go new file mode 100644 index 00000000..88400872 --- /dev/null +++ b/qt/script/cflags.go @@ -0,0 +1,6 @@ +package script + +/* +#cgo pkg-config: Qt5Script +*/ +import "C" diff --git a/qt/script/gen_qscriptable.cpp b/qt/script/gen_qscriptable.cpp new file mode 100644 index 00000000..cf6234bc --- /dev/null +++ b/qt/script/gen_qscriptable.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include "gen_qscriptable.h" +#include "_cgo_export.h" + +void QScriptable_new(QScriptable** outptr_QScriptable) { + QScriptable* ret = new QScriptable(); + *outptr_QScriptable = ret; +} + +QScriptEngine* QScriptable_Engine(const QScriptable* self) { + return self->engine(); +} + +QScriptContext* QScriptable_Context(const QScriptable* self) { + return self->context(); +} + +QScriptValue* QScriptable_ThisObject(const QScriptable* self) { + return new QScriptValue(self->thisObject()); +} + +int QScriptable_ArgumentCount(const QScriptable* self) { + return self->argumentCount(); +} + +QScriptValue* QScriptable_Argument(const QScriptable* self, int index) { + return new QScriptValue(self->argument(static_cast(index))); +} + +void QScriptable_Delete(QScriptable* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptable.go b/qt/script/gen_qscriptable.go new file mode 100644 index 00000000..1f81a759 --- /dev/null +++ b/qt/script/gen_qscriptable.go @@ -0,0 +1,100 @@ +package script + +/* + +#include "gen_qscriptable.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptable struct { + h *C.QScriptable + isSubclass bool +} + +func (this *QScriptable) cPointer() *C.QScriptable { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptable) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptable constructs the type using only CGO pointers. +func newQScriptable(h *C.QScriptable) *QScriptable { + if h == nil { + return nil + } + return &QScriptable{h: h} +} + +// UnsafeNewQScriptable constructs the type using only unsafe pointers. +func UnsafeNewQScriptable(h unsafe.Pointer) *QScriptable { + if h == nil { + return nil + } + + return &QScriptable{h: (*C.QScriptable)(h)} +} + +// NewQScriptable constructs a new QScriptable object. +func NewQScriptable() *QScriptable { + var outptr_QScriptable *C.QScriptable = nil + + C.QScriptable_new(&outptr_QScriptable) + ret := newQScriptable(outptr_QScriptable) + ret.isSubclass = true + return ret +} + +func (this *QScriptable) Engine() *QScriptEngine { + return UnsafeNewQScriptEngine(unsafe.Pointer(C.QScriptable_Engine(this.h)), nil) +} + +func (this *QScriptable) Context() *QScriptContext { + return UnsafeNewQScriptContext(unsafe.Pointer(C.QScriptable_Context(this.h))) +} + +func (this *QScriptable) ThisObject() *QScriptValue { + _ret := C.QScriptable_ThisObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptable) ArgumentCount() int { + return (int)(C.QScriptable_ArgumentCount(this.h)) +} + +func (this *QScriptable) Argument(index int) *QScriptValue { + _ret := C.QScriptable_Argument(this.h, (C.int)(index)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +// Delete this object from C++ memory. +func (this *QScriptable) Delete() { + C.QScriptable_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptable) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptable) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptable.h b/qt/script/gen_qscriptable.h new file mode 100644 index 00000000..929e17f7 --- /dev/null +++ b/qt/script/gen_qscriptable.h @@ -0,0 +1,41 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTABLE_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTABLE_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptContext; +class QScriptEngine; +class QScriptValue; +class QScriptable; +#else +typedef struct QScriptContext QScriptContext; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptValue QScriptValue; +typedef struct QScriptable QScriptable; +#endif + +void QScriptable_new(QScriptable** outptr_QScriptable); +QScriptEngine* QScriptable_Engine(const QScriptable* self); +QScriptContext* QScriptable_Context(const QScriptable* self); +QScriptValue* QScriptable_ThisObject(const QScriptable* self); +int QScriptable_ArgumentCount(const QScriptable* self); +QScriptValue* QScriptable_Argument(const QScriptable* self, int index); +void QScriptable_Delete(QScriptable* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptclass.cpp b/qt/script/gen_qscriptclass.cpp new file mode 100644 index 00000000..73a42fff --- /dev/null +++ b/qt/script/gen_qscriptclass.cpp @@ -0,0 +1,412 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptclass.h" +#include "_cgo_export.h" + +class MiqtVirtualQScriptClass : public virtual QScriptClass { +public: + + MiqtVirtualQScriptClass(QScriptEngine* engine): QScriptClass(engine) {}; + + virtual ~MiqtVirtualQScriptClass() = default; + + // cgo.Handle value for overwritten implementation + intptr_t handle__QueryProperty = 0; + + // Subclass to allow providing a Go implementation + virtual QScriptClass::QueryFlags queryProperty(const QScriptValue& object, const QScriptString& name, QScriptClass::QueryFlags flags, uint* id) override { + if (handle__QueryProperty == 0) { + return QScriptClass::queryProperty(object, name, flags, id); + } + + const QScriptValue& object_ret = object; + // Cast returned reference into pointer + QScriptValue* sigval1 = const_cast(&object_ret); + const QScriptString& name_ret = name; + // Cast returned reference into pointer + QScriptString* sigval2 = const_cast(&name_ret); + QScriptClass::QueryFlags flags_ret = flags; + int sigval3 = static_cast(flags_ret); + uint* id_ret = id; + unsigned int* sigval4 = static_cast(id_ret); + + int callback_return_value = miqt_exec_callback_QScriptClass_QueryProperty(this, handle__QueryProperty, sigval1, sigval2, sigval3, sigval4); + + return static_cast(callback_return_value); + } + + // Wrapper to allow calling protected method + int virtualbase_QueryProperty(QScriptValue* object, QScriptString* name, int flags, unsigned int* id) { + + QScriptClass::QueryFlags _ret = QScriptClass::queryProperty(*object, *name, static_cast(flags), static_cast(id)); + return static_cast(_ret); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Property = 0; + + // Subclass to allow providing a Go implementation + virtual QScriptValue property(const QScriptValue& object, const QScriptString& name, uint id) override { + if (handle__Property == 0) { + return QScriptClass::property(object, name, id); + } + + const QScriptValue& object_ret = object; + // Cast returned reference into pointer + QScriptValue* sigval1 = const_cast(&object_ret); + const QScriptString& name_ret = name; + // Cast returned reference into pointer + QScriptString* sigval2 = const_cast(&name_ret); + uint id_ret = id; + unsigned int sigval3 = static_cast(id_ret); + + QScriptValue* callback_return_value = miqt_exec_callback_QScriptClass_Property(this, handle__Property, sigval1, sigval2, sigval3); + + return *callback_return_value; + } + + // Wrapper to allow calling protected method + QScriptValue* virtualbase_Property(QScriptValue* object, QScriptString* name, unsigned int id) { + + return new QScriptValue(QScriptClass::property(*object, *name, static_cast(id))); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__SetProperty = 0; + + // Subclass to allow providing a Go implementation + virtual void setProperty(QScriptValue& object, const QScriptString& name, uint id, const QScriptValue& value) override { + if (handle__SetProperty == 0) { + QScriptClass::setProperty(object, name, id, value); + return; + } + + QScriptValue& object_ret = object; + // Cast returned reference into pointer + QScriptValue* sigval1 = &object_ret; + const QScriptString& name_ret = name; + // Cast returned reference into pointer + QScriptString* sigval2 = const_cast(&name_ret); + uint id_ret = id; + unsigned int sigval3 = static_cast(id_ret); + const QScriptValue& value_ret = value; + // Cast returned reference into pointer + QScriptValue* sigval4 = const_cast(&value_ret); + + miqt_exec_callback_QScriptClass_SetProperty(this, handle__SetProperty, sigval1, sigval2, sigval3, sigval4); + + + } + + // Wrapper to allow calling protected method + void virtualbase_SetProperty(QScriptValue* object, QScriptString* name, unsigned int id, QScriptValue* value) { + + QScriptClass::setProperty(*object, *name, static_cast(id), *value); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__PropertyFlags = 0; + + // Subclass to allow providing a Go implementation + virtual QScriptValue::PropertyFlags propertyFlags(const QScriptValue& object, const QScriptString& name, uint id) override { + if (handle__PropertyFlags == 0) { + return QScriptClass::propertyFlags(object, name, id); + } + + const QScriptValue& object_ret = object; + // Cast returned reference into pointer + QScriptValue* sigval1 = const_cast(&object_ret); + const QScriptString& name_ret = name; + // Cast returned reference into pointer + QScriptString* sigval2 = const_cast(&name_ret); + uint id_ret = id; + unsigned int sigval3 = static_cast(id_ret); + + int callback_return_value = miqt_exec_callback_QScriptClass_PropertyFlags(this, handle__PropertyFlags, sigval1, sigval2, sigval3); + + return static_cast(callback_return_value); + } + + // Wrapper to allow calling protected method + int virtualbase_PropertyFlags(QScriptValue* object, QScriptString* name, unsigned int id) { + + QScriptValue::PropertyFlags _ret = QScriptClass::propertyFlags(*object, *name, static_cast(id)); + return static_cast(_ret); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__NewIterator = 0; + + // Subclass to allow providing a Go implementation + virtual QScriptClassPropertyIterator* newIterator(const QScriptValue& object) override { + if (handle__NewIterator == 0) { + return QScriptClass::newIterator(object); + } + + const QScriptValue& object_ret = object; + // Cast returned reference into pointer + QScriptValue* sigval1 = const_cast(&object_ret); + + QScriptClassPropertyIterator* callback_return_value = miqt_exec_callback_QScriptClass_NewIterator(this, handle__NewIterator, sigval1); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + QScriptClassPropertyIterator* virtualbase_NewIterator(QScriptValue* object) { + + return QScriptClass::newIterator(*object); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Prototype = 0; + + // Subclass to allow providing a Go implementation + virtual QScriptValue prototype() const override { + if (handle__Prototype == 0) { + return QScriptClass::prototype(); + } + + + QScriptValue* callback_return_value = miqt_exec_callback_QScriptClass_Prototype(const_cast(this), handle__Prototype); + + return *callback_return_value; + } + + // Wrapper to allow calling protected method + QScriptValue* virtualbase_Prototype() const { + + return new QScriptValue(QScriptClass::prototype()); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Name = 0; + + // Subclass to allow providing a Go implementation + virtual QString name() const override { + if (handle__Name == 0) { + return QScriptClass::name(); + } + + + struct miqt_string callback_return_value = miqt_exec_callback_QScriptClass_Name(const_cast(this), handle__Name); + QString callback_return_value_QString = QString::fromUtf8(callback_return_value.data, callback_return_value.len); + + return callback_return_value_QString; + } + + // Wrapper to allow calling protected method + struct miqt_string virtualbase_Name() const { + + QString _ret = QScriptClass::name(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__SupportsExtension = 0; + + // Subclass to allow providing a Go implementation + virtual bool supportsExtension(QScriptClass::Extension extension) const override { + if (handle__SupportsExtension == 0) { + return QScriptClass::supportsExtension(extension); + } + + QScriptClass::Extension extension_ret = extension; + int sigval1 = static_cast(extension_ret); + + bool callback_return_value = miqt_exec_callback_QScriptClass_SupportsExtension(const_cast(this), handle__SupportsExtension, sigval1); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_SupportsExtension(int extension) const { + + return QScriptClass::supportsExtension(static_cast(extension)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Extension = 0; + + // Subclass to allow providing a Go implementation + virtual QVariant extension(QScriptClass::Extension extension, const QVariant& argument) override { + if (handle__Extension == 0) { + return QScriptClass::extension(extension, argument); + } + + QScriptClass::Extension extension_ret = extension; + int sigval1 = static_cast(extension_ret); + const QVariant& argument_ret = argument; + // Cast returned reference into pointer + QVariant* sigval2 = const_cast(&argument_ret); + + QVariant* callback_return_value = miqt_exec_callback_QScriptClass_Extension(this, handle__Extension, sigval1, sigval2); + + return *callback_return_value; + } + + // Wrapper to allow calling protected method + QVariant* virtualbase_Extension(int extension, QVariant* argument) { + + return new QVariant(QScriptClass::extension(static_cast(extension), *argument)); + + } + +}; + +void QScriptClass_new(QScriptEngine* engine, QScriptClass** outptr_QScriptClass) { + MiqtVirtualQScriptClass* ret = new MiqtVirtualQScriptClass(engine); + *outptr_QScriptClass = ret; +} + +QScriptEngine* QScriptClass_Engine(const QScriptClass* self) { + return self->engine(); +} + +int QScriptClass_QueryProperty(QScriptClass* self, QScriptValue* object, QScriptString* name, int flags, unsigned int* id) { + QScriptClass::QueryFlags _ret = self->queryProperty(*object, *name, static_cast(flags), static_cast(id)); + return static_cast(_ret); +} + +QScriptValue* QScriptClass_Property(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id) { + return new QScriptValue(self->property(*object, *name, static_cast(id))); +} + +void QScriptClass_SetProperty(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id, QScriptValue* value) { + self->setProperty(*object, *name, static_cast(id), *value); +} + +int QScriptClass_PropertyFlags(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id) { + QScriptValue::PropertyFlags _ret = self->propertyFlags(*object, *name, static_cast(id)); + return static_cast(_ret); +} + +QScriptClassPropertyIterator* QScriptClass_NewIterator(QScriptClass* self, QScriptValue* object) { + return self->newIterator(*object); +} + +QScriptValue* QScriptClass_Prototype(const QScriptClass* self) { + return new QScriptValue(self->prototype()); +} + +struct miqt_string QScriptClass_Name(const QScriptClass* self) { + QString _ret = self->name(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +bool QScriptClass_SupportsExtension(const QScriptClass* self, int extension) { + return self->supportsExtension(static_cast(extension)); +} + +QVariant* QScriptClass_Extension(QScriptClass* self, int extension, QVariant* argument) { + return new QVariant(self->extension(static_cast(extension), *argument)); +} + +void QScriptClass_override_virtual_QueryProperty(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__QueryProperty = slot; +} + +int QScriptClass_virtualbase_QueryProperty(void* self, QScriptValue* object, QScriptString* name, int flags, unsigned int* id) { + return ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_QueryProperty(object, name, flags, id); +} + +void QScriptClass_override_virtual_Property(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__Property = slot; +} + +QScriptValue* QScriptClass_virtualbase_Property(void* self, QScriptValue* object, QScriptString* name, unsigned int id) { + return ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_Property(object, name, id); +} + +void QScriptClass_override_virtual_SetProperty(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__SetProperty = slot; +} + +void QScriptClass_virtualbase_SetProperty(void* self, QScriptValue* object, QScriptString* name, unsigned int id, QScriptValue* value) { + ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_SetProperty(object, name, id, value); +} + +void QScriptClass_override_virtual_PropertyFlags(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__PropertyFlags = slot; +} + +int QScriptClass_virtualbase_PropertyFlags(void* self, QScriptValue* object, QScriptString* name, unsigned int id) { + return ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_PropertyFlags(object, name, id); +} + +void QScriptClass_override_virtual_NewIterator(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__NewIterator = slot; +} + +QScriptClassPropertyIterator* QScriptClass_virtualbase_NewIterator(void* self, QScriptValue* object) { + return ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_NewIterator(object); +} + +void QScriptClass_override_virtual_Prototype(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__Prototype = slot; +} + +QScriptValue* QScriptClass_virtualbase_Prototype(const void* self) { + return ( (const MiqtVirtualQScriptClass*)(self) )->virtualbase_Prototype(); +} + +void QScriptClass_override_virtual_Name(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__Name = slot; +} + +struct miqt_string QScriptClass_virtualbase_Name(const void* self) { + return ( (const MiqtVirtualQScriptClass*)(self) )->virtualbase_Name(); +} + +void QScriptClass_override_virtual_SupportsExtension(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__SupportsExtension = slot; +} + +bool QScriptClass_virtualbase_SupportsExtension(const void* self, int extension) { + return ( (const MiqtVirtualQScriptClass*)(self) )->virtualbase_SupportsExtension(extension); +} + +void QScriptClass_override_virtual_Extension(void* self, intptr_t slot) { + dynamic_cast( (QScriptClass*)(self) )->handle__Extension = slot; +} + +QVariant* QScriptClass_virtualbase_Extension(void* self, int extension, QVariant* argument) { + return ( (MiqtVirtualQScriptClass*)(self) )->virtualbase_Extension(extension, argument); +} + +void QScriptClass_Delete(QScriptClass* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptclass.go b/qt/script/gen_qscriptclass.go new file mode 100644 index 00000000..fe8a5e8f --- /dev/null +++ b/qt/script/gen_qscriptclass.go @@ -0,0 +1,387 @@ +package script + +/* + +#include "gen_qscriptclass.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QScriptClass__QueryFlag int + +const ( + QScriptClass__HandlesReadAccess QScriptClass__QueryFlag = 1 + QScriptClass__HandlesWriteAccess QScriptClass__QueryFlag = 2 +) + +type QScriptClass__Extension int + +const ( + QScriptClass__Callable QScriptClass__Extension = 0 + QScriptClass__HasInstance QScriptClass__Extension = 1 +) + +type QScriptClass struct { + h *C.QScriptClass + isSubclass bool +} + +func (this *QScriptClass) cPointer() *C.QScriptClass { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptClass) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptClass constructs the type using only CGO pointers. +func newQScriptClass(h *C.QScriptClass) *QScriptClass { + if h == nil { + return nil + } + return &QScriptClass{h: h} +} + +// UnsafeNewQScriptClass constructs the type using only unsafe pointers. +func UnsafeNewQScriptClass(h unsafe.Pointer) *QScriptClass { + if h == nil { + return nil + } + + return &QScriptClass{h: (*C.QScriptClass)(h)} +} + +// NewQScriptClass constructs a new QScriptClass object. +func NewQScriptClass(engine *QScriptEngine) *QScriptClass { + var outptr_QScriptClass *C.QScriptClass = nil + + C.QScriptClass_new(engine.cPointer(), &outptr_QScriptClass) + ret := newQScriptClass(outptr_QScriptClass) + ret.isSubclass = true + return ret +} + +func (this *QScriptClass) Engine() *QScriptEngine { + return UnsafeNewQScriptEngine(unsafe.Pointer(C.QScriptClass_Engine(this.h)), nil) +} + +func (this *QScriptClass) QueryProperty(object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag { + return (QScriptClass__QueryFlag)(C.QScriptClass_QueryProperty(this.h, object.cPointer(), name.cPointer(), (C.int)(flags), (*C.uint)(unsafe.Pointer(id)))) +} + +func (this *QScriptClass) Property(object *QScriptValue, name *QScriptString, id uint) *QScriptValue { + _ret := C.QScriptClass_Property(this.h, object.cPointer(), name.cPointer(), (C.uint)(id)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptClass) SetProperty(object *QScriptValue, name *QScriptString, id uint, value *QScriptValue) { + C.QScriptClass_SetProperty(this.h, object.cPointer(), name.cPointer(), (C.uint)(id), value.cPointer()) +} + +func (this *QScriptClass) PropertyFlags(object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag { + return (QScriptValue__PropertyFlag)(C.QScriptClass_PropertyFlags(this.h, object.cPointer(), name.cPointer(), (C.uint)(id))) +} + +func (this *QScriptClass) NewIterator(object *QScriptValue) *QScriptClassPropertyIterator { + return UnsafeNewQScriptClassPropertyIterator(unsafe.Pointer(C.QScriptClass_NewIterator(this.h, object.cPointer()))) +} + +func (this *QScriptClass) Prototype() *QScriptValue { + _ret := C.QScriptClass_Prototype(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptClass) Name() string { + var _ms C.struct_miqt_string = C.QScriptClass_Name(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptClass) SupportsExtension(extension QScriptClass__Extension) bool { + return (bool)(C.QScriptClass_SupportsExtension(this.h, (C.int)(extension))) +} + +func (this *QScriptClass) Extension(extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant { + _ret := C.QScriptClass_Extension(this.h, (C.int)(extension), (*C.QVariant)(argument.UnsafePointer())) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptClass) callVirtualBase_QueryProperty(object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag { + + return (QScriptClass__QueryFlag)(C.QScriptClass_virtualbase_QueryProperty(unsafe.Pointer(this.h), object.cPointer(), name.cPointer(), (C.int)(flags), (*C.uint)(unsafe.Pointer(id)))) + +} +func (this *QScriptClass) OnQueryProperty(slot func(super func(object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag, object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag) { + C.QScriptClass_override_virtual_QueryProperty(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_QueryProperty +func miqt_exec_callback_QScriptClass_QueryProperty(self *C.QScriptClass, cb C.intptr_t, object *C.QScriptValue, name *C.QScriptString, flags C.int, id *C.uint) C.int { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag, object *QScriptValue, name *QScriptString, flags QScriptClass__QueryFlag, id *uint) QScriptClass__QueryFlag) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(object)) + slotval2 := UnsafeNewQScriptString(unsafe.Pointer(name)) + slotval3 := (QScriptClass__QueryFlag)(flags) + + slotval4 := (*uint)(unsafe.Pointer(id)) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_QueryProperty, slotval1, slotval2, slotval3, slotval4) + + return (C.int)(virtualReturn) + +} + +func (this *QScriptClass) callVirtualBase_Property(object *QScriptValue, name *QScriptString, id uint) *QScriptValue { + + _ret := C.QScriptClass_virtualbase_Property(unsafe.Pointer(this.h), object.cPointer(), name.cPointer(), (C.uint)(id)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr + +} +func (this *QScriptClass) OnProperty(slot func(super func(object *QScriptValue, name *QScriptString, id uint) *QScriptValue, object *QScriptValue, name *QScriptString, id uint) *QScriptValue) { + C.QScriptClass_override_virtual_Property(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_Property +func miqt_exec_callback_QScriptClass_Property(self *C.QScriptClass, cb C.intptr_t, object *C.QScriptValue, name *C.QScriptString, id C.uint) *C.QScriptValue { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(object *QScriptValue, name *QScriptString, id uint) *QScriptValue, object *QScriptValue, name *QScriptString, id uint) *QScriptValue) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(object)) + slotval2 := UnsafeNewQScriptString(unsafe.Pointer(name)) + slotval3 := (uint)(id) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_Property, slotval1, slotval2, slotval3) + + return virtualReturn.cPointer() + +} + +func (this *QScriptClass) callVirtualBase_SetProperty(object *QScriptValue, name *QScriptString, id uint, value *QScriptValue) { + + C.QScriptClass_virtualbase_SetProperty(unsafe.Pointer(this.h), object.cPointer(), name.cPointer(), (C.uint)(id), value.cPointer()) + +} +func (this *QScriptClass) OnSetProperty(slot func(super func(object *QScriptValue, name *QScriptString, id uint, value *QScriptValue), object *QScriptValue, name *QScriptString, id uint, value *QScriptValue)) { + C.QScriptClass_override_virtual_SetProperty(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_SetProperty +func miqt_exec_callback_QScriptClass_SetProperty(self *C.QScriptClass, cb C.intptr_t, object *C.QScriptValue, name *C.QScriptString, id C.uint, value *C.QScriptValue) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(object *QScriptValue, name *QScriptString, id uint, value *QScriptValue), object *QScriptValue, name *QScriptString, id uint, value *QScriptValue)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(object)) + slotval2 := UnsafeNewQScriptString(unsafe.Pointer(name)) + slotval3 := (uint)(id) + + slotval4 := UnsafeNewQScriptValue(unsafe.Pointer(value)) + + gofunc((&QScriptClass{h: self}).callVirtualBase_SetProperty, slotval1, slotval2, slotval3, slotval4) + +} + +func (this *QScriptClass) callVirtualBase_PropertyFlags(object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag { + + return (QScriptValue__PropertyFlag)(C.QScriptClass_virtualbase_PropertyFlags(unsafe.Pointer(this.h), object.cPointer(), name.cPointer(), (C.uint)(id))) + +} +func (this *QScriptClass) OnPropertyFlags(slot func(super func(object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag, object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag) { + C.QScriptClass_override_virtual_PropertyFlags(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_PropertyFlags +func miqt_exec_callback_QScriptClass_PropertyFlags(self *C.QScriptClass, cb C.intptr_t, object *C.QScriptValue, name *C.QScriptString, id C.uint) C.int { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag, object *QScriptValue, name *QScriptString, id uint) QScriptValue__PropertyFlag) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(object)) + slotval2 := UnsafeNewQScriptString(unsafe.Pointer(name)) + slotval3 := (uint)(id) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_PropertyFlags, slotval1, slotval2, slotval3) + + return (C.int)(virtualReturn) + +} + +func (this *QScriptClass) callVirtualBase_NewIterator(object *QScriptValue) *QScriptClassPropertyIterator { + + return UnsafeNewQScriptClassPropertyIterator(unsafe.Pointer(C.QScriptClass_virtualbase_NewIterator(unsafe.Pointer(this.h), object.cPointer()))) +} +func (this *QScriptClass) OnNewIterator(slot func(super func(object *QScriptValue) *QScriptClassPropertyIterator, object *QScriptValue) *QScriptClassPropertyIterator) { + C.QScriptClass_override_virtual_NewIterator(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_NewIterator +func miqt_exec_callback_QScriptClass_NewIterator(self *C.QScriptClass, cb C.intptr_t, object *C.QScriptValue) *C.QScriptClassPropertyIterator { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(object *QScriptValue) *QScriptClassPropertyIterator, object *QScriptValue) *QScriptClassPropertyIterator) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(object)) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_NewIterator, slotval1) + + return virtualReturn.cPointer() + +} + +func (this *QScriptClass) callVirtualBase_Prototype() *QScriptValue { + + _ret := C.QScriptClass_virtualbase_Prototype(unsafe.Pointer(this.h)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr + +} +func (this *QScriptClass) OnPrototype(slot func(super func() *QScriptValue) *QScriptValue) { + C.QScriptClass_override_virtual_Prototype(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_Prototype +func miqt_exec_callback_QScriptClass_Prototype(self *C.QScriptClass, cb C.intptr_t) *C.QScriptValue { + gofunc, ok := cgo.Handle(cb).Value().(func(super func() *QScriptValue) *QScriptValue) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_Prototype) + + return virtualReturn.cPointer() + +} + +func (this *QScriptClass) callVirtualBase_Name() string { + + var _ms C.struct_miqt_string = C.QScriptClass_virtualbase_Name(unsafe.Pointer(this.h)) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} +func (this *QScriptClass) OnName(slot func(super func() string) string) { + C.QScriptClass_override_virtual_Name(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_Name +func miqt_exec_callback_QScriptClass_Name(self *C.QScriptClass, cb C.intptr_t) C.struct_miqt_string { + gofunc, ok := cgo.Handle(cb).Value().(func(super func() string) string) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_Name) + virtualReturn_ms := C.struct_miqt_string{} + virtualReturn_ms.data = C.CString(virtualReturn) + virtualReturn_ms.len = C.size_t(len(virtualReturn)) + defer C.free(unsafe.Pointer(virtualReturn_ms.data)) + + return virtualReturn_ms + +} + +func (this *QScriptClass) callVirtualBase_SupportsExtension(extension QScriptClass__Extension) bool { + + return (bool)(C.QScriptClass_virtualbase_SupportsExtension(unsafe.Pointer(this.h), (C.int)(extension))) + +} +func (this *QScriptClass) OnSupportsExtension(slot func(super func(extension QScriptClass__Extension) bool, extension QScriptClass__Extension) bool) { + C.QScriptClass_override_virtual_SupportsExtension(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_SupportsExtension +func miqt_exec_callback_QScriptClass_SupportsExtension(self *C.QScriptClass, cb C.intptr_t, extension C.int) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(extension QScriptClass__Extension) bool, extension QScriptClass__Extension) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (QScriptClass__Extension)(extension) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_SupportsExtension, slotval1) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptClass) callVirtualBase_Extension(extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant { + + _ret := C.QScriptClass_virtualbase_Extension(unsafe.Pointer(this.h), (C.int)(extension), (*C.QVariant)(argument.UnsafePointer())) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr + +} +func (this *QScriptClass) OnExtension(slot func(super func(extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant, extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant) { + C.QScriptClass_override_virtual_Extension(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptClass_Extension +func miqt_exec_callback_QScriptClass_Extension(self *C.QScriptClass, cb C.intptr_t, extension C.int, argument *C.QVariant) *C.QVariant { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant, extension QScriptClass__Extension, argument *qt.QVariant) *qt.QVariant) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (QScriptClass__Extension)(extension) + + slotval2 := qt.UnsafeNewQVariant(unsafe.Pointer(argument)) + + virtualReturn := gofunc((&QScriptClass{h: self}).callVirtualBase_Extension, slotval1, slotval2) + + return (*C.QVariant)(virtualReturn.UnsafePointer()) + +} + +// Delete this object from C++ memory. +func (this *QScriptClass) Delete() { + C.QScriptClass_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptClass) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptClass) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptclass.h b/qt/script/gen_qscriptclass.h new file mode 100644 index 00000000..ca948115 --- /dev/null +++ b/qt/script/gen_qscriptclass.h @@ -0,0 +1,68 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTCLASS_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTCLASS_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptClass; +class QScriptClassPropertyIterator; +class QScriptEngine; +class QScriptString; +class QScriptValue; +class QVariant; +#else +typedef struct QScriptClass QScriptClass; +typedef struct QScriptClassPropertyIterator QScriptClassPropertyIterator; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptString QScriptString; +typedef struct QScriptValue QScriptValue; +typedef struct QVariant QVariant; +#endif + +void QScriptClass_new(QScriptEngine* engine, QScriptClass** outptr_QScriptClass); +QScriptEngine* QScriptClass_Engine(const QScriptClass* self); +int QScriptClass_QueryProperty(QScriptClass* self, QScriptValue* object, QScriptString* name, int flags, unsigned int* id); +QScriptValue* QScriptClass_Property(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id); +void QScriptClass_SetProperty(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id, QScriptValue* value); +int QScriptClass_PropertyFlags(QScriptClass* self, QScriptValue* object, QScriptString* name, unsigned int id); +QScriptClassPropertyIterator* QScriptClass_NewIterator(QScriptClass* self, QScriptValue* object); +QScriptValue* QScriptClass_Prototype(const QScriptClass* self); +struct miqt_string QScriptClass_Name(const QScriptClass* self); +bool QScriptClass_SupportsExtension(const QScriptClass* self, int extension); +QVariant* QScriptClass_Extension(QScriptClass* self, int extension, QVariant* argument); +void QScriptClass_override_virtual_QueryProperty(void* self, intptr_t slot); +int QScriptClass_virtualbase_QueryProperty(void* self, QScriptValue* object, QScriptString* name, int flags, unsigned int* id); +void QScriptClass_override_virtual_Property(void* self, intptr_t slot); +QScriptValue* QScriptClass_virtualbase_Property(void* self, QScriptValue* object, QScriptString* name, unsigned int id); +void QScriptClass_override_virtual_SetProperty(void* self, intptr_t slot); +void QScriptClass_virtualbase_SetProperty(void* self, QScriptValue* object, QScriptString* name, unsigned int id, QScriptValue* value); +void QScriptClass_override_virtual_PropertyFlags(void* self, intptr_t slot); +int QScriptClass_virtualbase_PropertyFlags(void* self, QScriptValue* object, QScriptString* name, unsigned int id); +void QScriptClass_override_virtual_NewIterator(void* self, intptr_t slot); +QScriptClassPropertyIterator* QScriptClass_virtualbase_NewIterator(void* self, QScriptValue* object); +void QScriptClass_override_virtual_Prototype(void* self, intptr_t slot); +QScriptValue* QScriptClass_virtualbase_Prototype(const void* self); +void QScriptClass_override_virtual_Name(void* self, intptr_t slot); +struct miqt_string QScriptClass_virtualbase_Name(const void* self); +void QScriptClass_override_virtual_SupportsExtension(void* self, intptr_t slot); +bool QScriptClass_virtualbase_SupportsExtension(const void* self, int extension); +void QScriptClass_override_virtual_Extension(void* self, intptr_t slot); +QVariant* QScriptClass_virtualbase_Extension(void* self, int extension, QVariant* argument); +void QScriptClass_Delete(QScriptClass* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptclasspropertyiterator.cpp b/qt/script/gen_qscriptclasspropertyiterator.cpp new file mode 100644 index 00000000..00692205 --- /dev/null +++ b/qt/script/gen_qscriptclasspropertyiterator.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +#include +#include "gen_qscriptclasspropertyiterator.h" +#include "_cgo_export.h" + +QScriptValue* QScriptClassPropertyIterator_Object(const QScriptClassPropertyIterator* self) { + return new QScriptValue(self->object()); +} + +bool QScriptClassPropertyIterator_HasNext(const QScriptClassPropertyIterator* self) { + return self->hasNext(); +} + +void QScriptClassPropertyIterator_Next(QScriptClassPropertyIterator* self) { + self->next(); +} + +bool QScriptClassPropertyIterator_HasPrevious(const QScriptClassPropertyIterator* self) { + return self->hasPrevious(); +} + +void QScriptClassPropertyIterator_Previous(QScriptClassPropertyIterator* self) { + self->previous(); +} + +void QScriptClassPropertyIterator_ToFront(QScriptClassPropertyIterator* self) { + self->toFront(); +} + +void QScriptClassPropertyIterator_ToBack(QScriptClassPropertyIterator* self) { + self->toBack(); +} + +QScriptString* QScriptClassPropertyIterator_Name(const QScriptClassPropertyIterator* self) { + return new QScriptString(self->name()); +} + +unsigned int QScriptClassPropertyIterator_Id(const QScriptClassPropertyIterator* self) { + uint _ret = self->id(); + return static_cast(_ret); +} + +int QScriptClassPropertyIterator_Flags(const QScriptClassPropertyIterator* self) { + QScriptValue::PropertyFlags _ret = self->flags(); + return static_cast(_ret); +} + +void QScriptClassPropertyIterator_Delete(QScriptClassPropertyIterator* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptclasspropertyiterator.go b/qt/script/gen_qscriptclasspropertyiterator.go new file mode 100644 index 00000000..7c4caa8a --- /dev/null +++ b/qt/script/gen_qscriptclasspropertyiterator.go @@ -0,0 +1,110 @@ +package script + +/* + +#include "gen_qscriptclasspropertyiterator.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptClassPropertyIterator struct { + h *C.QScriptClassPropertyIterator + isSubclass bool +} + +func (this *QScriptClassPropertyIterator) cPointer() *C.QScriptClassPropertyIterator { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptClassPropertyIterator) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptClassPropertyIterator constructs the type using only CGO pointers. +func newQScriptClassPropertyIterator(h *C.QScriptClassPropertyIterator) *QScriptClassPropertyIterator { + if h == nil { + return nil + } + return &QScriptClassPropertyIterator{h: h} +} + +// UnsafeNewQScriptClassPropertyIterator constructs the type using only unsafe pointers. +func UnsafeNewQScriptClassPropertyIterator(h unsafe.Pointer) *QScriptClassPropertyIterator { + if h == nil { + return nil + } + + return &QScriptClassPropertyIterator{h: (*C.QScriptClassPropertyIterator)(h)} +} + +func (this *QScriptClassPropertyIterator) Object() *QScriptValue { + _ret := C.QScriptClassPropertyIterator_Object(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptClassPropertyIterator) HasNext() bool { + return (bool)(C.QScriptClassPropertyIterator_HasNext(this.h)) +} + +func (this *QScriptClassPropertyIterator) Next() { + C.QScriptClassPropertyIterator_Next(this.h) +} + +func (this *QScriptClassPropertyIterator) HasPrevious() bool { + return (bool)(C.QScriptClassPropertyIterator_HasPrevious(this.h)) +} + +func (this *QScriptClassPropertyIterator) Previous() { + C.QScriptClassPropertyIterator_Previous(this.h) +} + +func (this *QScriptClassPropertyIterator) ToFront() { + C.QScriptClassPropertyIterator_ToFront(this.h) +} + +func (this *QScriptClassPropertyIterator) ToBack() { + C.QScriptClassPropertyIterator_ToBack(this.h) +} + +func (this *QScriptClassPropertyIterator) Name() *QScriptString { + _ret := C.QScriptClassPropertyIterator_Name(this.h) + _goptr := newQScriptString(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptClassPropertyIterator) Id() uint { + return (uint)(C.QScriptClassPropertyIterator_Id(this.h)) +} + +func (this *QScriptClassPropertyIterator) Flags() QScriptValue__PropertyFlag { + return (QScriptValue__PropertyFlag)(C.QScriptClassPropertyIterator_Flags(this.h)) +} + +// Delete this object from C++ memory. +func (this *QScriptClassPropertyIterator) Delete() { + C.QScriptClassPropertyIterator_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptClassPropertyIterator) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptClassPropertyIterator) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptclasspropertyiterator.h b/qt/script/gen_qscriptclasspropertyiterator.h new file mode 100644 index 00000000..2db49d6c --- /dev/null +++ b/qt/script/gen_qscriptclasspropertyiterator.h @@ -0,0 +1,43 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTCLASSPROPERTYITERATOR_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTCLASSPROPERTYITERATOR_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptClassPropertyIterator; +class QScriptString; +class QScriptValue; +#else +typedef struct QScriptClassPropertyIterator QScriptClassPropertyIterator; +typedef struct QScriptString QScriptString; +typedef struct QScriptValue QScriptValue; +#endif + +QScriptValue* QScriptClassPropertyIterator_Object(const QScriptClassPropertyIterator* self); +bool QScriptClassPropertyIterator_HasNext(const QScriptClassPropertyIterator* self); +void QScriptClassPropertyIterator_Next(QScriptClassPropertyIterator* self); +bool QScriptClassPropertyIterator_HasPrevious(const QScriptClassPropertyIterator* self); +void QScriptClassPropertyIterator_Previous(QScriptClassPropertyIterator* self); +void QScriptClassPropertyIterator_ToFront(QScriptClassPropertyIterator* self); +void QScriptClassPropertyIterator_ToBack(QScriptClassPropertyIterator* self); +QScriptString* QScriptClassPropertyIterator_Name(const QScriptClassPropertyIterator* self); +unsigned int QScriptClassPropertyIterator_Id(const QScriptClassPropertyIterator* self); +int QScriptClassPropertyIterator_Flags(const QScriptClassPropertyIterator* self); +void QScriptClassPropertyIterator_Delete(QScriptClassPropertyIterator* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptcontext.cpp b/qt/script/gen_qscriptcontext.cpp new file mode 100644 index 00000000..f0f23e8f --- /dev/null +++ b/qt/script/gen_qscriptcontext.cpp @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptcontext.h" +#include "_cgo_export.h" + +QScriptContext* QScriptContext_ParentContext(const QScriptContext* self) { + return self->parentContext(); +} + +QScriptEngine* QScriptContext_Engine(const QScriptContext* self) { + return self->engine(); +} + +int QScriptContext_State(const QScriptContext* self) { + QScriptContext::ExecutionState _ret = self->state(); + return static_cast(_ret); +} + +QScriptValue* QScriptContext_Callee(const QScriptContext* self) { + return new QScriptValue(self->callee()); +} + +int QScriptContext_ArgumentCount(const QScriptContext* self) { + return self->argumentCount(); +} + +QScriptValue* QScriptContext_Argument(const QScriptContext* self, int index) { + return new QScriptValue(self->argument(static_cast(index))); +} + +QScriptValue* QScriptContext_ArgumentsObject(const QScriptContext* self) { + return new QScriptValue(self->argumentsObject()); +} + +struct miqt_array /* of QScriptValue* */ QScriptContext_ScopeChain(const QScriptContext* self) { + QScriptValueList _ret = self->scopeChain(); + // Convert QList<> from C++ memory to manually-managed C memory + QScriptValue** _arr = static_cast(malloc(sizeof(QScriptValue*) * _ret.length())); + for (size_t i = 0, e = _ret.length(); i < e; ++i) { + _arr[i] = new QScriptValue(_ret[i]); + } + struct miqt_array _out; + _out.len = _ret.length(); + _out.data = static_cast(_arr); + return _out; +} + +void QScriptContext_PushScope(QScriptContext* self, QScriptValue* object) { + self->pushScope(*object); +} + +QScriptValue* QScriptContext_PopScope(QScriptContext* self) { + return new QScriptValue(self->popScope()); +} + +QScriptValue* QScriptContext_ReturnValue(const QScriptContext* self) { + return new QScriptValue(self->returnValue()); +} + +void QScriptContext_SetReturnValue(QScriptContext* self, QScriptValue* result) { + self->setReturnValue(*result); +} + +QScriptValue* QScriptContext_ActivationObject(const QScriptContext* self) { + return new QScriptValue(self->activationObject()); +} + +void QScriptContext_SetActivationObject(QScriptContext* self, QScriptValue* activation) { + self->setActivationObject(*activation); +} + +QScriptValue* QScriptContext_ThisObject(const QScriptContext* self) { + return new QScriptValue(self->thisObject()); +} + +void QScriptContext_SetThisObject(QScriptContext* self, QScriptValue* thisObject) { + self->setThisObject(*thisObject); +} + +bool QScriptContext_IsCalledAsConstructor(const QScriptContext* self) { + return self->isCalledAsConstructor(); +} + +QScriptValue* QScriptContext_ThrowValue(QScriptContext* self, QScriptValue* value) { + return new QScriptValue(self->throwValue(*value)); +} + +QScriptValue* QScriptContext_ThrowError(QScriptContext* self, int error, struct miqt_string text) { + QString text_QString = QString::fromUtf8(text.data, text.len); + return new QScriptValue(self->throwError(static_cast(error), text_QString)); +} + +QScriptValue* QScriptContext_ThrowErrorWithText(QScriptContext* self, struct miqt_string text) { + QString text_QString = QString::fromUtf8(text.data, text.len); + return new QScriptValue(self->throwError(text_QString)); +} + +struct miqt_array /* of struct miqt_string */ QScriptContext_Backtrace(const QScriptContext* self) { + QStringList _ret = self->backtrace(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +struct miqt_string QScriptContext_ToString(const QScriptContext* self) { + QString _ret = self->toString(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +void QScriptContext_Delete(QScriptContext* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptcontext.go b/qt/script/gen_qscriptcontext.go new file mode 100644 index 00000000..e3176cc6 --- /dev/null +++ b/qt/script/gen_qscriptcontext.go @@ -0,0 +1,229 @@ +package script + +/* + +#include "gen_qscriptcontext.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptContext__ExecutionState int + +const ( + QScriptContext__NormalState QScriptContext__ExecutionState = 0 + QScriptContext__ExceptionState QScriptContext__ExecutionState = 1 +) + +type QScriptContext__Error int + +const ( + QScriptContext__UnknownError QScriptContext__Error = 0 + QScriptContext__ReferenceError QScriptContext__Error = 1 + QScriptContext__SyntaxError QScriptContext__Error = 2 + QScriptContext__TypeError QScriptContext__Error = 3 + QScriptContext__RangeError QScriptContext__Error = 4 + QScriptContext__URIError QScriptContext__Error = 5 +) + +type QScriptContext struct { + h *C.QScriptContext + isSubclass bool +} + +func (this *QScriptContext) cPointer() *C.QScriptContext { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptContext) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptContext constructs the type using only CGO pointers. +func newQScriptContext(h *C.QScriptContext) *QScriptContext { + if h == nil { + return nil + } + return &QScriptContext{h: h} +} + +// UnsafeNewQScriptContext constructs the type using only unsafe pointers. +func UnsafeNewQScriptContext(h unsafe.Pointer) *QScriptContext { + if h == nil { + return nil + } + + return &QScriptContext{h: (*C.QScriptContext)(h)} +} + +func (this *QScriptContext) ParentContext() *QScriptContext { + return UnsafeNewQScriptContext(unsafe.Pointer(C.QScriptContext_ParentContext(this.h))) +} + +func (this *QScriptContext) Engine() *QScriptEngine { + return UnsafeNewQScriptEngine(unsafe.Pointer(C.QScriptContext_Engine(this.h)), nil) +} + +func (this *QScriptContext) State() QScriptContext__ExecutionState { + return (QScriptContext__ExecutionState)(C.QScriptContext_State(this.h)) +} + +func (this *QScriptContext) Callee() *QScriptValue { + _ret := C.QScriptContext_Callee(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ArgumentCount() int { + return (int)(C.QScriptContext_ArgumentCount(this.h)) +} + +func (this *QScriptContext) Argument(index int) *QScriptValue { + _ret := C.QScriptContext_Argument(this.h, (C.int)(index)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ArgumentsObject() *QScriptValue { + _ret := C.QScriptContext_ArgumentsObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ScopeChain() []QScriptValue { + var _ma C.struct_miqt_array = C.QScriptContext_ScopeChain(this.h) + _ret := make([]QScriptValue, int(_ma.len)) + _outCast := (*[0xffff]*C.QScriptValue)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + _lv_ret := _outCast[i] + _lv_goptr := newQScriptValue(_lv_ret) + _lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + _ret[i] = *_lv_goptr + } + return _ret +} + +func (this *QScriptContext) PushScope(object *QScriptValue) { + C.QScriptContext_PushScope(this.h, object.cPointer()) +} + +func (this *QScriptContext) PopScope() *QScriptValue { + _ret := C.QScriptContext_PopScope(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ReturnValue() *QScriptValue { + _ret := C.QScriptContext_ReturnValue(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) SetReturnValue(result *QScriptValue) { + C.QScriptContext_SetReturnValue(this.h, result.cPointer()) +} + +func (this *QScriptContext) ActivationObject() *QScriptValue { + _ret := C.QScriptContext_ActivationObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) SetActivationObject(activation *QScriptValue) { + C.QScriptContext_SetActivationObject(this.h, activation.cPointer()) +} + +func (this *QScriptContext) ThisObject() *QScriptValue { + _ret := C.QScriptContext_ThisObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) SetThisObject(thisObject *QScriptValue) { + C.QScriptContext_SetThisObject(this.h, thisObject.cPointer()) +} + +func (this *QScriptContext) IsCalledAsConstructor() bool { + return (bool)(C.QScriptContext_IsCalledAsConstructor(this.h)) +} + +func (this *QScriptContext) ThrowValue(value *QScriptValue) *QScriptValue { + _ret := C.QScriptContext_ThrowValue(this.h, value.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ThrowError(error QScriptContext__Error, text string) *QScriptValue { + text_ms := C.struct_miqt_string{} + text_ms.data = C.CString(text) + text_ms.len = C.size_t(len(text)) + defer C.free(unsafe.Pointer(text_ms.data)) + _ret := C.QScriptContext_ThrowError(this.h, (C.int)(error), text_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) ThrowErrorWithText(text string) *QScriptValue { + text_ms := C.struct_miqt_string{} + text_ms.data = C.CString(text) + text_ms.len = C.size_t(len(text)) + defer C.free(unsafe.Pointer(text_ms.data)) + _ret := C.QScriptContext_ThrowErrorWithText(this.h, text_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptContext) Backtrace() []string { + var _ma C.struct_miqt_array = C.QScriptContext_Backtrace(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptContext) ToString() string { + var _ms C.struct_miqt_string = C.QScriptContext_ToString(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +// Delete this object from C++ memory. +func (this *QScriptContext) Delete() { + C.QScriptContext_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptContext) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptContext) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptcontext.h b/qt/script/gen_qscriptcontext.h new file mode 100644 index 00000000..85faa157 --- /dev/null +++ b/qt/script/gen_qscriptcontext.h @@ -0,0 +1,55 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTCONTEXT_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTCONTEXT_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptContext; +class QScriptEngine; +class QScriptValue; +#else +typedef struct QScriptContext QScriptContext; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptValue QScriptValue; +#endif + +QScriptContext* QScriptContext_ParentContext(const QScriptContext* self); +QScriptEngine* QScriptContext_Engine(const QScriptContext* self); +int QScriptContext_State(const QScriptContext* self); +QScriptValue* QScriptContext_Callee(const QScriptContext* self); +int QScriptContext_ArgumentCount(const QScriptContext* self); +QScriptValue* QScriptContext_Argument(const QScriptContext* self, int index); +QScriptValue* QScriptContext_ArgumentsObject(const QScriptContext* self); +struct miqt_array /* of QScriptValue* */ QScriptContext_ScopeChain(const QScriptContext* self); +void QScriptContext_PushScope(QScriptContext* self, QScriptValue* object); +QScriptValue* QScriptContext_PopScope(QScriptContext* self); +QScriptValue* QScriptContext_ReturnValue(const QScriptContext* self); +void QScriptContext_SetReturnValue(QScriptContext* self, QScriptValue* result); +QScriptValue* QScriptContext_ActivationObject(const QScriptContext* self); +void QScriptContext_SetActivationObject(QScriptContext* self, QScriptValue* activation); +QScriptValue* QScriptContext_ThisObject(const QScriptContext* self); +void QScriptContext_SetThisObject(QScriptContext* self, QScriptValue* thisObject); +bool QScriptContext_IsCalledAsConstructor(const QScriptContext* self); +QScriptValue* QScriptContext_ThrowValue(QScriptContext* self, QScriptValue* value); +QScriptValue* QScriptContext_ThrowError(QScriptContext* self, int error, struct miqt_string text); +QScriptValue* QScriptContext_ThrowErrorWithText(QScriptContext* self, struct miqt_string text); +struct miqt_array /* of struct miqt_string */ QScriptContext_Backtrace(const QScriptContext* self); +struct miqt_string QScriptContext_ToString(const QScriptContext* self); +void QScriptContext_Delete(QScriptContext* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptcontextinfo.cpp b/qt/script/gen_qscriptcontextinfo.cpp new file mode 100644 index 00000000..d53095e7 --- /dev/null +++ b/qt/script/gen_qscriptcontextinfo.cpp @@ -0,0 +1,121 @@ +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptcontextinfo.h" +#include "_cgo_export.h" + +void QScriptContextInfo_new(QScriptContext* context, QScriptContextInfo** outptr_QScriptContextInfo) { + QScriptContextInfo* ret = new QScriptContextInfo(context); + *outptr_QScriptContextInfo = ret; +} + +void QScriptContextInfo_new2(QScriptContextInfo* other, QScriptContextInfo** outptr_QScriptContextInfo) { + QScriptContextInfo* ret = new QScriptContextInfo(*other); + *outptr_QScriptContextInfo = ret; +} + +void QScriptContextInfo_new3(QScriptContextInfo** outptr_QScriptContextInfo) { + QScriptContextInfo* ret = new QScriptContextInfo(); + *outptr_QScriptContextInfo = ret; +} + +void QScriptContextInfo_OperatorAssign(QScriptContextInfo* self, QScriptContextInfo* other) { + self->operator=(*other); +} + +bool QScriptContextInfo_IsNull(const QScriptContextInfo* self) { + return self->isNull(); +} + +long long QScriptContextInfo_ScriptId(const QScriptContextInfo* self) { + qint64 _ret = self->scriptId(); + return static_cast(_ret); +} + +struct miqt_string QScriptContextInfo_FileName(const QScriptContextInfo* 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +int QScriptContextInfo_LineNumber(const QScriptContextInfo* self) { + return self->lineNumber(); +} + +int QScriptContextInfo_ColumnNumber(const QScriptContextInfo* self) { + return self->columnNumber(); +} + +struct miqt_string QScriptContextInfo_FunctionName(const QScriptContextInfo* self) { + QString _ret = self->functionName(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +int QScriptContextInfo_FunctionType(const QScriptContextInfo* self) { + QScriptContextInfo::FunctionType _ret = self->functionType(); + return static_cast(_ret); +} + +struct miqt_array /* of struct miqt_string */ QScriptContextInfo_FunctionParameterNames(const QScriptContextInfo* self) { + QStringList _ret = self->functionParameterNames(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +int QScriptContextInfo_FunctionStartLineNumber(const QScriptContextInfo* self) { + return self->functionStartLineNumber(); +} + +int QScriptContextInfo_FunctionEndLineNumber(const QScriptContextInfo* self) { + return self->functionEndLineNumber(); +} + +int QScriptContextInfo_FunctionMetaIndex(const QScriptContextInfo* self) { + return self->functionMetaIndex(); +} + +bool QScriptContextInfo_OperatorEqual(const QScriptContextInfo* self, QScriptContextInfo* other) { + return (*self == *other); +} + +bool QScriptContextInfo_OperatorNotEqual(const QScriptContextInfo* self, QScriptContextInfo* other) { + return (*self != *other); +} + +void QScriptContextInfo_Delete(QScriptContextInfo* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptcontextinfo.go b/qt/script/gen_qscriptcontextinfo.go new file mode 100644 index 00000000..28884475 --- /dev/null +++ b/qt/script/gen_qscriptcontextinfo.go @@ -0,0 +1,174 @@ +package script + +/* + +#include "gen_qscriptcontextinfo.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptContextInfo__FunctionType int + +const ( + QScriptContextInfo__ScriptFunction QScriptContextInfo__FunctionType = 0 + QScriptContextInfo__QtFunction QScriptContextInfo__FunctionType = 1 + QScriptContextInfo__QtPropertyFunction QScriptContextInfo__FunctionType = 2 + QScriptContextInfo__NativeFunction QScriptContextInfo__FunctionType = 3 +) + +type QScriptContextInfo struct { + h *C.QScriptContextInfo + isSubclass bool +} + +func (this *QScriptContextInfo) cPointer() *C.QScriptContextInfo { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptContextInfo) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptContextInfo constructs the type using only CGO pointers. +func newQScriptContextInfo(h *C.QScriptContextInfo) *QScriptContextInfo { + if h == nil { + return nil + } + return &QScriptContextInfo{h: h} +} + +// UnsafeNewQScriptContextInfo constructs the type using only unsafe pointers. +func UnsafeNewQScriptContextInfo(h unsafe.Pointer) *QScriptContextInfo { + if h == nil { + return nil + } + + return &QScriptContextInfo{h: (*C.QScriptContextInfo)(h)} +} + +// NewQScriptContextInfo constructs a new QScriptContextInfo object. +func NewQScriptContextInfo(context *QScriptContext) *QScriptContextInfo { + var outptr_QScriptContextInfo *C.QScriptContextInfo = nil + + C.QScriptContextInfo_new(context.cPointer(), &outptr_QScriptContextInfo) + ret := newQScriptContextInfo(outptr_QScriptContextInfo) + ret.isSubclass = true + return ret +} + +// NewQScriptContextInfo2 constructs a new QScriptContextInfo object. +func NewQScriptContextInfo2(other *QScriptContextInfo) *QScriptContextInfo { + var outptr_QScriptContextInfo *C.QScriptContextInfo = nil + + C.QScriptContextInfo_new2(other.cPointer(), &outptr_QScriptContextInfo) + ret := newQScriptContextInfo(outptr_QScriptContextInfo) + ret.isSubclass = true + return ret +} + +// NewQScriptContextInfo3 constructs a new QScriptContextInfo object. +func NewQScriptContextInfo3() *QScriptContextInfo { + var outptr_QScriptContextInfo *C.QScriptContextInfo = nil + + C.QScriptContextInfo_new3(&outptr_QScriptContextInfo) + ret := newQScriptContextInfo(outptr_QScriptContextInfo) + ret.isSubclass = true + return ret +} + +func (this *QScriptContextInfo) OperatorAssign(other *QScriptContextInfo) { + C.QScriptContextInfo_OperatorAssign(this.h, other.cPointer()) +} + +func (this *QScriptContextInfo) IsNull() bool { + return (bool)(C.QScriptContextInfo_IsNull(this.h)) +} + +func (this *QScriptContextInfo) ScriptId() int64 { + return (int64)(C.QScriptContextInfo_ScriptId(this.h)) +} + +func (this *QScriptContextInfo) FileName() string { + var _ms C.struct_miqt_string = C.QScriptContextInfo_FileName(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptContextInfo) LineNumber() int { + return (int)(C.QScriptContextInfo_LineNumber(this.h)) +} + +func (this *QScriptContextInfo) ColumnNumber() int { + return (int)(C.QScriptContextInfo_ColumnNumber(this.h)) +} + +func (this *QScriptContextInfo) FunctionName() string { + var _ms C.struct_miqt_string = C.QScriptContextInfo_FunctionName(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptContextInfo) FunctionType() QScriptContextInfo__FunctionType { + return (QScriptContextInfo__FunctionType)(C.QScriptContextInfo_FunctionType(this.h)) +} + +func (this *QScriptContextInfo) FunctionParameterNames() []string { + var _ma C.struct_miqt_array = C.QScriptContextInfo_FunctionParameterNames(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptContextInfo) FunctionStartLineNumber() int { + return (int)(C.QScriptContextInfo_FunctionStartLineNumber(this.h)) +} + +func (this *QScriptContextInfo) FunctionEndLineNumber() int { + return (int)(C.QScriptContextInfo_FunctionEndLineNumber(this.h)) +} + +func (this *QScriptContextInfo) FunctionMetaIndex() int { + return (int)(C.QScriptContextInfo_FunctionMetaIndex(this.h)) +} + +func (this *QScriptContextInfo) OperatorEqual(other *QScriptContextInfo) bool { + return (bool)(C.QScriptContextInfo_OperatorEqual(this.h, other.cPointer())) +} + +func (this *QScriptContextInfo) OperatorNotEqual(other *QScriptContextInfo) bool { + return (bool)(C.QScriptContextInfo_OperatorNotEqual(this.h, other.cPointer())) +} + +// Delete this object from C++ memory. +func (this *QScriptContextInfo) Delete() { + C.QScriptContextInfo_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptContextInfo) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptContextInfo) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptcontextinfo.h b/qt/script/gen_qscriptcontextinfo.h new file mode 100644 index 00000000..6ff7d89e --- /dev/null +++ b/qt/script/gen_qscriptcontextinfo.h @@ -0,0 +1,48 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTCONTEXTINFO_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTCONTEXTINFO_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptContext; +class QScriptContextInfo; +#else +typedef struct QScriptContext QScriptContext; +typedef struct QScriptContextInfo QScriptContextInfo; +#endif + +void QScriptContextInfo_new(QScriptContext* context, QScriptContextInfo** outptr_QScriptContextInfo); +void QScriptContextInfo_new2(QScriptContextInfo* other, QScriptContextInfo** outptr_QScriptContextInfo); +void QScriptContextInfo_new3(QScriptContextInfo** outptr_QScriptContextInfo); +void QScriptContextInfo_OperatorAssign(QScriptContextInfo* self, QScriptContextInfo* other); +bool QScriptContextInfo_IsNull(const QScriptContextInfo* self); +long long QScriptContextInfo_ScriptId(const QScriptContextInfo* self); +struct miqt_string QScriptContextInfo_FileName(const QScriptContextInfo* self); +int QScriptContextInfo_LineNumber(const QScriptContextInfo* self); +int QScriptContextInfo_ColumnNumber(const QScriptContextInfo* self); +struct miqt_string QScriptContextInfo_FunctionName(const QScriptContextInfo* self); +int QScriptContextInfo_FunctionType(const QScriptContextInfo* self); +struct miqt_array /* of struct miqt_string */ QScriptContextInfo_FunctionParameterNames(const QScriptContextInfo* self); +int QScriptContextInfo_FunctionStartLineNumber(const QScriptContextInfo* self); +int QScriptContextInfo_FunctionEndLineNumber(const QScriptContextInfo* self); +int QScriptContextInfo_FunctionMetaIndex(const QScriptContextInfo* self); +bool QScriptContextInfo_OperatorEqual(const QScriptContextInfo* self, QScriptContextInfo* other); +bool QScriptContextInfo_OperatorNotEqual(const QScriptContextInfo* self, QScriptContextInfo* other); +void QScriptContextInfo_Delete(QScriptContextInfo* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptengine.cpp b/qt/script/gen_qscriptengine.cpp new file mode 100644 index 00000000..1b7cf4c4 --- /dev/null +++ b/qt/script/gen_qscriptengine.cpp @@ -0,0 +1,697 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptengine.h" +#include "_cgo_export.h" + +void QScriptSyntaxCheckResult_new(QScriptSyntaxCheckResult* other, QScriptSyntaxCheckResult** outptr_QScriptSyntaxCheckResult) { + QScriptSyntaxCheckResult* ret = new QScriptSyntaxCheckResult(*other); + *outptr_QScriptSyntaxCheckResult = ret; +} + +int QScriptSyntaxCheckResult_State(const QScriptSyntaxCheckResult* self) { + QScriptSyntaxCheckResult::State _ret = self->state(); + return static_cast(_ret); +} + +int QScriptSyntaxCheckResult_ErrorLineNumber(const QScriptSyntaxCheckResult* self) { + return self->errorLineNumber(); +} + +int QScriptSyntaxCheckResult_ErrorColumnNumber(const QScriptSyntaxCheckResult* self) { + return self->errorColumnNumber(); +} + +struct miqt_string QScriptSyntaxCheckResult_ErrorMessage(const QScriptSyntaxCheckResult* self) { + QString _ret = self->errorMessage(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +void QScriptSyntaxCheckResult_OperatorAssign(QScriptSyntaxCheckResult* self, QScriptSyntaxCheckResult* other) { + self->operator=(*other); +} + +void QScriptSyntaxCheckResult_Delete(QScriptSyntaxCheckResult* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + +class MiqtVirtualQScriptEngine : public virtual QScriptEngine { +public: + + MiqtVirtualQScriptEngine(): QScriptEngine() {}; + MiqtVirtualQScriptEngine(QObject* parent): QScriptEngine(parent) {}; + + virtual ~MiqtVirtualQScriptEngine() = default; + + // cgo.Handle value for overwritten implementation + intptr_t handle__Event = 0; + + // Subclass to allow providing a Go implementation + virtual bool event(QEvent* event) override { + if (handle__Event == 0) { + return QScriptEngine::event(event); + } + + QEvent* sigval1 = event; + + bool callback_return_value = miqt_exec_callback_QScriptEngine_Event(this, handle__Event, sigval1); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_Event(QEvent* event) { + + return QScriptEngine::event(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__EventFilter = 0; + + // Subclass to allow providing a Go implementation + virtual bool eventFilter(QObject* watched, QEvent* event) override { + if (handle__EventFilter == 0) { + return QScriptEngine::eventFilter(watched, event); + } + + QObject* sigval1 = watched; + QEvent* sigval2 = event; + + bool callback_return_value = miqt_exec_callback_QScriptEngine_EventFilter(this, handle__EventFilter, sigval1, sigval2); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_EventFilter(QObject* watched, QEvent* event) { + + return QScriptEngine::eventFilter(watched, event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__TimerEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void timerEvent(QTimerEvent* event) override { + if (handle__TimerEvent == 0) { + QScriptEngine::timerEvent(event); + return; + } + + QTimerEvent* sigval1 = event; + + miqt_exec_callback_QScriptEngine_TimerEvent(this, handle__TimerEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_TimerEvent(QTimerEvent* event) { + + QScriptEngine::timerEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ChildEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void childEvent(QChildEvent* event) override { + if (handle__ChildEvent == 0) { + QScriptEngine::childEvent(event); + return; + } + + QChildEvent* sigval1 = event; + + miqt_exec_callback_QScriptEngine_ChildEvent(this, handle__ChildEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ChildEvent(QChildEvent* event) { + + QScriptEngine::childEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__CustomEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void customEvent(QEvent* event) override { + if (handle__CustomEvent == 0) { + QScriptEngine::customEvent(event); + return; + } + + QEvent* sigval1 = event; + + miqt_exec_callback_QScriptEngine_CustomEvent(this, handle__CustomEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_CustomEvent(QEvent* event) { + + QScriptEngine::customEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ConnectNotify = 0; + + // Subclass to allow providing a Go implementation + virtual void connectNotify(const QMetaMethod& signal) override { + if (handle__ConnectNotify == 0) { + QScriptEngine::connectNotify(signal); + return; + } + + const QMetaMethod& signal_ret = signal; + // Cast returned reference into pointer + QMetaMethod* sigval1 = const_cast(&signal_ret); + + miqt_exec_callback_QScriptEngine_ConnectNotify(this, handle__ConnectNotify, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ConnectNotify(QMetaMethod* signal) { + + QScriptEngine::connectNotify(*signal); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__DisconnectNotify = 0; + + // Subclass to allow providing a Go implementation + virtual void disconnectNotify(const QMetaMethod& signal) override { + if (handle__DisconnectNotify == 0) { + QScriptEngine::disconnectNotify(signal); + return; + } + + const QMetaMethod& signal_ret = signal; + // Cast returned reference into pointer + QMetaMethod* sigval1 = const_cast(&signal_ret); + + miqt_exec_callback_QScriptEngine_DisconnectNotify(this, handle__DisconnectNotify, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_DisconnectNotify(QMetaMethod* signal) { + + QScriptEngine::disconnectNotify(*signal); + + } + +}; + +void QScriptEngine_new(QScriptEngine** outptr_QScriptEngine, QObject** outptr_QObject) { + MiqtVirtualQScriptEngine* ret = new MiqtVirtualQScriptEngine(); + *outptr_QScriptEngine = ret; + *outptr_QObject = static_cast(ret); +} + +void QScriptEngine_new2(QObject* parent, QScriptEngine** outptr_QScriptEngine, QObject** outptr_QObject) { + MiqtVirtualQScriptEngine* ret = new MiqtVirtualQScriptEngine(parent); + *outptr_QScriptEngine = ret; + *outptr_QObject = static_cast(ret); +} + +QMetaObject* QScriptEngine_MetaObject(const QScriptEngine* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QScriptEngine_Metacast(QScriptEngine* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string QScriptEngine_Tr(const char* s) { + QString _ret = QScriptEngine::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptEngine_TrUtf8(const char* s) { + QString _ret = QScriptEngine::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +QScriptValue* QScriptEngine_GlobalObject(const QScriptEngine* self) { + return new QScriptValue(self->globalObject()); +} + +void QScriptEngine_SetGlobalObject(QScriptEngine* self, QScriptValue* object) { + self->setGlobalObject(*object); +} + +QScriptContext* QScriptEngine_CurrentContext(const QScriptEngine* self) { + return self->currentContext(); +} + +QScriptContext* QScriptEngine_PushContext(QScriptEngine* self) { + return self->pushContext(); +} + +void QScriptEngine_PopContext(QScriptEngine* self) { + self->popContext(); +} + +bool QScriptEngine_CanEvaluate(const QScriptEngine* self, struct miqt_string program) { + QString program_QString = QString::fromUtf8(program.data, program.len); + return self->canEvaluate(program_QString); +} + +QScriptSyntaxCheckResult* QScriptEngine_CheckSyntax(struct miqt_string program) { + QString program_QString = QString::fromUtf8(program.data, program.len); + return new QScriptSyntaxCheckResult(QScriptEngine::checkSyntax(program_QString)); +} + +QScriptValue* QScriptEngine_Evaluate(QScriptEngine* self, struct miqt_string program) { + QString program_QString = QString::fromUtf8(program.data, program.len); + return new QScriptValue(self->evaluate(program_QString)); +} + +QScriptValue* QScriptEngine_EvaluateWithProgram(QScriptEngine* self, QScriptProgram* program) { + return new QScriptValue(self->evaluate(*program)); +} + +bool QScriptEngine_IsEvaluating(const QScriptEngine* self) { + return self->isEvaluating(); +} + +void QScriptEngine_AbortEvaluation(QScriptEngine* self) { + self->abortEvaluation(); +} + +bool QScriptEngine_HasUncaughtException(const QScriptEngine* self) { + return self->hasUncaughtException(); +} + +QScriptValue* QScriptEngine_UncaughtException(const QScriptEngine* self) { + return new QScriptValue(self->uncaughtException()); +} + +int QScriptEngine_UncaughtExceptionLineNumber(const QScriptEngine* self) { + return self->uncaughtExceptionLineNumber(); +} + +struct miqt_array /* of struct miqt_string */ QScriptEngine_UncaughtExceptionBacktrace(const QScriptEngine* self) { + QStringList _ret = self->uncaughtExceptionBacktrace(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +void QScriptEngine_ClearExceptions(QScriptEngine* self) { + self->clearExceptions(); +} + +QScriptValue* QScriptEngine_NullValue(QScriptEngine* self) { + return new QScriptValue(self->nullValue()); +} + +QScriptValue* QScriptEngine_UndefinedValue(QScriptEngine* self) { + return new QScriptValue(self->undefinedValue()); +} + +QScriptValue* QScriptEngine_NewVariant(QScriptEngine* self, QVariant* value) { + return new QScriptValue(self->newVariant(*value)); +} + +QScriptValue* QScriptEngine_NewVariant2(QScriptEngine* self, QScriptValue* object, QVariant* value) { + return new QScriptValue(self->newVariant(*object, *value)); +} + +QScriptValue* QScriptEngine_NewRegExp(QScriptEngine* self, QRegExp* regexp) { + return new QScriptValue(self->newRegExp(*regexp)); +} + +QScriptValue* QScriptEngine_NewObject(QScriptEngine* self) { + return new QScriptValue(self->newObject()); +} + +QScriptValue* QScriptEngine_NewObjectWithScriptClass(QScriptEngine* self, QScriptClass* scriptClass) { + return new QScriptValue(self->newObject(scriptClass)); +} + +QScriptValue* QScriptEngine_NewArray(QScriptEngine* self) { + return new QScriptValue(self->newArray()); +} + +QScriptValue* QScriptEngine_NewRegExp2(QScriptEngine* self, struct miqt_string pattern, struct miqt_string flags) { + QString pattern_QString = QString::fromUtf8(pattern.data, pattern.len); + QString flags_QString = QString::fromUtf8(flags.data, flags.len); + return new QScriptValue(self->newRegExp(pattern_QString, flags_QString)); +} + +QScriptValue* QScriptEngine_NewDate(QScriptEngine* self, double value) { + return new QScriptValue(self->newDate(static_cast(value))); +} + +QScriptValue* QScriptEngine_NewDateWithValue(QScriptEngine* self, QDateTime* value) { + return new QScriptValue(self->newDate(*value)); +} + +QScriptValue* QScriptEngine_NewActivationObject(QScriptEngine* self) { + return new QScriptValue(self->newActivationObject()); +} + +QScriptValue* QScriptEngine_NewQObject(QScriptEngine* self, QObject* object) { + return new QScriptValue(self->newQObject(object)); +} + +QScriptValue* QScriptEngine_NewQObject2(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject) { + return new QScriptValue(self->newQObject(*scriptObject, qtObject)); +} + +QScriptValue* QScriptEngine_NewQMetaObject(QScriptEngine* self, QMetaObject* metaObject) { + return new QScriptValue(self->newQMetaObject(metaObject)); +} + +QScriptValue* QScriptEngine_DefaultPrototype(const QScriptEngine* self, int metaTypeId) { + return new QScriptValue(self->defaultPrototype(static_cast(metaTypeId))); +} + +void QScriptEngine_SetDefaultPrototype(QScriptEngine* self, int metaTypeId, QScriptValue* prototype) { + self->setDefaultPrototype(static_cast(metaTypeId), *prototype); +} + +void QScriptEngine_InstallTranslatorFunctions(QScriptEngine* self) { + self->installTranslatorFunctions(); +} + +QScriptValue* QScriptEngine_ImportExtension(QScriptEngine* self, struct miqt_string extension) { + QString extension_QString = QString::fromUtf8(extension.data, extension.len); + return new QScriptValue(self->importExtension(extension_QString)); +} + +struct miqt_array /* of struct miqt_string */ QScriptEngine_AvailableExtensions(const QScriptEngine* self) { + QStringList _ret = self->availableExtensions(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +struct miqt_array /* of struct miqt_string */ QScriptEngine_ImportedExtensions(const QScriptEngine* self) { + QStringList _ret = self->importedExtensions(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +void QScriptEngine_CollectGarbage(QScriptEngine* self) { + self->collectGarbage(); +} + +void QScriptEngine_ReportAdditionalMemoryCost(QScriptEngine* self, int size) { + self->reportAdditionalMemoryCost(static_cast(size)); +} + +void QScriptEngine_SetProcessEventsInterval(QScriptEngine* self, int interval) { + self->setProcessEventsInterval(static_cast(interval)); +} + +int QScriptEngine_ProcessEventsInterval(const QScriptEngine* self) { + return self->processEventsInterval(); +} + +void QScriptEngine_SetAgent(QScriptEngine* self, QScriptEngineAgent* agent) { + self->setAgent(agent); +} + +QScriptEngineAgent* QScriptEngine_Agent(const QScriptEngine* self) { + return self->agent(); +} + +QScriptString* QScriptEngine_ToStringHandle(QScriptEngine* self, struct miqt_string str) { + QString str_QString = QString::fromUtf8(str.data, str.len); + return new QScriptString(self->toStringHandle(str_QString)); +} + +QScriptValue* QScriptEngine_ToObject(QScriptEngine* self, QScriptValue* value) { + return new QScriptValue(self->toObject(*value)); +} + +QScriptValue* QScriptEngine_ObjectById(const QScriptEngine* self, long long id) { + return new QScriptValue(self->objectById(static_cast(id))); +} + +void QScriptEngine_SignalHandlerException(QScriptEngine* self, QScriptValue* exception) { + self->signalHandlerException(*exception); +} + +void QScriptEngine_connect_SignalHandlerException(QScriptEngine* self, intptr_t slot) { + MiqtVirtualQScriptEngine::connect(self, static_cast(&QScriptEngine::signalHandlerException), self, [=](const QScriptValue& exception) { + const QScriptValue& exception_ret = exception; + // Cast returned reference into pointer + QScriptValue* sigval1 = const_cast(&exception_ret); + miqt_exec_callback_QScriptEngine_SignalHandlerException(slot, sigval1); + }); +} + +struct miqt_string QScriptEngine_Tr2(const char* s, const char* c) { + QString _ret = QScriptEngine::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptEngine_Tr3(const char* s, const char* c, int n) { + QString _ret = QScriptEngine::tr(s, c, static_cast(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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptEngine_TrUtf82(const char* s, const char* c) { + QString _ret = QScriptEngine::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptEngine_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QScriptEngine::trUtf8(s, c, static_cast(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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +QScriptValue* QScriptEngine_Evaluate2(QScriptEngine* self, struct miqt_string program, struct miqt_string fileName) { + QString program_QString = QString::fromUtf8(program.data, program.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + return new QScriptValue(self->evaluate(program_QString, fileName_QString)); +} + +QScriptValue* QScriptEngine_Evaluate3(QScriptEngine* self, struct miqt_string program, struct miqt_string fileName, int lineNumber) { + QString program_QString = QString::fromUtf8(program.data, program.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + return new QScriptValue(self->evaluate(program_QString, fileName_QString, static_cast(lineNumber))); +} + +void QScriptEngine_AbortEvaluation1(QScriptEngine* self, QScriptValue* result) { + self->abortEvaluation(*result); +} + +QScriptValue* QScriptEngine_NewObject2(QScriptEngine* self, QScriptClass* scriptClass, QScriptValue* data) { + return new QScriptValue(self->newObject(scriptClass, *data)); +} + +QScriptValue* QScriptEngine_NewArray1(QScriptEngine* self, unsigned int length) { + return new QScriptValue(self->newArray(static_cast(length))); +} + +QScriptValue* QScriptEngine_NewQObject22(QScriptEngine* self, QObject* object, int ownership) { + return new QScriptValue(self->newQObject(object, static_cast(ownership))); +} + +QScriptValue* QScriptEngine_NewQObject3(QScriptEngine* self, QObject* object, int ownership, int* options) { + return new QScriptValue(self->newQObject(object, static_cast(ownership), (const QScriptEngine::QObjectWrapOptions&)(*options))); +} + +QScriptValue* QScriptEngine_NewQObject32(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject, int ownership) { + return new QScriptValue(self->newQObject(*scriptObject, qtObject, static_cast(ownership))); +} + +QScriptValue* QScriptEngine_NewQObject4(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject, int ownership, int* options) { + return new QScriptValue(self->newQObject(*scriptObject, qtObject, static_cast(ownership), (const QScriptEngine::QObjectWrapOptions&)(*options))); +} + +QScriptValue* QScriptEngine_NewQMetaObject2(QScriptEngine* self, QMetaObject* metaObject, QScriptValue* ctor) { + return new QScriptValue(self->newQMetaObject(metaObject, *ctor)); +} + +void QScriptEngine_InstallTranslatorFunctions1(QScriptEngine* self, QScriptValue* object) { + self->installTranslatorFunctions(*object); +} + +void QScriptEngine_override_virtual_Event(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__Event = slot; +} + +bool QScriptEngine_virtualbase_Event(void* self, QEvent* event) { + return ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_Event(event); +} + +void QScriptEngine_override_virtual_EventFilter(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__EventFilter = slot; +} + +bool QScriptEngine_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event) { + return ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_EventFilter(watched, event); +} + +void QScriptEngine_override_virtual_TimerEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__TimerEvent = slot; +} + +void QScriptEngine_virtualbase_TimerEvent(void* self, QTimerEvent* event) { + ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_TimerEvent(event); +} + +void QScriptEngine_override_virtual_ChildEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__ChildEvent = slot; +} + +void QScriptEngine_virtualbase_ChildEvent(void* self, QChildEvent* event) { + ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_ChildEvent(event); +} + +void QScriptEngine_override_virtual_CustomEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__CustomEvent = slot; +} + +void QScriptEngine_virtualbase_CustomEvent(void* self, QEvent* event) { + ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_CustomEvent(event); +} + +void QScriptEngine_override_virtual_ConnectNotify(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__ConnectNotify = slot; +} + +void QScriptEngine_virtualbase_ConnectNotify(void* self, QMetaMethod* signal) { + ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_ConnectNotify(signal); +} + +void QScriptEngine_override_virtual_DisconnectNotify(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngine*)(self) )->handle__DisconnectNotify = slot; +} + +void QScriptEngine_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal) { + ( (MiqtVirtualQScriptEngine*)(self) )->virtualbase_DisconnectNotify(signal); +} + +void QScriptEngine_Delete(QScriptEngine* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptengine.go b/qt/script/gen_qscriptengine.go new file mode 100644 index 00000000..b7c3e935 --- /dev/null +++ b/qt/script/gen_qscriptengine.go @@ -0,0 +1,863 @@ +package script + +/* + +#include "gen_qscriptengine.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QScriptSyntaxCheckResult__State int + +const ( + QScriptSyntaxCheckResult__Error QScriptSyntaxCheckResult__State = 0 + QScriptSyntaxCheckResult__Intermediate QScriptSyntaxCheckResult__State = 1 + QScriptSyntaxCheckResult__Valid QScriptSyntaxCheckResult__State = 2 +) + +type QScriptEngine__ValueOwnership int + +const ( + QScriptEngine__QtOwnership QScriptEngine__ValueOwnership = 0 + QScriptEngine__ScriptOwnership QScriptEngine__ValueOwnership = 1 + QScriptEngine__AutoOwnership QScriptEngine__ValueOwnership = 2 +) + +type QScriptEngine__QObjectWrapOption int + +const ( + QScriptEngine__ExcludeChildObjects QScriptEngine__QObjectWrapOption = 1 + QScriptEngine__ExcludeSuperClassMethods QScriptEngine__QObjectWrapOption = 2 + QScriptEngine__ExcludeSuperClassProperties QScriptEngine__QObjectWrapOption = 4 + QScriptEngine__ExcludeSuperClassContents QScriptEngine__QObjectWrapOption = 6 + QScriptEngine__SkipMethodsInEnumeration QScriptEngine__QObjectWrapOption = 8 + QScriptEngine__ExcludeDeleteLater QScriptEngine__QObjectWrapOption = 16 + QScriptEngine__ExcludeSlots QScriptEngine__QObjectWrapOption = 32 + QScriptEngine__AutoCreateDynamicProperties QScriptEngine__QObjectWrapOption = 256 + QScriptEngine__PreferExistingWrapperObject QScriptEngine__QObjectWrapOption = 512 +) + +type QScriptSyntaxCheckResult struct { + h *C.QScriptSyntaxCheckResult + isSubclass bool +} + +func (this *QScriptSyntaxCheckResult) cPointer() *C.QScriptSyntaxCheckResult { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptSyntaxCheckResult) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptSyntaxCheckResult constructs the type using only CGO pointers. +func newQScriptSyntaxCheckResult(h *C.QScriptSyntaxCheckResult) *QScriptSyntaxCheckResult { + if h == nil { + return nil + } + return &QScriptSyntaxCheckResult{h: h} +} + +// UnsafeNewQScriptSyntaxCheckResult constructs the type using only unsafe pointers. +func UnsafeNewQScriptSyntaxCheckResult(h unsafe.Pointer) *QScriptSyntaxCheckResult { + if h == nil { + return nil + } + + return &QScriptSyntaxCheckResult{h: (*C.QScriptSyntaxCheckResult)(h)} +} + +// NewQScriptSyntaxCheckResult constructs a new QScriptSyntaxCheckResult object. +func NewQScriptSyntaxCheckResult(other *QScriptSyntaxCheckResult) *QScriptSyntaxCheckResult { + var outptr_QScriptSyntaxCheckResult *C.QScriptSyntaxCheckResult = nil + + C.QScriptSyntaxCheckResult_new(other.cPointer(), &outptr_QScriptSyntaxCheckResult) + ret := newQScriptSyntaxCheckResult(outptr_QScriptSyntaxCheckResult) + ret.isSubclass = true + return ret +} + +func (this *QScriptSyntaxCheckResult) State() QScriptSyntaxCheckResult__State { + return (QScriptSyntaxCheckResult__State)(C.QScriptSyntaxCheckResult_State(this.h)) +} + +func (this *QScriptSyntaxCheckResult) ErrorLineNumber() int { + return (int)(C.QScriptSyntaxCheckResult_ErrorLineNumber(this.h)) +} + +func (this *QScriptSyntaxCheckResult) ErrorColumnNumber() int { + return (int)(C.QScriptSyntaxCheckResult_ErrorColumnNumber(this.h)) +} + +func (this *QScriptSyntaxCheckResult) ErrorMessage() string { + var _ms C.struct_miqt_string = C.QScriptSyntaxCheckResult_ErrorMessage(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptSyntaxCheckResult) OperatorAssign(other *QScriptSyntaxCheckResult) { + C.QScriptSyntaxCheckResult_OperatorAssign(this.h, other.cPointer()) +} + +// Delete this object from C++ memory. +func (this *QScriptSyntaxCheckResult) Delete() { + C.QScriptSyntaxCheckResult_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptSyntaxCheckResult) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptSyntaxCheckResult) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} + +type QScriptEngine struct { + h *C.QScriptEngine + isSubclass bool + *qt.QObject +} + +func (this *QScriptEngine) cPointer() *C.QScriptEngine { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptEngine) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptEngine constructs the type using only CGO pointers. +func newQScriptEngine(h *C.QScriptEngine, h_QObject *C.QObject) *QScriptEngine { + if h == nil { + return nil + } + return &QScriptEngine{h: h, + QObject: qt.UnsafeNewQObject(unsafe.Pointer(h_QObject))} +} + +// UnsafeNewQScriptEngine constructs the type using only unsafe pointers. +func UnsafeNewQScriptEngine(h unsafe.Pointer, h_QObject unsafe.Pointer) *QScriptEngine { + if h == nil { + return nil + } + + return &QScriptEngine{h: (*C.QScriptEngine)(h), + QObject: qt.UnsafeNewQObject(h_QObject)} +} + +// NewQScriptEngine constructs a new QScriptEngine object. +func NewQScriptEngine() *QScriptEngine { + var outptr_QScriptEngine *C.QScriptEngine = nil + var outptr_QObject *C.QObject = nil + + C.QScriptEngine_new(&outptr_QScriptEngine, &outptr_QObject) + ret := newQScriptEngine(outptr_QScriptEngine, outptr_QObject) + ret.isSubclass = true + return ret +} + +// NewQScriptEngine2 constructs a new QScriptEngine object. +func NewQScriptEngine2(parent *qt.QObject) *QScriptEngine { + var outptr_QScriptEngine *C.QScriptEngine = nil + var outptr_QObject *C.QObject = nil + + C.QScriptEngine_new2((*C.QObject)(parent.UnsafePointer()), &outptr_QScriptEngine, &outptr_QObject) + ret := newQScriptEngine(outptr_QScriptEngine, outptr_QObject) + ret.isSubclass = true + return ret +} + +func (this *QScriptEngine) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QScriptEngine_MetaObject(this.h))) +} + +func (this *QScriptEngine) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return (unsafe.Pointer)(C.QScriptEngine_Metacast(this.h, param1_Cstring)) +} + +func QScriptEngine_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_Tr(s_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptEngine_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_TrUtf8(s_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptEngine) GlobalObject() *QScriptValue { + _ret := C.QScriptEngine_GlobalObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) SetGlobalObject(object *QScriptValue) { + C.QScriptEngine_SetGlobalObject(this.h, object.cPointer()) +} + +func (this *QScriptEngine) CurrentContext() *QScriptContext { + return UnsafeNewQScriptContext(unsafe.Pointer(C.QScriptEngine_CurrentContext(this.h))) +} + +func (this *QScriptEngine) PushContext() *QScriptContext { + return UnsafeNewQScriptContext(unsafe.Pointer(C.QScriptEngine_PushContext(this.h))) +} + +func (this *QScriptEngine) PopContext() { + C.QScriptEngine_PopContext(this.h) +} + +func (this *QScriptEngine) CanEvaluate(program string) bool { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + return (bool)(C.QScriptEngine_CanEvaluate(this.h, program_ms)) +} + +func QScriptEngine_CheckSyntax(program string) *QScriptSyntaxCheckResult { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + _ret := C.QScriptEngine_CheckSyntax(program_ms) + _goptr := newQScriptSyntaxCheckResult(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) Evaluate(program string) *QScriptValue { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + _ret := C.QScriptEngine_Evaluate(this.h, program_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) EvaluateWithProgram(program *QScriptProgram) *QScriptValue { + _ret := C.QScriptEngine_EvaluateWithProgram(this.h, program.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) IsEvaluating() bool { + return (bool)(C.QScriptEngine_IsEvaluating(this.h)) +} + +func (this *QScriptEngine) AbortEvaluation() { + C.QScriptEngine_AbortEvaluation(this.h) +} + +func (this *QScriptEngine) HasUncaughtException() bool { + return (bool)(C.QScriptEngine_HasUncaughtException(this.h)) +} + +func (this *QScriptEngine) UncaughtException() *QScriptValue { + _ret := C.QScriptEngine_UncaughtException(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) UncaughtExceptionLineNumber() int { + return (int)(C.QScriptEngine_UncaughtExceptionLineNumber(this.h)) +} + +func (this *QScriptEngine) UncaughtExceptionBacktrace() []string { + var _ma C.struct_miqt_array = C.QScriptEngine_UncaughtExceptionBacktrace(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptEngine) ClearExceptions() { + C.QScriptEngine_ClearExceptions(this.h) +} + +func (this *QScriptEngine) NullValue() *QScriptValue { + _ret := C.QScriptEngine_NullValue(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) UndefinedValue() *QScriptValue { + _ret := C.QScriptEngine_UndefinedValue(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewVariant(value *qt.QVariant) *QScriptValue { + _ret := C.QScriptEngine_NewVariant(this.h, (*C.QVariant)(value.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewVariant2(object *QScriptValue, value *qt.QVariant) *QScriptValue { + _ret := C.QScriptEngine_NewVariant2(this.h, object.cPointer(), (*C.QVariant)(value.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewRegExp(regexp *qt.QRegExp) *QScriptValue { + _ret := C.QScriptEngine_NewRegExp(this.h, (*C.QRegExp)(regexp.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewObject() *QScriptValue { + _ret := C.QScriptEngine_NewObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewObjectWithScriptClass(scriptClass *QScriptClass) *QScriptValue { + _ret := C.QScriptEngine_NewObjectWithScriptClass(this.h, scriptClass.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewArray() *QScriptValue { + _ret := C.QScriptEngine_NewArray(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewRegExp2(pattern string, flags string) *QScriptValue { + pattern_ms := C.struct_miqt_string{} + pattern_ms.data = C.CString(pattern) + pattern_ms.len = C.size_t(len(pattern)) + defer C.free(unsafe.Pointer(pattern_ms.data)) + flags_ms := C.struct_miqt_string{} + flags_ms.data = C.CString(flags) + flags_ms.len = C.size_t(len(flags)) + defer C.free(unsafe.Pointer(flags_ms.data)) + _ret := C.QScriptEngine_NewRegExp2(this.h, pattern_ms, flags_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewDate(value float64) *QScriptValue { + _ret := C.QScriptEngine_NewDate(this.h, (C.double)(value)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewDateWithValue(value *qt.QDateTime) *QScriptValue { + _ret := C.QScriptEngine_NewDateWithValue(this.h, (*C.QDateTime)(value.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewActivationObject() *QScriptValue { + _ret := C.QScriptEngine_NewActivationObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject(object *qt.QObject) *QScriptValue { + _ret := C.QScriptEngine_NewQObject(this.h, (*C.QObject)(object.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject2(scriptObject *QScriptValue, qtObject *qt.QObject) *QScriptValue { + _ret := C.QScriptEngine_NewQObject2(this.h, scriptObject.cPointer(), (*C.QObject)(qtObject.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQMetaObject(metaObject *qt.QMetaObject) *QScriptValue { + _ret := C.QScriptEngine_NewQMetaObject(this.h, (*C.QMetaObject)(metaObject.UnsafePointer())) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) DefaultPrototype(metaTypeId int) *QScriptValue { + _ret := C.QScriptEngine_DefaultPrototype(this.h, (C.int)(metaTypeId)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) SetDefaultPrototype(metaTypeId int, prototype *QScriptValue) { + C.QScriptEngine_SetDefaultPrototype(this.h, (C.int)(metaTypeId), prototype.cPointer()) +} + +func (this *QScriptEngine) InstallTranslatorFunctions() { + C.QScriptEngine_InstallTranslatorFunctions(this.h) +} + +func (this *QScriptEngine) ImportExtension(extension string) *QScriptValue { + extension_ms := C.struct_miqt_string{} + extension_ms.data = C.CString(extension) + extension_ms.len = C.size_t(len(extension)) + defer C.free(unsafe.Pointer(extension_ms.data)) + _ret := C.QScriptEngine_ImportExtension(this.h, extension_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) AvailableExtensions() []string { + var _ma C.struct_miqt_array = C.QScriptEngine_AvailableExtensions(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptEngine) ImportedExtensions() []string { + var _ma C.struct_miqt_array = C.QScriptEngine_ImportedExtensions(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptEngine) CollectGarbage() { + C.QScriptEngine_CollectGarbage(this.h) +} + +func (this *QScriptEngine) ReportAdditionalMemoryCost(size int) { + C.QScriptEngine_ReportAdditionalMemoryCost(this.h, (C.int)(size)) +} + +func (this *QScriptEngine) SetProcessEventsInterval(interval int) { + C.QScriptEngine_SetProcessEventsInterval(this.h, (C.int)(interval)) +} + +func (this *QScriptEngine) ProcessEventsInterval() int { + return (int)(C.QScriptEngine_ProcessEventsInterval(this.h)) +} + +func (this *QScriptEngine) SetAgent(agent *QScriptEngineAgent) { + C.QScriptEngine_SetAgent(this.h, agent.cPointer()) +} + +func (this *QScriptEngine) Agent() *QScriptEngineAgent { + return UnsafeNewQScriptEngineAgent(unsafe.Pointer(C.QScriptEngine_Agent(this.h))) +} + +func (this *QScriptEngine) ToStringHandle(str string) *QScriptString { + str_ms := C.struct_miqt_string{} + str_ms.data = C.CString(str) + str_ms.len = C.size_t(len(str)) + defer C.free(unsafe.Pointer(str_ms.data)) + _ret := C.QScriptEngine_ToStringHandle(this.h, str_ms) + _goptr := newQScriptString(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) ToObject(value *QScriptValue) *QScriptValue { + _ret := C.QScriptEngine_ToObject(this.h, value.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) ObjectById(id int64) *QScriptValue { + _ret := C.QScriptEngine_ObjectById(this.h, (C.longlong)(id)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) SignalHandlerException(exception *QScriptValue) { + C.QScriptEngine_SignalHandlerException(this.h, exception.cPointer()) +} +func (this *QScriptEngine) OnSignalHandlerException(slot func(exception *QScriptValue)) { + C.QScriptEngine_connect_SignalHandlerException(this.h, C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_SignalHandlerException +func miqt_exec_callback_QScriptEngine_SignalHandlerException(cb C.intptr_t, exception *C.QScriptValue) { + gofunc, ok := cgo.Handle(cb).Value().(func(exception *QScriptValue)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := UnsafeNewQScriptValue(unsafe.Pointer(exception)) + + gofunc(slotval1) +} + +func QScriptEngine_Tr2(s string, c string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptEngine_Tr3(s string, c string, n int) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_Tr3(s_Cstring, c_Cstring, (C.int)(n)) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptEngine_TrUtf82(s string, c string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptEngine_TrUtf83(s string, c string, n int) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptEngine_TrUtf83(s_Cstring, c_Cstring, (C.int)(n)) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptEngine) Evaluate2(program string, fileName string) *QScriptValue { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + _ret := C.QScriptEngine_Evaluate2(this.h, program_ms, fileName_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) Evaluate3(program string, fileName string, lineNumber int) *QScriptValue { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + _ret := C.QScriptEngine_Evaluate3(this.h, program_ms, fileName_ms, (C.int)(lineNumber)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) AbortEvaluation1(result *QScriptValue) { + C.QScriptEngine_AbortEvaluation1(this.h, result.cPointer()) +} + +func (this *QScriptEngine) NewObject2(scriptClass *QScriptClass, data *QScriptValue) *QScriptValue { + _ret := C.QScriptEngine_NewObject2(this.h, scriptClass.cPointer(), data.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewArray1(length uint) *QScriptValue { + _ret := C.QScriptEngine_NewArray1(this.h, (C.uint)(length)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject22(object *qt.QObject, ownership QScriptEngine__ValueOwnership) *QScriptValue { + _ret := C.QScriptEngine_NewQObject22(this.h, (*C.QObject)(object.UnsafePointer()), (C.int)(ownership)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject3(object *qt.QObject, ownership QScriptEngine__ValueOwnership, options *QScriptEngine__QObjectWrapOption) *QScriptValue { + _ret := C.QScriptEngine_NewQObject3(this.h, (*C.QObject)(object.UnsafePointer()), (C.int)(ownership), (*C.int)(unsafe.Pointer(options))) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject32(scriptObject *QScriptValue, qtObject *qt.QObject, ownership QScriptEngine__ValueOwnership) *QScriptValue { + _ret := C.QScriptEngine_NewQObject32(this.h, scriptObject.cPointer(), (*C.QObject)(qtObject.UnsafePointer()), (C.int)(ownership)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQObject4(scriptObject *QScriptValue, qtObject *qt.QObject, ownership QScriptEngine__ValueOwnership, options *QScriptEngine__QObjectWrapOption) *QScriptValue { + _ret := C.QScriptEngine_NewQObject4(this.h, scriptObject.cPointer(), (*C.QObject)(qtObject.UnsafePointer()), (C.int)(ownership), (*C.int)(unsafe.Pointer(options))) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) NewQMetaObject2(metaObject *qt.QMetaObject, ctor *QScriptValue) *QScriptValue { + _ret := C.QScriptEngine_NewQMetaObject2(this.h, (*C.QMetaObject)(metaObject.UnsafePointer()), ctor.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngine) InstallTranslatorFunctions1(object *QScriptValue) { + C.QScriptEngine_InstallTranslatorFunctions1(this.h, object.cPointer()) +} + +func (this *QScriptEngine) callVirtualBase_Event(event *qt.QEvent) bool { + + return (bool)(C.QScriptEngine_virtualbase_Event(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer()))) + +} +func (this *QScriptEngine) OnEvent(slot func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool) { + C.QScriptEngine_override_virtual_Event(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_Event +func miqt_exec_callback_QScriptEngine_Event(self *C.QScriptEngine, cb C.intptr_t, event *C.QEvent) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + virtualReturn := gofunc((&QScriptEngine{h: self}).callVirtualBase_Event, slotval1) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptEngine) callVirtualBase_EventFilter(watched *qt.QObject, event *qt.QEvent) bool { + + return (bool)(C.QScriptEngine_virtualbase_EventFilter(unsafe.Pointer(this.h), (*C.QObject)(watched.UnsafePointer()), (*C.QEvent)(event.UnsafePointer()))) + +} +func (this *QScriptEngine) OnEventFilter(slot func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool) { + C.QScriptEngine_override_virtual_EventFilter(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_EventFilter +func miqt_exec_callback_QScriptEngine_EventFilter(self *C.QScriptEngine, cb C.intptr_t, watched *C.QObject, event *C.QEvent) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQObject(unsafe.Pointer(watched)) + slotval2 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + virtualReturn := gofunc((&QScriptEngine{h: self}).callVirtualBase_EventFilter, slotval1, slotval2) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptEngine) callVirtualBase_TimerEvent(event *qt.QTimerEvent) { + + C.QScriptEngine_virtualbase_TimerEvent(unsafe.Pointer(this.h), (*C.QTimerEvent)(event.UnsafePointer())) + +} +func (this *QScriptEngine) OnTimerEvent(slot func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent)) { + C.QScriptEngine_override_virtual_TimerEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_TimerEvent +func miqt_exec_callback_QScriptEngine_TimerEvent(self *C.QScriptEngine, cb C.intptr_t, event *C.QTimerEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQTimerEvent(unsafe.Pointer(event), nil) + + gofunc((&QScriptEngine{h: self}).callVirtualBase_TimerEvent, slotval1) + +} + +func (this *QScriptEngine) callVirtualBase_ChildEvent(event *qt.QChildEvent) { + + C.QScriptEngine_virtualbase_ChildEvent(unsafe.Pointer(this.h), (*C.QChildEvent)(event.UnsafePointer())) + +} +func (this *QScriptEngine) OnChildEvent(slot func(super func(event *qt.QChildEvent), event *qt.QChildEvent)) { + C.QScriptEngine_override_virtual_ChildEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_ChildEvent +func miqt_exec_callback_QScriptEngine_ChildEvent(self *C.QScriptEngine, cb C.intptr_t, event *C.QChildEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QChildEvent), event *qt.QChildEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQChildEvent(unsafe.Pointer(event), nil) + + gofunc((&QScriptEngine{h: self}).callVirtualBase_ChildEvent, slotval1) + +} + +func (this *QScriptEngine) callVirtualBase_CustomEvent(event *qt.QEvent) { + + C.QScriptEngine_virtualbase_CustomEvent(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer())) + +} +func (this *QScriptEngine) OnCustomEvent(slot func(super func(event *qt.QEvent), event *qt.QEvent)) { + C.QScriptEngine_override_virtual_CustomEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_CustomEvent +func miqt_exec_callback_QScriptEngine_CustomEvent(self *C.QScriptEngine, cb C.intptr_t, event *C.QEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent), event *qt.QEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + gofunc((&QScriptEngine{h: self}).callVirtualBase_CustomEvent, slotval1) + +} + +func (this *QScriptEngine) callVirtualBase_ConnectNotify(signal *qt.QMetaMethod) { + + C.QScriptEngine_virtualbase_ConnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer())) + +} +func (this *QScriptEngine) OnConnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) { + C.QScriptEngine_override_virtual_ConnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_ConnectNotify +func miqt_exec_callback_QScriptEngine_ConnectNotify(self *C.QScriptEngine, cb C.intptr_t, signal *C.QMetaMethod) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal)) + + gofunc((&QScriptEngine{h: self}).callVirtualBase_ConnectNotify, slotval1) + +} + +func (this *QScriptEngine) callVirtualBase_DisconnectNotify(signal *qt.QMetaMethod) { + + C.QScriptEngine_virtualbase_DisconnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer())) + +} +func (this *QScriptEngine) OnDisconnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) { + C.QScriptEngine_override_virtual_DisconnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngine_DisconnectNotify +func miqt_exec_callback_QScriptEngine_DisconnectNotify(self *C.QScriptEngine, cb C.intptr_t, signal *C.QMetaMethod) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal)) + + gofunc((&QScriptEngine{h: self}).callVirtualBase_DisconnectNotify, slotval1) + +} + +// Delete this object from C++ memory. +func (this *QScriptEngine) Delete() { + C.QScriptEngine_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptEngine) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptEngine) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptengine.h b/qt/script/gen_qscriptengine.h new file mode 100644 index 00000000..a7aba9f7 --- /dev/null +++ b/qt/script/gen_qscriptengine.h @@ -0,0 +1,152 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTENGINE_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTENGINE_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QChildEvent; +class QDateTime; +class QEvent; +class QMetaMethod; +class QMetaObject; +class QObject; +class QRegExp; +class QScriptClass; +class QScriptContext; +class QScriptEngine; +class QScriptEngineAgent; +class QScriptProgram; +class QScriptString; +class QScriptSyntaxCheckResult; +class QScriptValue; +class QTimerEvent; +class QVariant; +#else +typedef struct QChildEvent QChildEvent; +typedef struct QDateTime QDateTime; +typedef struct QEvent QEvent; +typedef struct QMetaMethod QMetaMethod; +typedef struct QMetaObject QMetaObject; +typedef struct QObject QObject; +typedef struct QRegExp QRegExp; +typedef struct QScriptClass QScriptClass; +typedef struct QScriptContext QScriptContext; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptEngineAgent QScriptEngineAgent; +typedef struct QScriptProgram QScriptProgram; +typedef struct QScriptString QScriptString; +typedef struct QScriptSyntaxCheckResult QScriptSyntaxCheckResult; +typedef struct QScriptValue QScriptValue; +typedef struct QTimerEvent QTimerEvent; +typedef struct QVariant QVariant; +#endif + +void QScriptSyntaxCheckResult_new(QScriptSyntaxCheckResult* other, QScriptSyntaxCheckResult** outptr_QScriptSyntaxCheckResult); +int QScriptSyntaxCheckResult_State(const QScriptSyntaxCheckResult* self); +int QScriptSyntaxCheckResult_ErrorLineNumber(const QScriptSyntaxCheckResult* self); +int QScriptSyntaxCheckResult_ErrorColumnNumber(const QScriptSyntaxCheckResult* self); +struct miqt_string QScriptSyntaxCheckResult_ErrorMessage(const QScriptSyntaxCheckResult* self); +void QScriptSyntaxCheckResult_OperatorAssign(QScriptSyntaxCheckResult* self, QScriptSyntaxCheckResult* other); +void QScriptSyntaxCheckResult_Delete(QScriptSyntaxCheckResult* self, bool isSubclass); + +void QScriptEngine_new(QScriptEngine** outptr_QScriptEngine, QObject** outptr_QObject); +void QScriptEngine_new2(QObject* parent, QScriptEngine** outptr_QScriptEngine, QObject** outptr_QObject); +QMetaObject* QScriptEngine_MetaObject(const QScriptEngine* self); +void* QScriptEngine_Metacast(QScriptEngine* self, const char* param1); +struct miqt_string QScriptEngine_Tr(const char* s); +struct miqt_string QScriptEngine_TrUtf8(const char* s); +QScriptValue* QScriptEngine_GlobalObject(const QScriptEngine* self); +void QScriptEngine_SetGlobalObject(QScriptEngine* self, QScriptValue* object); +QScriptContext* QScriptEngine_CurrentContext(const QScriptEngine* self); +QScriptContext* QScriptEngine_PushContext(QScriptEngine* self); +void QScriptEngine_PopContext(QScriptEngine* self); +bool QScriptEngine_CanEvaluate(const QScriptEngine* self, struct miqt_string program); +QScriptSyntaxCheckResult* QScriptEngine_CheckSyntax(struct miqt_string program); +QScriptValue* QScriptEngine_Evaluate(QScriptEngine* self, struct miqt_string program); +QScriptValue* QScriptEngine_EvaluateWithProgram(QScriptEngine* self, QScriptProgram* program); +bool QScriptEngine_IsEvaluating(const QScriptEngine* self); +void QScriptEngine_AbortEvaluation(QScriptEngine* self); +bool QScriptEngine_HasUncaughtException(const QScriptEngine* self); +QScriptValue* QScriptEngine_UncaughtException(const QScriptEngine* self); +int QScriptEngine_UncaughtExceptionLineNumber(const QScriptEngine* self); +struct miqt_array /* of struct miqt_string */ QScriptEngine_UncaughtExceptionBacktrace(const QScriptEngine* self); +void QScriptEngine_ClearExceptions(QScriptEngine* self); +QScriptValue* QScriptEngine_NullValue(QScriptEngine* self); +QScriptValue* QScriptEngine_UndefinedValue(QScriptEngine* self); +QScriptValue* QScriptEngine_NewVariant(QScriptEngine* self, QVariant* value); +QScriptValue* QScriptEngine_NewVariant2(QScriptEngine* self, QScriptValue* object, QVariant* value); +QScriptValue* QScriptEngine_NewRegExp(QScriptEngine* self, QRegExp* regexp); +QScriptValue* QScriptEngine_NewObject(QScriptEngine* self); +QScriptValue* QScriptEngine_NewObjectWithScriptClass(QScriptEngine* self, QScriptClass* scriptClass); +QScriptValue* QScriptEngine_NewArray(QScriptEngine* self); +QScriptValue* QScriptEngine_NewRegExp2(QScriptEngine* self, struct miqt_string pattern, struct miqt_string flags); +QScriptValue* QScriptEngine_NewDate(QScriptEngine* self, double value); +QScriptValue* QScriptEngine_NewDateWithValue(QScriptEngine* self, QDateTime* value); +QScriptValue* QScriptEngine_NewActivationObject(QScriptEngine* self); +QScriptValue* QScriptEngine_NewQObject(QScriptEngine* self, QObject* object); +QScriptValue* QScriptEngine_NewQObject2(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject); +QScriptValue* QScriptEngine_NewQMetaObject(QScriptEngine* self, QMetaObject* metaObject); +QScriptValue* QScriptEngine_DefaultPrototype(const QScriptEngine* self, int metaTypeId); +void QScriptEngine_SetDefaultPrototype(QScriptEngine* self, int metaTypeId, QScriptValue* prototype); +void QScriptEngine_InstallTranslatorFunctions(QScriptEngine* self); +QScriptValue* QScriptEngine_ImportExtension(QScriptEngine* self, struct miqt_string extension); +struct miqt_array /* of struct miqt_string */ QScriptEngine_AvailableExtensions(const QScriptEngine* self); +struct miqt_array /* of struct miqt_string */ QScriptEngine_ImportedExtensions(const QScriptEngine* self); +void QScriptEngine_CollectGarbage(QScriptEngine* self); +void QScriptEngine_ReportAdditionalMemoryCost(QScriptEngine* self, int size); +void QScriptEngine_SetProcessEventsInterval(QScriptEngine* self, int interval); +int QScriptEngine_ProcessEventsInterval(const QScriptEngine* self); +void QScriptEngine_SetAgent(QScriptEngine* self, QScriptEngineAgent* agent); +QScriptEngineAgent* QScriptEngine_Agent(const QScriptEngine* self); +QScriptString* QScriptEngine_ToStringHandle(QScriptEngine* self, struct miqt_string str); +QScriptValue* QScriptEngine_ToObject(QScriptEngine* self, QScriptValue* value); +QScriptValue* QScriptEngine_ObjectById(const QScriptEngine* self, long long id); +void QScriptEngine_SignalHandlerException(QScriptEngine* self, QScriptValue* exception); +void QScriptEngine_connect_SignalHandlerException(QScriptEngine* self, intptr_t slot); +struct miqt_string QScriptEngine_Tr2(const char* s, const char* c); +struct miqt_string QScriptEngine_Tr3(const char* s, const char* c, int n); +struct miqt_string QScriptEngine_TrUtf82(const char* s, const char* c); +struct miqt_string QScriptEngine_TrUtf83(const char* s, const char* c, int n); +QScriptValue* QScriptEngine_Evaluate2(QScriptEngine* self, struct miqt_string program, struct miqt_string fileName); +QScriptValue* QScriptEngine_Evaluate3(QScriptEngine* self, struct miqt_string program, struct miqt_string fileName, int lineNumber); +void QScriptEngine_AbortEvaluation1(QScriptEngine* self, QScriptValue* result); +QScriptValue* QScriptEngine_NewObject2(QScriptEngine* self, QScriptClass* scriptClass, QScriptValue* data); +QScriptValue* QScriptEngine_NewArray1(QScriptEngine* self, unsigned int length); +QScriptValue* QScriptEngine_NewQObject22(QScriptEngine* self, QObject* object, int ownership); +QScriptValue* QScriptEngine_NewQObject3(QScriptEngine* self, QObject* object, int ownership, int* options); +QScriptValue* QScriptEngine_NewQObject32(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject, int ownership); +QScriptValue* QScriptEngine_NewQObject4(QScriptEngine* self, QScriptValue* scriptObject, QObject* qtObject, int ownership, int* options); +QScriptValue* QScriptEngine_NewQMetaObject2(QScriptEngine* self, QMetaObject* metaObject, QScriptValue* ctor); +void QScriptEngine_InstallTranslatorFunctions1(QScriptEngine* self, QScriptValue* object); +void QScriptEngine_override_virtual_Event(void* self, intptr_t slot); +bool QScriptEngine_virtualbase_Event(void* self, QEvent* event); +void QScriptEngine_override_virtual_EventFilter(void* self, intptr_t slot); +bool QScriptEngine_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event); +void QScriptEngine_override_virtual_TimerEvent(void* self, intptr_t slot); +void QScriptEngine_virtualbase_TimerEvent(void* self, QTimerEvent* event); +void QScriptEngine_override_virtual_ChildEvent(void* self, intptr_t slot); +void QScriptEngine_virtualbase_ChildEvent(void* self, QChildEvent* event); +void QScriptEngine_override_virtual_CustomEvent(void* self, intptr_t slot); +void QScriptEngine_virtualbase_CustomEvent(void* self, QEvent* event); +void QScriptEngine_override_virtual_ConnectNotify(void* self, intptr_t slot); +void QScriptEngine_virtualbase_ConnectNotify(void* self, QMetaMethod* signal); +void QScriptEngine_override_virtual_DisconnectNotify(void* self, intptr_t slot); +void QScriptEngine_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal); +void QScriptEngine_Delete(QScriptEngine* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptengineagent.cpp b/qt/script/gen_qscriptengineagent.cpp new file mode 100644 index 00000000..d7c9ae64 --- /dev/null +++ b/qt/script/gen_qscriptengineagent.cpp @@ -0,0 +1,474 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptengineagent.h" +#include "_cgo_export.h" + +class MiqtVirtualQScriptEngineAgent : public virtual QScriptEngineAgent { +public: + + MiqtVirtualQScriptEngineAgent(QScriptEngine* engine): QScriptEngineAgent(engine) {}; + + virtual ~MiqtVirtualQScriptEngineAgent() = default; + + // cgo.Handle value for overwritten implementation + intptr_t handle__ScriptLoad = 0; + + // Subclass to allow providing a Go implementation + virtual void scriptLoad(qint64 id, const QString& program, const QString& fileName, int baseLineNumber) override { + if (handle__ScriptLoad == 0) { + QScriptEngineAgent::scriptLoad(id, program, fileName, baseLineNumber); + return; + } + + qint64 id_ret = id; + long long sigval1 = static_cast(id_ret); + const QString program_ret = program; + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray program_b = program_ret.toUtf8(); + struct miqt_string program_ms; + program_ms.len = program_b.length(); + program_ms.data = static_cast(malloc(program_ms.len)); + memcpy(program_ms.data, program_b.data(), program_ms.len); + struct miqt_string sigval2 = program_ms; + const QString fileName_ret = fileName; + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray fileName_b = fileName_ret.toUtf8(); + struct miqt_string fileName_ms; + fileName_ms.len = fileName_b.length(); + fileName_ms.data = static_cast(malloc(fileName_ms.len)); + memcpy(fileName_ms.data, fileName_b.data(), fileName_ms.len); + struct miqt_string sigval3 = fileName_ms; + int sigval4 = baseLineNumber; + + miqt_exec_callback_QScriptEngineAgent_ScriptLoad(this, handle__ScriptLoad, sigval1, sigval2, sigval3, sigval4); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ScriptLoad(long long id, struct miqt_string program, struct miqt_string fileName, int baseLineNumber) { + QString program_QString = QString::fromUtf8(program.data, program.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + + QScriptEngineAgent::scriptLoad(static_cast(id), program_QString, fileName_QString, static_cast(baseLineNumber)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ScriptUnload = 0; + + // Subclass to allow providing a Go implementation + virtual void scriptUnload(qint64 id) override { + if (handle__ScriptUnload == 0) { + QScriptEngineAgent::scriptUnload(id); + return; + } + + qint64 id_ret = id; + long long sigval1 = static_cast(id_ret); + + miqt_exec_callback_QScriptEngineAgent_ScriptUnload(this, handle__ScriptUnload, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ScriptUnload(long long id) { + + QScriptEngineAgent::scriptUnload(static_cast(id)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ContextPush = 0; + + // Subclass to allow providing a Go implementation + virtual void contextPush() override { + if (handle__ContextPush == 0) { + QScriptEngineAgent::contextPush(); + return; + } + + + miqt_exec_callback_QScriptEngineAgent_ContextPush(this, handle__ContextPush); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ContextPush() { + + QScriptEngineAgent::contextPush(); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ContextPop = 0; + + // Subclass to allow providing a Go implementation + virtual void contextPop() override { + if (handle__ContextPop == 0) { + QScriptEngineAgent::contextPop(); + return; + } + + + miqt_exec_callback_QScriptEngineAgent_ContextPop(this, handle__ContextPop); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ContextPop() { + + QScriptEngineAgent::contextPop(); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__FunctionEntry = 0; + + // Subclass to allow providing a Go implementation + virtual void functionEntry(qint64 scriptId) override { + if (handle__FunctionEntry == 0) { + QScriptEngineAgent::functionEntry(scriptId); + return; + } + + qint64 scriptId_ret = scriptId; + long long sigval1 = static_cast(scriptId_ret); + + miqt_exec_callback_QScriptEngineAgent_FunctionEntry(this, handle__FunctionEntry, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_FunctionEntry(long long scriptId) { + + QScriptEngineAgent::functionEntry(static_cast(scriptId)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__FunctionExit = 0; + + // Subclass to allow providing a Go implementation + virtual void functionExit(qint64 scriptId, const QScriptValue& returnValue) override { + if (handle__FunctionExit == 0) { + QScriptEngineAgent::functionExit(scriptId, returnValue); + return; + } + + qint64 scriptId_ret = scriptId; + long long sigval1 = static_cast(scriptId_ret); + const QScriptValue& returnValue_ret = returnValue; + // Cast returned reference into pointer + QScriptValue* sigval2 = const_cast(&returnValue_ret); + + miqt_exec_callback_QScriptEngineAgent_FunctionExit(this, handle__FunctionExit, sigval1, sigval2); + + + } + + // Wrapper to allow calling protected method + void virtualbase_FunctionExit(long long scriptId, QScriptValue* returnValue) { + + QScriptEngineAgent::functionExit(static_cast(scriptId), *returnValue); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__PositionChange = 0; + + // Subclass to allow providing a Go implementation + virtual void positionChange(qint64 scriptId, int lineNumber, int columnNumber) override { + if (handle__PositionChange == 0) { + QScriptEngineAgent::positionChange(scriptId, lineNumber, columnNumber); + return; + } + + qint64 scriptId_ret = scriptId; + long long sigval1 = static_cast(scriptId_ret); + int sigval2 = lineNumber; + int sigval3 = columnNumber; + + miqt_exec_callback_QScriptEngineAgent_PositionChange(this, handle__PositionChange, sigval1, sigval2, sigval3); + + + } + + // Wrapper to allow calling protected method + void virtualbase_PositionChange(long long scriptId, int lineNumber, int columnNumber) { + + QScriptEngineAgent::positionChange(static_cast(scriptId), static_cast(lineNumber), static_cast(columnNumber)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ExceptionThrow = 0; + + // Subclass to allow providing a Go implementation + virtual void exceptionThrow(qint64 scriptId, const QScriptValue& exception, bool hasHandler) override { + if (handle__ExceptionThrow == 0) { + QScriptEngineAgent::exceptionThrow(scriptId, exception, hasHandler); + return; + } + + qint64 scriptId_ret = scriptId; + long long sigval1 = static_cast(scriptId_ret); + const QScriptValue& exception_ret = exception; + // Cast returned reference into pointer + QScriptValue* sigval2 = const_cast(&exception_ret); + bool sigval3 = hasHandler; + + miqt_exec_callback_QScriptEngineAgent_ExceptionThrow(this, handle__ExceptionThrow, sigval1, sigval2, sigval3); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ExceptionThrow(long long scriptId, QScriptValue* exception, bool hasHandler) { + + QScriptEngineAgent::exceptionThrow(static_cast(scriptId), *exception, hasHandler); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ExceptionCatch = 0; + + // Subclass to allow providing a Go implementation + virtual void exceptionCatch(qint64 scriptId, const QScriptValue& exception) override { + if (handle__ExceptionCatch == 0) { + QScriptEngineAgent::exceptionCatch(scriptId, exception); + return; + } + + qint64 scriptId_ret = scriptId; + long long sigval1 = static_cast(scriptId_ret); + const QScriptValue& exception_ret = exception; + // Cast returned reference into pointer + QScriptValue* sigval2 = const_cast(&exception_ret); + + miqt_exec_callback_QScriptEngineAgent_ExceptionCatch(this, handle__ExceptionCatch, sigval1, sigval2); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ExceptionCatch(long long scriptId, QScriptValue* exception) { + + QScriptEngineAgent::exceptionCatch(static_cast(scriptId), *exception); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__SupportsExtension = 0; + + // Subclass to allow providing a Go implementation + virtual bool supportsExtension(QScriptEngineAgent::Extension extension) const override { + if (handle__SupportsExtension == 0) { + return QScriptEngineAgent::supportsExtension(extension); + } + + QScriptEngineAgent::Extension extension_ret = extension; + int sigval1 = static_cast(extension_ret); + + bool callback_return_value = miqt_exec_callback_QScriptEngineAgent_SupportsExtension(const_cast(this), handle__SupportsExtension, sigval1); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_SupportsExtension(int extension) const { + + return QScriptEngineAgent::supportsExtension(static_cast(extension)); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Extension = 0; + + // Subclass to allow providing a Go implementation + virtual QVariant extension(QScriptEngineAgent::Extension extension, const QVariant& argument) override { + if (handle__Extension == 0) { + return QScriptEngineAgent::extension(extension, argument); + } + + QScriptEngineAgent::Extension extension_ret = extension; + int sigval1 = static_cast(extension_ret); + const QVariant& argument_ret = argument; + // Cast returned reference into pointer + QVariant* sigval2 = const_cast(&argument_ret); + + QVariant* callback_return_value = miqt_exec_callback_QScriptEngineAgent_Extension(this, handle__Extension, sigval1, sigval2); + + return *callback_return_value; + } + + // Wrapper to allow calling protected method + QVariant* virtualbase_Extension(int extension, QVariant* argument) { + + return new QVariant(QScriptEngineAgent::extension(static_cast(extension), *argument)); + + } + +}; + +void QScriptEngineAgent_new(QScriptEngine* engine, QScriptEngineAgent** outptr_QScriptEngineAgent) { + MiqtVirtualQScriptEngineAgent* ret = new MiqtVirtualQScriptEngineAgent(engine); + *outptr_QScriptEngineAgent = ret; +} + +void QScriptEngineAgent_ScriptLoad(QScriptEngineAgent* self, long long id, struct miqt_string program, struct miqt_string fileName, int baseLineNumber) { + QString program_QString = QString::fromUtf8(program.data, program.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + self->scriptLoad(static_cast(id), program_QString, fileName_QString, static_cast(baseLineNumber)); +} + +void QScriptEngineAgent_ScriptUnload(QScriptEngineAgent* self, long long id) { + self->scriptUnload(static_cast(id)); +} + +void QScriptEngineAgent_ContextPush(QScriptEngineAgent* self) { + self->contextPush(); +} + +void QScriptEngineAgent_ContextPop(QScriptEngineAgent* self) { + self->contextPop(); +} + +void QScriptEngineAgent_FunctionEntry(QScriptEngineAgent* self, long long scriptId) { + self->functionEntry(static_cast(scriptId)); +} + +void QScriptEngineAgent_FunctionExit(QScriptEngineAgent* self, long long scriptId, QScriptValue* returnValue) { + self->functionExit(static_cast(scriptId), *returnValue); +} + +void QScriptEngineAgent_PositionChange(QScriptEngineAgent* self, long long scriptId, int lineNumber, int columnNumber) { + self->positionChange(static_cast(scriptId), static_cast(lineNumber), static_cast(columnNumber)); +} + +void QScriptEngineAgent_ExceptionThrow(QScriptEngineAgent* self, long long scriptId, QScriptValue* exception, bool hasHandler) { + self->exceptionThrow(static_cast(scriptId), *exception, hasHandler); +} + +void QScriptEngineAgent_ExceptionCatch(QScriptEngineAgent* self, long long scriptId, QScriptValue* exception) { + self->exceptionCatch(static_cast(scriptId), *exception); +} + +bool QScriptEngineAgent_SupportsExtension(const QScriptEngineAgent* self, int extension) { + return self->supportsExtension(static_cast(extension)); +} + +QVariant* QScriptEngineAgent_Extension(QScriptEngineAgent* self, int extension, QVariant* argument) { + return new QVariant(self->extension(static_cast(extension), *argument)); +} + +QScriptEngine* QScriptEngineAgent_Engine(const QScriptEngineAgent* self) { + return self->engine(); +} + +void QScriptEngineAgent_override_virtual_ScriptLoad(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ScriptLoad = slot; +} + +void QScriptEngineAgent_virtualbase_ScriptLoad(void* self, long long id, struct miqt_string program, struct miqt_string fileName, int baseLineNumber) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ScriptLoad(id, program, fileName, baseLineNumber); +} + +void QScriptEngineAgent_override_virtual_ScriptUnload(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ScriptUnload = slot; +} + +void QScriptEngineAgent_virtualbase_ScriptUnload(void* self, long long id) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ScriptUnload(id); +} + +void QScriptEngineAgent_override_virtual_ContextPush(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ContextPush = slot; +} + +void QScriptEngineAgent_virtualbase_ContextPush(void* self) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ContextPush(); +} + +void QScriptEngineAgent_override_virtual_ContextPop(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ContextPop = slot; +} + +void QScriptEngineAgent_virtualbase_ContextPop(void* self) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ContextPop(); +} + +void QScriptEngineAgent_override_virtual_FunctionEntry(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__FunctionEntry = slot; +} + +void QScriptEngineAgent_virtualbase_FunctionEntry(void* self, long long scriptId) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_FunctionEntry(scriptId); +} + +void QScriptEngineAgent_override_virtual_FunctionExit(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__FunctionExit = slot; +} + +void QScriptEngineAgent_virtualbase_FunctionExit(void* self, long long scriptId, QScriptValue* returnValue) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_FunctionExit(scriptId, returnValue); +} + +void QScriptEngineAgent_override_virtual_PositionChange(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__PositionChange = slot; +} + +void QScriptEngineAgent_virtualbase_PositionChange(void* self, long long scriptId, int lineNumber, int columnNumber) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_PositionChange(scriptId, lineNumber, columnNumber); +} + +void QScriptEngineAgent_override_virtual_ExceptionThrow(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ExceptionThrow = slot; +} + +void QScriptEngineAgent_virtualbase_ExceptionThrow(void* self, long long scriptId, QScriptValue* exception, bool hasHandler) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ExceptionThrow(scriptId, exception, hasHandler); +} + +void QScriptEngineAgent_override_virtual_ExceptionCatch(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__ExceptionCatch = slot; +} + +void QScriptEngineAgent_virtualbase_ExceptionCatch(void* self, long long scriptId, QScriptValue* exception) { + ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_ExceptionCatch(scriptId, exception); +} + +void QScriptEngineAgent_override_virtual_SupportsExtension(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__SupportsExtension = slot; +} + +bool QScriptEngineAgent_virtualbase_SupportsExtension(const void* self, int extension) { + return ( (const MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_SupportsExtension(extension); +} + +void QScriptEngineAgent_override_virtual_Extension(void* self, intptr_t slot) { + dynamic_cast( (QScriptEngineAgent*)(self) )->handle__Extension = slot; +} + +QVariant* QScriptEngineAgent_virtualbase_Extension(void* self, int extension, QVariant* argument) { + return ( (MiqtVirtualQScriptEngineAgent*)(self) )->virtualbase_Extension(extension, argument); +} + +void QScriptEngineAgent_Delete(QScriptEngineAgent* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptengineagent.go b/qt/script/gen_qscriptengineagent.go new file mode 100644 index 00000000..938955bf --- /dev/null +++ b/qt/script/gen_qscriptengineagent.go @@ -0,0 +1,426 @@ +package script + +/* + +#include "gen_qscriptengineagent.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QScriptEngineAgent__Extension int + +const ( + QScriptEngineAgent__DebuggerInvocationRequest QScriptEngineAgent__Extension = 0 +) + +type QScriptEngineAgent struct { + h *C.QScriptEngineAgent + isSubclass bool +} + +func (this *QScriptEngineAgent) cPointer() *C.QScriptEngineAgent { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptEngineAgent) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptEngineAgent constructs the type using only CGO pointers. +func newQScriptEngineAgent(h *C.QScriptEngineAgent) *QScriptEngineAgent { + if h == nil { + return nil + } + return &QScriptEngineAgent{h: h} +} + +// UnsafeNewQScriptEngineAgent constructs the type using only unsafe pointers. +func UnsafeNewQScriptEngineAgent(h unsafe.Pointer) *QScriptEngineAgent { + if h == nil { + return nil + } + + return &QScriptEngineAgent{h: (*C.QScriptEngineAgent)(h)} +} + +// NewQScriptEngineAgent constructs a new QScriptEngineAgent object. +func NewQScriptEngineAgent(engine *QScriptEngine) *QScriptEngineAgent { + var outptr_QScriptEngineAgent *C.QScriptEngineAgent = nil + + C.QScriptEngineAgent_new(engine.cPointer(), &outptr_QScriptEngineAgent) + ret := newQScriptEngineAgent(outptr_QScriptEngineAgent) + ret.isSubclass = true + return ret +} + +func (this *QScriptEngineAgent) ScriptLoad(id int64, program string, fileName string, baseLineNumber int) { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + C.QScriptEngineAgent_ScriptLoad(this.h, (C.longlong)(id), program_ms, fileName_ms, (C.int)(baseLineNumber)) +} + +func (this *QScriptEngineAgent) ScriptUnload(id int64) { + C.QScriptEngineAgent_ScriptUnload(this.h, (C.longlong)(id)) +} + +func (this *QScriptEngineAgent) ContextPush() { + C.QScriptEngineAgent_ContextPush(this.h) +} + +func (this *QScriptEngineAgent) ContextPop() { + C.QScriptEngineAgent_ContextPop(this.h) +} + +func (this *QScriptEngineAgent) FunctionEntry(scriptId int64) { + C.QScriptEngineAgent_FunctionEntry(this.h, (C.longlong)(scriptId)) +} + +func (this *QScriptEngineAgent) FunctionExit(scriptId int64, returnValue *QScriptValue) { + C.QScriptEngineAgent_FunctionExit(this.h, (C.longlong)(scriptId), returnValue.cPointer()) +} + +func (this *QScriptEngineAgent) PositionChange(scriptId int64, lineNumber int, columnNumber int) { + C.QScriptEngineAgent_PositionChange(this.h, (C.longlong)(scriptId), (C.int)(lineNumber), (C.int)(columnNumber)) +} + +func (this *QScriptEngineAgent) ExceptionThrow(scriptId int64, exception *QScriptValue, hasHandler bool) { + C.QScriptEngineAgent_ExceptionThrow(this.h, (C.longlong)(scriptId), exception.cPointer(), (C.bool)(hasHandler)) +} + +func (this *QScriptEngineAgent) ExceptionCatch(scriptId int64, exception *QScriptValue) { + C.QScriptEngineAgent_ExceptionCatch(this.h, (C.longlong)(scriptId), exception.cPointer()) +} + +func (this *QScriptEngineAgent) SupportsExtension(extension QScriptEngineAgent__Extension) bool { + return (bool)(C.QScriptEngineAgent_SupportsExtension(this.h, (C.int)(extension))) +} + +func (this *QScriptEngineAgent) Extension(extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant { + _ret := C.QScriptEngineAgent_Extension(this.h, (C.int)(extension), (*C.QVariant)(argument.UnsafePointer())) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptEngineAgent) Engine() *QScriptEngine { + return UnsafeNewQScriptEngine(unsafe.Pointer(C.QScriptEngineAgent_Engine(this.h)), nil) +} + +func (this *QScriptEngineAgent) callVirtualBase_ScriptLoad(id int64, program string, fileName string, baseLineNumber int) { + program_ms := C.struct_miqt_string{} + program_ms.data = C.CString(program) + program_ms.len = C.size_t(len(program)) + defer C.free(unsafe.Pointer(program_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + + C.QScriptEngineAgent_virtualbase_ScriptLoad(unsafe.Pointer(this.h), (C.longlong)(id), program_ms, fileName_ms, (C.int)(baseLineNumber)) + +} +func (this *QScriptEngineAgent) OnScriptLoad(slot func(super func(id int64, program string, fileName string, baseLineNumber int), id int64, program string, fileName string, baseLineNumber int)) { + C.QScriptEngineAgent_override_virtual_ScriptLoad(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ScriptLoad +func miqt_exec_callback_QScriptEngineAgent_ScriptLoad(self *C.QScriptEngineAgent, cb C.intptr_t, id C.longlong, program C.struct_miqt_string, fileName C.struct_miqt_string, baseLineNumber C.int) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(id int64, program string, fileName string, baseLineNumber int), id int64, program string, fileName string, baseLineNumber int)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(id) + + var program_ms C.struct_miqt_string = program + program_ret := C.GoStringN(program_ms.data, C.int(int64(program_ms.len))) + C.free(unsafe.Pointer(program_ms.data)) + slotval2 := program_ret + var fileName_ms C.struct_miqt_string = fileName + fileName_ret := C.GoStringN(fileName_ms.data, C.int(int64(fileName_ms.len))) + C.free(unsafe.Pointer(fileName_ms.data)) + slotval3 := fileName_ret + slotval4 := (int)(baseLineNumber) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ScriptLoad, slotval1, slotval2, slotval3, slotval4) + +} + +func (this *QScriptEngineAgent) callVirtualBase_ScriptUnload(id int64) { + + C.QScriptEngineAgent_virtualbase_ScriptUnload(unsafe.Pointer(this.h), (C.longlong)(id)) + +} +func (this *QScriptEngineAgent) OnScriptUnload(slot func(super func(id int64), id int64)) { + C.QScriptEngineAgent_override_virtual_ScriptUnload(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ScriptUnload +func miqt_exec_callback_QScriptEngineAgent_ScriptUnload(self *C.QScriptEngineAgent, cb C.intptr_t, id C.longlong) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(id int64), id int64)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(id) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ScriptUnload, slotval1) + +} + +func (this *QScriptEngineAgent) callVirtualBase_ContextPush() { + + C.QScriptEngineAgent_virtualbase_ContextPush(unsafe.Pointer(this.h)) + +} +func (this *QScriptEngineAgent) OnContextPush(slot func(super func())) { + C.QScriptEngineAgent_override_virtual_ContextPush(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ContextPush +func miqt_exec_callback_QScriptEngineAgent_ContextPush(self *C.QScriptEngineAgent, cb C.intptr_t) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func())) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ContextPush) + +} + +func (this *QScriptEngineAgent) callVirtualBase_ContextPop() { + + C.QScriptEngineAgent_virtualbase_ContextPop(unsafe.Pointer(this.h)) + +} +func (this *QScriptEngineAgent) OnContextPop(slot func(super func())) { + C.QScriptEngineAgent_override_virtual_ContextPop(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ContextPop +func miqt_exec_callback_QScriptEngineAgent_ContextPop(self *C.QScriptEngineAgent, cb C.intptr_t) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func())) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ContextPop) + +} + +func (this *QScriptEngineAgent) callVirtualBase_FunctionEntry(scriptId int64) { + + C.QScriptEngineAgent_virtualbase_FunctionEntry(unsafe.Pointer(this.h), (C.longlong)(scriptId)) + +} +func (this *QScriptEngineAgent) OnFunctionEntry(slot func(super func(scriptId int64), scriptId int64)) { + C.QScriptEngineAgent_override_virtual_FunctionEntry(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_FunctionEntry +func miqt_exec_callback_QScriptEngineAgent_FunctionEntry(self *C.QScriptEngineAgent, cb C.intptr_t, scriptId C.longlong) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(scriptId int64), scriptId int64)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(scriptId) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_FunctionEntry, slotval1) + +} + +func (this *QScriptEngineAgent) callVirtualBase_FunctionExit(scriptId int64, returnValue *QScriptValue) { + + C.QScriptEngineAgent_virtualbase_FunctionExit(unsafe.Pointer(this.h), (C.longlong)(scriptId), returnValue.cPointer()) + +} +func (this *QScriptEngineAgent) OnFunctionExit(slot func(super func(scriptId int64, returnValue *QScriptValue), scriptId int64, returnValue *QScriptValue)) { + C.QScriptEngineAgent_override_virtual_FunctionExit(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_FunctionExit +func miqt_exec_callback_QScriptEngineAgent_FunctionExit(self *C.QScriptEngineAgent, cb C.intptr_t, scriptId C.longlong, returnValue *C.QScriptValue) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(scriptId int64, returnValue *QScriptValue), scriptId int64, returnValue *QScriptValue)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(scriptId) + + slotval2 := UnsafeNewQScriptValue(unsafe.Pointer(returnValue)) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_FunctionExit, slotval1, slotval2) + +} + +func (this *QScriptEngineAgent) callVirtualBase_PositionChange(scriptId int64, lineNumber int, columnNumber int) { + + C.QScriptEngineAgent_virtualbase_PositionChange(unsafe.Pointer(this.h), (C.longlong)(scriptId), (C.int)(lineNumber), (C.int)(columnNumber)) + +} +func (this *QScriptEngineAgent) OnPositionChange(slot func(super func(scriptId int64, lineNumber int, columnNumber int), scriptId int64, lineNumber int, columnNumber int)) { + C.QScriptEngineAgent_override_virtual_PositionChange(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_PositionChange +func miqt_exec_callback_QScriptEngineAgent_PositionChange(self *C.QScriptEngineAgent, cb C.intptr_t, scriptId C.longlong, lineNumber C.int, columnNumber C.int) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(scriptId int64, lineNumber int, columnNumber int), scriptId int64, lineNumber int, columnNumber int)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(scriptId) + + slotval2 := (int)(lineNumber) + + slotval3 := (int)(columnNumber) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_PositionChange, slotval1, slotval2, slotval3) + +} + +func (this *QScriptEngineAgent) callVirtualBase_ExceptionThrow(scriptId int64, exception *QScriptValue, hasHandler bool) { + + C.QScriptEngineAgent_virtualbase_ExceptionThrow(unsafe.Pointer(this.h), (C.longlong)(scriptId), exception.cPointer(), (C.bool)(hasHandler)) + +} +func (this *QScriptEngineAgent) OnExceptionThrow(slot func(super func(scriptId int64, exception *QScriptValue, hasHandler bool), scriptId int64, exception *QScriptValue, hasHandler bool)) { + C.QScriptEngineAgent_override_virtual_ExceptionThrow(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ExceptionThrow +func miqt_exec_callback_QScriptEngineAgent_ExceptionThrow(self *C.QScriptEngineAgent, cb C.intptr_t, scriptId C.longlong, exception *C.QScriptValue, hasHandler C.bool) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(scriptId int64, exception *QScriptValue, hasHandler bool), scriptId int64, exception *QScriptValue, hasHandler bool)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(scriptId) + + slotval2 := UnsafeNewQScriptValue(unsafe.Pointer(exception)) + slotval3 := (bool)(hasHandler) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ExceptionThrow, slotval1, slotval2, slotval3) + +} + +func (this *QScriptEngineAgent) callVirtualBase_ExceptionCatch(scriptId int64, exception *QScriptValue) { + + C.QScriptEngineAgent_virtualbase_ExceptionCatch(unsafe.Pointer(this.h), (C.longlong)(scriptId), exception.cPointer()) + +} +func (this *QScriptEngineAgent) OnExceptionCatch(slot func(super func(scriptId int64, exception *QScriptValue), scriptId int64, exception *QScriptValue)) { + C.QScriptEngineAgent_override_virtual_ExceptionCatch(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_ExceptionCatch +func miqt_exec_callback_QScriptEngineAgent_ExceptionCatch(self *C.QScriptEngineAgent, cb C.intptr_t, scriptId C.longlong, exception *C.QScriptValue) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(scriptId int64, exception *QScriptValue), scriptId int64, exception *QScriptValue)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (int64)(scriptId) + + slotval2 := UnsafeNewQScriptValue(unsafe.Pointer(exception)) + + gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_ExceptionCatch, slotval1, slotval2) + +} + +func (this *QScriptEngineAgent) callVirtualBase_SupportsExtension(extension QScriptEngineAgent__Extension) bool { + + return (bool)(C.QScriptEngineAgent_virtualbase_SupportsExtension(unsafe.Pointer(this.h), (C.int)(extension))) + +} +func (this *QScriptEngineAgent) OnSupportsExtension(slot func(super func(extension QScriptEngineAgent__Extension) bool, extension QScriptEngineAgent__Extension) bool) { + C.QScriptEngineAgent_override_virtual_SupportsExtension(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_SupportsExtension +func miqt_exec_callback_QScriptEngineAgent_SupportsExtension(self *C.QScriptEngineAgent, cb C.intptr_t, extension C.int) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(extension QScriptEngineAgent__Extension) bool, extension QScriptEngineAgent__Extension) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (QScriptEngineAgent__Extension)(extension) + + virtualReturn := gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_SupportsExtension, slotval1) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptEngineAgent) callVirtualBase_Extension(extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant { + + _ret := C.QScriptEngineAgent_virtualbase_Extension(unsafe.Pointer(this.h), (C.int)(extension), (*C.QVariant)(argument.UnsafePointer())) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr + +} +func (this *QScriptEngineAgent) OnExtension(slot func(super func(extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant, extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant) { + C.QScriptEngineAgent_override_virtual_Extension(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptEngineAgent_Extension +func miqt_exec_callback_QScriptEngineAgent_Extension(self *C.QScriptEngineAgent, cb C.intptr_t, extension C.int, argument *C.QVariant) *C.QVariant { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant, extension QScriptEngineAgent__Extension, argument *qt.QVariant) *qt.QVariant) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := (QScriptEngineAgent__Extension)(extension) + + slotval2 := qt.UnsafeNewQVariant(unsafe.Pointer(argument)) + + virtualReturn := gofunc((&QScriptEngineAgent{h: self}).callVirtualBase_Extension, slotval1, slotval2) + + return (*C.QVariant)(virtualReturn.UnsafePointer()) + +} + +// Delete this object from C++ memory. +func (this *QScriptEngineAgent) Delete() { + C.QScriptEngineAgent_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptEngineAgent) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptEngineAgent) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptengineagent.h b/qt/script/gen_qscriptengineagent.h new file mode 100644 index 00000000..610ddc7a --- /dev/null +++ b/qt/script/gen_qscriptengineagent.h @@ -0,0 +1,70 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTENGINEAGENT_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTENGINEAGENT_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptEngine; +class QScriptEngineAgent; +class QScriptValue; +class QVariant; +#else +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptEngineAgent QScriptEngineAgent; +typedef struct QScriptValue QScriptValue; +typedef struct QVariant QVariant; +#endif + +void QScriptEngineAgent_new(QScriptEngine* engine, QScriptEngineAgent** outptr_QScriptEngineAgent); +void QScriptEngineAgent_ScriptLoad(QScriptEngineAgent* self, long long id, struct miqt_string program, struct miqt_string fileName, int baseLineNumber); +void QScriptEngineAgent_ScriptUnload(QScriptEngineAgent* self, long long id); +void QScriptEngineAgent_ContextPush(QScriptEngineAgent* self); +void QScriptEngineAgent_ContextPop(QScriptEngineAgent* self); +void QScriptEngineAgent_FunctionEntry(QScriptEngineAgent* self, long long scriptId); +void QScriptEngineAgent_FunctionExit(QScriptEngineAgent* self, long long scriptId, QScriptValue* returnValue); +void QScriptEngineAgent_PositionChange(QScriptEngineAgent* self, long long scriptId, int lineNumber, int columnNumber); +void QScriptEngineAgent_ExceptionThrow(QScriptEngineAgent* self, long long scriptId, QScriptValue* exception, bool hasHandler); +void QScriptEngineAgent_ExceptionCatch(QScriptEngineAgent* self, long long scriptId, QScriptValue* exception); +bool QScriptEngineAgent_SupportsExtension(const QScriptEngineAgent* self, int extension); +QVariant* QScriptEngineAgent_Extension(QScriptEngineAgent* self, int extension, QVariant* argument); +QScriptEngine* QScriptEngineAgent_Engine(const QScriptEngineAgent* self); +void QScriptEngineAgent_override_virtual_ScriptLoad(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ScriptLoad(void* self, long long id, struct miqt_string program, struct miqt_string fileName, int baseLineNumber); +void QScriptEngineAgent_override_virtual_ScriptUnload(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ScriptUnload(void* self, long long id); +void QScriptEngineAgent_override_virtual_ContextPush(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ContextPush(void* self); +void QScriptEngineAgent_override_virtual_ContextPop(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ContextPop(void* self); +void QScriptEngineAgent_override_virtual_FunctionEntry(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_FunctionEntry(void* self, long long scriptId); +void QScriptEngineAgent_override_virtual_FunctionExit(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_FunctionExit(void* self, long long scriptId, QScriptValue* returnValue); +void QScriptEngineAgent_override_virtual_PositionChange(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_PositionChange(void* self, long long scriptId, int lineNumber, int columnNumber); +void QScriptEngineAgent_override_virtual_ExceptionThrow(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ExceptionThrow(void* self, long long scriptId, QScriptValue* exception, bool hasHandler); +void QScriptEngineAgent_override_virtual_ExceptionCatch(void* self, intptr_t slot); +void QScriptEngineAgent_virtualbase_ExceptionCatch(void* self, long long scriptId, QScriptValue* exception); +void QScriptEngineAgent_override_virtual_SupportsExtension(void* self, intptr_t slot); +bool QScriptEngineAgent_virtualbase_SupportsExtension(const void* self, int extension); +void QScriptEngineAgent_override_virtual_Extension(void* self, intptr_t slot); +QVariant* QScriptEngineAgent_virtualbase_Extension(void* self, int extension, QVariant* argument); +void QScriptEngineAgent_Delete(QScriptEngineAgent* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptextensioninterface.cpp b/qt/script/gen_qscriptextensioninterface.cpp new file mode 100644 index 00000000..3d32d485 --- /dev/null +++ b/qt/script/gen_qscriptextensioninterface.cpp @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptextensioninterface.h" +#include "_cgo_export.h" + +class MiqtVirtualQScriptExtensionInterface : public virtual QScriptExtensionInterface { +public: + + MiqtVirtualQScriptExtensionInterface(const QScriptExtensionInterface& param1): QScriptExtensionInterface(param1) {}; + + virtual ~MiqtVirtualQScriptExtensionInterface() = default; + + // cgo.Handle value for overwritten implementation + intptr_t handle__Initialize = 0; + + // Subclass to allow providing a Go implementation + virtual void initialize(const QString& key, QScriptEngine* engine) override { + if (handle__Initialize == 0) { + return; // Pure virtual, there is no base we can call + } + + const QString key_ret = key; + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray key_b = key_ret.toUtf8(); + struct miqt_string key_ms; + key_ms.len = key_b.length(); + key_ms.data = static_cast(malloc(key_ms.len)); + memcpy(key_ms.data, key_b.data(), key_ms.len); + struct miqt_string sigval1 = key_ms; + QScriptEngine* sigval2 = engine; + + miqt_exec_callback_QScriptExtensionInterface_Initialize(this, handle__Initialize, sigval1, sigval2); + + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Keys = 0; + + // Subclass to allow providing a Go implementation + virtual QStringList keys() const override { + if (handle__Keys == 0) { + return QStringList(); // Pure virtual, there is no base we can call + } + + + struct miqt_array /* of struct miqt_string */ callback_return_value = miqt_exec_callback_QScriptExtensionInterface_Keys(const_cast(this), handle__Keys); + QStringList callback_return_value_QList; + callback_return_value_QList.reserve(callback_return_value.len); + struct miqt_string* callback_return_value_arr = static_cast(callback_return_value.data); + for(size_t i = 0; i < callback_return_value.len; ++i) { + QString callback_return_value_arr_i_QString = QString::fromUtf8(callback_return_value_arr[i].data, callback_return_value_arr[i].len); + callback_return_value_QList.push_back(callback_return_value_arr_i_QString); + } + + return callback_return_value_QList; + } + +}; + +void QScriptExtensionInterface_new(QScriptExtensionInterface* param1, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface) { + MiqtVirtualQScriptExtensionInterface* ret = new MiqtVirtualQScriptExtensionInterface(*param1); + *outptr_QScriptExtensionInterface = ret; + *outptr_QFactoryInterface = static_cast(ret); +} + +void QScriptExtensionInterface_Initialize(QScriptExtensionInterface* self, struct miqt_string key, QScriptEngine* engine) { + QString key_QString = QString::fromUtf8(key.data, key.len); + self->initialize(key_QString, engine); +} + +void QScriptExtensionInterface_OperatorAssign(QScriptExtensionInterface* self, QScriptExtensionInterface* param1) { + self->operator=(*param1); +} + +void QScriptExtensionInterface_override_virtual_Initialize(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionInterface*)(self) )->handle__Initialize = slot; +} + +void QScriptExtensionInterface_override_virtual_Keys(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionInterface*)(self) )->handle__Keys = slot; +} + +void QScriptExtensionInterface_Delete(QScriptExtensionInterface* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptextensioninterface.go b/qt/script/gen_qscriptextensioninterface.go new file mode 100644 index 00000000..d8a36de9 --- /dev/null +++ b/qt/script/gen_qscriptextensioninterface.go @@ -0,0 +1,139 @@ +package script + +/* + +#include "gen_qscriptextensioninterface.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QScriptExtensionInterface struct { + h *C.QScriptExtensionInterface + isSubclass bool + *qt.QFactoryInterface +} + +func (this *QScriptExtensionInterface) cPointer() *C.QScriptExtensionInterface { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptExtensionInterface) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptExtensionInterface constructs the type using only CGO pointers. +func newQScriptExtensionInterface(h *C.QScriptExtensionInterface, h_QFactoryInterface *C.QFactoryInterface) *QScriptExtensionInterface { + if h == nil { + return nil + } + return &QScriptExtensionInterface{h: h, + QFactoryInterface: qt.UnsafeNewQFactoryInterface(unsafe.Pointer(h_QFactoryInterface))} +} + +// UnsafeNewQScriptExtensionInterface constructs the type using only unsafe pointers. +func UnsafeNewQScriptExtensionInterface(h unsafe.Pointer, h_QFactoryInterface unsafe.Pointer) *QScriptExtensionInterface { + if h == nil { + return nil + } + + return &QScriptExtensionInterface{h: (*C.QScriptExtensionInterface)(h), + QFactoryInterface: qt.UnsafeNewQFactoryInterface(h_QFactoryInterface)} +} + +// NewQScriptExtensionInterface constructs a new QScriptExtensionInterface object. +func NewQScriptExtensionInterface(param1 *QScriptExtensionInterface) *QScriptExtensionInterface { + var outptr_QScriptExtensionInterface *C.QScriptExtensionInterface = nil + var outptr_QFactoryInterface *C.QFactoryInterface = nil + + C.QScriptExtensionInterface_new(param1.cPointer(), &outptr_QScriptExtensionInterface, &outptr_QFactoryInterface) + ret := newQScriptExtensionInterface(outptr_QScriptExtensionInterface, outptr_QFactoryInterface) + ret.isSubclass = true + return ret +} + +func (this *QScriptExtensionInterface) Initialize(key string, engine *QScriptEngine) { + key_ms := C.struct_miqt_string{} + key_ms.data = C.CString(key) + key_ms.len = C.size_t(len(key)) + defer C.free(unsafe.Pointer(key_ms.data)) + C.QScriptExtensionInterface_Initialize(this.h, key_ms, engine.cPointer()) +} + +func (this *QScriptExtensionInterface) OperatorAssign(param1 *QScriptExtensionInterface) { + C.QScriptExtensionInterface_OperatorAssign(this.h, param1.cPointer()) +} +func (this *QScriptExtensionInterface) OnInitialize(slot func(key string, engine *QScriptEngine)) { + C.QScriptExtensionInterface_override_virtual_Initialize(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionInterface_Initialize +func miqt_exec_callback_QScriptExtensionInterface_Initialize(self *C.QScriptExtensionInterface, cb C.intptr_t, key C.struct_miqt_string, engine *C.QScriptEngine) { + gofunc, ok := cgo.Handle(cb).Value().(func(key string, engine *QScriptEngine)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + var key_ms C.struct_miqt_string = key + key_ret := C.GoStringN(key_ms.data, C.int(int64(key_ms.len))) + C.free(unsafe.Pointer(key_ms.data)) + slotval1 := key_ret + slotval2 := UnsafeNewQScriptEngine(unsafe.Pointer(engine), nil) + + gofunc(slotval1, slotval2) + +} +func (this *QScriptExtensionInterface) OnKeys(slot func() []string) { + C.QScriptExtensionInterface_override_virtual_Keys(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionInterface_Keys +func miqt_exec_callback_QScriptExtensionInterface_Keys(self *C.QScriptExtensionInterface, cb C.intptr_t) C.struct_miqt_array { + gofunc, ok := cgo.Handle(cb).Value().(func() []string) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + virtualReturn := gofunc() + virtualReturn_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(virtualReturn)))) + defer C.free(unsafe.Pointer(virtualReturn_CArray)) + for i := range virtualReturn { + virtualReturn_i_ms := C.struct_miqt_string{} + virtualReturn_i_ms.data = C.CString(virtualReturn[i]) + virtualReturn_i_ms.len = C.size_t(len(virtualReturn[i])) + defer C.free(unsafe.Pointer(virtualReturn_i_ms.data)) + virtualReturn_CArray[i] = virtualReturn_i_ms + } + virtualReturn_ma := C.struct_miqt_array{len: C.size_t(len(virtualReturn)), data: unsafe.Pointer(virtualReturn_CArray)} + + return virtualReturn_ma + +} + +// Delete this object from C++ memory. +func (this *QScriptExtensionInterface) Delete() { + C.QScriptExtensionInterface_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptExtensionInterface) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptExtensionInterface) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptextensioninterface.h b/qt/script/gen_qscriptextensioninterface.h new file mode 100644 index 00000000..f3551076 --- /dev/null +++ b/qt/script/gen_qscriptextensioninterface.h @@ -0,0 +1,40 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTEXTENSIONINTERFACE_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTEXTENSIONINTERFACE_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QFactoryInterface; +class QScriptEngine; +class QScriptExtensionInterface; +#else +typedef struct QFactoryInterface QFactoryInterface; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptExtensionInterface QScriptExtensionInterface; +#endif + +void QScriptExtensionInterface_new(QScriptExtensionInterface* param1, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface); +void QScriptExtensionInterface_Initialize(QScriptExtensionInterface* self, struct miqt_string key, QScriptEngine* engine); +void QScriptExtensionInterface_OperatorAssign(QScriptExtensionInterface* self, QScriptExtensionInterface* param1); +void QScriptExtensionInterface_override_virtual_Initialize(void* self, intptr_t slot); +void QScriptExtensionInterface_virtualbase_Initialize(void* self, struct miqt_string key, QScriptEngine* engine); +void QScriptExtensionInterface_override_virtual_Keys(void* self, intptr_t slot); +struct miqt_array /* of struct miqt_string */ QScriptExtensionInterface_virtualbase_Keys(const void* self); +void QScriptExtensionInterface_Delete(QScriptExtensionInterface* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptextensionplugin.cpp b/qt/script/gen_qscriptextensionplugin.cpp new file mode 100644 index 00000000..cd431fa6 --- /dev/null +++ b/qt/script/gen_qscriptextensionplugin.cpp @@ -0,0 +1,438 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptextensionplugin.h" +#include "_cgo_export.h" + +class MiqtVirtualQScriptExtensionPlugin : public virtual QScriptExtensionPlugin { +public: + + MiqtVirtualQScriptExtensionPlugin(): QScriptExtensionPlugin() {}; + MiqtVirtualQScriptExtensionPlugin(QObject* parent): QScriptExtensionPlugin(parent) {}; + + virtual ~MiqtVirtualQScriptExtensionPlugin() = default; + + // cgo.Handle value for overwritten implementation + intptr_t handle__Keys = 0; + + // Subclass to allow providing a Go implementation + virtual QStringList keys() const override { + if (handle__Keys == 0) { + return QStringList(); // Pure virtual, there is no base we can call + } + + + struct miqt_array /* of struct miqt_string */ callback_return_value = miqt_exec_callback_QScriptExtensionPlugin_Keys(const_cast(this), handle__Keys); + QStringList callback_return_value_QList; + callback_return_value_QList.reserve(callback_return_value.len); + struct miqt_string* callback_return_value_arr = static_cast(callback_return_value.data); + for(size_t i = 0; i < callback_return_value.len; ++i) { + QString callback_return_value_arr_i_QString = QString::fromUtf8(callback_return_value_arr[i].data, callback_return_value_arr[i].len); + callback_return_value_QList.push_back(callback_return_value_arr_i_QString); + } + + return callback_return_value_QList; + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Initialize = 0; + + // Subclass to allow providing a Go implementation + virtual void initialize(const QString& key, QScriptEngine* engine) override { + if (handle__Initialize == 0) { + return; // Pure virtual, there is no base we can call + } + + const QString key_ret = key; + // Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory + QByteArray key_b = key_ret.toUtf8(); + struct miqt_string key_ms; + key_ms.len = key_b.length(); + key_ms.data = static_cast(malloc(key_ms.len)); + memcpy(key_ms.data, key_b.data(), key_ms.len); + struct miqt_string sigval1 = key_ms; + QScriptEngine* sigval2 = engine; + + miqt_exec_callback_QScriptExtensionPlugin_Initialize(this, handle__Initialize, sigval1, sigval2); + + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__Event = 0; + + // Subclass to allow providing a Go implementation + virtual bool event(QEvent* event) override { + if (handle__Event == 0) { + return QScriptExtensionPlugin::event(event); + } + + QEvent* sigval1 = event; + + bool callback_return_value = miqt_exec_callback_QScriptExtensionPlugin_Event(this, handle__Event, sigval1); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_Event(QEvent* event) { + + return QScriptExtensionPlugin::event(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__EventFilter = 0; + + // Subclass to allow providing a Go implementation + virtual bool eventFilter(QObject* watched, QEvent* event) override { + if (handle__EventFilter == 0) { + return QScriptExtensionPlugin::eventFilter(watched, event); + } + + QObject* sigval1 = watched; + QEvent* sigval2 = event; + + bool callback_return_value = miqt_exec_callback_QScriptExtensionPlugin_EventFilter(this, handle__EventFilter, sigval1, sigval2); + + return callback_return_value; + } + + // Wrapper to allow calling protected method + bool virtualbase_EventFilter(QObject* watched, QEvent* event) { + + return QScriptExtensionPlugin::eventFilter(watched, event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__TimerEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void timerEvent(QTimerEvent* event) override { + if (handle__TimerEvent == 0) { + QScriptExtensionPlugin::timerEvent(event); + return; + } + + QTimerEvent* sigval1 = event; + + miqt_exec_callback_QScriptExtensionPlugin_TimerEvent(this, handle__TimerEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_TimerEvent(QTimerEvent* event) { + + QScriptExtensionPlugin::timerEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ChildEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void childEvent(QChildEvent* event) override { + if (handle__ChildEvent == 0) { + QScriptExtensionPlugin::childEvent(event); + return; + } + + QChildEvent* sigval1 = event; + + miqt_exec_callback_QScriptExtensionPlugin_ChildEvent(this, handle__ChildEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ChildEvent(QChildEvent* event) { + + QScriptExtensionPlugin::childEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__CustomEvent = 0; + + // Subclass to allow providing a Go implementation + virtual void customEvent(QEvent* event) override { + if (handle__CustomEvent == 0) { + QScriptExtensionPlugin::customEvent(event); + return; + } + + QEvent* sigval1 = event; + + miqt_exec_callback_QScriptExtensionPlugin_CustomEvent(this, handle__CustomEvent, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_CustomEvent(QEvent* event) { + + QScriptExtensionPlugin::customEvent(event); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__ConnectNotify = 0; + + // Subclass to allow providing a Go implementation + virtual void connectNotify(const QMetaMethod& signal) override { + if (handle__ConnectNotify == 0) { + QScriptExtensionPlugin::connectNotify(signal); + return; + } + + const QMetaMethod& signal_ret = signal; + // Cast returned reference into pointer + QMetaMethod* sigval1 = const_cast(&signal_ret); + + miqt_exec_callback_QScriptExtensionPlugin_ConnectNotify(this, handle__ConnectNotify, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_ConnectNotify(QMetaMethod* signal) { + + QScriptExtensionPlugin::connectNotify(*signal); + + } + + // cgo.Handle value for overwritten implementation + intptr_t handle__DisconnectNotify = 0; + + // Subclass to allow providing a Go implementation + virtual void disconnectNotify(const QMetaMethod& signal) override { + if (handle__DisconnectNotify == 0) { + QScriptExtensionPlugin::disconnectNotify(signal); + return; + } + + const QMetaMethod& signal_ret = signal; + // Cast returned reference into pointer + QMetaMethod* sigval1 = const_cast(&signal_ret); + + miqt_exec_callback_QScriptExtensionPlugin_DisconnectNotify(this, handle__DisconnectNotify, sigval1); + + + } + + // Wrapper to allow calling protected method + void virtualbase_DisconnectNotify(QMetaMethod* signal) { + + QScriptExtensionPlugin::disconnectNotify(*signal); + + } + +}; + +void QScriptExtensionPlugin_new(QScriptExtensionPlugin** outptr_QScriptExtensionPlugin, QObject** outptr_QObject, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface) { + MiqtVirtualQScriptExtensionPlugin* ret = new MiqtVirtualQScriptExtensionPlugin(); + *outptr_QScriptExtensionPlugin = ret; + *outptr_QObject = static_cast(ret); + *outptr_QScriptExtensionInterface = static_cast(ret); + *outptr_QFactoryInterface = static_cast(ret); +} + +void QScriptExtensionPlugin_new2(QObject* parent, QScriptExtensionPlugin** outptr_QScriptExtensionPlugin, QObject** outptr_QObject, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface) { + MiqtVirtualQScriptExtensionPlugin* ret = new MiqtVirtualQScriptExtensionPlugin(parent); + *outptr_QScriptExtensionPlugin = ret; + *outptr_QObject = static_cast(ret); + *outptr_QScriptExtensionInterface = static_cast(ret); + *outptr_QFactoryInterface = static_cast(ret); +} + +QMetaObject* QScriptExtensionPlugin_MetaObject(const QScriptExtensionPlugin* self) { + return (QMetaObject*) self->metaObject(); +} + +void* QScriptExtensionPlugin_Metacast(QScriptExtensionPlugin* self, const char* param1) { + return self->qt_metacast(param1); +} + +struct miqt_string QScriptExtensionPlugin_Tr(const char* s) { + QString _ret = QScriptExtensionPlugin::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptExtensionPlugin_TrUtf8(const char* s) { + QString _ret = QScriptExtensionPlugin::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_array /* of struct miqt_string */ QScriptExtensionPlugin_Keys(const QScriptExtensionPlugin* self) { + QStringList _ret = self->keys(); + // Convert QList<> from C++ memory to manually-managed C memory + struct miqt_string* _arr = static_cast(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(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(_arr); + return _out; +} + +void QScriptExtensionPlugin_Initialize(QScriptExtensionPlugin* self, struct miqt_string key, QScriptEngine* engine) { + QString key_QString = QString::fromUtf8(key.data, key.len); + self->initialize(key_QString, engine); +} + +QScriptValue* QScriptExtensionPlugin_SetupPackage(const QScriptExtensionPlugin* self, struct miqt_string key, QScriptEngine* engine) { + QString key_QString = QString::fromUtf8(key.data, key.len); + return new QScriptValue(self->setupPackage(key_QString, engine)); +} + +struct miqt_string QScriptExtensionPlugin_Tr2(const char* s, const char* c) { + QString _ret = QScriptExtensionPlugin::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptExtensionPlugin_Tr3(const char* s, const char* c, int n) { + QString _ret = QScriptExtensionPlugin::tr(s, c, static_cast(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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptExtensionPlugin_TrUtf82(const char* s, const char* c) { + QString _ret = QScriptExtensionPlugin::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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +struct miqt_string QScriptExtensionPlugin_TrUtf83(const char* s, const char* c, int n) { + QString _ret = QScriptExtensionPlugin::trUtf8(s, c, static_cast(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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +void QScriptExtensionPlugin_override_virtual_Keys(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__Keys = slot; +} + +void QScriptExtensionPlugin_override_virtual_Initialize(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__Initialize = slot; +} + +void QScriptExtensionPlugin_override_virtual_Event(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__Event = slot; +} + +bool QScriptExtensionPlugin_virtualbase_Event(void* self, QEvent* event) { + return ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_Event(event); +} + +void QScriptExtensionPlugin_override_virtual_EventFilter(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__EventFilter = slot; +} + +bool QScriptExtensionPlugin_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event) { + return ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_EventFilter(watched, event); +} + +void QScriptExtensionPlugin_override_virtual_TimerEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__TimerEvent = slot; +} + +void QScriptExtensionPlugin_virtualbase_TimerEvent(void* self, QTimerEvent* event) { + ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_TimerEvent(event); +} + +void QScriptExtensionPlugin_override_virtual_ChildEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__ChildEvent = slot; +} + +void QScriptExtensionPlugin_virtualbase_ChildEvent(void* self, QChildEvent* event) { + ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_ChildEvent(event); +} + +void QScriptExtensionPlugin_override_virtual_CustomEvent(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__CustomEvent = slot; +} + +void QScriptExtensionPlugin_virtualbase_CustomEvent(void* self, QEvent* event) { + ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_CustomEvent(event); +} + +void QScriptExtensionPlugin_override_virtual_ConnectNotify(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__ConnectNotify = slot; +} + +void QScriptExtensionPlugin_virtualbase_ConnectNotify(void* self, QMetaMethod* signal) { + ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_ConnectNotify(signal); +} + +void QScriptExtensionPlugin_override_virtual_DisconnectNotify(void* self, intptr_t slot) { + dynamic_cast( (QScriptExtensionPlugin*)(self) )->handle__DisconnectNotify = slot; +} + +void QScriptExtensionPlugin_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal) { + ( (MiqtVirtualQScriptExtensionPlugin*)(self) )->virtualbase_DisconnectNotify(signal); +} + +void QScriptExtensionPlugin_Delete(QScriptExtensionPlugin* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptextensionplugin.go b/qt/script/gen_qscriptextensionplugin.go new file mode 100644 index 00000000..380fd883 --- /dev/null +++ b/qt/script/gen_qscriptextensionplugin.go @@ -0,0 +1,415 @@ +package script + +/* + +#include "gen_qscriptextensionplugin.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "runtime/cgo" + "unsafe" +) + +type QScriptExtensionPlugin struct { + h *C.QScriptExtensionPlugin + isSubclass bool + *qt.QObject + *QScriptExtensionInterface +} + +func (this *QScriptExtensionPlugin) cPointer() *C.QScriptExtensionPlugin { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptExtensionPlugin) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptExtensionPlugin constructs the type using only CGO pointers. +func newQScriptExtensionPlugin(h *C.QScriptExtensionPlugin, h_QObject *C.QObject, h_QScriptExtensionInterface *C.QScriptExtensionInterface, h_QFactoryInterface *C.QFactoryInterface) *QScriptExtensionPlugin { + if h == nil { + return nil + } + return &QScriptExtensionPlugin{h: h, + QObject: qt.UnsafeNewQObject(unsafe.Pointer(h_QObject)), + QScriptExtensionInterface: newQScriptExtensionInterface(h_QScriptExtensionInterface, h_QFactoryInterface)} +} + +// UnsafeNewQScriptExtensionPlugin constructs the type using only unsafe pointers. +func UnsafeNewQScriptExtensionPlugin(h unsafe.Pointer, h_QObject unsafe.Pointer, h_QScriptExtensionInterface unsafe.Pointer, h_QFactoryInterface unsafe.Pointer) *QScriptExtensionPlugin { + if h == nil { + return nil + } + + return &QScriptExtensionPlugin{h: (*C.QScriptExtensionPlugin)(h), + QObject: qt.UnsafeNewQObject(h_QObject), + QScriptExtensionInterface: UnsafeNewQScriptExtensionInterface(h_QScriptExtensionInterface, h_QFactoryInterface)} +} + +// NewQScriptExtensionPlugin constructs a new QScriptExtensionPlugin object. +func NewQScriptExtensionPlugin() *QScriptExtensionPlugin { + var outptr_QScriptExtensionPlugin *C.QScriptExtensionPlugin = nil + var outptr_QObject *C.QObject = nil + var outptr_QScriptExtensionInterface *C.QScriptExtensionInterface = nil + var outptr_QFactoryInterface *C.QFactoryInterface = nil + + C.QScriptExtensionPlugin_new(&outptr_QScriptExtensionPlugin, &outptr_QObject, &outptr_QScriptExtensionInterface, &outptr_QFactoryInterface) + ret := newQScriptExtensionPlugin(outptr_QScriptExtensionPlugin, outptr_QObject, outptr_QScriptExtensionInterface, outptr_QFactoryInterface) + ret.isSubclass = true + return ret +} + +// NewQScriptExtensionPlugin2 constructs a new QScriptExtensionPlugin object. +func NewQScriptExtensionPlugin2(parent *qt.QObject) *QScriptExtensionPlugin { + var outptr_QScriptExtensionPlugin *C.QScriptExtensionPlugin = nil + var outptr_QObject *C.QObject = nil + var outptr_QScriptExtensionInterface *C.QScriptExtensionInterface = nil + var outptr_QFactoryInterface *C.QFactoryInterface = nil + + C.QScriptExtensionPlugin_new2((*C.QObject)(parent.UnsafePointer()), &outptr_QScriptExtensionPlugin, &outptr_QObject, &outptr_QScriptExtensionInterface, &outptr_QFactoryInterface) + ret := newQScriptExtensionPlugin(outptr_QScriptExtensionPlugin, outptr_QObject, outptr_QScriptExtensionInterface, outptr_QFactoryInterface) + ret.isSubclass = true + return ret +} + +func (this *QScriptExtensionPlugin) MetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QScriptExtensionPlugin_MetaObject(this.h))) +} + +func (this *QScriptExtensionPlugin) Metacast(param1 string) unsafe.Pointer { + param1_Cstring := C.CString(param1) + defer C.free(unsafe.Pointer(param1_Cstring)) + return (unsafe.Pointer)(C.QScriptExtensionPlugin_Metacast(this.h, param1_Cstring)) +} + +func QScriptExtensionPlugin_Tr(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_Tr(s_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptExtensionPlugin_TrUtf8(s string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_TrUtf8(s_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptExtensionPlugin) Keys() []string { + var _ma C.struct_miqt_array = C.QScriptExtensionPlugin_Keys(this.h) + _ret := make([]string, int(_ma.len)) + _outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya + for i := 0; i < int(_ma.len); i++ { + var _lv_ms C.struct_miqt_string = _outCast[i] + _lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len))) + C.free(unsafe.Pointer(_lv_ms.data)) + _ret[i] = _lv_ret + } + return _ret +} + +func (this *QScriptExtensionPlugin) Initialize(key string, engine *QScriptEngine) { + key_ms := C.struct_miqt_string{} + key_ms.data = C.CString(key) + key_ms.len = C.size_t(len(key)) + defer C.free(unsafe.Pointer(key_ms.data)) + C.QScriptExtensionPlugin_Initialize(this.h, key_ms, engine.cPointer()) +} + +func (this *QScriptExtensionPlugin) SetupPackage(key string, engine *QScriptEngine) *QScriptValue { + key_ms := C.struct_miqt_string{} + key_ms.data = C.CString(key) + key_ms.len = C.size_t(len(key)) + defer C.free(unsafe.Pointer(key_ms.data)) + _ret := C.QScriptExtensionPlugin_SetupPackage(this.h, key_ms, engine.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func QScriptExtensionPlugin_Tr2(s string, c string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_Tr2(s_Cstring, c_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptExtensionPlugin_Tr3(s string, c string, n int) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_Tr3(s_Cstring, c_Cstring, (C.int)(n)) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptExtensionPlugin_TrUtf82(s string, c string) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_TrUtf82(s_Cstring, c_Cstring) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func QScriptExtensionPlugin_TrUtf83(s string, c string, n int) string { + s_Cstring := C.CString(s) + defer C.free(unsafe.Pointer(s_Cstring)) + c_Cstring := C.CString(c) + defer C.free(unsafe.Pointer(c_Cstring)) + var _ms C.struct_miqt_string = C.QScriptExtensionPlugin_TrUtf83(s_Cstring, c_Cstring, (C.int)(n)) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} +func (this *QScriptExtensionPlugin) OnKeys(slot func() []string) { + C.QScriptExtensionPlugin_override_virtual_Keys(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_Keys +func miqt_exec_callback_QScriptExtensionPlugin_Keys(self *C.QScriptExtensionPlugin, cb C.intptr_t) C.struct_miqt_array { + gofunc, ok := cgo.Handle(cb).Value().(func() []string) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + virtualReturn := gofunc() + virtualReturn_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(virtualReturn)))) + defer C.free(unsafe.Pointer(virtualReturn_CArray)) + for i := range virtualReturn { + virtualReturn_i_ms := C.struct_miqt_string{} + virtualReturn_i_ms.data = C.CString(virtualReturn[i]) + virtualReturn_i_ms.len = C.size_t(len(virtualReturn[i])) + defer C.free(unsafe.Pointer(virtualReturn_i_ms.data)) + virtualReturn_CArray[i] = virtualReturn_i_ms + } + virtualReturn_ma := C.struct_miqt_array{len: C.size_t(len(virtualReturn)), data: unsafe.Pointer(virtualReturn_CArray)} + + return virtualReturn_ma + +} +func (this *QScriptExtensionPlugin) OnInitialize(slot func(key string, engine *QScriptEngine)) { + C.QScriptExtensionPlugin_override_virtual_Initialize(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_Initialize +func miqt_exec_callback_QScriptExtensionPlugin_Initialize(self *C.QScriptExtensionPlugin, cb C.intptr_t, key C.struct_miqt_string, engine *C.QScriptEngine) { + gofunc, ok := cgo.Handle(cb).Value().(func(key string, engine *QScriptEngine)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + var key_ms C.struct_miqt_string = key + key_ret := C.GoStringN(key_ms.data, C.int(int64(key_ms.len))) + C.free(unsafe.Pointer(key_ms.data)) + slotval1 := key_ret + slotval2 := UnsafeNewQScriptEngine(unsafe.Pointer(engine), nil) + + gofunc(slotval1, slotval2) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_Event(event *qt.QEvent) bool { + + return (bool)(C.QScriptExtensionPlugin_virtualbase_Event(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer()))) + +} +func (this *QScriptExtensionPlugin) OnEvent(slot func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool) { + C.QScriptExtensionPlugin_override_virtual_Event(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_Event +func miqt_exec_callback_QScriptExtensionPlugin_Event(self *C.QScriptExtensionPlugin, cb C.intptr_t, event *C.QEvent) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + virtualReturn := gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_Event, slotval1) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_EventFilter(watched *qt.QObject, event *qt.QEvent) bool { + + return (bool)(C.QScriptExtensionPlugin_virtualbase_EventFilter(unsafe.Pointer(this.h), (*C.QObject)(watched.UnsafePointer()), (*C.QEvent)(event.UnsafePointer()))) + +} +func (this *QScriptExtensionPlugin) OnEventFilter(slot func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool) { + C.QScriptExtensionPlugin_override_virtual_EventFilter(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_EventFilter +func miqt_exec_callback_QScriptExtensionPlugin_EventFilter(self *C.QScriptExtensionPlugin, cb C.intptr_t, watched *C.QObject, event *C.QEvent) C.bool { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQObject(unsafe.Pointer(watched)) + slotval2 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + virtualReturn := gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_EventFilter, slotval1, slotval2) + + return (C.bool)(virtualReturn) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_TimerEvent(event *qt.QTimerEvent) { + + C.QScriptExtensionPlugin_virtualbase_TimerEvent(unsafe.Pointer(this.h), (*C.QTimerEvent)(event.UnsafePointer())) + +} +func (this *QScriptExtensionPlugin) OnTimerEvent(slot func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent)) { + C.QScriptExtensionPlugin_override_virtual_TimerEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_TimerEvent +func miqt_exec_callback_QScriptExtensionPlugin_TimerEvent(self *C.QScriptExtensionPlugin, cb C.intptr_t, event *C.QTimerEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQTimerEvent(unsafe.Pointer(event), nil) + + gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_TimerEvent, slotval1) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_ChildEvent(event *qt.QChildEvent) { + + C.QScriptExtensionPlugin_virtualbase_ChildEvent(unsafe.Pointer(this.h), (*C.QChildEvent)(event.UnsafePointer())) + +} +func (this *QScriptExtensionPlugin) OnChildEvent(slot func(super func(event *qt.QChildEvent), event *qt.QChildEvent)) { + C.QScriptExtensionPlugin_override_virtual_ChildEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_ChildEvent +func miqt_exec_callback_QScriptExtensionPlugin_ChildEvent(self *C.QScriptExtensionPlugin, cb C.intptr_t, event *C.QChildEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QChildEvent), event *qt.QChildEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQChildEvent(unsafe.Pointer(event), nil) + + gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_ChildEvent, slotval1) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_CustomEvent(event *qt.QEvent) { + + C.QScriptExtensionPlugin_virtualbase_CustomEvent(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer())) + +} +func (this *QScriptExtensionPlugin) OnCustomEvent(slot func(super func(event *qt.QEvent), event *qt.QEvent)) { + C.QScriptExtensionPlugin_override_virtual_CustomEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_CustomEvent +func miqt_exec_callback_QScriptExtensionPlugin_CustomEvent(self *C.QScriptExtensionPlugin, cb C.intptr_t, event *C.QEvent) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent), event *qt.QEvent)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event)) + + gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_CustomEvent, slotval1) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_ConnectNotify(signal *qt.QMetaMethod) { + + C.QScriptExtensionPlugin_virtualbase_ConnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer())) + +} +func (this *QScriptExtensionPlugin) OnConnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) { + C.QScriptExtensionPlugin_override_virtual_ConnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_ConnectNotify +func miqt_exec_callback_QScriptExtensionPlugin_ConnectNotify(self *C.QScriptExtensionPlugin, cb C.intptr_t, signal *C.QMetaMethod) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal)) + + gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_ConnectNotify, slotval1) + +} + +func (this *QScriptExtensionPlugin) callVirtualBase_DisconnectNotify(signal *qt.QMetaMethod) { + + C.QScriptExtensionPlugin_virtualbase_DisconnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer())) + +} +func (this *QScriptExtensionPlugin) OnDisconnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) { + C.QScriptExtensionPlugin_override_virtual_DisconnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot))) +} + +//export miqt_exec_callback_QScriptExtensionPlugin_DisconnectNotify +func miqt_exec_callback_QScriptExtensionPlugin_DisconnectNotify(self *C.QScriptExtensionPlugin, cb C.intptr_t, signal *C.QMetaMethod) { + gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) + if !ok { + panic("miqt: callback of non-callback type (heap corruption?)") + } + + // Convert all CABI parameters to Go parameters + slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal)) + + gofunc((&QScriptExtensionPlugin{h: self}).callVirtualBase_DisconnectNotify, slotval1) + +} + +// Delete this object from C++ memory. +func (this *QScriptExtensionPlugin) Delete() { + C.QScriptExtensionPlugin_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptExtensionPlugin) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptExtensionPlugin) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptextensionplugin.h b/qt/script/gen_qscriptextensionplugin.h new file mode 100644 index 00000000..500f77b5 --- /dev/null +++ b/qt/script/gen_qscriptextensionplugin.h @@ -0,0 +1,80 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTEXTENSIONPLUGIN_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTEXTENSIONPLUGIN_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QChildEvent; +class QEvent; +class QFactoryInterface; +class QMetaMethod; +class QMetaObject; +class QObject; +class QScriptEngine; +class QScriptExtensionInterface; +class QScriptExtensionPlugin; +class QScriptValue; +class QTimerEvent; +#else +typedef struct QChildEvent QChildEvent; +typedef struct QEvent QEvent; +typedef struct QFactoryInterface QFactoryInterface; +typedef struct QMetaMethod QMetaMethod; +typedef struct QMetaObject QMetaObject; +typedef struct QObject QObject; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptExtensionInterface QScriptExtensionInterface; +typedef struct QScriptExtensionPlugin QScriptExtensionPlugin; +typedef struct QScriptValue QScriptValue; +typedef struct QTimerEvent QTimerEvent; +#endif + +void QScriptExtensionPlugin_new(QScriptExtensionPlugin** outptr_QScriptExtensionPlugin, QObject** outptr_QObject, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface); +void QScriptExtensionPlugin_new2(QObject* parent, QScriptExtensionPlugin** outptr_QScriptExtensionPlugin, QObject** outptr_QObject, QScriptExtensionInterface** outptr_QScriptExtensionInterface, QFactoryInterface** outptr_QFactoryInterface); +QMetaObject* QScriptExtensionPlugin_MetaObject(const QScriptExtensionPlugin* self); +void* QScriptExtensionPlugin_Metacast(QScriptExtensionPlugin* self, const char* param1); +struct miqt_string QScriptExtensionPlugin_Tr(const char* s); +struct miqt_string QScriptExtensionPlugin_TrUtf8(const char* s); +struct miqt_array /* of struct miqt_string */ QScriptExtensionPlugin_Keys(const QScriptExtensionPlugin* self); +void QScriptExtensionPlugin_Initialize(QScriptExtensionPlugin* self, struct miqt_string key, QScriptEngine* engine); +QScriptValue* QScriptExtensionPlugin_SetupPackage(const QScriptExtensionPlugin* self, struct miqt_string key, QScriptEngine* engine); +struct miqt_string QScriptExtensionPlugin_Tr2(const char* s, const char* c); +struct miqt_string QScriptExtensionPlugin_Tr3(const char* s, const char* c, int n); +struct miqt_string QScriptExtensionPlugin_TrUtf82(const char* s, const char* c); +struct miqt_string QScriptExtensionPlugin_TrUtf83(const char* s, const char* c, int n); +void QScriptExtensionPlugin_override_virtual_Keys(void* self, intptr_t slot); +struct miqt_array /* of struct miqt_string */ QScriptExtensionPlugin_virtualbase_Keys(const void* self); +void QScriptExtensionPlugin_override_virtual_Initialize(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_Initialize(void* self, struct miqt_string key, QScriptEngine* engine); +void QScriptExtensionPlugin_override_virtual_Event(void* self, intptr_t slot); +bool QScriptExtensionPlugin_virtualbase_Event(void* self, QEvent* event); +void QScriptExtensionPlugin_override_virtual_EventFilter(void* self, intptr_t slot); +bool QScriptExtensionPlugin_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event); +void QScriptExtensionPlugin_override_virtual_TimerEvent(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_TimerEvent(void* self, QTimerEvent* event); +void QScriptExtensionPlugin_override_virtual_ChildEvent(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_ChildEvent(void* self, QChildEvent* event); +void QScriptExtensionPlugin_override_virtual_CustomEvent(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_CustomEvent(void* self, QEvent* event); +void QScriptExtensionPlugin_override_virtual_ConnectNotify(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_ConnectNotify(void* self, QMetaMethod* signal); +void QScriptExtensionPlugin_override_virtual_DisconnectNotify(void* self, intptr_t slot); +void QScriptExtensionPlugin_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal); +void QScriptExtensionPlugin_Delete(QScriptExtensionPlugin* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptprogram.cpp b/qt/script/gen_qscriptprogram.cpp new file mode 100644 index 00000000..1d536031 --- /dev/null +++ b/qt/script/gen_qscriptprogram.cpp @@ -0,0 +1,88 @@ +#include +#include +#include +#include +#include +#include "gen_qscriptprogram.h" +#include "_cgo_export.h" + +void QScriptProgram_new(QScriptProgram** outptr_QScriptProgram) { + QScriptProgram* ret = new QScriptProgram(); + *outptr_QScriptProgram = ret; +} + +void QScriptProgram_new2(struct miqt_string sourceCode, QScriptProgram** outptr_QScriptProgram) { + QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len); + QScriptProgram* ret = new QScriptProgram(sourceCode_QString); + *outptr_QScriptProgram = ret; +} + +void QScriptProgram_new3(QScriptProgram* other, QScriptProgram** outptr_QScriptProgram) { + QScriptProgram* ret = new QScriptProgram(*other); + *outptr_QScriptProgram = ret; +} + +void QScriptProgram_new4(struct miqt_string sourceCode, struct miqt_string fileName, QScriptProgram** outptr_QScriptProgram) { + QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + QScriptProgram* ret = new QScriptProgram(sourceCode_QString, fileName_QString); + *outptr_QScriptProgram = ret; +} + +void QScriptProgram_new5(struct miqt_string sourceCode, struct miqt_string fileName, int firstLineNumber, QScriptProgram** outptr_QScriptProgram) { + QString sourceCode_QString = QString::fromUtf8(sourceCode.data, sourceCode.len); + QString fileName_QString = QString::fromUtf8(fileName.data, fileName.len); + QScriptProgram* ret = new QScriptProgram(sourceCode_QString, fileName_QString, static_cast(firstLineNumber)); + *outptr_QScriptProgram = ret; +} + +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(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(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); +} + +void QScriptProgram_Delete(QScriptProgram* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptprogram.go b/qt/script/gen_qscriptprogram.go new file mode 100644 index 00000000..f6ea3e57 --- /dev/null +++ b/qt/script/gen_qscriptprogram.go @@ -0,0 +1,168 @@ +package script + +/* + +#include "gen_qscriptprogram.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptProgram struct { + h *C.QScriptProgram + isSubclass bool +} + +func (this *QScriptProgram) cPointer() *C.QScriptProgram { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptProgram) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptProgram constructs the type using only CGO pointers. +func newQScriptProgram(h *C.QScriptProgram) *QScriptProgram { + if h == nil { + return nil + } + return &QScriptProgram{h: h} +} + +// UnsafeNewQScriptProgram constructs the type using only unsafe pointers. +func UnsafeNewQScriptProgram(h unsafe.Pointer) *QScriptProgram { + if h == nil { + return nil + } + + return &QScriptProgram{h: (*C.QScriptProgram)(h)} +} + +// NewQScriptProgram constructs a new QScriptProgram object. +func NewQScriptProgram() *QScriptProgram { + var outptr_QScriptProgram *C.QScriptProgram = nil + + C.QScriptProgram_new(&outptr_QScriptProgram) + ret := newQScriptProgram(outptr_QScriptProgram) + ret.isSubclass = true + return ret +} + +// NewQScriptProgram2 constructs a new QScriptProgram object. +func NewQScriptProgram2(sourceCode string) *QScriptProgram { + sourceCode_ms := C.struct_miqt_string{} + sourceCode_ms.data = C.CString(sourceCode) + sourceCode_ms.len = C.size_t(len(sourceCode)) + defer C.free(unsafe.Pointer(sourceCode_ms.data)) + var outptr_QScriptProgram *C.QScriptProgram = nil + + C.QScriptProgram_new2(sourceCode_ms, &outptr_QScriptProgram) + ret := newQScriptProgram(outptr_QScriptProgram) + ret.isSubclass = true + return ret +} + +// NewQScriptProgram3 constructs a new QScriptProgram object. +func NewQScriptProgram3(other *QScriptProgram) *QScriptProgram { + var outptr_QScriptProgram *C.QScriptProgram = nil + + C.QScriptProgram_new3(other.cPointer(), &outptr_QScriptProgram) + ret := newQScriptProgram(outptr_QScriptProgram) + ret.isSubclass = true + return ret +} + +// NewQScriptProgram4 constructs a new QScriptProgram object. +func NewQScriptProgram4(sourceCode string, fileName string) *QScriptProgram { + sourceCode_ms := C.struct_miqt_string{} + sourceCode_ms.data = C.CString(sourceCode) + sourceCode_ms.len = C.size_t(len(sourceCode)) + defer C.free(unsafe.Pointer(sourceCode_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + var outptr_QScriptProgram *C.QScriptProgram = nil + + C.QScriptProgram_new4(sourceCode_ms, fileName_ms, &outptr_QScriptProgram) + ret := newQScriptProgram(outptr_QScriptProgram) + ret.isSubclass = true + return ret +} + +// NewQScriptProgram5 constructs a new QScriptProgram object. +func NewQScriptProgram5(sourceCode string, fileName string, firstLineNumber int) *QScriptProgram { + sourceCode_ms := C.struct_miqt_string{} + sourceCode_ms.data = C.CString(sourceCode) + sourceCode_ms.len = C.size_t(len(sourceCode)) + defer C.free(unsafe.Pointer(sourceCode_ms.data)) + fileName_ms := C.struct_miqt_string{} + fileName_ms.data = C.CString(fileName) + fileName_ms.len = C.size_t(len(fileName)) + defer C.free(unsafe.Pointer(fileName_ms.data)) + var outptr_QScriptProgram *C.QScriptProgram = nil + + C.QScriptProgram_new5(sourceCode_ms, fileName_ms, (C.int)(firstLineNumber), &outptr_QScriptProgram) + ret := newQScriptProgram(outptr_QScriptProgram) + ret.isSubclass = true + return ret +} + +func (this *QScriptProgram) OperatorAssign(other *QScriptProgram) { + C.QScriptProgram_OperatorAssign(this.h, other.cPointer()) +} + +func (this *QScriptProgram) IsNull() bool { + return (bool)(C.QScriptProgram_IsNull(this.h)) +} + +func (this *QScriptProgram) SourceCode() string { + var _ms C.struct_miqt_string = C.QScriptProgram_SourceCode(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptProgram) FileName() string { + var _ms C.struct_miqt_string = C.QScriptProgram_FileName(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptProgram) FirstLineNumber() int { + return (int)(C.QScriptProgram_FirstLineNumber(this.h)) +} + +func (this *QScriptProgram) OperatorEqual(other *QScriptProgram) bool { + return (bool)(C.QScriptProgram_OperatorEqual(this.h, other.cPointer())) +} + +func (this *QScriptProgram) OperatorNotEqual(other *QScriptProgram) bool { + return (bool)(C.QScriptProgram_OperatorNotEqual(this.h, other.cPointer())) +} + +// Delete this object from C++ memory. +func (this *QScriptProgram) Delete() { + C.QScriptProgram_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptProgram) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptProgram) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptprogram.h b/qt/script/gen_qscriptprogram.h new file mode 100644 index 00000000..4055023e --- /dev/null +++ b/qt/script/gen_qscriptprogram.h @@ -0,0 +1,41 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTPROGRAM_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTPROGRAM_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptProgram; +#else +typedef struct QScriptProgram QScriptProgram; +#endif + +void QScriptProgram_new(QScriptProgram** outptr_QScriptProgram); +void QScriptProgram_new2(struct miqt_string sourceCode, QScriptProgram** outptr_QScriptProgram); +void QScriptProgram_new3(QScriptProgram* other, QScriptProgram** outptr_QScriptProgram); +void QScriptProgram_new4(struct miqt_string sourceCode, struct miqt_string fileName, QScriptProgram** outptr_QScriptProgram); +void QScriptProgram_new5(struct miqt_string sourceCode, struct miqt_string fileName, int firstLineNumber, QScriptProgram** outptr_QScriptProgram); +void QScriptProgram_OperatorAssign(QScriptProgram* self, QScriptProgram* other); +bool QScriptProgram_IsNull(const QScriptProgram* self); +struct miqt_string QScriptProgram_SourceCode(const QScriptProgram* self); +struct miqt_string QScriptProgram_FileName(const QScriptProgram* self); +int QScriptProgram_FirstLineNumber(const QScriptProgram* self); +bool QScriptProgram_OperatorEqual(const QScriptProgram* self, QScriptProgram* other); +bool QScriptProgram_OperatorNotEqual(const QScriptProgram* self, QScriptProgram* other); +void QScriptProgram_Delete(QScriptProgram* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptstring.cpp b/qt/script/gen_qscriptstring.cpp new file mode 100644 index 00000000..2fa7d0dc --- /dev/null +++ b/qt/script/gen_qscriptstring.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include +#include "gen_qscriptstring.h" +#include "_cgo_export.h" + +void QScriptString_new(QScriptString** outptr_QScriptString) { + QScriptString* ret = new QScriptString(); + *outptr_QScriptString = ret; +} + +void QScriptString_new2(QScriptString* other, QScriptString** outptr_QScriptString) { + QScriptString* ret = new QScriptString(*other); + *outptr_QScriptString = ret; +} + +void QScriptString_OperatorAssign(QScriptString* self, QScriptString* other) { + self->operator=(*other); +} + +bool QScriptString_IsValid(const QScriptString* self) { + return self->isValid(); +} + +bool QScriptString_OperatorEqual(const QScriptString* self, QScriptString* other) { + return (*self == *other); +} + +bool QScriptString_OperatorNotEqual(const QScriptString* self, QScriptString* other) { + return (*self != *other); +} + +unsigned int QScriptString_ToArrayIndex(const QScriptString* self) { + quint32 _ret = self->toArrayIndex(); + return static_cast(_ret); +} + +struct miqt_string QScriptString_ToString(const QScriptString* self) { + QString _ret = self->toString(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +unsigned int QScriptString_ToArrayIndex1(const QScriptString* self, bool* ok) { + quint32 _ret = self->toArrayIndex(ok); + return static_cast(_ret); +} + +void QScriptString_Delete(QScriptString* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptstring.go b/qt/script/gen_qscriptstring.go new file mode 100644 index 00000000..1c6c02c3 --- /dev/null +++ b/qt/script/gen_qscriptstring.go @@ -0,0 +1,115 @@ +package script + +/* + +#include "gen_qscriptstring.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptString struct { + h *C.QScriptString + isSubclass bool +} + +func (this *QScriptString) cPointer() *C.QScriptString { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptString) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptString constructs the type using only CGO pointers. +func newQScriptString(h *C.QScriptString) *QScriptString { + if h == nil { + return nil + } + return &QScriptString{h: h} +} + +// UnsafeNewQScriptString constructs the type using only unsafe pointers. +func UnsafeNewQScriptString(h unsafe.Pointer) *QScriptString { + if h == nil { + return nil + } + + return &QScriptString{h: (*C.QScriptString)(h)} +} + +// NewQScriptString constructs a new QScriptString object. +func NewQScriptString() *QScriptString { + var outptr_QScriptString *C.QScriptString = nil + + C.QScriptString_new(&outptr_QScriptString) + ret := newQScriptString(outptr_QScriptString) + ret.isSubclass = true + return ret +} + +// NewQScriptString2 constructs a new QScriptString object. +func NewQScriptString2(other *QScriptString) *QScriptString { + var outptr_QScriptString *C.QScriptString = nil + + C.QScriptString_new2(other.cPointer(), &outptr_QScriptString) + ret := newQScriptString(outptr_QScriptString) + ret.isSubclass = true + return ret +} + +func (this *QScriptString) OperatorAssign(other *QScriptString) { + C.QScriptString_OperatorAssign(this.h, other.cPointer()) +} + +func (this *QScriptString) IsValid() bool { + return (bool)(C.QScriptString_IsValid(this.h)) +} + +func (this *QScriptString) OperatorEqual(other *QScriptString) bool { + return (bool)(C.QScriptString_OperatorEqual(this.h, other.cPointer())) +} + +func (this *QScriptString) OperatorNotEqual(other *QScriptString) bool { + return (bool)(C.QScriptString_OperatorNotEqual(this.h, other.cPointer())) +} + +func (this *QScriptString) ToArrayIndex() uint { + return (uint)(C.QScriptString_ToArrayIndex(this.h)) +} + +func (this *QScriptString) ToString() string { + var _ms C.struct_miqt_string = C.QScriptString_ToString(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptString) ToArrayIndex1(ok *bool) uint { + return (uint)(C.QScriptString_ToArrayIndex1(this.h, (*C.bool)(unsafe.Pointer(ok)))) +} + +// Delete this object from C++ memory. +func (this *QScriptString) Delete() { + C.QScriptString_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptString) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptString) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptstring.h b/qt/script/gen_qscriptstring.h new file mode 100644 index 00000000..e8ed8a77 --- /dev/null +++ b/qt/script/gen_qscriptstring.h @@ -0,0 +1,38 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTSTRING_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTSTRING_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptString; +#else +typedef struct QScriptString QScriptString; +#endif + +void QScriptString_new(QScriptString** outptr_QScriptString); +void QScriptString_new2(QScriptString* other, QScriptString** outptr_QScriptString); +void QScriptString_OperatorAssign(QScriptString* self, QScriptString* other); +bool QScriptString_IsValid(const QScriptString* self); +bool QScriptString_OperatorEqual(const QScriptString* self, QScriptString* other); +bool QScriptString_OperatorNotEqual(const QScriptString* self, QScriptString* other); +unsigned int QScriptString_ToArrayIndex(const QScriptString* self); +struct miqt_string QScriptString_ToString(const QScriptString* self); +unsigned int QScriptString_ToArrayIndex1(const QScriptString* self, bool* ok); +void QScriptString_Delete(QScriptString* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptvalue.cpp b/qt/script/gen_qscriptvalue.cpp new file mode 100644 index 00000000..935cc06c --- /dev/null +++ b/qt/script/gen_qscriptvalue.cpp @@ -0,0 +1,414 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptvalue.h" +#include "_cgo_export.h" + +void QScriptValue_new(QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new2(QScriptValue* other, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(*other); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new3(QScriptEngine* engine, int val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, static_cast(val)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new4(QScriptEngine* engine, bool val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, val); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new5(QScriptEngine* engine, int val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, static_cast(val)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new6(QScriptEngine* engine, unsigned int val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, static_cast(val)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new7(QScriptEngine* engine, double val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, static_cast(val)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new8(QScriptEngine* engine, struct miqt_string val, QScriptValue** outptr_QScriptValue) { + QString val_QString = QString::fromUtf8(val.data, val.len); + QScriptValue* ret = new QScriptValue(engine, val_QString); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new9(QScriptEngine* engine, const char* val, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(engine, val); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new10(int value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(static_cast(value)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new11(bool value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(value); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new12(int value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(static_cast(value)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new13(unsigned int value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(static_cast(value)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new14(double value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(static_cast(value)); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new15(struct miqt_string value, QScriptValue** outptr_QScriptValue) { + QString value_QString = QString::fromUtf8(value.data, value.len); + QScriptValue* ret = new QScriptValue(value_QString); + *outptr_QScriptValue = ret; +} + +void QScriptValue_new16(const char* value, QScriptValue** outptr_QScriptValue) { + QScriptValue* ret = new QScriptValue(value); + *outptr_QScriptValue = ret; +} + +void QScriptValue_OperatorAssign(QScriptValue* self, QScriptValue* other) { + self->operator=(*other); +} + +QScriptEngine* QScriptValue_Engine(const QScriptValue* self) { + return self->engine(); +} + +bool QScriptValue_IsValid(const QScriptValue* self) { + return self->isValid(); +} + +bool QScriptValue_IsBool(const QScriptValue* self) { + return self->isBool(); +} + +bool QScriptValue_IsBoolean(const QScriptValue* self) { + return self->isBoolean(); +} + +bool QScriptValue_IsNumber(const QScriptValue* self) { + return self->isNumber(); +} + +bool QScriptValue_IsFunction(const QScriptValue* self) { + return self->isFunction(); +} + +bool QScriptValue_IsNull(const QScriptValue* self) { + return self->isNull(); +} + +bool QScriptValue_IsString(const QScriptValue* self) { + return self->isString(); +} + +bool QScriptValue_IsUndefined(const QScriptValue* self) { + return self->isUndefined(); +} + +bool QScriptValue_IsVariant(const QScriptValue* self) { + return self->isVariant(); +} + +bool QScriptValue_IsQObject(const QScriptValue* self) { + return self->isQObject(); +} + +bool QScriptValue_IsQMetaObject(const QScriptValue* self) { + return self->isQMetaObject(); +} + +bool QScriptValue_IsObject(const QScriptValue* self) { + return self->isObject(); +} + +bool QScriptValue_IsDate(const QScriptValue* self) { + return self->isDate(); +} + +bool QScriptValue_IsRegExp(const QScriptValue* self) { + return self->isRegExp(); +} + +bool QScriptValue_IsArray(const QScriptValue* self) { + return self->isArray(); +} + +bool QScriptValue_IsError(const QScriptValue* self) { + return self->isError(); +} + +struct miqt_string QScriptValue_ToString(const QScriptValue* self) { + QString _ret = self->toString(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +double QScriptValue_ToNumber(const QScriptValue* self) { + qsreal _ret = self->toNumber(); + return static_cast(_ret); +} + +bool QScriptValue_ToBool(const QScriptValue* self) { + return self->toBool(); +} + +bool QScriptValue_ToBoolean(const QScriptValue* self) { + return self->toBoolean(); +} + +double QScriptValue_ToInteger(const QScriptValue* self) { + qsreal _ret = self->toInteger(); + return static_cast(_ret); +} + +int QScriptValue_ToInt32(const QScriptValue* self) { + qint32 _ret = self->toInt32(); + return static_cast(_ret); +} + +unsigned int QScriptValue_ToUInt32(const QScriptValue* self) { + quint32 _ret = self->toUInt32(); + return static_cast(_ret); +} + +uint16_t QScriptValue_ToUInt16(const QScriptValue* self) { + quint16 _ret = self->toUInt16(); + return static_cast(_ret); +} + +QVariant* QScriptValue_ToVariant(const QScriptValue* self) { + return new QVariant(self->toVariant()); +} + +QObject* QScriptValue_ToQObject(const QScriptValue* self) { + return self->toQObject(); +} + +QMetaObject* QScriptValue_ToQMetaObject(const QScriptValue* self) { + return (QMetaObject*) self->toQMetaObject(); +} + +QScriptValue* QScriptValue_ToObject(const QScriptValue* self) { + return new QScriptValue(self->toObject()); +} + +QDateTime* QScriptValue_ToDateTime(const QScriptValue* self) { + return new QDateTime(self->toDateTime()); +} + +QRegExp* QScriptValue_ToRegExp(const QScriptValue* self) { + return new QRegExp(self->toRegExp()); +} + +bool QScriptValue_InstanceOf(const QScriptValue* self, QScriptValue* other) { + return self->instanceOf(*other); +} + +bool QScriptValue_LessThan(const QScriptValue* self, QScriptValue* other) { + return self->lessThan(*other); +} + +bool QScriptValue_Equals(const QScriptValue* self, QScriptValue* other) { + return self->equals(*other); +} + +bool QScriptValue_StrictlyEquals(const QScriptValue* self, QScriptValue* other) { + return self->strictlyEquals(*other); +} + +QScriptValue* QScriptValue_Prototype(const QScriptValue* self) { + return new QScriptValue(self->prototype()); +} + +void QScriptValue_SetPrototype(QScriptValue* self, QScriptValue* prototype) { + self->setPrototype(*prototype); +} + +QScriptValue* QScriptValue_Scope(const QScriptValue* self) { + return new QScriptValue(self->scope()); +} + +void QScriptValue_SetScope(QScriptValue* self, QScriptValue* scope) { + self->setScope(*scope); +} + +QScriptValue* QScriptValue_Property(const QScriptValue* self, struct miqt_string name) { + QString name_QString = QString::fromUtf8(name.data, name.len); + return new QScriptValue(self->property(name_QString)); +} + +void QScriptValue_SetProperty(QScriptValue* self, struct miqt_string name, QScriptValue* value) { + QString name_QString = QString::fromUtf8(name.data, name.len); + self->setProperty(name_QString, *value); +} + +QScriptValue* QScriptValue_PropertyWithArrayIndex(const QScriptValue* self, unsigned int arrayIndex) { + return new QScriptValue(self->property(static_cast(arrayIndex))); +} + +void QScriptValue_SetProperty2(QScriptValue* self, unsigned int arrayIndex, QScriptValue* value) { + self->setProperty(static_cast(arrayIndex), *value); +} + +QScriptValue* QScriptValue_PropertyWithName(const QScriptValue* self, QScriptString* name) { + return new QScriptValue(self->property(*name)); +} + +void QScriptValue_SetProperty3(QScriptValue* self, QScriptString* name, QScriptValue* value) { + self->setProperty(*name, *value); +} + +int QScriptValue_PropertyFlags(const QScriptValue* self, struct miqt_string name) { + QString name_QString = QString::fromUtf8(name.data, name.len); + QScriptValue::PropertyFlags _ret = self->propertyFlags(name_QString); + return static_cast(_ret); +} + +int QScriptValue_PropertyFlagsWithName(const QScriptValue* self, QScriptString* name) { + QScriptValue::PropertyFlags _ret = self->propertyFlags(*name); + return static_cast(_ret); +} + +QScriptValue* QScriptValue_Call(QScriptValue* self) { + return new QScriptValue(self->call()); +} + +QScriptValue* QScriptValue_Call2(QScriptValue* self, QScriptValue* thisObject, QScriptValue* arguments) { + return new QScriptValue(self->call(*thisObject, *arguments)); +} + +QScriptValue* QScriptValue_Construct(QScriptValue* self) { + return new QScriptValue(self->construct()); +} + +QScriptValue* QScriptValue_ConstructWithArguments(QScriptValue* self, QScriptValue* arguments) { + return new QScriptValue(self->construct(*arguments)); +} + +QScriptValue* QScriptValue_Data(const QScriptValue* self) { + return new QScriptValue(self->data()); +} + +void QScriptValue_SetData(QScriptValue* self, QScriptValue* data) { + self->setData(*data); +} + +QScriptClass* QScriptValue_ScriptClass(const QScriptValue* self) { + return self->scriptClass(); +} + +void QScriptValue_SetScriptClass(QScriptValue* self, QScriptClass* scriptClass) { + self->setScriptClass(scriptClass); +} + +long long QScriptValue_ObjectId(const QScriptValue* self) { + qint64 _ret = self->objectId(); + return static_cast(_ret); +} + +QScriptValue* QScriptValue_Property2(const QScriptValue* self, struct miqt_string name, int* mode) { + QString name_QString = QString::fromUtf8(name.data, name.len); + return new QScriptValue(self->property(name_QString, (const QScriptValue::ResolveFlags&)(*mode))); +} + +void QScriptValue_SetProperty32(QScriptValue* self, struct miqt_string name, QScriptValue* value, int* flags) { + QString name_QString = QString::fromUtf8(name.data, name.len); + self->setProperty(name_QString, *value, (const QScriptValue::PropertyFlags&)(*flags)); +} + +QScriptValue* QScriptValue_Property22(const QScriptValue* self, unsigned int arrayIndex, int* mode) { + return new QScriptValue(self->property(static_cast(arrayIndex), (const QScriptValue::ResolveFlags&)(*mode))); +} + +void QScriptValue_SetProperty33(QScriptValue* self, unsigned int arrayIndex, QScriptValue* value, int* flags) { + self->setProperty(static_cast(arrayIndex), *value, (const QScriptValue::PropertyFlags&)(*flags)); +} + +QScriptValue* QScriptValue_Property23(const QScriptValue* self, QScriptString* name, int* mode) { + return new QScriptValue(self->property(*name, (const QScriptValue::ResolveFlags&)(*mode))); +} + +void QScriptValue_SetProperty34(QScriptValue* self, QScriptString* name, QScriptValue* value, int* flags) { + self->setProperty(*name, *value, (const QScriptValue::PropertyFlags&)(*flags)); +} + +int QScriptValue_PropertyFlags2(const QScriptValue* self, struct miqt_string name, int* mode) { + QString name_QString = QString::fromUtf8(name.data, name.len); + QScriptValue::PropertyFlags _ret = self->propertyFlags(name_QString, (const QScriptValue::ResolveFlags&)(*mode)); + return static_cast(_ret); +} + +int QScriptValue_PropertyFlags22(const QScriptValue* self, QScriptString* name, int* mode) { + QScriptValue::PropertyFlags _ret = self->propertyFlags(*name, (const QScriptValue::ResolveFlags&)(*mode)); + return static_cast(_ret); +} + +QScriptValue* QScriptValue_Call1(QScriptValue* self, QScriptValue* thisObject) { + return new QScriptValue(self->call(*thisObject)); +} + +QScriptValue* QScriptValue_Call22(QScriptValue* self, QScriptValue* thisObject, struct miqt_array /* of QScriptValue* */ args) { + QScriptValueList args_QList; + args_QList.reserve(args.len); + QScriptValue** args_arr = static_cast(args.data); + for(size_t i = 0; i < args.len; ++i) { + args_QList.push_back(*(args_arr[i])); + } + return new QScriptValue(self->call(*thisObject, args_QList)); +} + +QScriptValue* QScriptValue_Construct1(QScriptValue* self, struct miqt_array /* of QScriptValue* */ args) { + QScriptValueList args_QList; + args_QList.reserve(args.len); + QScriptValue** args_arr = static_cast(args.data); + for(size_t i = 0; i < args.len; ++i) { + args_QList.push_back(*(args_arr[i])); + } + return new QScriptValue(self->construct(args_QList)); +} + +void QScriptValue_Delete(QScriptValue* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptvalue.go b/qt/script/gen_qscriptvalue.go new file mode 100644 index 00000000..a300d765 --- /dev/null +++ b/qt/script/gen_qscriptvalue.go @@ -0,0 +1,637 @@ +package script + +/* + +#include "gen_qscriptvalue.h" +#include + +*/ +import "C" + +import ( + "github.com/mappu/miqt/qt" + "runtime" + "unsafe" +) + +type QScriptValue__ResolveFlag int + +const ( + QScriptValue__ResolveLocal QScriptValue__ResolveFlag = 0 + QScriptValue__ResolvePrototype QScriptValue__ResolveFlag = 1 + QScriptValue__ResolveScope QScriptValue__ResolveFlag = 2 + QScriptValue__ResolveFull QScriptValue__ResolveFlag = 3 +) + +type QScriptValue__PropertyFlag int + +const ( + QScriptValue__ReadOnly QScriptValue__PropertyFlag = 1 + QScriptValue__Undeletable QScriptValue__PropertyFlag = 2 + QScriptValue__SkipInEnumeration QScriptValue__PropertyFlag = 4 + QScriptValue__PropertyGetter QScriptValue__PropertyFlag = 8 + QScriptValue__PropertySetter QScriptValue__PropertyFlag = 16 + QScriptValue__QObjectMember QScriptValue__PropertyFlag = 32 + QScriptValue__KeepExistingFlags QScriptValue__PropertyFlag = 2048 + QScriptValue__UserRange QScriptValue__PropertyFlag = 4278190080 +) + +type QScriptValue__SpecialValue int + +const ( + QScriptValue__NullValue QScriptValue__SpecialValue = 0 + QScriptValue__UndefinedValue QScriptValue__SpecialValue = 1 +) + +type QScriptValue struct { + h *C.QScriptValue + isSubclass bool +} + +func (this *QScriptValue) cPointer() *C.QScriptValue { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptValue) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptValue constructs the type using only CGO pointers. +func newQScriptValue(h *C.QScriptValue) *QScriptValue { + if h == nil { + return nil + } + return &QScriptValue{h: h} +} + +// UnsafeNewQScriptValue constructs the type using only unsafe pointers. +func UnsafeNewQScriptValue(h unsafe.Pointer) *QScriptValue { + if h == nil { + return nil + } + + return &QScriptValue{h: (*C.QScriptValue)(h)} +} + +// NewQScriptValue constructs a new QScriptValue object. +func NewQScriptValue() *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new(&outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue2 constructs a new QScriptValue object. +func NewQScriptValue2(other *QScriptValue) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new2(other.cPointer(), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue3 constructs a new QScriptValue object. +func NewQScriptValue3(engine *QScriptEngine, val QScriptValue__SpecialValue) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new3(engine.cPointer(), (C.int)(val), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue4 constructs a new QScriptValue object. +func NewQScriptValue4(engine *QScriptEngine, val bool) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new4(engine.cPointer(), (C.bool)(val), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue5 constructs a new QScriptValue object. +func NewQScriptValue5(engine *QScriptEngine, val int) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new5(engine.cPointer(), (C.int)(val), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue6 constructs a new QScriptValue object. +func NewQScriptValue6(engine *QScriptEngine, val uint) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new6(engine.cPointer(), (C.uint)(val), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue7 constructs a new QScriptValue object. +func NewQScriptValue7(engine *QScriptEngine, val float64) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new7(engine.cPointer(), (C.double)(val), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue8 constructs a new QScriptValue object. +func NewQScriptValue8(engine *QScriptEngine, val string) *QScriptValue { + val_ms := C.struct_miqt_string{} + val_ms.data = C.CString(val) + val_ms.len = C.size_t(len(val)) + defer C.free(unsafe.Pointer(val_ms.data)) + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new8(engine.cPointer(), val_ms, &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue9 constructs a new QScriptValue object. +func NewQScriptValue9(engine *QScriptEngine, val string) *QScriptValue { + val_Cstring := C.CString(val) + defer C.free(unsafe.Pointer(val_Cstring)) + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new9(engine.cPointer(), val_Cstring, &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue10 constructs a new QScriptValue object. +func NewQScriptValue10(value QScriptValue__SpecialValue) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new10((C.int)(value), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue11 constructs a new QScriptValue object. +func NewQScriptValue11(value bool) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new11((C.bool)(value), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue12 constructs a new QScriptValue object. +func NewQScriptValue12(value int) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new12((C.int)(value), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue13 constructs a new QScriptValue object. +func NewQScriptValue13(value uint) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new13((C.uint)(value), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue14 constructs a new QScriptValue object. +func NewQScriptValue14(value float64) *QScriptValue { + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new14((C.double)(value), &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue15 constructs a new QScriptValue object. +func NewQScriptValue15(value string) *QScriptValue { + value_ms := C.struct_miqt_string{} + value_ms.data = C.CString(value) + value_ms.len = C.size_t(len(value)) + defer C.free(unsafe.Pointer(value_ms.data)) + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new15(value_ms, &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +// NewQScriptValue16 constructs a new QScriptValue object. +func NewQScriptValue16(value string) *QScriptValue { + value_Cstring := C.CString(value) + defer C.free(unsafe.Pointer(value_Cstring)) + var outptr_QScriptValue *C.QScriptValue = nil + + C.QScriptValue_new16(value_Cstring, &outptr_QScriptValue) + ret := newQScriptValue(outptr_QScriptValue) + ret.isSubclass = true + return ret +} + +func (this *QScriptValue) OperatorAssign(other *QScriptValue) { + C.QScriptValue_OperatorAssign(this.h, other.cPointer()) +} + +func (this *QScriptValue) Engine() *QScriptEngine { + return UnsafeNewQScriptEngine(unsafe.Pointer(C.QScriptValue_Engine(this.h)), nil) +} + +func (this *QScriptValue) IsValid() bool { + return (bool)(C.QScriptValue_IsValid(this.h)) +} + +func (this *QScriptValue) IsBool() bool { + return (bool)(C.QScriptValue_IsBool(this.h)) +} + +func (this *QScriptValue) IsBoolean() bool { + return (bool)(C.QScriptValue_IsBoolean(this.h)) +} + +func (this *QScriptValue) IsNumber() bool { + return (bool)(C.QScriptValue_IsNumber(this.h)) +} + +func (this *QScriptValue) IsFunction() bool { + return (bool)(C.QScriptValue_IsFunction(this.h)) +} + +func (this *QScriptValue) IsNull() bool { + return (bool)(C.QScriptValue_IsNull(this.h)) +} + +func (this *QScriptValue) IsString() bool { + return (bool)(C.QScriptValue_IsString(this.h)) +} + +func (this *QScriptValue) IsUndefined() bool { + return (bool)(C.QScriptValue_IsUndefined(this.h)) +} + +func (this *QScriptValue) IsVariant() bool { + return (bool)(C.QScriptValue_IsVariant(this.h)) +} + +func (this *QScriptValue) IsQObject() bool { + return (bool)(C.QScriptValue_IsQObject(this.h)) +} + +func (this *QScriptValue) IsQMetaObject() bool { + return (bool)(C.QScriptValue_IsQMetaObject(this.h)) +} + +func (this *QScriptValue) IsObject() bool { + return (bool)(C.QScriptValue_IsObject(this.h)) +} + +func (this *QScriptValue) IsDate() bool { + return (bool)(C.QScriptValue_IsDate(this.h)) +} + +func (this *QScriptValue) IsRegExp() bool { + return (bool)(C.QScriptValue_IsRegExp(this.h)) +} + +func (this *QScriptValue) IsArray() bool { + return (bool)(C.QScriptValue_IsArray(this.h)) +} + +func (this *QScriptValue) IsError() bool { + return (bool)(C.QScriptValue_IsError(this.h)) +} + +func (this *QScriptValue) ToString() string { + var _ms C.struct_miqt_string = C.QScriptValue_ToString(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptValue) ToNumber() float64 { + return (float64)(C.QScriptValue_ToNumber(this.h)) +} + +func (this *QScriptValue) ToBool() bool { + return (bool)(C.QScriptValue_ToBool(this.h)) +} + +func (this *QScriptValue) ToBoolean() bool { + return (bool)(C.QScriptValue_ToBoolean(this.h)) +} + +func (this *QScriptValue) ToInteger() float64 { + return (float64)(C.QScriptValue_ToInteger(this.h)) +} + +func (this *QScriptValue) ToInt32() int { + return (int)(C.QScriptValue_ToInt32(this.h)) +} + +func (this *QScriptValue) ToUInt32() uint { + return (uint)(C.QScriptValue_ToUInt32(this.h)) +} + +func (this *QScriptValue) ToUInt16() uint16 { + return (uint16)(C.QScriptValue_ToUInt16(this.h)) +} + +func (this *QScriptValue) ToVariant() *qt.QVariant { + _ret := C.QScriptValue_ToVariant(this.h) + _goptr := qt.UnsafeNewQVariant(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) ToQObject() *qt.QObject { + return qt.UnsafeNewQObject(unsafe.Pointer(C.QScriptValue_ToQObject(this.h))) +} + +func (this *QScriptValue) ToQMetaObject() *qt.QMetaObject { + return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QScriptValue_ToQMetaObject(this.h))) +} + +func (this *QScriptValue) ToObject() *QScriptValue { + _ret := C.QScriptValue_ToObject(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) ToDateTime() *qt.QDateTime { + _ret := C.QScriptValue_ToDateTime(this.h) + _goptr := qt.UnsafeNewQDateTime(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) ToRegExp() *qt.QRegExp { + _ret := C.QScriptValue_ToRegExp(this.h) + _goptr := qt.UnsafeNewQRegExp(unsafe.Pointer(_ret)) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) InstanceOf(other *QScriptValue) bool { + return (bool)(C.QScriptValue_InstanceOf(this.h, other.cPointer())) +} + +func (this *QScriptValue) LessThan(other *QScriptValue) bool { + return (bool)(C.QScriptValue_LessThan(this.h, other.cPointer())) +} + +func (this *QScriptValue) Equals(other *QScriptValue) bool { + return (bool)(C.QScriptValue_Equals(this.h, other.cPointer())) +} + +func (this *QScriptValue) StrictlyEquals(other *QScriptValue) bool { + return (bool)(C.QScriptValue_StrictlyEquals(this.h, other.cPointer())) +} + +func (this *QScriptValue) Prototype() *QScriptValue { + _ret := C.QScriptValue_Prototype(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetPrototype(prototype *QScriptValue) { + C.QScriptValue_SetPrototype(this.h, prototype.cPointer()) +} + +func (this *QScriptValue) Scope() *QScriptValue { + _ret := C.QScriptValue_Scope(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetScope(scope *QScriptValue) { + C.QScriptValue_SetScope(this.h, scope.cPointer()) +} + +func (this *QScriptValue) Property(name string) *QScriptValue { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + _ret := C.QScriptValue_Property(this.h, name_ms) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty(name string, value *QScriptValue) { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + C.QScriptValue_SetProperty(this.h, name_ms, value.cPointer()) +} + +func (this *QScriptValue) PropertyWithArrayIndex(arrayIndex uint) *QScriptValue { + _ret := C.QScriptValue_PropertyWithArrayIndex(this.h, (C.uint)(arrayIndex)) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty2(arrayIndex uint, value *QScriptValue) { + C.QScriptValue_SetProperty2(this.h, (C.uint)(arrayIndex), value.cPointer()) +} + +func (this *QScriptValue) PropertyWithName(name *QScriptString) *QScriptValue { + _ret := C.QScriptValue_PropertyWithName(this.h, name.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty3(name *QScriptString, value *QScriptValue) { + C.QScriptValue_SetProperty3(this.h, name.cPointer(), value.cPointer()) +} + +func (this *QScriptValue) PropertyFlags(name string) QScriptValue__PropertyFlag { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + return (QScriptValue__PropertyFlag)(C.QScriptValue_PropertyFlags(this.h, name_ms)) +} + +func (this *QScriptValue) PropertyFlagsWithName(name *QScriptString) QScriptValue__PropertyFlag { + return (QScriptValue__PropertyFlag)(C.QScriptValue_PropertyFlagsWithName(this.h, name.cPointer())) +} + +func (this *QScriptValue) Call() *QScriptValue { + _ret := C.QScriptValue_Call(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) Call2(thisObject *QScriptValue, arguments *QScriptValue) *QScriptValue { + _ret := C.QScriptValue_Call2(this.h, thisObject.cPointer(), arguments.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) Construct() *QScriptValue { + _ret := C.QScriptValue_Construct(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) ConstructWithArguments(arguments *QScriptValue) *QScriptValue { + _ret := C.QScriptValue_ConstructWithArguments(this.h, arguments.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) Data() *QScriptValue { + _ret := C.QScriptValue_Data(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetData(data *QScriptValue) { + C.QScriptValue_SetData(this.h, data.cPointer()) +} + +func (this *QScriptValue) ScriptClass() *QScriptClass { + return UnsafeNewQScriptClass(unsafe.Pointer(C.QScriptValue_ScriptClass(this.h))) +} + +func (this *QScriptValue) SetScriptClass(scriptClass *QScriptClass) { + C.QScriptValue_SetScriptClass(this.h, scriptClass.cPointer()) +} + +func (this *QScriptValue) ObjectId() int64 { + return (int64)(C.QScriptValue_ObjectId(this.h)) +} + +func (this *QScriptValue) Property2(name string, mode *QScriptValue__ResolveFlag) *QScriptValue { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + _ret := C.QScriptValue_Property2(this.h, name_ms, (*C.int)(unsafe.Pointer(mode))) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty32(name string, value *QScriptValue, flags *QScriptValue__PropertyFlag) { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + C.QScriptValue_SetProperty32(this.h, name_ms, value.cPointer(), (*C.int)(unsafe.Pointer(flags))) +} + +func (this *QScriptValue) Property22(arrayIndex uint, mode *QScriptValue__ResolveFlag) *QScriptValue { + _ret := C.QScriptValue_Property22(this.h, (C.uint)(arrayIndex), (*C.int)(unsafe.Pointer(mode))) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty33(arrayIndex uint, value *QScriptValue, flags *QScriptValue__PropertyFlag) { + C.QScriptValue_SetProperty33(this.h, (C.uint)(arrayIndex), value.cPointer(), (*C.int)(unsafe.Pointer(flags))) +} + +func (this *QScriptValue) Property23(name *QScriptString, mode *QScriptValue__ResolveFlag) *QScriptValue { + _ret := C.QScriptValue_Property23(this.h, name.cPointer(), (*C.int)(unsafe.Pointer(mode))) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) SetProperty34(name *QScriptString, value *QScriptValue, flags *QScriptValue__PropertyFlag) { + C.QScriptValue_SetProperty34(this.h, name.cPointer(), value.cPointer(), (*C.int)(unsafe.Pointer(flags))) +} + +func (this *QScriptValue) PropertyFlags2(name string, mode *QScriptValue__ResolveFlag) QScriptValue__PropertyFlag { + name_ms := C.struct_miqt_string{} + name_ms.data = C.CString(name) + name_ms.len = C.size_t(len(name)) + defer C.free(unsafe.Pointer(name_ms.data)) + return (QScriptValue__PropertyFlag)(C.QScriptValue_PropertyFlags2(this.h, name_ms, (*C.int)(unsafe.Pointer(mode)))) +} + +func (this *QScriptValue) PropertyFlags22(name *QScriptString, mode *QScriptValue__ResolveFlag) QScriptValue__PropertyFlag { + return (QScriptValue__PropertyFlag)(C.QScriptValue_PropertyFlags22(this.h, name.cPointer(), (*C.int)(unsafe.Pointer(mode)))) +} + +func (this *QScriptValue) Call1(thisObject *QScriptValue) *QScriptValue { + _ret := C.QScriptValue_Call1(this.h, thisObject.cPointer()) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) Call22(thisObject *QScriptValue, args []QScriptValue) *QScriptValue { + args_CArray := (*[0xffff]*C.QScriptValue)(C.malloc(C.size_t(8 * len(args)))) + defer C.free(unsafe.Pointer(args_CArray)) + for i := range args { + args_CArray[i] = args[i].cPointer() + } + args_ma := C.struct_miqt_array{len: C.size_t(len(args)), data: unsafe.Pointer(args_CArray)} + _ret := C.QScriptValue_Call22(this.h, thisObject.cPointer(), args_ma) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValue) Construct1(args []QScriptValue) *QScriptValue { + args_CArray := (*[0xffff]*C.QScriptValue)(C.malloc(C.size_t(8 * len(args)))) + defer C.free(unsafe.Pointer(args_CArray)) + for i := range args { + args_CArray[i] = args[i].cPointer() + } + args_ma := C.struct_miqt_array{len: C.size_t(len(args)), data: unsafe.Pointer(args_CArray)} + _ret := C.QScriptValue_Construct1(this.h, args_ma) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +// Delete this object from C++ memory. +func (this *QScriptValue) Delete() { + C.QScriptValue_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptValue) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptValue) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptvalue.h b/qt/script/gen_qscriptvalue.h new file mode 100644 index 00000000..2cb5a905 --- /dev/null +++ b/qt/script/gen_qscriptvalue.h @@ -0,0 +1,129 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTVALUE_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTVALUE_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QDateTime; +class QMetaObject; +class QObject; +class QRegExp; +class QScriptClass; +class QScriptEngine; +class QScriptString; +class QScriptValue; +class QVariant; +#else +typedef struct QDateTime QDateTime; +typedef struct QMetaObject QMetaObject; +typedef struct QObject QObject; +typedef struct QRegExp QRegExp; +typedef struct QScriptClass QScriptClass; +typedef struct QScriptEngine QScriptEngine; +typedef struct QScriptString QScriptString; +typedef struct QScriptValue QScriptValue; +typedef struct QVariant QVariant; +#endif + +void QScriptValue_new(QScriptValue** outptr_QScriptValue); +void QScriptValue_new2(QScriptValue* other, QScriptValue** outptr_QScriptValue); +void QScriptValue_new3(QScriptEngine* engine, int val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new4(QScriptEngine* engine, bool val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new5(QScriptEngine* engine, int val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new6(QScriptEngine* engine, unsigned int val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new7(QScriptEngine* engine, double val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new8(QScriptEngine* engine, struct miqt_string val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new9(QScriptEngine* engine, const char* val, QScriptValue** outptr_QScriptValue); +void QScriptValue_new10(int value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new11(bool value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new12(int value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new13(unsigned int value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new14(double value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new15(struct miqt_string value, QScriptValue** outptr_QScriptValue); +void QScriptValue_new16(const char* value, QScriptValue** outptr_QScriptValue); +void QScriptValue_OperatorAssign(QScriptValue* self, QScriptValue* other); +QScriptEngine* QScriptValue_Engine(const QScriptValue* self); +bool QScriptValue_IsValid(const QScriptValue* self); +bool QScriptValue_IsBool(const QScriptValue* self); +bool QScriptValue_IsBoolean(const QScriptValue* self); +bool QScriptValue_IsNumber(const QScriptValue* self); +bool QScriptValue_IsFunction(const QScriptValue* self); +bool QScriptValue_IsNull(const QScriptValue* self); +bool QScriptValue_IsString(const QScriptValue* self); +bool QScriptValue_IsUndefined(const QScriptValue* self); +bool QScriptValue_IsVariant(const QScriptValue* self); +bool QScriptValue_IsQObject(const QScriptValue* self); +bool QScriptValue_IsQMetaObject(const QScriptValue* self); +bool QScriptValue_IsObject(const QScriptValue* self); +bool QScriptValue_IsDate(const QScriptValue* self); +bool QScriptValue_IsRegExp(const QScriptValue* self); +bool QScriptValue_IsArray(const QScriptValue* self); +bool QScriptValue_IsError(const QScriptValue* self); +struct miqt_string QScriptValue_ToString(const QScriptValue* self); +double QScriptValue_ToNumber(const QScriptValue* self); +bool QScriptValue_ToBool(const QScriptValue* self); +bool QScriptValue_ToBoolean(const QScriptValue* self); +double QScriptValue_ToInteger(const QScriptValue* self); +int QScriptValue_ToInt32(const QScriptValue* self); +unsigned int QScriptValue_ToUInt32(const QScriptValue* self); +uint16_t QScriptValue_ToUInt16(const QScriptValue* self); +QVariant* QScriptValue_ToVariant(const QScriptValue* self); +QObject* QScriptValue_ToQObject(const QScriptValue* self); +QMetaObject* QScriptValue_ToQMetaObject(const QScriptValue* self); +QScriptValue* QScriptValue_ToObject(const QScriptValue* self); +QDateTime* QScriptValue_ToDateTime(const QScriptValue* self); +QRegExp* QScriptValue_ToRegExp(const QScriptValue* self); +bool QScriptValue_InstanceOf(const QScriptValue* self, QScriptValue* other); +bool QScriptValue_LessThan(const QScriptValue* self, QScriptValue* other); +bool QScriptValue_Equals(const QScriptValue* self, QScriptValue* other); +bool QScriptValue_StrictlyEquals(const QScriptValue* self, QScriptValue* other); +QScriptValue* QScriptValue_Prototype(const QScriptValue* self); +void QScriptValue_SetPrototype(QScriptValue* self, QScriptValue* prototype); +QScriptValue* QScriptValue_Scope(const QScriptValue* self); +void QScriptValue_SetScope(QScriptValue* self, QScriptValue* scope); +QScriptValue* QScriptValue_Property(const QScriptValue* self, struct miqt_string name); +void QScriptValue_SetProperty(QScriptValue* self, struct miqt_string name, QScriptValue* value); +QScriptValue* QScriptValue_PropertyWithArrayIndex(const QScriptValue* self, unsigned int arrayIndex); +void QScriptValue_SetProperty2(QScriptValue* self, unsigned int arrayIndex, QScriptValue* value); +QScriptValue* QScriptValue_PropertyWithName(const QScriptValue* self, QScriptString* name); +void QScriptValue_SetProperty3(QScriptValue* self, QScriptString* name, QScriptValue* value); +int QScriptValue_PropertyFlags(const QScriptValue* self, struct miqt_string name); +int QScriptValue_PropertyFlagsWithName(const QScriptValue* self, QScriptString* name); +QScriptValue* QScriptValue_Call(QScriptValue* self); +QScriptValue* QScriptValue_Call2(QScriptValue* self, QScriptValue* thisObject, QScriptValue* arguments); +QScriptValue* QScriptValue_Construct(QScriptValue* self); +QScriptValue* QScriptValue_ConstructWithArguments(QScriptValue* self, QScriptValue* arguments); +QScriptValue* QScriptValue_Data(const QScriptValue* self); +void QScriptValue_SetData(QScriptValue* self, QScriptValue* data); +QScriptClass* QScriptValue_ScriptClass(const QScriptValue* self); +void QScriptValue_SetScriptClass(QScriptValue* self, QScriptClass* scriptClass); +long long QScriptValue_ObjectId(const QScriptValue* self); +QScriptValue* QScriptValue_Property2(const QScriptValue* self, struct miqt_string name, int* mode); +void QScriptValue_SetProperty32(QScriptValue* self, struct miqt_string name, QScriptValue* value, int* flags); +QScriptValue* QScriptValue_Property22(const QScriptValue* self, unsigned int arrayIndex, int* mode); +void QScriptValue_SetProperty33(QScriptValue* self, unsigned int arrayIndex, QScriptValue* value, int* flags); +QScriptValue* QScriptValue_Property23(const QScriptValue* self, QScriptString* name, int* mode); +void QScriptValue_SetProperty34(QScriptValue* self, QScriptString* name, QScriptValue* value, int* flags); +int QScriptValue_PropertyFlags2(const QScriptValue* self, struct miqt_string name, int* mode); +int QScriptValue_PropertyFlags22(const QScriptValue* self, QScriptString* name, int* mode); +QScriptValue* QScriptValue_Call1(QScriptValue* self, QScriptValue* thisObject); +QScriptValue* QScriptValue_Call22(QScriptValue* self, QScriptValue* thisObject, struct miqt_array /* of QScriptValue* */ args); +QScriptValue* QScriptValue_Construct1(QScriptValue* self, struct miqt_array /* of QScriptValue* */ args); +void QScriptValue_Delete(QScriptValue* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif diff --git a/qt/script/gen_qscriptvalueiterator.cpp b/qt/script/gen_qscriptvalueiterator.cpp new file mode 100644 index 00000000..123f398c --- /dev/null +++ b/qt/script/gen_qscriptvalueiterator.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include +#include +#include "gen_qscriptvalueiterator.h" +#include "_cgo_export.h" + +void QScriptValueIterator_new(QScriptValue* value, QScriptValueIterator** outptr_QScriptValueIterator) { + QScriptValueIterator* ret = new QScriptValueIterator(*value); + *outptr_QScriptValueIterator = ret; +} + +bool QScriptValueIterator_HasNext(const QScriptValueIterator* self) { + return self->hasNext(); +} + +void QScriptValueIterator_Next(QScriptValueIterator* self) { + self->next(); +} + +bool QScriptValueIterator_HasPrevious(const QScriptValueIterator* self) { + return self->hasPrevious(); +} + +void QScriptValueIterator_Previous(QScriptValueIterator* self) { + self->previous(); +} + +struct miqt_string QScriptValueIterator_Name(const QScriptValueIterator* self) { + QString _ret = self->name(); + // 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(malloc(_ms.len)); + memcpy(_ms.data, _b.data(), _ms.len); + return _ms; +} + +QScriptString* QScriptValueIterator_ScriptName(const QScriptValueIterator* self) { + return new QScriptString(self->scriptName()); +} + +QScriptValue* QScriptValueIterator_Value(const QScriptValueIterator* self) { + return new QScriptValue(self->value()); +} + +void QScriptValueIterator_SetValue(QScriptValueIterator* self, QScriptValue* value) { + self->setValue(*value); +} + +int QScriptValueIterator_Flags(const QScriptValueIterator* self) { + QScriptValue::PropertyFlags _ret = self->flags(); + return static_cast(_ret); +} + +void QScriptValueIterator_Remove(QScriptValueIterator* self) { + self->remove(); +} + +void QScriptValueIterator_ToFront(QScriptValueIterator* self) { + self->toFront(); +} + +void QScriptValueIterator_ToBack(QScriptValueIterator* self) { + self->toBack(); +} + +void QScriptValueIterator_OperatorAssign(QScriptValueIterator* self, QScriptValue* value) { + self->operator=(*value); +} + +void QScriptValueIterator_Delete(QScriptValueIterator* self, bool isSubclass) { + if (isSubclass) { + delete dynamic_cast( self ); + } else { + delete self; + } +} + diff --git a/qt/script/gen_qscriptvalueiterator.go b/qt/script/gen_qscriptvalueiterator.go new file mode 100644 index 00000000..a3d09960 --- /dev/null +++ b/qt/script/gen_qscriptvalueiterator.go @@ -0,0 +1,135 @@ +package script + +/* + +#include "gen_qscriptvalueiterator.h" +#include + +*/ +import "C" + +import ( + "runtime" + "unsafe" +) + +type QScriptValueIterator struct { + h *C.QScriptValueIterator + isSubclass bool +} + +func (this *QScriptValueIterator) cPointer() *C.QScriptValueIterator { + if this == nil { + return nil + } + return this.h +} + +func (this *QScriptValueIterator) UnsafePointer() unsafe.Pointer { + if this == nil { + return nil + } + return unsafe.Pointer(this.h) +} + +// newQScriptValueIterator constructs the type using only CGO pointers. +func newQScriptValueIterator(h *C.QScriptValueIterator) *QScriptValueIterator { + if h == nil { + return nil + } + return &QScriptValueIterator{h: h} +} + +// UnsafeNewQScriptValueIterator constructs the type using only unsafe pointers. +func UnsafeNewQScriptValueIterator(h unsafe.Pointer) *QScriptValueIterator { + if h == nil { + return nil + } + + return &QScriptValueIterator{h: (*C.QScriptValueIterator)(h)} +} + +// NewQScriptValueIterator constructs a new QScriptValueIterator object. +func NewQScriptValueIterator(value *QScriptValue) *QScriptValueIterator { + var outptr_QScriptValueIterator *C.QScriptValueIterator = nil + + C.QScriptValueIterator_new(value.cPointer(), &outptr_QScriptValueIterator) + ret := newQScriptValueIterator(outptr_QScriptValueIterator) + ret.isSubclass = true + return ret +} + +func (this *QScriptValueIterator) HasNext() bool { + return (bool)(C.QScriptValueIterator_HasNext(this.h)) +} + +func (this *QScriptValueIterator) Next() { + C.QScriptValueIterator_Next(this.h) +} + +func (this *QScriptValueIterator) HasPrevious() bool { + return (bool)(C.QScriptValueIterator_HasPrevious(this.h)) +} + +func (this *QScriptValueIterator) Previous() { + C.QScriptValueIterator_Previous(this.h) +} + +func (this *QScriptValueIterator) Name() string { + var _ms C.struct_miqt_string = C.QScriptValueIterator_Name(this.h) + _ret := C.GoStringN(_ms.data, C.int(int64(_ms.len))) + C.free(unsafe.Pointer(_ms.data)) + return _ret +} + +func (this *QScriptValueIterator) ScriptName() *QScriptString { + _ret := C.QScriptValueIterator_ScriptName(this.h) + _goptr := newQScriptString(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValueIterator) Value() *QScriptValue { + _ret := C.QScriptValueIterator_Value(this.h) + _goptr := newQScriptValue(_ret) + _goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer + return _goptr +} + +func (this *QScriptValueIterator) SetValue(value *QScriptValue) { + C.QScriptValueIterator_SetValue(this.h, value.cPointer()) +} + +func (this *QScriptValueIterator) Flags() QScriptValue__PropertyFlag { + return (QScriptValue__PropertyFlag)(C.QScriptValueIterator_Flags(this.h)) +} + +func (this *QScriptValueIterator) Remove() { + C.QScriptValueIterator_Remove(this.h) +} + +func (this *QScriptValueIterator) ToFront() { + C.QScriptValueIterator_ToFront(this.h) +} + +func (this *QScriptValueIterator) ToBack() { + C.QScriptValueIterator_ToBack(this.h) +} + +func (this *QScriptValueIterator) OperatorAssign(value *QScriptValue) { + C.QScriptValueIterator_OperatorAssign(this.h, value.cPointer()) +} + +// Delete this object from C++ memory. +func (this *QScriptValueIterator) Delete() { + C.QScriptValueIterator_Delete(this.h, C.bool(this.isSubclass)) +} + +// GoGC adds a Go Finalizer to this pointer, so that it will be deleted +// from C++ memory once it is unreachable from Go memory. +func (this *QScriptValueIterator) GoGC() { + runtime.SetFinalizer(this, func(this *QScriptValueIterator) { + this.Delete() + runtime.KeepAlive(this.h) + }) +} diff --git a/qt/script/gen_qscriptvalueiterator.h b/qt/script/gen_qscriptvalueiterator.h new file mode 100644 index 00000000..5dfff1eb --- /dev/null +++ b/qt/script/gen_qscriptvalueiterator.h @@ -0,0 +1,47 @@ +#pragma once +#ifndef MIQT_QT_SCRIPT_GEN_QSCRIPTVALUEITERATOR_H +#define MIQT_QT_SCRIPT_GEN_QSCRIPTVALUEITERATOR_H + +#include +#include +#include + +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#include "../../libmiqt/libmiqt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +class QScriptString; +class QScriptValue; +class QScriptValueIterator; +#else +typedef struct QScriptString QScriptString; +typedef struct QScriptValue QScriptValue; +typedef struct QScriptValueIterator QScriptValueIterator; +#endif + +void QScriptValueIterator_new(QScriptValue* value, QScriptValueIterator** outptr_QScriptValueIterator); +bool QScriptValueIterator_HasNext(const QScriptValueIterator* self); +void QScriptValueIterator_Next(QScriptValueIterator* self); +bool QScriptValueIterator_HasPrevious(const QScriptValueIterator* self); +void QScriptValueIterator_Previous(QScriptValueIterator* self); +struct miqt_string QScriptValueIterator_Name(const QScriptValueIterator* self); +QScriptString* QScriptValueIterator_ScriptName(const QScriptValueIterator* self); +QScriptValue* QScriptValueIterator_Value(const QScriptValueIterator* self); +void QScriptValueIterator_SetValue(QScriptValueIterator* self, QScriptValue* value); +int QScriptValueIterator_Flags(const QScriptValueIterator* self); +void QScriptValueIterator_Remove(QScriptValueIterator* self); +void QScriptValueIterator_ToFront(QScriptValueIterator* self); +void QScriptValueIterator_ToBack(QScriptValueIterator* self); +void QScriptValueIterator_OperatorAssign(QScriptValueIterator* self, QScriptValue* value); +void QScriptValueIterator_Delete(QScriptValueIterator* self, bool isSubclass); + +#ifdef __cplusplus +} /* extern C */ +#endif + +#endif