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>
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only 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;
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-19 13:04:25 +02:00
|
|
|
static QRegularExpression createRegExp(
|
|
|
|
|
const QString &pattern,
|
|
|
|
|
CaseSensitivity caseSensitivity = CaseSensitivity::CaseInsensitive,
|
|
|
|
|
bool multiWord = false);
|
2017-10-30 20:50:11 +02:00
|
|
|
static QRegularExpression createRegExp(const QString &pattern,
|
2022-09-19 13:04:25 +02:00
|
|
|
Qt::CaseSensitivity caseSensitivity,
|
|
|
|
|
bool multiWord);
|
2017-07-24 20:55:47 +02:00
|
|
|
static HighlightingPositions highlightingPositions(const QRegularExpressionMatch &match);
|
2017-07-26 14:08:26 +02:00
|
|
|
};
|