forked from qt-creator/qt-creator
Tools: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I16d8928689d208c13776b76cabd663c006a0eb51 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QSettings>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <mach/error.h>
|
||||
|
||||
@@ -1437,11 +1437,12 @@ void AppOpSession::deviceCallbackReturned()
|
||||
|
||||
int AppOpSession::qmljsDebugPort() const
|
||||
{
|
||||
QRegExp qmlPortRe = QRegExp(QLatin1String("-qmljsdebugger=port:([0-9]+)"));
|
||||
foreach (const QString &arg, extraArgs) {
|
||||
if (qmlPortRe.indexIn(arg) == 0) {
|
||||
const QRegularExpression qmlPortRe(QLatin1String("-qmljsdebugger=port:([0-9]+)"));
|
||||
for (const QString &arg : qAsConst(extraArgs)) {
|
||||
const QRegularExpressionMatch match = qmlPortRe.match(arg);
|
||||
if (match.hasMatch()) {
|
||||
bool ok;
|
||||
int res = qmlPortRe.cap(1).toInt(&ok);
|
||||
int res = match.captured(1).toInt(&ok);
|
||||
if (ok && res >0 && res <= 0xFFFF)
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <QDebug>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
#include <QScopedArrayPointer>
|
||||
#include <QTcpServer>
|
||||
#include <QSocketNotifier>
|
||||
@@ -605,13 +606,14 @@ void IosTool::run(const QStringList &args)
|
||||
connect(manager,&Ios::IosDeviceManager::appOutput, this, &IosTool::appOutput);
|
||||
connect(manager,&Ios::IosDeviceManager::errorMsg, this, &IosTool::errorMsg);
|
||||
manager->watchDevices();
|
||||
QRegExp qmlPortRe=QRegExp(QLatin1String("-qmljsdebugger=port:([0-9]+)"));
|
||||
foreach (const QString &arg, extraArgs) {
|
||||
if (qmlPortRe.indexIn(arg) == 0) {
|
||||
const QRegularExpression qmlPortRe(QLatin1String("-qmljsdebugger=port:([0-9]+)"));
|
||||
for (const QString &arg : extraArgs) {
|
||||
const QRegularExpressionMatch match = qmlPortRe.match(arg);
|
||||
if (match.hasMatch()) {
|
||||
bool ok;
|
||||
int qmlPort = qmlPortRe.cap(1).toInt(&ok);
|
||||
int qmlPort = match.captured(1).toInt(&ok);
|
||||
if (ok && qmlPort > 0 && qmlPort <= 0xFFFF)
|
||||
m_qmlPort = qmlPortRe.cap(1);
|
||||
m_qmlPort = match.captured(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -832,11 +834,11 @@ void IosTool::deviceInfo(const QString &deviceId, const Ios::IosDeviceManager::D
|
||||
|
||||
void IosTool::writeTextInElement(const QString &output)
|
||||
{
|
||||
QRegExp controlCharRe(QLatin1String("[\x01-\x08]|\x0B|\x0C|[\x0E-\x1F]|\\0000"));
|
||||
const QRegularExpression controlCharRe(QLatin1String("[\x01-\x08]|\x0B|\x0C|[\x0E-\x1F]|\\0000"));
|
||||
int pos = 0;
|
||||
int oldPos = 0;
|
||||
|
||||
while ((pos = controlCharRe.indexIn(output, pos)) != -1) {
|
||||
while ((pos = output.indexOf(controlCharRe, pos)) != -1) {
|
||||
QMutexLocker l(&m_xmlMutex);
|
||||
out.writeCharacters(output.mid(oldPos, pos - oldPos));
|
||||
out.writeEmptyElement(QLatin1String("control_char"));
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextStream>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
@@ -166,11 +166,11 @@ void CrashHandler::onBacktraceFinished(const QString &backtrace)
|
||||
// ...
|
||||
// Thread 1 (Thread 0x7f1c33c79780 (LWP 975)):
|
||||
// ...
|
||||
QRegExp rx(QLatin1String("\\[Current thread is (\\d+)"));
|
||||
const int pos = rx.indexIn(backtrace);
|
||||
if (pos == -1)
|
||||
const QRegularExpression rx(QLatin1String("\\[Current thread is (\\d+)"));
|
||||
const QRegularExpressionMatch match = rx.match(backtrace);
|
||||
if (!match.hasMatch())
|
||||
return;
|
||||
const QString threadNumber = rx.cap(1);
|
||||
const QString threadNumber = match.captured(1);
|
||||
const QString textToSelect = QString::fromLatin1("Thread %1").arg(threadNumber);
|
||||
d->dialog.selectLineWithContents(textToSelect);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "settings.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -582,8 +582,8 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map, const QVariantMap &t
|
||||
|
||||
for (auto i = tcs.constBegin(); i != tcs.constEnd(); ++i) {
|
||||
if (!i.value().isEmpty() && !AddToolChainOperation::exists(tcMap, i.value())) {
|
||||
QRegExp abiRegExp = QRegExp("[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-(8|16|32|64|128)bit");
|
||||
if (!abiRegExp.exactMatch(i.value())) {
|
||||
const QRegularExpression abiRegExp("^[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-[a-z0-9_]+-(8|16|32|64|128)bit$");
|
||||
if (!abiRegExp.match(i.value()).hasMatch()) {
|
||||
std::cerr << "Error: Toolchain " << qPrintable(i.value())
|
||||
<< " for language " << qPrintable(i.key()) << " does not exist." << std::endl;
|
||||
return QVariantMap();
|
||||
|
||||
Reference in New Issue
Block a user