Introduce default ctors for QRegularExpressionMatch(Iterator)
This allows to put them in containers, and to enable subsequent features for QString. Change-Id: I3b3fe695ffe6930331ed9f670738376722e0fc36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0ae529c911
commit
65fba49d63
@ -1657,6 +1657,26 @@ QString QRegularExpression::escape(const QString &str)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.1
|
||||||
|
|
||||||
|
Constructs a valid, empty QRegularExpressionMatch object. The regular
|
||||||
|
expression is set to a default-constructed one; the match type to
|
||||||
|
QRegularExpression::NoMatch and the match options to
|
||||||
|
QRegularExpression::NoMatchOption.
|
||||||
|
|
||||||
|
The object will report no match through the hasMatch() and the
|
||||||
|
hasPartialMatch() member functions.
|
||||||
|
*/
|
||||||
|
QRegularExpressionMatch::QRegularExpressionMatch()
|
||||||
|
: d(new QRegularExpressionMatchPrivate(QRegularExpression(),
|
||||||
|
QString(),
|
||||||
|
QRegularExpression::NoMatch,
|
||||||
|
QRegularExpression::NoMatchOption))
|
||||||
|
{
|
||||||
|
d->isValid = true;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Destroys the match result.
|
Destroys the match result.
|
||||||
*/
|
*/
|
||||||
@ -2000,6 +2020,26 @@ QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(QRegularExpress
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\since 5.1
|
||||||
|
|
||||||
|
Constructs an empty, valid QRegularExpressionMatchIterator object. The
|
||||||
|
regular expression is set to a default-constructed one; the match type to
|
||||||
|
QRegularExpression::NoMatch and the match options to
|
||||||
|
QRegularExpression::NoMatchOption.
|
||||||
|
|
||||||
|
Invoking the hasNext() member function on the constructed object will
|
||||||
|
return false, as the iterator is not iterating on a valid sequence of
|
||||||
|
matches.
|
||||||
|
*/
|
||||||
|
QRegularExpressionMatchIterator::QRegularExpressionMatchIterator()
|
||||||
|
: d(new QRegularExpressionMatchIteratorPrivate(QRegularExpression(),
|
||||||
|
QRegularExpression::NoMatch,
|
||||||
|
QRegularExpression::NoMatchOption,
|
||||||
|
QRegularExpressionMatch()))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Destroys the QRegularExpressionMatchIterator object.
|
Destroys the QRegularExpressionMatchIterator object.
|
||||||
*/
|
*/
|
||||||
|
@ -154,6 +154,7 @@ struct QRegularExpressionMatchPrivate;
|
|||||||
class Q_CORE_EXPORT QRegularExpressionMatch
|
class Q_CORE_EXPORT QRegularExpressionMatch
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QRegularExpressionMatch();
|
||||||
~QRegularExpressionMatch();
|
~QRegularExpressionMatch();
|
||||||
QRegularExpressionMatch(const QRegularExpressionMatch &match);
|
QRegularExpressionMatch(const QRegularExpressionMatch &match);
|
||||||
QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match);
|
QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match);
|
||||||
@ -211,6 +212,7 @@ struct QRegularExpressionMatchIteratorPrivate;
|
|||||||
class Q_CORE_EXPORT QRegularExpressionMatchIterator
|
class Q_CORE_EXPORT QRegularExpressionMatchIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
QRegularExpressionMatchIterator();
|
||||||
~QRegularExpressionMatchIterator();
|
~QRegularExpressionMatchIterator();
|
||||||
QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator);
|
QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator);
|
||||||
QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator);
|
QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator);
|
||||||
|
@ -291,6 +291,31 @@ void tst_QRegularExpression::provideRegularExpressions()
|
|||||||
| QRegularExpression::InvertedGreedinessOption);
|
| QRegularExpression::InvertedGreedinessOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QRegularExpression::defaultConstructors()
|
||||||
|
{
|
||||||
|
QRegularExpression re;
|
||||||
|
QCOMPARE(re.pattern(), QString());
|
||||||
|
QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption);
|
||||||
|
|
||||||
|
QRegularExpressionMatch match;
|
||||||
|
QCOMPARE(match.regularExpression(), QRegularExpression());
|
||||||
|
QCOMPARE(match.regularExpression(), re);
|
||||||
|
QCOMPARE(match.matchType(), QRegularExpression::NoMatch);
|
||||||
|
QCOMPARE(match.matchOptions(), QRegularExpression::NoMatchOption);
|
||||||
|
QCOMPARE(match.hasMatch(), false);
|
||||||
|
QCOMPARE(match.hasPartialMatch(), false);
|
||||||
|
QCOMPARE(match.isValid(), true);
|
||||||
|
QCOMPARE(match.lastCapturedIndex(), -1);
|
||||||
|
|
||||||
|
QRegularExpressionMatchIterator iterator;
|
||||||
|
QCOMPARE(iterator.regularExpression(), QRegularExpression());
|
||||||
|
QCOMPARE(iterator.regularExpression(), re);
|
||||||
|
QCOMPARE(iterator.matchType(), QRegularExpression::NoMatch);
|
||||||
|
QCOMPARE(iterator.matchOptions(), QRegularExpression::NoMatchOption);
|
||||||
|
QCOMPARE(iterator.isValid(), true);
|
||||||
|
QCOMPARE(iterator.hasNext(), false);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QRegularExpression::gettersSetters_data()
|
void tst_QRegularExpression::gettersSetters_data()
|
||||||
{
|
{
|
||||||
provideRegularExpressions();
|
provideRegularExpressions();
|
||||||
|
@ -51,6 +51,7 @@ class tst_QRegularExpression : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void defaultConstructors();
|
||||||
void gettersSetters_data();
|
void gettersSetters_data();
|
||||||
void gettersSetters();
|
void gettersSetters();
|
||||||
void escape_data();
|
void escape_data();
|
||||||
|
Loading…
Reference in New Issue
Block a user