File indexing completed on 2024-05-05 04:39:26
0001 /* 0002 SPDX-FileCopyrightText: 2017 Aleix Pol <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CMAKESERVER_H 0008 #define CMAKESERVER_H 0009 0010 #include <util/path.h> 0011 #include <QProcess> 0012 #include <QLocalSocket> 0013 #include "cmakecommonexport.h" 0014 0015 namespace KDevelop { class IProject; } 0016 0017 class KDEVCMAKECOMMON_EXPORT CMakeServer : public QObject 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit CMakeServer(KDevelop::IProject* project); 0022 ~CMakeServer() override; 0023 0024 bool isServerAvailable(); 0025 void sendCommand(const QJsonObject& object); 0026 0027 void handshake(const KDevelop::Path& source, const KDevelop::Path& build); 0028 void configure(const QStringList &args); 0029 void compute(); 0030 void codemodel(); 0031 0032 Q_SIGNALS: 0033 void connected(); 0034 void disconnected(); 0035 void finished(int code); 0036 void response(const QJsonObject &value); 0037 0038 private: 0039 void processOutput(); 0040 void emitResponse(const QByteArray &data); 0041 void setConnected(bool connected); 0042 0043 QLocalSocket* m_localSocket; 0044 QByteArray m_buffer; 0045 QProcess m_process; 0046 bool m_connected = false; 0047 }; 0048 0049 #endif // CMAKESERVER_H