Simplified some switch statements and removed redundant code (VS warning) in GUI.

This commit is contained in:
PKEuS 2012-10-19 11:08:50 +02:00
parent d84d360afc
commit 60271a5819
2 changed files with 8 additions and 26 deletions

View File

@ -65,30 +65,22 @@ void CheckStatistics::Clear()
unsigned CheckStatistics::GetCount(ShowTypes::ShowType type) const
{
unsigned count = 0;
switch (type) {
case ShowTypes::ShowStyle:
count = mStyle;
break;
return mStyle;
case ShowTypes::ShowWarnings:
count = mWarning;
break;
return mWarning;
case ShowTypes::ShowPerformance:
count = mPerformance;
break;
return mPerformance;
case ShowTypes::ShowPortability:
count = mPortability;
break;
return mPortability;
case ShowTypes::ShowErrors:
count = mError;
break;
return mError;
case ShowTypes::ShowInformation:
count = mInformation;
break;
return mInformation;
case ShowTypes::ShowNone:
default:
qDebug() << "Unknown error type - returning zero statistics.";
break;
return 0;
}
return count;
}

View File

@ -51,8 +51,6 @@ ShowTypes::ShowType ShowTypes::SeverityToShowType(Severity::SeverityType severit
default:
return ShowTypes::ShowNone;
}
return ShowTypes::ShowNone;
}
Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type)
@ -60,34 +58,26 @@ Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type)
switch (type) {
case ShowTypes::ShowStyle:
return Severity::style;
break;
case ShowTypes::ShowErrors:
return Severity::error;
break;
case ShowTypes::ShowWarnings:
return Severity::warning;
break;
case ShowTypes::ShowPerformance:
return Severity::performance;
break;
case ShowTypes::ShowPortability:
return Severity::portability;
break;
case ShowTypes::ShowInformation:
return Severity::information;
break;
case ShowTypes::ShowNone:
default:
return Severity::none;
break;
}
return Severity::none;
}
ShowTypes::ShowType ShowTypes::VariantToShowType(const QVariant &data)