fix Warning
This commit is contained in:
1 parent
593c221d23
commit
8345470273
316 files changed
+1246
-929
No files matched your search
+2
-1
@@ -7,6 +7,7 @@
|
||||
* Created by Hannes Baeuerle, SLSE, 2016-05-12
|
||||
*/
|
||||
#include "participant_handler.h"
|
||||
#include <utility>
|
||||
|
||||
#include "participant.h"
|
||||
#include "ppm_common.h"
|
||||
@@ -43,7 +44,7 @@ void ParticipantHandler::clearParticipants()
|
||||
dts()->removeHitLineInfoByKey(it.value().id());
|
||||
m_hitLineInfoMap.clear();
|
||||
|
||||
for (auto p : qAsConst(m_participants))
|
||||
for (auto p : std::as_const(m_participants))
|
||||
{
|
||||
p->removeFromDds();
|
||||
delete p;
|
||||
|
||||
+18
-17
@@ -7,6 +7,7 @@
|
||||
* Created by Hannes Baeuerle, SLSE, 2016-05-12
|
||||
*/
|
||||
#include "participant_handler_for_exercise.h"
|
||||
#include <utility>
|
||||
|
||||
#include "convert_db_to_dds.h"
|
||||
#include "firing_unit_validator.h"
|
||||
@@ -168,7 +169,7 @@ bool ParticipantHandlerForExercise::init()
|
||||
}
|
||||
|
||||
// remove the 'unused' EquipmentExerciseMappings (for whatever reason there are some...)
|
||||
for (const auto &eem : qAsConst(localEquipmentExerciseMappings))
|
||||
for (const auto &eem : std::as_const(localEquipmentExerciseMappings))
|
||||
dbEx0->removeEquipmentExerciseMapping(eem);
|
||||
|
||||
// after m_publishEquipmentExerciseMappings has been set and participants are created
|
||||
@@ -189,7 +190,7 @@ bool ParticipantHandlerForExercise::init()
|
||||
bool isOwnPositionParticipant = false;
|
||||
|
||||
// publish participants in dds
|
||||
for (Participant *p : qAsConst(m_participants))
|
||||
for (Participant *p : std::as_const(m_participants))
|
||||
{
|
||||
if (p->equipmentNumber() == 1)
|
||||
isOwnPositionParticipant = true;
|
||||
@@ -309,7 +310,7 @@ bool ParticipantHandlerForExercise::init()
|
||||
dtc->equipmentExerciseMappings([this](const EquipmentExerciseMapping &data) { onEquipmentExerciseMappingChanged(data, DataModification::eAdded); });
|
||||
|
||||
auto pub = dts();
|
||||
for (const ParticipantOrganisation &partOrga : qAsConst(m_participantOrganisations))
|
||||
for (const ParticipantOrganisation &partOrga : std::as_const(m_participantOrganisations))
|
||||
pub->publish(partOrga);
|
||||
|
||||
if (m_mainHandler->exerciseId() > 0)
|
||||
@@ -351,7 +352,7 @@ bool ParticipantHandlerForExercise::init()
|
||||
m_pdmDtc->waitForHistoricalDataGearTypeChargeType();
|
||||
}
|
||||
|
||||
// for(const auto &participant : qAsConst(m_participants))
|
||||
// for(const auto &participant : std::as_const(m_participants))
|
||||
// customedSetGearCharges(participant);
|
||||
|
||||
return true;
|
||||
@@ -454,7 +455,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
|
||||
checkLongActionBreak();
|
||||
|
||||
for (const ParticipantManagement::ParticipantData ¤tParticipant : qAsConst(validateData.participantsToBeCreatedOrModified))
|
||||
for (const ParticipantManagement::ParticipantData ¤tParticipant : std::as_const(validateData.participantsToBeCreatedOrModified))
|
||||
{
|
||||
auto ret = validateParticipantData(validateData, currentParticipant);
|
||||
if (ret.error())
|
||||
@@ -596,7 +597,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
DEBUG_LOG(m_logger) << "New participants created and existing participants updated";
|
||||
|
||||
// build hierarchy
|
||||
for (const ParticipantData ¤tData : qAsConst(validateData.participantsToBeCreatedOrModified)) // first set superiorIds
|
||||
for (const ParticipantData ¤tData : std::as_const(validateData.participantsToBeCreatedOrModified)) // first set superiorIds
|
||||
{
|
||||
Participant *participantToUpdate = participantById(validateData.modIdToParticipantId.value(currentData.modId()));
|
||||
if (currentData.superiorModId() >= 0) // superiorModId < 0 -> no change in superior
|
||||
@@ -612,7 +613,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
QHash<int, std::vector<int32_t>> inferiors;
|
||||
inferiors.reserve(m_participants.size() / 2);
|
||||
// first collect all inferiors per superior
|
||||
for (const Participant *currentParticipant : qAsConst(m_participants))
|
||||
for (const Participant *currentParticipant : std::as_const(m_participants))
|
||||
{
|
||||
int superiorId = currentParticipant->superiorId();
|
||||
inferiors[superiorId].push_back(currentParticipant->id());
|
||||
@@ -625,7 +626,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
}
|
||||
}
|
||||
// now update all participants with newly collected inferiors
|
||||
for (Participant *currentParticipant : qAsConst(m_participants))
|
||||
for (Participant *currentParticipant : std::as_const(m_participants))
|
||||
{
|
||||
if (currentParticipant->hasNewInferiorStructure(inferiors.value(currentParticipant->id())))
|
||||
participantsWithChanges.insert(currentParticipant);
|
||||
@@ -635,7 +636,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
// update in Database
|
||||
std::vector<Database::PpmParticipant> dbParticipantsToUpdate;
|
||||
dbParticipantsToUpdate.reserve(participantsWithChanges.size());
|
||||
for (Participant *currentParticipant : qAsConst(participantsWithChanges))
|
||||
for (Participant *currentParticipant : std::as_const(participantsWithChanges))
|
||||
{
|
||||
dbParticipantsToUpdate.push_back(currentParticipant->toDbParticipant());
|
||||
partiesUsed.insert(currentParticipant->partyId());
|
||||
@@ -651,13 +652,13 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
|
||||
// mark parties in use
|
||||
ChangePartyUsedStateRequest req;
|
||||
for (int partyId : qAsConst(partiesUsed))
|
||||
for (int partyId : std::as_const(partiesUsed))
|
||||
{
|
||||
req.partyId(partyId);
|
||||
req.isUsedBy(true);
|
||||
m_mainHandler->partyHandler()->changePartyUsedStateRequest(req);
|
||||
}
|
||||
for (int partyId : qAsConst(partiesWithDeletedOrMovedOutParticipants))
|
||||
for (int partyId : std::as_const(partiesWithDeletedOrMovedOutParticipants))
|
||||
{
|
||||
req.partyId(partyId);
|
||||
req.isUsedBy(false);
|
||||
@@ -726,7 +727,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::modifyParticipantDataRe
|
||||
QJsonArray jsonArray;
|
||||
|
||||
// finally ... publish participant data via dds if no error occured
|
||||
for (Participant *currentParticipant : qAsConst(participantsWithChanges))
|
||||
for (Participant *currentParticipant : std::as_const(participantsWithChanges))
|
||||
{
|
||||
currentParticipant->publishParticipant();
|
||||
NOTICE_LOG(m_logger) << "publishParticipant id=" << currentParticipant->id();
|
||||
@@ -1292,7 +1293,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::selectiveReammunitionRe
|
||||
tabRequest.participantId(request.id());
|
||||
tabRequest.gearId(request.gearId());
|
||||
INFO_LOG(m_logger) << "Gear id = " << request.gearId();
|
||||
for (const Reammunition ra : qAsConst(request.reammunition()))
|
||||
for (const Reammunition ra : std::as_const(request.reammunition()))
|
||||
{
|
||||
TrainingAreaBase::Reammunition tabRa;
|
||||
tabRa.chargeTypeId(ra.chargeTypeId());
|
||||
@@ -1367,7 +1368,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::setSimulatedPositionReq
|
||||
{
|
||||
if (request.participantId() <= 0)
|
||||
{
|
||||
for (Participant *participant : qAsConst(m_participants))
|
||||
for (Participant *participant : std::as_const(m_participants))
|
||||
{
|
||||
if (participant->isDeleted() || participant->superiorId() != 0)
|
||||
continue;
|
||||
@@ -1507,7 +1508,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
DEBUG_LOG(m_logger) << "checking superiorIds";
|
||||
// superior exists?
|
||||
bool isExistingSuperiorId = false;
|
||||
for (const ParticipantData &dat : qAsConst(data.participantsToBeCreatedOrModified))
|
||||
for (const ParticipantData &dat : std::as_const(data.participantsToBeCreatedOrModified))
|
||||
{
|
||||
if (participantToValidate.superiorModId() == dat.modId())
|
||||
{
|
||||
@@ -1529,7 +1530,7 @@ Core::FunctionReplyObject ParticipantHandlerForExercise::validateParticipantData
|
||||
|
||||
// all hierarchy numbers with same superior unique?
|
||||
DEBUG_LOG(m_logger) << "checking hierarchyNumbers";
|
||||
for (const ParticipantData &dat : qAsConst(data.participantsToBeCreatedOrModified))
|
||||
for (const ParticipantData &dat : std::as_const(data.participantsToBeCreatedOrModified))
|
||||
{
|
||||
// operator==() on optionals returns false if not set ...
|
||||
if (dat.modId() != participantToValidate.modId() && dat.superiorModId() == participantToValidate.superiorModId()
|
||||
@@ -1803,7 +1804,7 @@ void ParticipantHandlerForExercise::onEquipmentExerciseMappingChanged(const Equi
|
||||
case DataModification::eModified:
|
||||
{
|
||||
QSet<int> oldEqIds;
|
||||
for (const auto &db : qAsConst(m_equipmentExerciseMappings))
|
||||
for (const auto &db : std::as_const(m_equipmentExerciseMappings))
|
||||
{
|
||||
if (db.exerciseId != data.exerciseId())
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user