summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qregularexpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qregularexpression.cpp')
-rw-r--r--src/corelib/tools/qregularexpression.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp
index 070e68154f..d8b0bf6e9f 100644
--- a/src/corelib/tools/qregularexpression.cpp
+++ b/src/corelib/tools/qregularexpression.cpp
@@ -38,6 +38,7 @@
#ifndef QT_NO_REGULAREXPRESSION
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qhashfunctions.h>
#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
#include <QtCore/qstringlist.h>
@@ -1842,6 +1843,21 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const
*/
/*!
+ \since 5.6
+ \relates QRegularExpression
+
+ Returns the hash value for \a key, using
+ \a seed to seed the calculation.
+*/
+uint qHash(const QRegularExpression &key, uint seed) Q_DECL_NOTHROW
+{
+ QtPrivate::QHashCombine hash;
+ seed = hash(seed, key.d->pattern);
+ seed = hash(seed, key.d->patternOptions);
+ return seed;
+}
+
+/*!
Escapes all characters of \a str so that they no longer have any special
meaning when used as a regular expression pattern string, and returns
the escaped string. For instance:
@@ -2109,7 +2125,8 @@ QStringRef QRegularExpressionMatch::capturedRef(const QString &name) const
QStringList QRegularExpressionMatch::capturedTexts() const
{
QStringList texts;
- for (int i = 0; i <= lastCapturedIndex(); ++i)
+ texts.reserve(d->capturedCount);
+ for (int i = 0; i < d->capturedCount; ++i)
texts << captured(i);
return texts;
}