File indexing completed on 2024-04-28 04:37:05
0001 /* 0002 SPDX-FileCopyrightText: 2011 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PROJECTUTILS_H 0008 #define KDEVPLATFORM_PROJECTUTILS_H 0009 0010 #include "projectexport.h" 0011 0012 #include <interfaces/context.h> 0013 0014 #include <QList> 0015 0016 #include <functional> 0017 0018 class QMenu; 0019 0020 namespace KDevelop { 0021 0022 class ProjectBaseItem; 0023 class ProjectFileItem; 0024 0025 // TODO: Move to own header? Rename to ProjectItemContext and remove original from context.h? 0026 class KDEVPLATFORMPROJECT_EXPORT ProjectItemContextImpl : public ProjectItemContext 0027 { 0028 public: 0029 explicit ProjectItemContextImpl(const QList<ProjectBaseItem*>& items); 0030 0031 QList<QUrl> urls() const override; 0032 0033 private: 0034 Q_DISABLE_COPY(ProjectItemContextImpl) 0035 }; 0036 0037 /** 0038 * Runs the @p callback on all files that have @p projectItem as ancestor 0039 */ 0040 KDEVPLATFORMPROJECT_EXPORT void forEachFile(const ProjectBaseItem* projectItem, 0041 const std::function<void(ProjectFileItem*)>& callback); 0042 0043 /** 0044 * Returns all the files that have @p projectItem as ancestor 0045 */ 0046 KDEVPLATFORMPROJECT_EXPORT QList<ProjectFileItem*> allFiles(const ProjectBaseItem* projectItem); 0047 } 0048 0049 #endif // KDEVPLATFORM_PROJECTUTILS_H