logic: removed "unknown" source group status type

* removed "unknown" source group status type and implemented falling back to
  "disabled", because "unknown" should not be handled anywhere in the rest of
  the code base.
This commit is contained in:
mlangkabel
2018-01-16 09:15:30 +01:00
parent 95e04cf485
commit 68e86ad41a
2 changed files with 7 additions and 6 deletions
+6 -4
View File
@@ -1,5 +1,7 @@
#include "settings/SourceGroupStatusType.h"
#include "utility/logging/logging.h"
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v)
{
switch (v)
@@ -8,10 +10,9 @@ std::string sourceGroupStatusTypeToString(SourceGroupStatusType v)
return "enabled";
case SOURCE_GROUP_STATUS_DISABLED:
return "disabled";
case SOURCE_GROUP_STATUS_UNKNOWN:
break;
}
return "unknown";
LOG_WARNING("Trying to convert unknown Source Group status type to string, falling back to disabled status.");
return "disabled";
}
SourceGroupStatusType stringToSourceGroupStatusType(std::string v)
@@ -25,5 +26,6 @@ SourceGroupStatusType stringToSourceGroupStatusType(std::string v)
return SOURCE_GROUP_STATUS_DISABLED;
}
return SOURCE_GROUP_STATUS_UNKNOWN;
LOG_WARNING("Trying to convert unknown string to Source Group status type, falling back to disabled status.");
return SOURCE_GROUP_STATUS_DISABLED;
}
+1 -2
View File
@@ -6,8 +6,7 @@
enum SourceGroupStatusType
{
SOURCE_GROUP_STATUS_ENABLED,
SOURCE_GROUP_STATUS_DISABLED,
SOURCE_GROUP_STATUS_UNKNOWN
SOURCE_GROUP_STATUS_DISABLED
};
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v);