Moved base classes into own header

This commit is contained in:
0xFEEDC0DE64
2018-09-01 16:50:01 +02:00
parent acaa6372d7
commit b5bd365834
5 changed files with 197 additions and 96 deletions
+51
View File
@@ -0,0 +1,51 @@
#include "dbmsglib.h"
#include <QDebug>
#include <algorithm>
DbMsgFieldBase::DbMsgFieldBase() :
m_touched(false)
{
}
DbMsgFieldBase::~DbMsgFieldBase()
{
}
bool DbMsgFieldBase::touched() const
{
return m_touched;
}
void DbMsgFieldBase::setTouched(bool touched)
{
m_touched = touched;
}
DbMsgBase::DbMsgBase()
{
}
DbMsgBase::~DbMsgBase()
{
}
bool DbMsgBase::touched() const
{
const auto fields = getFields();
return std::any_of(fields.cbegin(), fields.cend(), [](const DbMsgFieldBase *field) { return field->touched(); });
}
void DbMsgBase::setTouched(bool touched)
{
for(DbMsgFieldBase *field : getFields())
field->setTouched(touched);
}
void DbMsgBase::debug() const
{
const auto fields = getFields();
for(auto iter = fields.cbegin(); iter != fields.cend(); iter++)
qDebug() << iter.key() << iter.value()->getVariant() << iter.value()->touched();
}