diff options
author | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-05 14:18:35 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-06 14:43:16 (GMT) |
commit | 98e0b95581f46b94773a55195e0e67a466c333ed (patch) | |
tree | 062707bdf2ef4ed19ed0124a77b7abf7099f2b22 /src/corelib/tools | |
parent | 863369deceeb254ea71724a247953fd0760ae30b (diff) | |
download | Qt-98e0b95581f46b94773a55195e0e67a466c333ed.zip Qt-98e0b95581f46b94773a55195e0e67a466c333ed.tar.gz Qt-98e0b95581f46b94773a55195e0e67a466c333ed.tar.bz2 |
API review: QRegExp::numCaptures() -> QRegExp::captureCount()
QRegExp::numCaptures() is marked as obsolete.
Replaced all usage in Qt and test-cases.
Reviewed-by: Andreas Aardal Hanssen
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qregexp.cpp | 18 | ||||
-rw-r--r-- | src/corelib/tools/qregexp.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 2 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 1f23211..3ca8ab9 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 1a7cf53..2bad40e 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/qstring.cpp b/src/corelib/tools/qstring.cpp index 55ad28d..f7321ef 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; |