17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 06:19:19 +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.
This commit is contained in:
jerrrrycho
2026-10-10 16:49:01 +02:00
parent e524d38128
commit 34c0c8182d
14 changed files with 887 additions and 846 deletions

View File

@@ -388,17 +388,18 @@ basic_controller::log_error( std::string const &Error, int const Line ) const {
auto
basic_controller::guess_element_type_from_name( std::string const &Name ) const -> basic_element::type_e {
using enum plc::basic_element::type_e;
auto const [nametype, nameindex]{ split_string_and_number( Name ) };
if( nametype == "t" || nametype == "ton" || nametype.find("timer.") == 0 ) {
return basic_element::type_e::timer;
return timer;
}
if( nametype == "c" || nametype.find("counter.") == 0 ) {
return basic_element::type_e::counter;
return counter;
}
return basic_element::type_e::variable;
return variable;
}
} // plc