Files
qt5-legatus-legacy/Lts/Services/ParticipantManagement/ParticipantHandling/firing_unit_validator.h
T
2026-08-13 18:33:10 +02:00

52 lines
1.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* The FiringUnitValidator regulates the rules for firing units serverside
* $Id: participant_dis_helper.h 37747 2017-12-08 08:07:01Z ehrlicher $
* $HeadURL: svn://10.196.0.54/TDS/branches/product/features/24_vulcano/Lts/Plugins/ParticipantManagement/Gui/Common/participant_dis_helper.h $
* $Author: ehrlicher $
* Created by Hannes Fritsche, ESZS, 2024-03-07
*/
#pragma once
#include <QObject>
#include <memory>
#include <DDS/Core/function_reply_object.h>
namespace ParticipantManagement
{
class ParticipantData;
namespace TypeHandling
{
class TypeHandler;
} //namespace TypeHandling
namespace ParticipantHandling
{
class ParticipantHandler;
class FiringUnitValidator : public QObject
{
Q_OBJECT
public:
FiringUnitValidator(const std::shared_ptr<ParticipantHandler> &participantHandler,
const std::shared_ptr<TypeHandling::TypeHandler> &typeHandler,
QObject *parent = nullptr);
Core::FunctionReplyObject firingUnitError(const QHash<int, int> &modIdToParticipantId, const QVector<ParticipantData> &participantData);
private:
QString getError(const QHash<int, int> &modIdToParticipantId, const QVector<ParticipantData> &participantData, int unitModId) const;
int nonModdedInferiorsCount(int unitModId, const QHash<int, int> &modIdToParticipantId) const;
int participantTypeInFiringUnit(int unitModId, const QHash<int, int> &modIdToParticipantId) const;
std::shared_ptr<ParticipantHandler> m_participantHandler;
std::shared_ptr<TypeHandling::TypeHandler> m_typeHandler;
}; // namespace FiringUnitValidator
} //namespace ParticipantHandling
} // namespace ParticipantManagement