forked from qt-creator/qt-creator
Find Symbols: Use QRegularExpression instead of QRegExp
This makes it more consistent with the other find filters. Change-Id: I39ad144d66091c3ccc5e4452009cc236165915ea Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -46,6 +46,7 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
@@ -281,11 +282,13 @@ public:
|
|||||||
CPlusPlus::Snapshot::const_iterator it = m_snapshot.begin();
|
CPlusPlus::Snapshot::const_iterator it = m_snapshot.begin();
|
||||||
|
|
||||||
QString findString = (m_parameters.flags & Core::FindRegularExpression
|
QString findString = (m_parameters.flags & Core::FindRegularExpression
|
||||||
? m_parameters.text : QRegExp::escape(m_parameters.text));
|
? m_parameters.text : QRegularExpression::escape(m_parameters.text));
|
||||||
if (m_parameters.flags & Core::FindWholeWords)
|
if (m_parameters.flags & Core::FindWholeWords)
|
||||||
findString = QString::fromLatin1("\\b%1\\b").arg(findString);
|
findString = QString::fromLatin1("\\b%1\\b").arg(findString);
|
||||||
QRegExp matcher(findString, (m_parameters.flags & Core::FindCaseSensitively
|
QRegularExpression matcher(findString, (m_parameters.flags & Core::FindCaseSensitively
|
||||||
? Qt::CaseSensitive : Qt::CaseInsensitive));
|
? QRegularExpression::NoPatternOption
|
||||||
|
: QRegularExpression::CaseInsensitiveOption));
|
||||||
|
matcher.optimize();
|
||||||
while (it != m_snapshot.end()) {
|
while (it != m_snapshot.end()) {
|
||||||
if (future.isPaused())
|
if (future.isPaused())
|
||||||
future.waitForResume();
|
future.waitForResume();
|
||||||
@@ -294,7 +297,7 @@ public:
|
|||||||
if (m_fileNames.isEmpty() || m_fileNames.contains(it.value()->fileName())) {
|
if (m_fileNames.isEmpty() || m_fileNames.contains(it.value()->fileName())) {
|
||||||
QVector<Core::SearchResultItem> resultItems;
|
QVector<Core::SearchResultItem> resultItems;
|
||||||
auto filter = [&](const IndexItem::Ptr &info) -> IndexItem::VisitorResult {
|
auto filter = [&](const IndexItem::Ptr &info) -> IndexItem::VisitorResult {
|
||||||
if (matcher.indexIn(info->symbolName()) != -1) {
|
if (matcher.match(info->symbolName()).hasMatch()) {
|
||||||
QString text = info->symbolName();
|
QString text = info->symbolName();
|
||||||
QString scope = info->symbolScope();
|
QString scope = info->symbolScope();
|
||||||
if (info->type() == IndexItem::Function) {
|
if (info->type() == IndexItem::Function) {
|
||||||
|
Reference in New Issue
Block a user