Remove redundant overloads in QString

These were added since we couldn't add default parameters in the Qt 5 lifetime.

Change-Id: Idf04df78cc7f56c6c1dc1fe6c07e30003350ed0d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
This commit is contained in:
Frederik Gladhorn 2019-11-06 13:29:37 +01:00
parent a5f474b9bb
commit 36fcfd962d
3 changed files with 9 additions and 62 deletions

View File

@ -433,14 +433,12 @@ void Widget::firstIndexOfFunction()
//! [93]
QString str = "the minimum";
str.indexOf(QRegularExpression("m[aeiou]"), 0); // returns 4
//! [93]
//! [99]
QString str = "the minimum";
QRegularExpressionMatch match;
str.indexOf(QRegularExpression("m[aeiou]"), 0, &match); // returns 4
// match.captured() == mi
//! [99]
//! [93]
}
void Widget::insertFunction()
@ -490,14 +488,12 @@ void Widget::lastIndexOfFunction()
//! [94]
QString str = "the minimum";
str.lastIndexOf(QRegularExpression("m[aeiou]")); // returns 8
//! [94]
//! [100]
QString str = "the minimum";
QRegularExpressionMatch match;
str.lastIndexOf(QRegularExpression("m[aeiou]"), -1, &match); // returns 8
// match.captured() == mu
//! [100]
//! [94]
}
void Widget::leftFunction()

View File

@ -4431,24 +4431,6 @@ int QString::count(const QRegExp& rx) const
#if QT_CONFIG(regularexpression)
/*!
\overload indexOf()
\since 5.0
Returns the index position of the first match of the regular
expression \a re in the string, searching forward from index
position \a from. Returns -1 if \a re didn't match anywhere.
Example:
\snippet qstring/main.cpp 93
*/
int QString::indexOf(const QRegularExpression& re, int from) const
{
return indexOf(re, from, nullptr);
}
/*!
\overload
\since 5.5
Returns the index position of the first match of the regular
@ -4461,7 +4443,7 @@ int QString::indexOf(const QRegularExpression& re, int from) const
Example:
\snippet qstring/main.cpp 99
\snippet qstring/main.cpp 93
*/
int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const
{
@ -4482,24 +4464,6 @@ int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionM
}
/*!
\overload lastIndexOf()
\since 5.0
Returns the index position of the last match of the regular
expression \a re in the string, which starts before the index
position \a from. Returns -1 if \a re didn't match anywhere.
Example:
\snippet qstring/main.cpp 94
*/
int QString::lastIndexOf(const QRegularExpression &re, int from) const
{
return lastIndexOf(re, from, nullptr);
}
/*!
\overload
\since 5.5
Returns the index position of the last match of the regular
@ -4512,7 +4476,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from) const
Example:
\snippet qstring/main.cpp 100
\snippet qstring/main.cpp 94
*/
int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const
{
@ -4539,19 +4503,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpress
return lastIndex;
}
/*! \overload contains()
\since 5.0
Returns \c true if the regular expression \a re matches somewhere in
this string; otherwise returns \c false.
*/
bool QString::contains(const QRegularExpression &re) const
{
return contains(re, nullptr);
}
/*!
\overload contains()
\since 5.1
Returns \c true if the regular expression \a re matches somewhere in this

View File

@ -425,12 +425,11 @@ public:
#endif
#if QT_CONFIG(regularexpression)
int indexOf(const QRegularExpression &re, int from = 0) const;
int indexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads
int lastIndexOf(const QRegularExpression &re, int from = -1) const;
int lastIndexOf(const QRegularExpression &re, int from, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads
bool contains(const QRegularExpression &re) const;
bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch) const; // ### Qt 6: merge overloads
int indexOf(const QRegularExpression &re, int from = 0,
QRegularExpressionMatch *rmatch = nullptr) const;
int lastIndexOf(const QRegularExpression &re, int from = -1,
QRegularExpressionMatch *rmatch = nullptr) const;
bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const;
int count(const QRegularExpression &re) const;
#endif