Browse Source

Fix SonarLint findings in LogLevelValue class

Patrick-Christopher Mattulat 11 months ago
parent
commit
767ceac601

+ 2 - 2
include/ls-std/io/logging/LogLevel.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-20
- * Changed:         2023-05-16
+ * Changed:         2023-05-19
  *
  * */
 
@@ -40,7 +40,7 @@ namespace ls::std::io
 
     private:
 
-      ::std::unordered_map<uint8_t, ::std::string> level{};
+      ::std::unordered_map<ls::std::io::LogLevelValue, ::std::string> level{};
       ls::std::io::LogLevelValue value{};
 
       [[nodiscard]] ls::std::io::LogLevelValue _getValueFromString(const ::std::string &_value);

+ 2 - 2
include/ls-std/io/logging/LogLevelValue.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-20
- * Changed:         2023-02-04
+ * Changed:         2023-05-19
  *
  * */
 
@@ -12,7 +12,7 @@
 
 namespace ls::std::io
 {
-  enum LogLevelValue
+  enum class LogLevelValue
   {
     FATAL = 0,
     ERR,

+ 2 - 2
source/ls-std/io/logging/LogLevel.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-08-20
- * Changed:         2023-05-16
+ * Changed:         2023-05-19
  *
  * */
 
@@ -92,7 +92,7 @@ string LogLevel::toString() const
 
 LogLevelValue LogLevel::_getValueFromString(const string &_value)
 {
-  const auto &iterator = find_if(this->level.begin(), this->level.end(), [&_value](const pair<uint8_t, string> &_logLevelString) { return _logLevelString.second == _value; });
+  const auto &iterator = find_if(this->level.begin(), this->level.end(), [&_value](const pair<LogLevelValue, string> &_logLevelString) { return _logLevelString.second == _value; });
   const auto &[logLevelEnumValue, logLevelStringRepresentation] = *iterator;
 
   return iterator != level.end() ? (LogLevelValue) logLevelEnumValue : LogLevelValue{};