File indexing completed on 2024-05-12 04:39:12

0001 /*
0002     SPDX-FileCopyrightText: 2014 Sergey Kalinichev <kalinichev.so.0@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef DOCUMENTFINDERHELPERS_H
0008 #define DOCUMENTFINDERHELPERS_H
0009 
0010 #include <QVector>
0011 
0012 #include <QUrl>
0013 
0014 #include "clangprivateexport.h"
0015 
0016 class QStringList;
0017 class QString;
0018 
0019 /// Helper class for handling @see IBuddyDocumentFinder features.
0020 namespace DocumentFinderHelpers
0021 {
0022 /// @return All supported mime types
0023 KDEVCLANGPRIVATE_EXPORT QStringList mimeTypesList();
0024 
0025 /**
0026  * Considers the URLs as buddy documents if the base path (without extension)
0027  * is the same, and one extension starts with h/H and the other one with c/C.
0028  * For example, foo.hpp and foo.C are buddies.
0029  */
0030 KDEVCLANGPRIVATE_EXPORT bool areBuddies(const QUrl &url1, const QUrl& url2);
0031 
0032 /// @see KDevelop::IBuddyDocumentFinder
0033 KDEVCLANGPRIVATE_EXPORT bool buddyOrder(const QUrl &url1, const QUrl& url2);
0034 
0035 /// @see KDevelop::IBuddyDocumentFinder
0036 KDEVCLANGPRIVATE_EXPORT QVector<QUrl> potentialBuddies(const QUrl& url, bool checkDUChain = true);
0037 
0038 /**
0039  * Returns path to the source file for given @p headerPath
0040  *
0041  * If no source file exists or @p headerPath is not a header an empty string is returned
0042  */
0043 KDEVCLANGPRIVATE_EXPORT QString sourceForHeader(const QString& headerPath);
0044 }
0045 
0046 #endif // DOCUMENTFINDERHELPERS_H