summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qregularexpression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-1/+1
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QRegularExpressionMatch capture-related documentationSamuel Gaist2018-12-151-1/+12
| | | | | | | | | | | | | The documentation is not explicit enough about the content of the returned list of capturedList nor the element 0 when calling captured or its friends. The first element (aka element 0) is the whole string captured when one or more groups are used. Change-Id: I3c59ebfc9f6d762dd4d8aaf8f5c0de24359f53d7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* QRegularExpression: anchor wildcard patternSamuel Gaist2018-12-151-1/+1
| | | | | | | | | | | | | | The current implementation of wildcardToRegularExpression doesn't anchor the pattern which makes it not narrow enough for globbing patterns. This patch fixes that by applying anchoredPattern before returning the wildcard pattern. [ChangeLog][QtCore][QRegularExpression] The wildcardToRegularExpression method now returns a properly anchored pattern. Change-Id: I7bee73389d408cf42499652e4fb854517a8125b5 Fixes: QTBUG-72539 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix various documentation warningsTopi Reinio2018-11-061-2/+2
| | | | | | | | | | | | These include typos, marking functions as \internal, documenting trivial things, and fixing the function signatures passed to the \fn command. Task-number: QTBUG-71502 Change-Id: I24a9e1f7e1cdb39e5c31b99202bdd593c6b789ff Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-151-6/+2
| | | | | | | | | | | We need to override this snippet for the documentation we generate for Qt for Python, and it is easier to have it on a separate file. Task-number: PYSIDE-801 Task-number: PYSIDE-691 Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Disable warnings about deprecated QRegularExpression::PatternOptionsTor Arne Vestbø2018-08-241-0/+3
| | | | | | | | | We still want to have these in the debug output for completeness, so disable the warning instead of removing the lines. Change-Id: I4291adddff486e4ea963be36ac0ebda089a66045 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Implement exact match expression builder for QRegularExpressionSamuel Gaist2018-08-191-0/+16
| | | | | | | | | | | | | | | | | QRegularExpression doesn't offer a direct equivalent of QRegExp's exact match. There are several places in the Qt sources that use this feature. This patch implements a small helper function that builds the expression as recommended in the documentation and updates the related code. [ChangeLog][Core][Tools] QRegularExpression now provides anchoredPattern() which is a helper function to build regular expressions used for exact matching. Change-Id: Idbbf142c4c5cb9b62abf8229f4ce85fd4409e5d0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: refactor wildcard translationSamuel Gaist2018-08-181-24/+35
| | | | | | | | | | | This patch refactors the wildcardToRegularExpression method to generate a simpler regular expression. It also fixes some shortcomings of the previous implementation. Tests have been updated to ensure all cases are properly supported. Change-Id: I454e3fe8fe0bb663b2f319d6fa2fa8aec626c50d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Refactor wildcard support in QRegularExpressionSamuel Gaist2018-08-161-121/+117
| | | | | | | | | | | | | | | The API originally proposed was flawed in the sense that the setter function would use a modified version of the parameter given which would have make it a black box for the user. This patch fixes that by removing that setter and providing a static method that will return the pattern suitably modified to be used by QRegularExpression the same way the escape method does. [ChangeLog][Core][QRegularExpression] Implemented support for wildcard patterns through a static method. Change-Id: I0054bcaffd7525dac569f54fa81f73b7e4544b2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: minor code tidiesGiuseppe D'Angelo2018-06-231-6/+6
| | | | | | | Use nullptr, clarify comments. Change-Id: Ib5f5879d8281cc455635513f82ff8c4bdb951ea8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: refactor pattern optimizationGiuseppe D'Angelo2018-06-221-75/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the move to PCRE2, optimizing patterns has been a thorn in the side due to the fact that PCRE2's JIT compiler modifies the pattern object itself (instead of returning a new set of data, like PCRE1 did). To make this fit with the existing behavior, a read/write lock was introduced, with the read part locking when matching and the write when compiling (or JIT-compiling) the pattern. This locking strategy however introduced a performance issue, as we needed: * to acquire a write lock to compile/optimize the pattern (incl. the common case where the pattern was already compiled, so bailing out immediately); * to acquire a read lock during the actual match, to prevent some other thread from optimizing the pattern under our nose. This was due to the "lazy" optimization policy of QRegularExpression -- optimize a pattern after a certain number of usages. The excessive amount of locking effectively limited scalability. Simplify the code, and drop that policy altogether: since JIT compiling in PCRE2 is faster and pretty much "always recommended", just always do it for any pattern (unless it gets disabled via env variables) when compiling it. This allows to go back to a plain QMutex, and now the actual matching doesn't require acquiring any locks any longer. Of course, there is still a mutex acquired just before matching for checking whether the pattern needs recompiling in the first place; this can probably be further optimized via double-checked locking (using atomics), but not doing it right now. This shift makes a couple of pattern options controlling optimization useless, and allows to centralize the 3 QRegularExpression tests (which were actually the very same test, just setting slightly different optimizations strategies). While at it, install a stress-test for threading, with the idea of running it under TSAN or helgrind to catch bugs in QRegularExpression's locking. [ChangeLog][Important Behavior Changes][QRegularExpression] Regular expressions are now automatically optimized (including JIT compiling) on their first usage. The pattern options OptimizeOnFirstUsageOption and DontAutomaticallyOptimizeOption no longer have any effect, and will get removed in a future version of Qt. QRegularExpression::optimize() can be still used to compile and optimize the regular expression in advance (before any match), if needed. Task-number: QTBUG-66781 Change-Id: Ia0e97208ae78255fe811b78029ed01c204e47bd2 Reviewed-by: David Faure <david.faure@kdab.com>
* Add wildcard-to-regexp support to QRegularExpressionSamuel Gaist2018-03-301-0/+118
| | | | | | | | | | | | | | | | | | This method will make QRegularExpression on par with QRegExp and will allow to replace this class when a wildcard expression can be set through an API (e.g. QSortFilterProxyModel::setFilterWildcard). For other use cases, see QTBUG-34052. [ChangeLog][QRegularExpression] Implemented support for wildcard patterns. Warning: QRegularExpression might not give the exact same result as QRegExp as its implementation follows strictly the glob patterns definition for the wildcard expressions. Change-Id: I5ed4617ca679159430c3d46da3449f6b3100e366 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Modernize the "regularexpression" featureUlf Hermann2018-03-201-4/+0
| | | | | | | | | | | | | Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-9/+26
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Doc: Clarify the porting notes from QRegExp to QRegularExpressionFriedemann Kleint2017-04-071-9/+26
| | | | | | | | | | | | | | | | | | | | Add a small table to illustrate the results exactMatch() and split out the part on partial matching to a separate section since it is less common. Change-Id: Ifbd5c3cbd1d8c0ee9e8b2d58ed13f40776b03762 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Use qToStringViewIgnoringNull() where applicableMarc Mutz2017-04-191-5/+5
| | | | | | | | | | | | | | | | | | Saves just over ¼KiB in QtCore text size on optimized GCC 6.1 Linux AMD64 builds, iow: qToStringViewIgnoringNull() saves ~40B per use. Change-Id: I3278306d5ce594e8ccd0f58b8f8d0319637d1b2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QRegularExpression: streamline some wording in the documentationGiuseppe D'Angelo2017-04-111-19/+30
| | | | | | | | | | | | Change-Id: Ic1adbf9358ef6fbdaaee52471cd8ed9ca895a9d0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devLiang Qi2017-04-041-1/+1
|\|
| * Prefer rvalue versions of toLatin() and toUtf8()Anton Kudryavtsev2017-03-301-1/+1
| | | | | | | | | | | | | | ... to re-use existing buffers. Change-Id: I7c42529b8cd4400520a59e658ab76f4f8e965cd4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpressionMatch: add QStringView-related functionsGiuseppe D'Angelo2017-04-041-12/+129
|/ | | | | Change-Id: Ia81ba131cc2c7f56acb3312fbc7d62ffe5e18da4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QRegularExpression: build fixGiuseppe D'Angelo2017-03-021-0/+2
| | | | | | | | | Latest PCRE2 versions require a macro to be defined before including pcre2.h, so do it. Task-number: QTBUG-59226 Change-Id: I472ff557e29d1212fdcd99454778551323be4d4b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* PCRE2: port QRegularExpression to PCRE2Giuseppe D'Angelo2016-12-121-233/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCRE1 is going towards EOL. PCRE2 is the way forward in terms of new features, performance, and security improvements. The APIs that QRegularExpression uses are similar so the required modifications aren't extensive. The biggest difference comes to JIT-compiling of the pattern. In PCRE1, JIT-compiling did not modify the processed PCRE pattern, but returned a new chunk of data. This allowed multiple threads to keep matching using the same processed data and NULL for the JIT data, until a thread JIT-compiled and atomically set the shared JIT data to the results of the compilation. In PCRE2, JIT-compiling _modifies_ the processed PCRE pattern in a way that it's thread unsafe [1]; the results of JIT-compilation are stored somewhere inside the processed pattern. This means the above approach cannot work -- a thread may be matching while another one JIT-compiles, causing a data race. While waiting for better workarounds from upstream, employ a read/write mutex to protect the matching from JIT-compilation. [1] https://lists.exim.org/lurker/message/20160104.105831.3cb25b39.en.html [ChangeLog][General] QRegularExpression now requires the PCRE2 library, at least version 10.20. Support for the PCRE1 library has been dropped. A copy of PCRE2 is shipped with Qt and will automatically be used on those platforms which lack it. Change-Id: I9fe11104230a096796df2d0bdcea861acf769f57 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-221-1/+1
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/qeglfshooks.cpp Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
| * Fix some typos in docs and apidocsFrederik Schwarzer2016-10-211-1/+1
| | | | | | | | | | | | | | | | While "commonest" is still correct English, it's rather old-fashioned and "most common" predominates Qt's wording style. Change-Id: I20d72c098ee40b2a89f91e42f7208fe5b87286a2 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-5/+5
| | | | | | | Use character literals where applicable. Change-Id: I8e198774c2247c1cc1d852a41b59b301199b7878 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-08-261-24/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/snippets/code/doc_src_qmake-manual.pro qmake/doc/src/qmake-manual.qdoc src/corelib/io/qstorageinfo_unix.cpp src/corelib/tools/qbytearray.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp tests/auto/network/access/qnetworkreply/BLACKLIST Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
| * QRegularExpression: fix matching over QStringRefsGiuseppe D'Angelo2015-08-181-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing with the offset argument of pcre_exec is not equivalent to adjusting the pointer to the subject string. In particular, PCRE can go behind the offset to check for lookbehinds or "transition" metacharacters (\b, \B, etc.). This made the code that deals with QStringRefs not matching in behavior with the corresponding code dealing with QStrings. For instance, QString subject("Miss"); QRegularExpression re("(?<=M)iss"); re.match(subject.mid(1)); // doesn't match re.match(subject.midRef(1)); // matches!!! Instead, actually adjust the pointer to the subject string so that the behavior is identical. A broken test that relied on the equivalence is also removed. Change-Id: If96333241ef59621d7f5a6a170ebd0a186844874 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | core: Add several QList::reserve() calls.Sérgio Martins2015-06-111-1/+2
| | | | | | | | | | | | | | Reduces reallocations. Change-Id: Ib63539fb690a80245d8fe81ff8468e79ffa8e57c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-031-0/+20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qnamespace.qdoc src/corelib/io/qwindowspipereader.cpp src/corelib/io/qwindowspipereader_p.h src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/plugins/platforms/xcb/qxcbconnection.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/tools/qmake/tst_qmake.cpp tests/manual/touch/main.cpp Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
| * Doc: added doc to undocumented functionsNico Vertriest2015-05-181-0/+20
| | | | | | | | | | | | | | Task-number: QTBUG-36985 Change-Id: Ia98654f88cf5da77245b3fcd903b860d12862fc2 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Add qHash(QRegExp) and qHash(QRegularExpression)Marc Mutz2015-05-051-0/+16
|/ | | | | | | | | | | | | | | | QReg*Exp*s can be compared for equality, so qHash should be overloaded, too. There was a (poor) private implementation of qHash(QRegExpEngineKey) already, which has now been replaced with a better one (the old one didn't take into account all the fields that make up equality, producing unnecessary collisions). [ChangeLog][QtCore][QRegExp] Added qHash(QRegExp). [ChangeLog][QtCore][QRegularExpression] Added qHash(QRegularExpression). Change-Id: I1d22fbcc0508018a3f94b4c24571b13ba6e07df2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QRegularExpression: add error strings from PCRE 8.37Giuseppe D'Angelo2015-05-011-1/+2
| | | | | | | Change-Id: Id62abd91c1584e4e63b95afec0520995125fe807 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-4/+7
| | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-091-9/+9
|\ | | | | | | Change-Id: I05fcd8dc66d9ad0dc76bb7f5bae05c9876bfba14
| * Doc: Use title case in section1 titlesNico Vertriest2014-09-301-9/+9
| | | | | | | | | | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+15
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
| * Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-0/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Fix QT_NO_REGULAREXPRESSION buildSérgio Martins2014-08-131-0/+4
| | | | | | | | | | | | | | | Change-Id: Ibf1358733d7c5aa2c14cf46c23a24ba4da14143c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QRegularExpression: add overloads matching over a QStringRefGiuseppe D'Angelo2014-09-021-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QRegularExpression] Support for matching using QStringRef as the subject's string type has been added. Change-Id: Idb956bbbdf4213f9ebe035db32cd37cf3370c6bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QRegularExpression: take into account the subject's start position and offsetGiuseppe D'Angelo2014-09-021-24/+53
|/ / | | | | | | | | | | | | This will enable the matching over QStringRefs. Change-Id: I77729433d201982659a8c2aab939b2d15f1c8aca Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-071-0/+1
| | | | | | | | | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: make optimize() constGiuseppe D'Angelo2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Revert "QRegularExpression: lock a mutex only if there's actual work to do"Giuseppe D'Angelo2014-07-131-2/+2
| | | | | | | | | | | | | | | | | | | | Blunder -- two threads may step into this method together, both see not studied, and both study (with one leaking its study data). This reverts commit 5fbd787cf9a72621d66604a4898f06ea4365226e. Change-Id: Ia746925abcad1e43adf4f6f1d495b018de022b07 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | QRegularExpression: allow users to skip the UTF-16 check of the subject stringGiuseppe D'Angelo2014-05-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCRE does not handle invalid UTF-16 sequences. For this reason we always check a subject string's UTF-16 validity before attempting any match over it (actually we let PCRE do that). The only exception so far has been global matching -- once the first match was done, we skipped re-doing the check over and over again the same string (PCRE actually checks the /entire/ string, not only the part it uses for matching). Still, users had no way to skip this check if they were 100% sure the string was a valid UTF-16 string. This commit introduces a way for them to skip the check. Change-Id: Iea352c06f531aa2153863b3a1681acaab7ac375c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: remove a boolean trap in private APIGiuseppe D'Angelo2014-05-061-6/+12
| | | | | | | | | | | | | | Small improvement to the code by using an enum instead of a boolean. Change-Id: Ib792cf97224b5204fd36ca215387fc7be34f2c32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: lock a mutex only if there's actual work to doGiuseppe D'Angelo2014-05-061-2/+2
| | | | | | | | | | | | | | | | | | We can do the (atomic) test of studyData before locking the mutex protecting the entire function body. Change-Id: I3006e3a0028608f21668ddaebe8a799aed56362f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QRegularExpression: add an option to prevent automatic optimizationGiuseppe D'Angelo2014-05-061-7/+25
| | | | | | | | | | | | | | | | | | | | If a user doesn't like that QRegularExpression might do an uncontrolled CPU/memory spike when it decides to optimize a pattern, offer a way to disable the automatic optimization. Change-Id: I38a98a3bfb239cfad9f977b0eeb75903268e747f Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>