108 lines
2.6 KiB
C++
108 lines
2.6 KiB
C++
#include "ruleactionparam.h"
|
|
|
|
#include <QDebug>
|
|
|
|
RuleActionParam::RuleActionParam(const QString ¶mName, const QVariant &value, QObject *parent):
|
|
Param(parent),
|
|
m_paramName(paramName)
|
|
{
|
|
setValue(value);
|
|
}
|
|
|
|
RuleActionParam::RuleActionParam(QObject *parent) : Param(parent)
|
|
{
|
|
|
|
}
|
|
|
|
QString RuleActionParam::paramName() const
|
|
{
|
|
return m_paramName;
|
|
}
|
|
|
|
void RuleActionParam::setParamName(const QString ¶mName)
|
|
{
|
|
if (m_paramName != paramName) {
|
|
m_paramName = paramName;
|
|
emit paramNameChanged();
|
|
}
|
|
}
|
|
|
|
QString RuleActionParam::eventTypeId() const
|
|
{
|
|
return m_eventTypeId;
|
|
}
|
|
|
|
void RuleActionParam::setEventTypeId(const QString &eventTypeId)
|
|
{
|
|
if (m_eventTypeId != eventTypeId) {
|
|
m_eventTypeId = eventTypeId;
|
|
emit eventTypeIdChanged();
|
|
}
|
|
}
|
|
|
|
QString RuleActionParam::eventParamTypeId() const
|
|
{
|
|
return m_eventParamTypeId;
|
|
}
|
|
|
|
void RuleActionParam::setEventParamTypeId(const QString &eventParamTypeId)
|
|
{
|
|
if (m_eventParamTypeId != eventParamTypeId) {
|
|
m_eventParamTypeId = eventParamTypeId;
|
|
emit eventParamTypeIdChanged();
|
|
}
|
|
}
|
|
|
|
QString RuleActionParam::stateDeviceId() const
|
|
{
|
|
return m_stateDeviceId;
|
|
}
|
|
|
|
void RuleActionParam::setStateDeviceId(const QString &stateDeviceId)
|
|
{
|
|
if (m_stateDeviceId != stateDeviceId) {
|
|
m_stateDeviceId = stateDeviceId;
|
|
emit stateDeviceIdChanged();
|
|
}
|
|
}
|
|
|
|
QString RuleActionParam::stateTypeId() const
|
|
{
|
|
return m_stateTypeId;
|
|
}
|
|
|
|
void RuleActionParam::setStateTypeId(const QString &stateTypeId)
|
|
{
|
|
if (m_stateTypeId != stateTypeId) {
|
|
m_stateTypeId = stateTypeId;
|
|
emit stateTypeIdChanged();
|
|
}
|
|
}
|
|
|
|
RuleActionParam *RuleActionParam::clone() const
|
|
{
|
|
RuleActionParam *ret = new RuleActionParam();
|
|
ret->setParamTypeId(paramTypeId());
|
|
ret->setParamName(paramName());
|
|
ret->setValue(value());
|
|
ret->setEventTypeId(eventTypeId());
|
|
ret->setEventParamTypeId(eventParamTypeId());
|
|
ret->setStateDeviceId(stateDeviceId());
|
|
ret->setStateTypeId(stateTypeId());
|
|
return ret;
|
|
}
|
|
|
|
#define COMPARE(a, b) if (a != b) { qDebug() << a << "!=" << b; return false; }
|
|
#define COMPARE_PTR(a, b) if (!a->operator==(b)) { qDebug() << a << "!=" << b; return false; }
|
|
bool RuleActionParam::operator==(RuleActionParam *other) const
|
|
{
|
|
COMPARE(m_paramTypeId, other->paramTypeId());
|
|
COMPARE(m_paramName, other->paramName());
|
|
COMPARE(m_eventTypeId, other->eventTypeId());
|
|
COMPARE(m_eventParamTypeId, other->eventParamTypeId());
|
|
COMPARE(m_stateDeviceId, other->stateDeviceId());
|
|
COMPARE(m_stateTypeId, other->stateTypeId());
|
|
COMPARE(m_value, other->value());
|
|
return true;
|
|
}
|