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 CheckStatistics::GetCount(ShowTypes::ShowType type) const
{ {
unsigned count = 0;
switch (type) { switch (type) {
case ShowTypes::ShowStyle: case ShowTypes::ShowStyle:
count = mStyle; return mStyle;
break;
case ShowTypes::ShowWarnings: case ShowTypes::ShowWarnings:
count = mWarning; return mWarning;
break;
case ShowTypes::ShowPerformance: case ShowTypes::ShowPerformance:
count = mPerformance; return mPerformance;
break;
case ShowTypes::ShowPortability: case ShowTypes::ShowPortability:
count = mPortability; return mPortability;
break;
case ShowTypes::ShowErrors: case ShowTypes::ShowErrors:
count = mError; return mError;
break;
case ShowTypes::ShowInformation: case ShowTypes::ShowInformation:
count = mInformation; return mInformation;
break;
case ShowTypes::ShowNone: case ShowTypes::ShowNone:
default: default:
qDebug() << "Unknown error type - returning zero statistics."; 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: default:
return ShowTypes::ShowNone; return ShowTypes::ShowNone;
} }
return ShowTypes::ShowNone;
} }
Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type) Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type)
@ -60,34 +58,26 @@ Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type)
switch (type) { switch (type) {
case ShowTypes::ShowStyle: case ShowTypes::ShowStyle:
return Severity::style; return Severity::style;
break;
case ShowTypes::ShowErrors: case ShowTypes::ShowErrors:
return Severity::error; return Severity::error;
break;
case ShowTypes::ShowWarnings: case ShowTypes::ShowWarnings:
return Severity::warning; return Severity::warning;
break;
case ShowTypes::ShowPerformance: case ShowTypes::ShowPerformance:
return Severity::performance; return Severity::performance;
break;
case ShowTypes::ShowPortability: case ShowTypes::ShowPortability:
return Severity::portability; return Severity::portability;
break;
case ShowTypes::ShowInformation: case ShowTypes::ShowInformation:
return Severity::information; return Severity::information;
break;
case ShowTypes::ShowNone: case ShowTypes::ShowNone:
default:
return Severity::none; return Severity::none;
break;
} }
return Severity::none;
} }
ShowTypes::ShowType ShowTypes::VariantToShowType(const QVariant &data) ShowTypes::ShowType ShowTypes::VariantToShowType(const QVariant &data)