mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Replace QRegExp with QRegularExpression
Reviewers: kbasan, msutcliffe Reviewed By: kbasan, msutcliffe Subscribers: jenkins Differential Revision: https://dev.swift-project.org/D11
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/compare.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#include <QStringList>
|
||||
@@ -126,10 +125,10 @@ namespace BlackMisc
|
||||
if (this->m_callsign.length() < 3) { return ""; }
|
||||
if (this->isAtcCallsign()) { return ""; }
|
||||
|
||||
static const QRegExp regExp("^[A-Z]{3,}");
|
||||
const int pos = regExp.indexIn(this->m_callsign);
|
||||
if (pos < 0) { return ""; }
|
||||
const QString airline = regExp.cap(0);
|
||||
thread_local const QRegularExpression regExp("^[A-Z]{3,}");
|
||||
QRegularExpressionMatch match = regExp.match(this->m_callsign);
|
||||
if (!match.hasMatch()) { return QString(); }
|
||||
const QString airline = match.captured(0);
|
||||
if (airline.length() == 3) { return airline; } // we allow 3 letters
|
||||
if (airline.length() == 4 && airline.startsWith('V')) { return airline; } // we allow virtual 4 letter codes, e.g. VDLD
|
||||
return ""; // invalid
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <Qt>
|
||||
#include <QtDebug>
|
||||
|
||||
@@ -131,8 +131,8 @@ namespace BlackMisc
|
||||
qint32 tc = transponderCode.toInt(&number);
|
||||
if (!number) return false;
|
||||
if (tc < 0 || tc > 7777) return false;
|
||||
QRegExp rx("[0-7]{1,4}");
|
||||
return rx.exactMatch(transponderCode);
|
||||
thread_local const QRegularExpression rx("^[0-7]{1,4}$");
|
||||
return rx.match(transponderCode).hasMatch();
|
||||
}
|
||||
|
||||
bool CTransponder::isValidTransponderCode(qint32 transponderCode)
|
||||
|
||||
Reference in New Issue
Block a user