Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* The Party class represents a party. It holds the data and offers some conversion methods.
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Hannes Baeuerle, SLSE, 2016-05-12
|
||||
*/
|
||||
|
||||
#include "party.h"
|
||||
|
||||
bool ParticipantManagement::PartyHandling::Party::hasChanges(const ParticipantManagement::Party &request,
|
||||
const bool bIgnoreIsUsedBy)
|
||||
{
|
||||
const QString requestProperties = QString::fromStdString(request.properties());
|
||||
bool hasChanges = request.color() != m_data.color
|
||||
|| request.fadingColor() != m_data.fadingColor
|
||||
|| request.name() != m_data.name.toStdString()
|
||||
|| request.hlaForceIdentifier().underlying() != m_data.hlaForceIdentifier
|
||||
|| request.role() != m_data.roleId
|
||||
|| requestProperties != m_data.properties;
|
||||
if (!bIgnoreIsUsedBy && !hasChanges)
|
||||
hasChanges = request.isUsedBy() != m_data.isUsedBy;
|
||||
|
||||
if (hasChanges)
|
||||
{
|
||||
m_data.color = request.color();
|
||||
m_data.fadingColor = request.fadingColor();
|
||||
m_data.name = QString::fromStdString(request.name());
|
||||
m_data.roleId = request.role();
|
||||
m_data.hlaForceIdentifier = request.hlaForceIdentifier().underlying();
|
||||
m_data.properties = requestProperties;
|
||||
if (!bIgnoreIsUsedBy)
|
||||
m_data.isUsedBy = request.isUsedBy();
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
|
||||
ParticipantManagement::Database::PpmParty ParticipantManagement::PartyHandling::Party::toDbParty() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
ParticipantManagement::Party ParticipantManagement::PartyHandling::Party::toDdsParty() const
|
||||
{
|
||||
ParticipantManagement::Party result;
|
||||
|
||||
result.id(id());
|
||||
result.color(m_data.color);
|
||||
result.fadingColor(m_data.fadingColor);
|
||||
result.name(m_data.name.toStdString());
|
||||
result.role(m_data.roleId);
|
||||
result.hlaForceIdentifier(static_cast<HlaForceIdentifierEnum::inner_enum>(m_data.hlaForceIdentifier));
|
||||
result.isUsedBy(m_data.isUsedBy);
|
||||
result.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
result.properties(m_data.properties.toStdString());
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in new issue
Block a user