QRegularExpression: make optimize() const

Although it may seem strange that such a method is const,
optimizing doesn't affect the user-visible part of the object.

Moreover, *not* having it const makes it asymmetrical with other
methods (such as match()) which are const, and under certain
conditions optimize as well.

Change-Id: I0cd8d4a6909d00629fcc65c1c3a1f011f31db782
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Giuseppe D'Angelo 2014-07-13 17:08:31 +02:00
parent 972a653a86
commit b84699ae1b
2 changed files with 2 additions and 2 deletions

View File

@ -1731,7 +1731,7 @@ QRegularExpressionMatchIterator QRegularExpression::globalMatch(const QString &s
\sa QRegularExpression::OptimizeOnFirstUsageOption
*/
void QRegularExpression::optimize()
void QRegularExpression::optimize() const
{
if (!isValid()) // will compile the pattern
return;

View File

@ -125,7 +125,7 @@ public:
MatchType matchType = NormalMatch,
MatchOptions matchOptions = NoMatchOption) const;
void optimize();
void optimize() const;
static QString escape(const QString &str);