QRegularExpression: inline some compatibility calls

The functions take QStringView now. The ones taking QString can
be implemented inline (BC break). Drive-by change, use
qToStringViewIgnoringNull.

Change-Id: Ia3089c574446418e5ab93e08e21869ef19fbfbfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2020-02-12 02:38:20 +01:00
parent 75514103e2
commit 2537d04785
2 changed files with 13 additions and 13 deletions

View File

@ -1831,12 +1831,9 @@ uint qHash(const QRegularExpression &key, uint seed) noexcept
#if QT_STRINGVIEW_LEVEL < 2 #if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QString QRegularExpression::escape(const QString &str)
\overload \overload
*/ */
QString QRegularExpression::escape(const QString &str)
{
return escape(QStringView(str));
}
#endif // QT_STRINGVIEW_LEVEL < 2 #endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
@ -1897,12 +1894,9 @@ QString QRegularExpression::escape(QStringView str)
#if QT_STRINGVIEW_LEVEL < 2 #if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\since 5.12 \since 5.12
\fn QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
\overload \overload
*/ */
QString QRegularExpression::wildcardToRegularExpression(const QString &pattern)
{
return wildcardToRegularExpression(QStringView(pattern));
}
#endif // QT_STRINGVIEW_LEVEL < 2 #endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
@ -2036,9 +2030,7 @@ QString QRegularExpression::wildcardToRegularExpression(QStringView pattern)
#if QT_STRINGVIEW_LEVEL < 2 #if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QRegularExpression::anchoredPattern(const QString &expression) \fn QRegularExpression::anchoredPattern(const QString &expression)
\since 5.12 \since 5.12
\overload \overload
*/ */
#endif // QT_STRINGVIEW_LEVEL < 2 #endif // QT_STRINGVIEW_LEVEL < 2

View File

@ -138,11 +138,19 @@ public:
void optimize() const; void optimize() const;
#if QT_STRINGVIEW_LEVEL < 2 #if QT_STRINGVIEW_LEVEL < 2
static QString escape(const QString &str); static QString escape(const QString &str)
static QString wildcardToRegularExpression(const QString &str); {
return escape(qToStringViewIgnoringNull(str));
}
static QString wildcardToRegularExpression(const QString &str)
{
return wildcardToRegularExpression(qToStringViewIgnoringNull(str));
}
static inline QString anchoredPattern(const QString &expression) static inline QString anchoredPattern(const QString &expression)
{ {
return anchoredPattern(QStringView(expression)); return anchoredPattern(qToStringViewIgnoringNull(expression));
} }
#endif #endif