chore: Re-simplify IndexVersionType and MessageLevel with c++20
This sets our compiler requirements to gcc 11 and clang 13. If we forgo the use of `using enum` we can drop to gcc 10 and clang 10 but that means using `MessageLevel::Enum::Unknown` for direct enum access Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "MessageLevel.h"
|
||||
|
||||
MessageLevel messageLevelFromName(const QString& levelName)
|
||||
MessageLevel MessageLevel::fromName(const QString& levelName)
|
||||
{
|
||||
QString name = levelName.toUpper();
|
||||
if (name == "LAUNCHER")
|
||||
@@ -25,7 +25,7 @@ MessageLevel messageLevelFromName(const QString& levelName)
|
||||
return MessageLevel::Unknown;
|
||||
}
|
||||
|
||||
MessageLevel messageLevelFromQtMsgType(QtMsgType type)
|
||||
MessageLevel MessageLevel::fromQtMsgType(const QtMsgType& type)
|
||||
{
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
@@ -43,18 +43,20 @@ MessageLevel messageLevelFromQtMsgType(QtMsgType type)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get message level from a line. Line is modified if it was successful. */
|
||||
MessageLevel messageLevelFromLine(QString& line)
|
||||
{
|
||||
// Level prefix
|
||||
int endmark = line.indexOf("]!");
|
||||
if (line.startsWith("!![") && endmark != -1) {
|
||||
auto level = messageLevelFromName(line.left(endmark).mid(3));
|
||||
auto level = MessageLevel::fromName(line.left(endmark).mid(3));
|
||||
line = line.mid(endmark + 2);
|
||||
return level;
|
||||
}
|
||||
return MessageLevel::Unknown;
|
||||
}
|
||||
|
||||
/* Get message level from a line from the launcher log. Line is modified if it was successful. */
|
||||
MessageLevel messageLevelFromLauncherLine(QString& line)
|
||||
{
|
||||
// Level prefix
|
||||
@@ -63,7 +65,7 @@ MessageLevel messageLevelFromLauncherLine(QString& line)
|
||||
++startMark;
|
||||
int endmark = line.indexOf(":");
|
||||
if (startMark < line.size() && endmark != -1) {
|
||||
auto level = messageLevelFromName(line.left(endmark).mid(startMark));
|
||||
auto level = MessageLevel::fromName(line.left(endmark).mid(startMark));
|
||||
line = line.mid(endmark + 2);
|
||||
return level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user