Clang: Decouple ConnectionClient and ClangCodeModel*

We want to reuse the connection client in other plugins. This is the first
step, the next step is refactoring the IPC mechanismn and move it up to
the IpcServer- and IpcClientInterface.

Change-Id: I6eb6db1e9bc18232c8df350a6303afd2edc68da8
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Marco Bubke
2016-07-04 14:55:58 +02:00
committed by Tim Jenssen
parent e6fa92e58c
commit c5e79f6269
14 changed files with 278 additions and 29 deletions

View File

@@ -49,7 +49,7 @@ class CMBIPC_EXPORT ConnectionClient : public QObject
Q_OBJECT
public:
ConnectionClient(ClangCodeModelClientInterface *client);
ConnectionClient();
~ConnectionClient();
void startProcessAndConnectToServerAsynchronously();
@@ -72,14 +72,18 @@ public:
bool waitForEcho();
bool waitForConnected();
ClangCodeModelServerProxy &serverProxy();
QProcess *processForTestOnly() const;
signals:
void connectedToLocalSocket();
void processFinished();
protected:
QIODevice *ioDevice();
virtual void sendEndCommand() = 0;
virtual void resetCounter() = 0;
private:
std::unique_ptr<QProcess> startProcess();
void finishProcess(std::unique_ptr<QProcess> &&process);
@@ -107,14 +111,13 @@ private:
private:
mutable std::unique_ptr<QProcess> process_;
QLocalSocket localSocket;
ClangCodeModelServerProxy serverProxy_;
QTimer processAliveTimer;
QString processPath_;
bool isAliveTimerResetted = false;
bool processIsStarting = false;
LinePrefixer stdErrPrefixer;
LinePrefixer stdOutPrefixer;
LinePrefixer stdErrPrefixer = QByteArrayLiteral("clangbackend.stderr: ");
LinePrefixer stdOutPrefixer = QByteArrayLiteral("clangbackend.stdout: ");
};
} // namespace ClangBackEnd