1 /*
2     SPDX-FileCopyrightText: 2011 David Nolden <david.nolden.kdevelop@art-master.de>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef KDEVPLATFORM_PROJECTUTILS_H
8 #define KDEVPLATFORM_PROJECTUTILS_H
9 
10 #include "projectexport.h"
11 
12 #include <interfaces/context.h>
13 
14 #include <QList>
15 
16 #include <functional>
17 
18 class QMenu;
19 
20 namespace KDevelop {
21 
22 class ProjectBaseItem;
23 class ProjectFileItem;
24 
25 // TODO: Move to own header? Rename to ProjectItemContext and remove original from context.h?
26 class KDEVPLATFORMPROJECT_EXPORT ProjectItemContextImpl : public ProjectItemContext
27 {
28 public:
29     explicit ProjectItemContextImpl(const QList<ProjectBaseItem*>& items);
30 
31     QList<QUrl> urls() const override;
32 
33 private:
34     Q_DISABLE_COPY(ProjectItemContextImpl)
35 };
36 
37 /**
38  * Runs the @p callback on all files that have @p projectItem as ancestor
39  */
40 KDEVPLATFORMPROJECT_EXPORT void forEachFile(const ProjectBaseItem* projectItem,
41                                             const std::function<void(ProjectFileItem*)>& callback);
42 
43 /**
44  * Returns all the files that have @p projectItem as ancestor
45  */
46 KDEVPLATFORMPROJECT_EXPORT QList<ProjectFileItem*> allFiles(const ProjectBaseItem* projectItem);
47 }
48 
49 #endif // KDEVPLATFORM_PROJECTUTILS_H
50