Replaced local implementations of Severity<->String conversions by wrappers of functions in /lib

This commit is contained in:
PKEuS 2012-10-20 21:11:34 +02:00
parent f63e68fcaa
commit be52a1404b
1 changed files with 6 additions and 42 deletions

View File

@ -32,53 +32,17 @@ class ErrorLine;
/**
* @brief GUI versions of severity conversions.
* GUI needs its own versions of conversions since GUI uses Qt's QString
* GUI needs wrappers for conversion functions since GUI uses Qt's QString
* instead of the std::string used by lib/cli.
*/
class GuiSeverity : Severity {
class GuiSeverity {
public:
static QString toString(SeverityType severity) {
switch (severity) {
case none:
return "";
case error:
return "error";
case warning:
return "warning";
case style:
return "style";
case performance:
return "performance";
case portability:
return "portability";
case information:
return "information";
case debug:
return "debug";
};
return "???";
static QString toString(Severity::SeverityType severity) {
return QString(Severity::toString(severity).c_str());
}
static SeverityType fromString(const QString &severity) {
if (severity.isEmpty())
return none;
if (severity == "none")
return none;
if (severity == "error")
return error;
if (severity == "warning")
return warning;
if (severity == "style")
return style;
if (severity == "performance")
return performance;
if (severity == "portability")
return portability;
if (severity == "information")
return information;
if (severity == "debug")
return debug;
return none;
static Severity::SeverityType fromString(const QString &severity) {
return Severity::fromString(severity.toStdString());
}
};