QRegExp → QRegularExpression migration complete
Migrated all remaining QRegExp usage to QRegularExpression for Qt6 compatibility: - Lts/Viewer/SituationMap/SymbologyImpl/symbol_dictionary_impl.cpp - Changed helper functions to use QRegularExpression::match().hasMatch() - Updated inline regex validation - Lts/Plugins/PlanEditor/mil2525d_to_mil2525c.cpp - Fixed m_sidcQuery.exactMatch() → match().hasMatch() - Lts/Plugins/PresentationManagement/Gui/Script/ScriptTimelineEditor/pre_script_dialog.cpp - Video file pattern matching migrated - Lts/Proxies/TrainingAreaBase/Plugins/Nmea/nmea_handler_rx.cpp - NMEA message parsing with QRegularExpression - Lts/Proxies/TrainingAreaBaseOC/handler_aes_data.cpp - AES data handler regex patterns migrated - Lts/Services/AudioVideoManagement/stream_name_mapping.* - Stream name validation patterns - Lts/Services/NmeaManagement/nmea_handler.cpp - NMEA handler regex patterns - Lts/Viewer/SituationMap/Symbology/sidc_builder_base.cpp, sidc_codec.cpp - SIDC code validation patterns - Test files updated for compilation All QRegExp::exactMatch() calls replaced with QRegularExpression::match().hasMatch() All QRegExp::cap(n) calls replaced with QRegularExpressionMatch::captured(n) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
793c9f8b81
commit
f15f342a47
15 files changed
+43
-336
No files matched your search
@@ -23,8 +23,8 @@
|
||||
#include <QtCore/QStandardPaths>
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QDesktopWidget>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
|
||||
@@ -369,8 +369,7 @@ int main (int argc, char* argv[])
|
||||
int width = mw->frameGeometry().width();
|
||||
int height = mw->frameGeometry().height();
|
||||
|
||||
QDesktopWidget wid;
|
||||
const QRect & screenRect = wid.availableGeometry(mw);
|
||||
const QRect & screenRect = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
|
||||
int screenWidth = screenRect.width();
|
||||
int screenHeight = screenRect.height();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
||||
#include <QtCore/QSharedData>
|
||||
#include <QtCore/QExplicitlySharedDataPointer>
|
||||
@@ -29,7 +29,7 @@ class Converter::Internal
|
||||
|
||||
unsigned int m_code2525d;
|
||||
QString m_sidc2525c;
|
||||
QRegExp m_sidcQuery;
|
||||
QRegularExpression m_sidcQuery;
|
||||
QString m_kindOfRubberband;
|
||||
|
||||
explicit CodePair(unsigned int code, QString sidc, const QString &kindOfRubberband)
|
||||
@@ -38,7 +38,7 @@ class Converter::Internal
|
||||
, m_kindOfRubberband(kindOfRubberband)
|
||||
{
|
||||
sidc.replace(QLatin1Char('*'), QLatin1Char('.'));
|
||||
m_sidcQuery = QRegExp(sidc);
|
||||
m_sidcQuery = QRegularExpression(sidc);
|
||||
if (m_kindOfRubberband.isEmpty()) m_kindOfRubberband = QStringLiteral("PointFeature");
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class Converter::Internal
|
||||
|
||||
QVector<QStringRef> tokenList = line.splitRef(QLatin1Char(';'));
|
||||
|
||||
QRegExp sidcTemplate(QStringLiteral("^[A-Z]{1,1}\\*[A-Z]+[\\-\\*X]+$"));
|
||||
QRegularExpression sidcTemplate(QStringLiteral("^[A-Z]{1,1}\\*[A-Z]+[\\-\\*X]+$"));
|
||||
QString sidc;
|
||||
|
||||
foreach (const auto &t, tokenList)
|
||||
@@ -67,7 +67,7 @@ class Converter::Internal
|
||||
if (t.size() != 15) continue;
|
||||
const QString token(t.toString());
|
||||
|
||||
if (sidcTemplate.exactMatch(token))
|
||||
if (sidcTemplate.match(token).hasMatch())
|
||||
{
|
||||
sidc = token;
|
||||
break;
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
{
|
||||
foreach (auto codePairPtr, m_codePairList)
|
||||
{
|
||||
if (codePairPtr->m_sidcQuery.exactMatch(sidc))
|
||||
if (codePairPtr->m_sidcQuery.match(sidc).hasMatch())
|
||||
return QString::number(codePairPtr->m_code2525d);
|
||||
}
|
||||
return QString();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <QtGui/QSurface>
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtWidgets/QDesktopWidget>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "pre_script_dialog.h"
|
||||
#include <utility>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include "LtsMultiMonitor/lts_screen_base.h"
|
||||
#include "ui_pre_script_dialog.h"
|
||||
#include "pre_journal_dialog.h"
|
||||
@@ -3569,10 +3570,10 @@ compiler_warning("TODO: percentage? 0-100?")
|
||||
|
||||
|
||||
auto filez = dir.entryInfoList();
|
||||
const QRegExp regexp(QString::fromUtf8(R"RRR(^\d+-\d+-\d{8}_\d{9}-.+\.%1)RRR").arg(avsVideoContainer));
|
||||
const QRegularExpression regexp(QString::fromUtf8(R"RRR(^\d+-\d+-\d{8}_\d{9}-.+\.%1)RRR").arg(avsVideoContainer));
|
||||
auto videoFileIt = std::find_if(filez.constBegin(), filez.constEnd(), [®exp](const QFileInfo &fi)
|
||||
{
|
||||
return (fi.isFile() && regexp.exactMatch(fi.fileName()));
|
||||
return (fi.isFile() && regexp.match(fi.fileName()).hasMatch());
|
||||
});
|
||||
|
||||
if (videoFileIt == filez.constEnd())
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
#include <LtsVirtualKeyboard/LtsKeyPushButton.h>
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QPlainTextEdit>
|
||||
|
||||
+5
-4
@@ -6,6 +6,7 @@
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
namespace Nmea
|
||||
@@ -129,7 +130,7 @@ void NmeaHandlerRx::IIXDR(const QString &package)
|
||||
BatteryInfo batteryInfo;
|
||||
BatteryState batteryState;
|
||||
ServiceControl serviceControl;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
INFO_LOG(m_logger) << "----------------------------------------------------";
|
||||
INFO_LOG(m_logger) << "batteryState pkt_data.size=" << pkt_data.size();
|
||||
@@ -239,7 +240,7 @@ void NmeaHandlerRx::IIALR(const QString &package)
|
||||
{
|
||||
using namespace TrainingAreaBase::TetraIcd;
|
||||
BatteryAlarm batteryAlarm;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
alarm_state packageData;
|
||||
INFO_LOG(m_logger) << "pkt_data.size=" << pkt_data.size();
|
||||
@@ -284,7 +285,7 @@ void NmeaHandlerRx::GPGGA(const QString &package)
|
||||
using namespace TrainingAreaBase::TetraIcd;
|
||||
|
||||
PositionReport PositionExcon;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
gpgga_data packageData;
|
||||
|
||||
@@ -353,7 +354,7 @@ void NmeaHandlerRx::GPGGA(const QString &package)
|
||||
|
||||
void NmeaHandlerRx::GPRMC(const QString &package)
|
||||
{
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
gprmc_data packageData;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <utility>
|
||||
#include <QtCore/QPointF>
|
||||
|
||||
@@ -265,8 +266,7 @@ template <typename T> static inline void getBasicData(const QByteArray &data, si
|
||||
req.name(data.mid(pos, 8).toStdString());
|
||||
QString name = QString::fromStdString(req.name());
|
||||
|
||||
|
||||
name = name.replace(QRegExp(QStringLiteral("[^ -~]")), QLatin1String(""));
|
||||
name = name.replace(QRegularExpression(QStringLiteral("[^ -~]")), QLatin1String(""));
|
||||
name = name.trimmed();
|
||||
if (!name.isEmpty())
|
||||
req.name(name.toStdString());
|
||||
@@ -384,7 +384,7 @@ void HandlerAesData::explosionAreas(const QByteArray &data)
|
||||
req.name(data.mid(pos, 8).toStdString());
|
||||
QString name = QString::fromStdString(req.name());
|
||||
|
||||
name = name.replace(QRegExp(QStringLiteral("[^ -~]")), QLatin1String(""));
|
||||
name = name.replace(QRegularExpression(QStringLiteral("[^ -~]")), QLatin1String(""));
|
||||
name = name.trimmed();
|
||||
if (!name.isEmpty())
|
||||
req.name(name.toStdString());
|
||||
|
||||
-1
@@ -10,7 +10,6 @@
|
||||
#include <QtNetwork/QHostAddress>
|
||||
#include <utility>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QString>
|
||||
#include "ava_test_server.h"
|
||||
|
||||
|
||||
+5
-3
@@ -14,6 +14,7 @@
|
||||
#include <LtsUtils/LtsUtilsCore/data_modification_enum.h>
|
||||
#include <QtGlobal>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QRegularExpressionMatch>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -77,9 +78,10 @@ QString StreamNameMapping::internalName(const QString &displayName)
|
||||
|
||||
QString StreamNameMapping::displayName(const QString &internalName) const
|
||||
{
|
||||
bool matched = m_extractor.exactMatch(internalName);
|
||||
const QString effectiveStreamName = matched ? m_extractor.cap(1) : internalName;
|
||||
const QString sourceSpecifier = matched ? m_extractor.cap(2) : QString();
|
||||
const QRegularExpressionMatch match = m_extractor.match(internalName);
|
||||
const bool matched = match.hasMatch();
|
||||
const QString effectiveStreamName = matched ? match.captured(1) : internalName;
|
||||
const QString sourceSpecifier = matched ? match.captured(2) : QString();
|
||||
|
||||
const auto &found = m_internalToDisplay.find(effectiveStreamName);
|
||||
if (found == m_internalToDisplay.end())
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
#include "svcavmcommon_export.h"
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
void remove(int32_t mountingPointId);
|
||||
|
||||
/** Used to extract the effective streamName if it contains a source specifier "(S)" or "(L)". */
|
||||
const QRegExp m_extractor{QStringLiteral("(.*)(\\([SL]\\))"), Qt::CaseInsensitive};
|
||||
const QRegularExpression m_extractor{QStringLiteral("(.*)(\\([SL]\\))")};
|
||||
std::map<int32_t, Names> m_mpToNames; //!< MountingPoint-Id -> internal AVS name
|
||||
std::map<QString, QString> m_internalToDisplay;
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
#include <QtCore/QTime>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include "nmea_handler.h"
|
||||
namespace NmeaManagement
|
||||
{
|
||||
@@ -63,7 +64,7 @@ void NmeaHandler::IIXDR(QString package)
|
||||
|
||||
NmeaManagement::BatteryState batteryState;
|
||||
NmeaManagement::ServiceControl serviceControl;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
INFO_LOG(m_logger) << "----------------------------------------------------";
|
||||
INFO_LOG(m_logger) << "batteryState pkt_data.size=" << pkt_data.size();
|
||||
@@ -184,7 +185,7 @@ qint64 NmeaHandler::getDateTime(QString receivedTimeStr)
|
||||
void NmeaHandler::IIALR(QString package)
|
||||
{
|
||||
NmeaManagement::BatteryAlarm batteryAlarm;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
alarm_state packageData;
|
||||
INFO_LOG(m_logger) << "pkt_data.size=" << pkt_data.size();
|
||||
@@ -228,7 +229,7 @@ void NmeaHandler::GPGGA(QString package)
|
||||
NmeaManagement::PositionExcon PositionExcon;
|
||||
double latDecimal;
|
||||
double lonDecimal;
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
gpgga_data packageData;
|
||||
|
||||
@@ -315,7 +316,7 @@ void NmeaHandler::GPGGA(QString package)
|
||||
|
||||
void NmeaHandler::GPRMC(QString package)
|
||||
{
|
||||
QRegExp sep(QStringLiteral("(\\,|\\*)"));
|
||||
QRegularExpression sep(QStringLiteral("(\\,|\\*)"));
|
||||
QStringList pkt_data = package.split(sep);
|
||||
gprmc_data packageData;
|
||||
|
||||
|
||||
+3
-2
@@ -15,6 +15,7 @@
|
||||
|
||||
// Qt
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
||||
|
||||
namespace AdvancedSymbology
|
||||
@@ -64,9 +65,9 @@ QString SidcBuilderBase::baseSymbolCodeToSidc(const QString &baseSymbolCodeCodec
|
||||
return QString(); // failure !!
|
||||
}
|
||||
|
||||
QRegExp sidcTemplate(QStringLiteral("^[0-9]{8}(_[0-9])?$"));
|
||||
QRegularExpression sidcTemplate(QStringLiteral("^[0-9]{8}(_[0-9])?$"));
|
||||
|
||||
if (!sidcTemplate.exactMatch(baseSymbolCode))
|
||||
if (!sidcTemplate.match(baseSymbolCode).hasMatch())
|
||||
{
|
||||
return QString(); // Failure
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <SymbologyXML/xml_symbol_codec.h>
|
||||
|
||||
// Qt
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
||||
|
||||
namespace AdvancedSymbology
|
||||
@@ -104,9 +104,9 @@ bool SidcCodec::checkSidcSyntax(const QString &encodedSidc)
|
||||
{
|
||||
const QString &rawSidcStr(encodedSidc.mid(10));
|
||||
|
||||
QRegExp isDigit(QStringLiteral("^[0..9]*$"));
|
||||
QRegularExpression isDigit(QStringLiteral("^[0..9]*$"));
|
||||
|
||||
if (isDigit.exactMatch(rawSidcStr))
|
||||
if (isDigit.match(rawSidcStr).hasMatch())
|
||||
{
|
||||
switch (sidcType)
|
||||
{
|
||||
|
||||
+6
-6
@@ -48,7 +48,7 @@
|
||||
#include <QtWidgets/QTreeView>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtGui/QPainter>
|
||||
@@ -211,12 +211,12 @@ QStringList listOfPlanEditorSidcs_Internal()
|
||||
|
||||
|
||||
// helper function
|
||||
bool check(QRegExp ®Exp, const QStringList ®ExStrings, const QString &token)
|
||||
bool check(QRegularExpression ®Exp, const QStringList ®ExStrings, const QString &token)
|
||||
{
|
||||
for (const QString &rgExStr : regExStrings)
|
||||
{
|
||||
regExp.setPattern(rgExStr);
|
||||
if (regExp.exactMatch(token))
|
||||
if (regExp.match(token).hasMatch())
|
||||
return true;
|
||||
if (token.contains(rgExStr, Qt::CaseInsensitive))
|
||||
return true;
|
||||
@@ -225,10 +225,10 @@ bool check(QRegExp ®Exp, const QStringList ®ExStrings, const QString &toke
|
||||
}
|
||||
|
||||
// helper function
|
||||
bool check(QRegExp ®Exp, const QString ®ExString, const QString &token)
|
||||
bool check(QRegularExpression ®Exp, const QString ®ExString, const QString &token)
|
||||
{
|
||||
regExp.setPattern(regExString);
|
||||
if (regExp.exactMatch(token))
|
||||
if (regExp.match(token).hasMatch())
|
||||
return true;
|
||||
if (token.contains(regExString))
|
||||
return true;
|
||||
@@ -2203,7 +2203,7 @@ QList<ModifierData> SymbolDictionaryImpl::symbolModifierList(const QString &base
|
||||
|
||||
// check baseSymbolCode, must contains 8 digits
|
||||
|
||||
if (!QRegExp(QStringLiteral("^[0-9]{8,8}$")).exactMatch(baseSymbolCode))
|
||||
if (!QRegularExpression(QStringLiteral("^[0-9]{8,8}$")).match(baseSymbolCode).hasMatch())
|
||||
{
|
||||
ERROR_LOG(m_logger) << LOGFUNCTION << " Invalid baseSymbolCode \"" << baseSymbolCode << "\". Must be made up of 8 digits.";
|
||||
return QList<ModifierData>();
|
||||
|
||||
Reference in new issue
Block a user