forked from qt-creator/qt-creator
ProWriter: Port to QRegularExpression
Change-Id: I2b3173f5ad852c8930e8207d97faec26951c6097 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
8c8e8d9dd5
commit
dcac6afcad
@@ -28,8 +28,8 @@
|
|||||||
#include "proitems.h"
|
#include "proitems.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace QmakeProjectManager::Internal;
|
using namespace QmakeProjectManager::Internal;
|
||||||
|
|
||||||
@@ -354,9 +354,11 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
if (scopeStart < 0) {
|
if (scopeStart < 0) {
|
||||||
added = QLatin1Char('\n') + scope + QLatin1String(" {");
|
added = QLatin1Char('\n') + scope + QLatin1String(" {");
|
||||||
} else {
|
} else {
|
||||||
QRegExp rx(QLatin1String("(\\s*") + scope + QLatin1String("\\s*:\\s*)[^\\s{].*"));
|
// TODO use anchoredPattern() once Qt 5.12 is mandatory
|
||||||
if (rx.exactMatch(lines->at(scopeStart))) {
|
const QRegularExpression rx("\\A(\\s*" + scope + "\\s*:\\s*)[^\\s{].*\\z");
|
||||||
(*lines)[scopeStart].replace(0, rx.cap(1).length(),
|
const QRegularExpressionMatch match(rx.match(lines->at(scopeStart)));
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
(*lines)[scopeStart].replace(0, match.captured(1).length(),
|
||||||
QString(scope + QLatin1String(" {\n")
|
QString(scope + QLatin1String(" {\n")
|
||||||
+ continuationIndent));
|
+ continuationIndent));
|
||||||
contInfo = skipContLines(lines, scopeStart, false);
|
contInfo = skipContLines(lines, scopeStart, false);
|
||||||
|
Reference in New Issue
Block a user