aboutsummaryrefslogtreecommitdiffstats
path: root/ApiExtractor/typesystem.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-23 16:28:30 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-04-06 08:35:56 +0000
commitfa3bcfcd649d2fa7218cb0f0cb6a9d62c5a2dff9 (patch)
tree91f64c73b0eff01e15593328e15654c85d93b01c /ApiExtractor/typesystem.cpp
parent8b461d7a64512a7f0f394879d5326a409c2c0809 (diff)
Port to QRegularExpression
Port most QRegExp to QRegularExpression. Change-Id: Icb551f16e97c409fc979c1caa10f6496248202b2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'ApiExtractor/typesystem.cpp')
-rw-r--r--ApiExtractor/typesystem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/ApiExtractor/typesystem.cpp b/ApiExtractor/typesystem.cpp
index d33ae3f63..a5b98b0f6 100644
--- a/ApiExtractor/typesystem.cpp
+++ b/ApiExtractor/typesystem.cpp
@@ -32,6 +32,7 @@
#include "reporthandler.h"
#include <QtCore/QDir>
#include <QtCore/QFile>
+#include <QtCore/QRegularExpression>
#include <QtCore/QXmlStreamAttributes>
#include <QtCore/QXmlStreamReader>
@@ -494,7 +495,8 @@ static QString getNamePrefix(StackElement* element)
static QString checkSignatureError(const QString& signature, const QString& tag)
{
QString funcName = signature.left(signature.indexOf(QLatin1Char('('))).trimmed();
- static QRegExp whiteSpace(QLatin1String("\\s"));
+ static const QRegularExpression whiteSpace(QStringLiteral("\\s"));
+ Q_ASSERT(whiteSpace.isValid());
if (!funcName.startsWith(QLatin1String("operator ")) && funcName.contains(whiteSpace)) {
return QString::fromLatin1("Error in <%1> tag signature attribute '%2'.\n"
"White spaces aren't allowed in function names, "
@@ -726,8 +728,9 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
}
QString rename = attributes[QLatin1String("rename")];
if (!rename.isEmpty()) {
- static QRegExp functionNameRegExp(QLatin1String("^[a-zA-Z_][a-zA-Z0-9_]*$"));
- if (!functionNameRegExp.exactMatch(rename)) {
+ static const QRegularExpression functionNameRegExp(QLatin1String("^[a-zA-Z_][a-zA-Z0-9_]*$"));
+ Q_ASSERT(functionNameRegExp.isValid());
+ if (!functionNameRegExp.match(rename).hasMatch()) {
m_error = QLatin1String("can not rename '") + signature + QLatin1String("', '")
+ rename + QLatin1String("' is not a valid function name");
return false;
@@ -2256,7 +2259,8 @@ bool FunctionModification::operator==(const FunctionModification& other) const
static AddedFunction::TypeInfo parseType(const QString& signature, int startPos = 0, int* endPos = 0)
{
AddedFunction::TypeInfo result;
- QRegExp regex(QLatin1String("\\w"));
+ static const QRegularExpression regex(QLatin1String("\\w"));
+ Q_ASSERT(regex.isValid());
int length = signature.length();
int start = signature.indexOf(regex, startPos);
if (start == -1) {