mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 07:29:20 +02:00
refactor(sonar): reduce enum qualification with using enum (cpp:S6177)
Applied only where no unqualified name in the block could be captured by the introduced enumerators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,48 +51,49 @@ void TMemCell::UpdateValues( std::string const &szNewText, double const fNewValu
|
||||
|
||||
TCommandType TMemCell::CommandCheck()
|
||||
{ // rozpoznanie komendy
|
||||
using enum TCommandType;
|
||||
if( szText == "SetVelocity" ) // najpopularniejsze
|
||||
{
|
||||
eCommand = TCommandType::cm_SetVelocity;
|
||||
eCommand = cm_SetVelocity;
|
||||
bCommand = false; // ta komenda nie jest wysyłana
|
||||
}
|
||||
else if( szText == "ShuntVelocity" ) // w tarczach manewrowych
|
||||
{
|
||||
eCommand = TCommandType::cm_ShuntVelocity;
|
||||
eCommand = cm_ShuntVelocity;
|
||||
bCommand = false; // ta komenda nie jest wysyłana
|
||||
}
|
||||
else if( szText == "Change_direction" ) // zdarza się
|
||||
{
|
||||
eCommand = TCommandType::cm_ChangeDirection;
|
||||
eCommand = cm_ChangeDirection;
|
||||
bCommand = true; // do wysłania
|
||||
}
|
||||
else if( szText == "OutsideStation" ) // zdarza się
|
||||
{
|
||||
eCommand = TCommandType::cm_OutsideStation;
|
||||
eCommand = cm_OutsideStation;
|
||||
bCommand = false; // tego nie powinno być w komórce
|
||||
}
|
||||
else if( szText.starts_with("PassengerStopPoint:") ) // porównanie początków
|
||||
{
|
||||
eCommand = TCommandType::cm_PassengerStopPoint;
|
||||
eCommand = cm_PassengerStopPoint;
|
||||
bCommand = false; // tego nie powinno być w komórce
|
||||
}
|
||||
else if( szText == "SetProximityVelocity" ) // nie powinno tego być
|
||||
{
|
||||
eCommand = TCommandType::cm_SetProximityVelocity;
|
||||
eCommand = cm_SetProximityVelocity;
|
||||
bCommand = false; // ta komenda nie jest wysyłana
|
||||
}
|
||||
else if( szText == "Emergency_brake" )
|
||||
{
|
||||
eCommand = TCommandType::cm_EmergencyBrake;
|
||||
eCommand = cm_EmergencyBrake;
|
||||
bCommand = false;
|
||||
}
|
||||
else if( szText == "CabSignal" ) {
|
||||
eCommand = TCommandType::cm_SecuritySystemMagnet;
|
||||
eCommand = cm_SecuritySystemMagnet;
|
||||
bCommand = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
eCommand = TCommandType::cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
|
||||
eCommand = cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
|
||||
bCommand = true; // do wysłania
|
||||
}
|
||||
return eCommand;
|
||||
@@ -177,20 +178,22 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
|
||||
}
|
||||
|
||||
switch( Pass ) {
|
||||
case comparison_pass::all: { return checkfailed == false; }
|
||||
case comparison_pass::any: { return checkpassed == true; }
|
||||
case comparison_pass::none: { return checkpassed == false; }
|
||||
using enum comparison_pass;
|
||||
case all: { return checkfailed == false; }
|
||||
case any: { return checkpassed == true; }
|
||||
case none: { return checkpassed == false; }
|
||||
default: { return false; }
|
||||
}
|
||||
};
|
||||
|
||||
bool TMemCell::IsVelocity() const
|
||||
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
|
||||
if (eCommand == TCommandType::cm_SetVelocity)
|
||||
using enum TCommandType;
|
||||
if (eCommand == cm_SetVelocity)
|
||||
return true;
|
||||
if (eCommand == TCommandType::cm_ShuntVelocity)
|
||||
if (eCommand == cm_ShuntVelocity)
|
||||
return true;
|
||||
return eCommand == TCommandType::cm_SetProximityVelocity;
|
||||
return eCommand == cm_SetProximityVelocity;
|
||||
};
|
||||
|
||||
void TMemCell::StopCommandSent()
|
||||
|
||||
Reference in New Issue
Block a user