mirror of
https://github.com/status-im/dotherside.git
synced 2025-02-12 04:26:43 +00:00
Removed leftovers
This commit is contained in:
parent
2fdba7dace
commit
2ebada68b5
@ -16,9 +16,6 @@ find_package(Qt5Widgets)
|
||||
set(HEADERS_LIST
|
||||
include/DOtherSide/DOtherSideTypes.h
|
||||
include/DOtherSide/DOtherSideTypesCpp.h
|
||||
include/DOtherSide/DynamicSignal.h
|
||||
include/DOtherSide/DynamicProperty.h
|
||||
include/DOtherSide/DynamicSlot.h
|
||||
include/DOtherSide/DOtherSide.h
|
||||
include/DOtherSide/IDynamicQObject.h
|
||||
include/DOtherSide/OnSlotExecutedHandler.h
|
||||
@ -30,9 +27,6 @@ set(HEADERS_LIST
|
||||
set(SRC_LIST
|
||||
src/DOtherSide.cpp
|
||||
src/OnSlotExecutedHandler.cpp
|
||||
src/DynamicSlot.cpp
|
||||
src/DynamicSignal.cpp
|
||||
src/DynamicProperty.cpp
|
||||
src/DynamicQObjectFactory.cpp
|
||||
src/DynamicQObject.cpp
|
||||
src/DOtherSideTypesCpp.cpp
|
||||
|
@ -1,40 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// std
|
||||
#include <memory>
|
||||
// Qt
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QMetaType>
|
||||
|
||||
class DynamicProperty final
|
||||
{
|
||||
public:
|
||||
DynamicProperty();
|
||||
DynamicProperty(const QString& name,
|
||||
QMetaType::Type type,
|
||||
const QString& readSlotName,
|
||||
const QString& writeSlotName = QString(),
|
||||
const QString& notifySignalName = QString());
|
||||
DynamicProperty(const DynamicProperty& other);
|
||||
DynamicProperty& operator=(const DynamicProperty& other);
|
||||
~DynamicProperty();
|
||||
|
||||
QString name() const;
|
||||
QMetaType::Type type() const;
|
||||
|
||||
bool isValid() const {
|
||||
return d != nullptr;
|
||||
}
|
||||
|
||||
bool isReadable() const;
|
||||
bool isWriteable() const;
|
||||
bool hasNotifySignal() const;
|
||||
|
||||
QString readSlot() const;
|
||||
QString writeSlot() const;
|
||||
QString notifySignal() const;
|
||||
|
||||
private:
|
||||
struct PropertyData;
|
||||
std::unique_ptr<PropertyData> d;
|
||||
};
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// std
|
||||
#include <memory>
|
||||
// Qt
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QList>
|
||||
|
||||
class DynamicSignal final
|
||||
{
|
||||
public:
|
||||
DynamicSignal();
|
||||
DynamicSignal(const QString& name, const QList<QMetaType::Type>& arguments);
|
||||
DynamicSignal(const DynamicSignal& signal);
|
||||
DynamicSignal& operator=(const DynamicSignal& signal);
|
||||
~DynamicSignal();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QString name() const;
|
||||
QByteArray signature() const;
|
||||
|
||||
bool validate(const QVariantList& arguments);
|
||||
|
||||
private:
|
||||
void _initSignature();
|
||||
|
||||
struct SignalData;
|
||||
std::unique_ptr<SignalData> d;
|
||||
};
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// std
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
// Qt
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QMetaType>
|
||||
#include "private/qmetaobjectbuilder_p.h"
|
||||
|
||||
class QString;
|
||||
|
||||
class DynamicSlot final
|
||||
{
|
||||
public:
|
||||
DynamicSlot();
|
||||
DynamicSlot(const QString& name,
|
||||
QMetaType::Type returnType,
|
||||
const QList<QMetaType::Type>& argumentsTypes);
|
||||
DynamicSlot(const DynamicSlot& slot);
|
||||
DynamicSlot& operator=(const DynamicSlot& slot);
|
||||
~DynamicSlot();
|
||||
|
||||
QString name() const;
|
||||
bool isValid() const;
|
||||
QByteArray signature() const;
|
||||
QMetaType::Type returnType() const;
|
||||
QList<QMetaType::Type> argumentsTypes() const;
|
||||
QMetaType::Type argumentTypeAt(int i) const;
|
||||
|
||||
private:
|
||||
void _initSignature();
|
||||
|
||||
struct SlotData;
|
||||
std::unique_ptr<SlotData> d;
|
||||
};
|
@ -1,111 +0,0 @@
|
||||
#include "DOtherSide/DynamicProperty.h"
|
||||
|
||||
struct DynamicProperty::PropertyData final
|
||||
{
|
||||
PropertyData(const QString& name,
|
||||
QMetaType::Type type,
|
||||
const QString& readSlotName,
|
||||
const QString& writeSlotName,
|
||||
const QString& notifySignalName)
|
||||
: name(name)
|
||||
, type(type)
|
||||
, readSlotName(readSlotName)
|
||||
, writeSlotName(writeSlotName)
|
||||
, notifySignalName(notifySignalName)
|
||||
{}
|
||||
|
||||
PropertyData(const PropertyData& other)
|
||||
: name(other.name)
|
||||
, type(other.type)
|
||||
, readSlotName(other.readSlotName)
|
||||
, writeSlotName(other.writeSlotName)
|
||||
, notifySignalName(other.notifySignalName)
|
||||
{}
|
||||
|
||||
PropertyData& operator=(const PropertyData& other)
|
||||
{
|
||||
name = other.name;
|
||||
type = other.type;
|
||||
readSlotName = other.readSlotName;
|
||||
writeSlotName = other.writeSlotName;
|
||||
notifySignalName = other.notifySignalName;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString name;
|
||||
QMetaType::Type type;
|
||||
QString readSlotName;
|
||||
QString writeSlotName;
|
||||
QString notifySignalName;
|
||||
};
|
||||
|
||||
DynamicProperty::DynamicProperty()
|
||||
: d(nullptr)
|
||||
{}
|
||||
|
||||
DynamicProperty::DynamicProperty(const QString& name, QMetaType::Type type, const QString& readSlotName, const QString& writeSlotName, const QString& notifySignalName)
|
||||
: d(new PropertyData(name, type, readSlotName, writeSlotName, notifySignalName))
|
||||
{
|
||||
}
|
||||
|
||||
DynamicProperty::DynamicProperty(const DynamicProperty& other)
|
||||
: d(nullptr)
|
||||
{
|
||||
if (other.d)
|
||||
d.reset(new PropertyData(*other.d));
|
||||
}
|
||||
|
||||
DynamicProperty& DynamicProperty::operator=(const DynamicProperty& other)
|
||||
{
|
||||
if (!other.d && d)
|
||||
d.reset();
|
||||
else if (other.d && !d)
|
||||
d.reset(new PropertyData(*other.d));
|
||||
else if (other.d && d)
|
||||
*d = *other.d;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
DynamicProperty::~DynamicProperty()
|
||||
{}
|
||||
|
||||
QString DynamicProperty::name() const
|
||||
{
|
||||
return d->name;
|
||||
}
|
||||
|
||||
QMetaType::Type DynamicProperty::type() const
|
||||
{
|
||||
return d->type;
|
||||
}
|
||||
|
||||
bool DynamicProperty::isReadable() const
|
||||
{
|
||||
return !d->readSlotName.isEmpty();
|
||||
}
|
||||
|
||||
bool DynamicProperty::isWriteable() const
|
||||
{
|
||||
return !d->writeSlotName.isEmpty();
|
||||
}
|
||||
|
||||
bool DynamicProperty::hasNotifySignal() const
|
||||
{
|
||||
return !d->notifySignalName.isEmpty();
|
||||
}
|
||||
|
||||
QString DynamicProperty::readSlot() const
|
||||
{
|
||||
return d->readSlotName;
|
||||
}
|
||||
|
||||
QString DynamicProperty::writeSlot() const
|
||||
{
|
||||
return d->writeSlotName;
|
||||
}
|
||||
|
||||
QString DynamicProperty::notifySignal() const
|
||||
{
|
||||
return d->notifySignalName;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
#include "DOtherSide/DynamicSignal.h"
|
||||
|
||||
struct DynamicSignal::SignalData
|
||||
{
|
||||
QString name;
|
||||
QList<QMetaType::Type> argumentsTypes;
|
||||
QByteArray signature;
|
||||
};
|
||||
|
||||
DynamicSignal::DynamicSignal()
|
||||
: d(nullptr)
|
||||
{}
|
||||
|
||||
DynamicSignal::DynamicSignal(const QString& name, const QList<QMetaType::Type>& arguments)
|
||||
: d(new SignalData())
|
||||
{
|
||||
d->name = name;
|
||||
d->signature = QByteArray();
|
||||
d->argumentsTypes = arguments;
|
||||
_initSignature();
|
||||
}
|
||||
|
||||
DynamicSignal::DynamicSignal(const DynamicSignal& signal)
|
||||
{
|
||||
if (signal.isValid())
|
||||
{
|
||||
d.reset(new SignalData());
|
||||
*d = *signal.d;
|
||||
}
|
||||
else
|
||||
d.reset(nullptr);
|
||||
}
|
||||
|
||||
DynamicSignal& DynamicSignal::operator=(const DynamicSignal& signal)
|
||||
{
|
||||
if (signal.isValid())
|
||||
{
|
||||
d.reset(new SignalData());
|
||||
*d = *signal.d;
|
||||
}
|
||||
else
|
||||
d.reset(nullptr);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
DynamicSignal::~DynamicSignal() = default;
|
||||
|
||||
bool DynamicSignal::isValid() const
|
||||
{
|
||||
return d != nullptr;
|
||||
}
|
||||
|
||||
QString DynamicSignal::name() const
|
||||
{
|
||||
return isValid() ? d->name : QString();
|
||||
}
|
||||
|
||||
QByteArray DynamicSignal::signature() const
|
||||
{
|
||||
return isValid() ? d->signature : QByteArray();
|
||||
}
|
||||
|
||||
bool DynamicSignal::validate(const QVariantList& arguments)
|
||||
{
|
||||
// TODO: here we should test if the given arguments
|
||||
// match this signal signature
|
||||
// This is important because a class could have multiple
|
||||
// signals with the same name but different arguments
|
||||
Q_UNUSED(arguments);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DynamicSignal::_initSignature()
|
||||
{
|
||||
QString signature("%1(%2)");
|
||||
QString arguments;
|
||||
for (int i = 0; i < d->argumentsTypes.size(); ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
arguments += ',';
|
||||
arguments += QMetaType::typeName(d->argumentsTypes[i]);
|
||||
}
|
||||
|
||||
d->signature = signature.arg(d->name, arguments).toUtf8();
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
#include "DOtherSide/DynamicSlot.h"
|
||||
|
||||
struct DynamicSlot::SlotData
|
||||
{
|
||||
QString name;
|
||||
QMetaType::Type returnType;
|
||||
QList<QMetaType::Type> argumentsTypes;
|
||||
QByteArray signature;
|
||||
};
|
||||
|
||||
DynamicSlot::DynamicSlot()
|
||||
: d(nullptr)
|
||||
{}
|
||||
|
||||
DynamicSlot::DynamicSlot(const QString& name,
|
||||
QMetaType::Type returnType,
|
||||
const QList<QMetaType::Type>& argumentsTypes)
|
||||
: d(new SlotData())
|
||||
{
|
||||
d->name = name;
|
||||
d->returnType = returnType;
|
||||
d->argumentsTypes = argumentsTypes;
|
||||
_initSignature();
|
||||
}
|
||||
|
||||
DynamicSlot::DynamicSlot(const DynamicSlot& slot)
|
||||
{
|
||||
if (slot.isValid())
|
||||
{
|
||||
d.reset(new SlotData());
|
||||
*d = *slot.d;
|
||||
}
|
||||
else
|
||||
d.reset(nullptr);
|
||||
}
|
||||
|
||||
DynamicSlot& DynamicSlot::operator=(const DynamicSlot& slot)
|
||||
{
|
||||
if (slot.isValid())
|
||||
{
|
||||
d.reset(new SlotData());
|
||||
*d = *slot.d;
|
||||
}
|
||||
else
|
||||
d.reset(nullptr);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
DynamicSlot::~DynamicSlot()
|
||||
{
|
||||
}
|
||||
|
||||
QString DynamicSlot::name() const
|
||||
{
|
||||
return isValid() ? d->name : QString();
|
||||
}
|
||||
|
||||
bool DynamicSlot::isValid() const
|
||||
{
|
||||
return d != nullptr;
|
||||
}
|
||||
|
||||
QByteArray DynamicSlot::signature() const
|
||||
{
|
||||
return isValid() ? d->signature : QByteArray();
|
||||
}
|
||||
|
||||
QMetaType::Type DynamicSlot::returnType() const
|
||||
{
|
||||
return isValid() ? d->returnType : QMetaType::UnknownType;
|
||||
}
|
||||
|
||||
QList<QMetaType::Type> DynamicSlot::argumentsTypes() const
|
||||
{
|
||||
return isValid() ? d->argumentsTypes : QList<QMetaType::Type>();
|
||||
}
|
||||
|
||||
QMetaType::Type DynamicSlot::argumentTypeAt(int i) const
|
||||
{
|
||||
return isValid() ? d->argumentsTypes.at(i) : QMetaType::UnknownType;
|
||||
}
|
||||
|
||||
void DynamicSlot::_initSignature()
|
||||
{
|
||||
QString signature("%1(%2)");
|
||||
QString arguments = "";
|
||||
for (int i = 0; i < d->argumentsTypes.size(); ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
arguments += ',';
|
||||
arguments += QMetaType::typeName(d->argumentsTypes[i]);
|
||||
}
|
||||
|
||||
d->signature = signature.arg(d->name, arguments).toUtf8();
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
#include "DOtherSide/OnSlotExecutedHandler.h"
|
||||
#include "DOtherSide/DynamicSlot.h"
|
||||
|
||||
OnSlotExecutedHandler::OnSlotExecutedHandler(void *dObjectPointer,
|
||||
Callback dObjectCallback)
|
||||
|
Loading…
x
Reference in New Issue
Block a user