chore: make all the regexes static const

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2025-04-16 18:55:26 +03:00
parent 21c90527d2
commit c5fd5e6ac1
37 changed files with 87 additions and 84 deletions

View File

@@ -82,8 +82,8 @@ auto Resource::name() const -> QString
static void removeThePrefix(QString& string)
{
QRegularExpression regex(QStringLiteral("^(?:the|teh) +"), QRegularExpression::CaseInsensitiveOption);
string.remove(regex);
static const QRegularExpression s_regex(QStringLiteral("^(?:the|teh) +"), QRegularExpression::CaseInsensitiveOption);
string.remove(s_regex);
string = string.trimmed();
}

View File

@@ -3,8 +3,6 @@
#include <QCoreApplication>
#include <QDebug>
#include <QMap>
#include <QRegularExpression>
#include "MTPixmapCache.h"
#include "Version.h"

View File

@@ -22,8 +22,6 @@
#include "ShaderPack.h"
#include <QRegularExpression>
void ShaderPack::setPackFormat(ShaderPackFormat new_format)
{
QMutexLocker locker(&m_data_lock);

View File

@@ -21,8 +21,6 @@
#include <QDebug>
#include <QMap>
#include <QRegularExpression>
#include "MTPixmapCache.h"
#include "minecraft/mod/tasks/LocalTexturePackParseTask.h"

View File

@@ -16,7 +16,7 @@
#include "minecraft/mod/ModDetails.h"
#include "settings/INIFile.h"
static QRegularExpression newlineRegex("\r\n|\n|\r");
static const QRegularExpression s_newlineRegex("\r\n|\n|\r");
namespace ModUtils {
@@ -494,7 +494,7 @@ bool processZIP(Mod& mod, [[maybe_unused]] ProcessingLevel level)
}
// quick and dirty line-by-line parser
auto manifestLines = QString(file.readAll()).split(newlineRegex);
auto manifestLines = QString(file.readAll()).split(s_newlineRegex);
QString manifestVersion = "";
for (auto& line : manifestLines) {
if (line.startsWith("Implementation-Version: ", Qt::CaseInsensitive)) {