2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
|
// Copyright (C) 2017 BlackBerry Limited <qt@blackberry.com>
|
|
|
|
|
// Copyright (C) 2017 Andre Hartmann <aha_1980@gmx.de>
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2017-07-26 14:08:26 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
2017-07-24 20:55:47 +02:00
|
|
|
#include <QVector>
|
|
|
|
|
|
2017-07-26 14:08:26 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
2017-07-27 06:44:35 +02:00
|
|
|
class QRegularExpression;
|
2017-07-24 20:55:47 +02:00
|
|
|
class QRegularExpressionMatch;
|
2017-07-26 14:08:26 +02:00
|
|
|
class QString;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2017-10-30 20:50:11 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT FuzzyMatcher
|
2017-07-26 14:08:26 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum class CaseSensitivity {
|
|
|
|
|
CaseInsensitive,
|
|
|
|
|
CaseSensitive,
|
|
|
|
|
FirstLetterCaseSensitive
|
|
|
|
|
};
|
|
|
|
|
|
2017-07-24 20:55:47 +02:00
|
|
|
class HighlightingPositions {
|
|
|
|
|
public:
|
|
|
|
|
QVector<int> starts;
|
|
|
|
|
QVector<int> lengths;
|
|
|
|
|
};
|
|
|
|
|
|
2017-10-30 20:50:11 +02:00
|
|
|
static QRegularExpression createRegExp(const QString &pattern,
|
2017-07-26 14:08:26 +02:00
|
|
|
CaseSensitivity caseSensitivity = CaseSensitivity::CaseInsensitive);
|
2019-07-14 08:10:50 +02:00
|
|
|
static QRegularExpression createRegExp(const QString &pattern,
|
|
|
|
|
Qt::CaseSensitivity caseSensitivity);
|
2017-07-24 20:55:47 +02:00
|
|
|
static HighlightingPositions highlightingPositions(const QRegularExpressionMatch &match);
|
2017-07-26 14:08:26 +02:00
|
|
|
};
|