diff options
Diffstat (limited to 'src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h')
-rw-r--r-- | src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h index 25d0022dbe..a8578522cb 100644 --- a/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h +++ b/src/libs/3rdparty/syntax-highlighting/src/lib/keywordlist_p.h @@ -1,32 +1,16 @@ /* - Copyright (C) 2016 Volker Krause <vkrause@kde.org> - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> + SPDX-FileCopyrightText: 2020 Jonathan Poelen <jonathan.poelen@gmail.com> + + SPDX-License-Identifier: MIT */ #ifndef KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H #define KSYNTAXHIGHLIGHTING_KEYWORDLIST_P_H -#include <QSet> #include <QString> -#include <QVector> +#include <QStringList> +#include <QStringView> #include <vector> @@ -34,8 +18,8 @@ QT_BEGIN_NAMESPACE class QXmlStreamReader; QT_END_NAMESPACE -namespace KSyntaxHighlighting { - +namespace KSyntaxHighlighting +{ class Repository; class DefinitionData; @@ -60,14 +44,27 @@ public: return m_keywords; } + Qt::CaseSensitivity caseSensitivity() const + { + return m_caseSensitive; + } + + void setKeywordList(const QStringList &keywords) + { + m_keywords = keywords; + m_keywordsSortedCaseSensitive.clear(); + m_keywordsSortedCaseInsensitive.clear(); + initLookupForCaseSensitivity(m_caseSensitive); + } + /** Checks if @p str is a keyword in this list. */ - bool contains(const QStringRef &str) const + bool contains(QStringView str) const { return contains(str, m_caseSensitive); } /** Checks if @p str is a keyword in this list, overriding the global case-sensitivity setting. */ - bool contains(const QStringRef &str, Qt::CaseSensitivity caseSensitive) const; + bool contains(QStringView str, Qt::CaseSensitivity caseSensitive) const; void load(QXmlStreamReader &reader); void setCaseSensitivity(Qt::CaseSensitivity caseSensitive); @@ -98,12 +95,12 @@ private: /** * case-sensitive sorted string references to m_keywords for lookup */ - std::vector<QStringRef> m_keywordsSortedCaseSensitive; + std::vector<QStringView> m_keywordsSortedCaseSensitive; /** * case-insensitive sorted string references to m_keywords for lookup */ - std::vector<QStringRef> m_keywordsSortedCaseInsensitive; + std::vector<QStringView> m_keywordsSortedCaseInsensitive; }; } |