2015-07-08 22:55:38 +02:00
|
|
|
#pragma once
|
2014-07-19 18:26:08 +02:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include <functional>
|
|
|
|
|
2015-11-23 21:33:17 +01:00
|
|
|
#include "DOtherSide/IDynamicQObject.h"
|
2014-12-24 14:30:41 +01:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
namespace DOS
|
2014-07-19 18:26:08 +02:00
|
|
|
{
|
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
class DynamicQObjectFactory;
|
2014-07-19 18:26:08 +02:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
class DynamicQObject : public QObject, public IDynamicQObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using OnSlotExecuted = std::function<QVariant(const QString&, const std::vector<QVariant>&)>;
|
2014-12-24 14:30:41 +01:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
DynamicQObject(const DynamicQObjectFactory* factory,
|
|
|
|
OnSlotExecuted handler);
|
2014-12-24 14:30:41 +01:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
bool emitSignal(const QString& name, const std::vector<QVariant>& arguments) override;
|
2015-07-08 22:55:38 +02:00
|
|
|
const QMetaObject* metaObject() const override;
|
2015-12-28 13:21:02 +01:00
|
|
|
int qt_metacall(QMetaObject::Call callType, int index, void**args) override;
|
2014-07-19 18:26:08 +02:00
|
|
|
|
|
|
|
private:
|
2015-12-28 13:21:02 +01:00
|
|
|
bool executeSlot(int index, void** args);
|
|
|
|
bool readProperty(int index, void** args);
|
|
|
|
bool writeProperty(int index, void** args);
|
2014-12-24 14:30:41 +01:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
const DynamicQObjectFactory* const m_factory;
|
|
|
|
const OnSlotExecuted m_handler;
|
2014-07-19 18:26:08 +02:00
|
|
|
};
|
2015-02-04 23:02:26 +01:00
|
|
|
|
2015-12-28 13:21:02 +01:00
|
|
|
} // namespace DOS
|