File indexing completed on 2024-05-12 04:38:07

0001 /*
0002     SPDX-FileCopyrightText: 2014 Sven Brauch <svenbrauch@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_ABBREVIATIONS_H
0008 #define KDEVPLATFORM_ABBREVIATIONS_H
0009 
0010 #include <QVarLengthArray>
0011 
0012 #include <language/languageexport.h>
0013 
0014 class QStringList;
0015 class QStringRef;
0016 class QString;
0017 
0018 namespace KDevelop {
0019 class Path;
0020 
0021 KDEVPLATFORMLANGUAGE_EXPORT bool matchesAbbreviation(const QStringRef& word, const QString& typed);
0022 
0023 KDEVPLATFORMLANGUAGE_EXPORT bool matchesPath(const QString& path, const QString& typed);
0024 
0025 /**
0026  * @brief Matches a word against a list of search fragments.
0027  * The word will be split at separation characters (space, / and ::) and
0028  * the resulting fragments will be matched one-by-one against the typed fragments.
0029  * If all typed fragments can be matched against a fragment in word in the right order
0030  * (skipping is allowed), true will be returned.
0031  * @param word the word to search in
0032  * @param typedFragments the fragments which were typed
0033  * @return bool true if match, else false
0034  */
0035 KDEVPLATFORMLANGUAGE_EXPORT bool matchesAbbreviationMulti(const QString& word, const QStringList& typedFragments);
0036 
0037 /**
0038  * @brief Matches a path against a list of search fragments.
0039  * @return -1 when no match is found, otherwise a positive integer, higher values mean lower quality
0040  */
0041 KDEVPLATFORMLANGUAGE_EXPORT int matchPathFilter(const Path& toFilter, const QStringList& text, const Path& prefixPath);
0042 }
0043 
0044 #endif