File indexing completed on 2024-05-05 04:39:25
0001 /* 0002 SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CMAKEIMPORTJSONJOB_H 0008 #define CMAKEIMPORTJSONJOB_H 0009 0010 #include "cmakeprojectdata.h" 0011 #include <util/path.h> 0012 0013 #include <KJob> 0014 0015 #include <QFutureWatcher> 0016 0017 class CMakeFolderItem; 0018 0019 struct ImportData { 0020 CMakeFilesCompilationData compilationData; 0021 QHash<KDevelop::Path, QVector<CMakeTarget>> targets; 0022 QVector<CMakeTest> testSuites; 0023 }; 0024 0025 namespace KDevelop 0026 { 0027 class IProject; 0028 class ReferencedTopDUContext; 0029 } 0030 0031 class CMakeImportJsonJob : public KJob 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 enum Error { 0037 FileMissingError = UserDefinedError, ///< JSON file was not found 0038 ReadError ///< Failed to read the JSON file 0039 }; 0040 0041 CMakeImportJsonJob(KDevelop::IProject* project, QObject* parent); 0042 ~CMakeImportJsonJob() override; 0043 0044 void start() override; 0045 0046 KDevelop::IProject* project() const; 0047 0048 CMakeProjectData projectData() const; 0049 0050 private Q_SLOTS: 0051 void importCompileCommandsJsonFinished(); 0052 0053 private: 0054 KDevelop::IProject* m_project; 0055 QFutureWatcher<ImportData> m_futureWatcher; 0056 0057 CMakeProjectData m_data; 0058 }; 0059 0060 #endif // CMAKEIMPORTJSONJOB_H