summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qregexp.cpp18
-rw-r--r--src/corelib/tools/qregexp.h3
-rw-r--r--src/corelib/tools/qscopedpointer.h32
-rw-r--r--src/corelib/tools/qscopedpointer_p.h20
-rw-r--r--src/corelib/tools/qstring.cpp2
5 files changed, 30 insertions, 45 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 1f23211744..3ca8ab9709 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -1083,7 +1083,7 @@ public:
bool isValid() const { return valid; }
const QString &errorString() const { return yyError; }
- int numCaptures() const { return officialncap; }
+ int captureCount() const { return officialncap; }
int createState(QChar ch);
int createState(const QRegExpCharClass &cc);
@@ -1378,7 +1378,7 @@ void QRegExpMatchState::prepareForMatch(QRegExpEngine *eng)
#else
int newSlideTabSize = 0;
#endif
- int numCaptures = eng->numCaptures();
+ int numCaptures = eng->captureCount();
int newCapturedSize = 2 + 2 * numCaptures;
bigArray = q_check_ptr((int *)realloc(bigArray, ((3 + 4 * ncap) * ns + 4 * ncap + newSlideTabSize + newCapturedSize)*sizeof(int)));
@@ -4168,12 +4168,24 @@ int QRegExp::matchedLength() const
#ifndef QT_NO_REGEXP_CAPTURE
/*!
+ \obsolete
Returns the number of captures contained in the regular expression.
+
+ \sa captureCount()
*/
int QRegExp::numCaptures() const
{
+ return captureCount();
+}
+
+/*!
+ \since 4.6
+ Returns the number of captures contained in the regular expression.
+ */
+int QRegExp::captureCount() const
+{
prepareEngine(priv);
- return priv->eng->numCaptures();
+ return priv->eng->captureCount();
}
/*!
diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h
index 1a7cf53711..2bad40e0a9 100644
--- a/src/corelib/tools/qregexp.h
+++ b/src/corelib/tools/qregexp.h
@@ -119,7 +119,8 @@ public:
#endif
int matchedLength() const;
#ifndef QT_NO_REGEXP_CAPTURE
- int numCaptures() const;
+ QT_DEPRECATED int numCaptures() const;
+ int captureCount() const;
QStringList capturedTexts() const;
QStringList capturedTexts();
QString cap(int nth = 0) const;
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index 2dedcc5a03..c40b3cfb19 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -113,16 +113,6 @@ public:
return d;
}
- inline bool operator==(const QScopedPointer<T, Cleanup> &other) const
- {
- return d == other.d;
- }
-
- inline bool operator!=(const QScopedPointer<T, Cleanup> &other) const
- {
- return d != other.d;
- }
-
inline bool operator!() const
{
return !d;
@@ -181,6 +171,18 @@ private:
};
template <class T, class Cleanup>
+inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+{
+ return lhs.data() == rhs.data();
+}
+
+template <class T, class Cleanup>
+inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+{
+ return lhs.data() != rhs.data();
+}
+
+template <class T, class Cleanup>
Q_INLINE_TEMPLATE void qSwap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2)
{ p1.swap(p2); }
@@ -203,16 +205,6 @@ public:
return this->d[i];
}
- inline bool operator==(const QScopedArrayPointer<T, Cleanup> &other) const
- {
- return this->d == other.d;
- }
-
- inline bool operator!=(const QScopedArrayPointer<T, Cleanup> &other) const
- {
- return this->d != other.d;
- }
-
private:
Q_DISABLE_COPY(QScopedArrayPointer)
};
diff --git a/src/corelib/tools/qscopedpointer_p.h b/src/corelib/tools/qscopedpointer_p.h
index fb627a4e6a..b1636d5a50 100644
--- a/src/corelib/tools/qscopedpointer_p.h
+++ b/src/corelib/tools/qscopedpointer_p.h
@@ -76,16 +76,6 @@ public:
return this->d;
}
- inline bool operator==(const QCustomScopedPointer<T, Cleanup> &other) const
- {
- return this->d == other.d;
- }
-
- inline bool operator!=(const QCustomScopedPointer<T, Cleanup> &other) const
- {
- return this->d != other.d;
- }
-
private:
Q_DISABLE_COPY(QCustomScopedPointer)
};
@@ -130,16 +120,6 @@ public:
QScopedPointerSharedDeleter<T>::cleanup(oldD);
}
- inline bool operator==(const QScopedSharedPointer<T> &other) const
- {
- return this->d == other.d;
- }
-
- inline bool operator!=(const QScopedSharedPointer<T> &other) const
- {
- return this->d != other.d;
- }
-
private:
Q_DISABLE_COPY(QScopedSharedPointer)
};
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 55ad28d416..f7321ef404 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -2681,7 +2681,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after)
realloc();
int index = 0;
- int numCaptures = rx2.numCaptures();
+ int numCaptures = rx2.captureCount();
int al = after.length();
QRegExp::CaretMode caretMode = QRegExp::CaretAtZero;