mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 09:49: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user