2017-07-26 14:08:26 +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>
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
};
|