forked from qt-creator/qt-creator
Clang: Rename Ipc* in ClangCodeModel*
We want to share more functionality of the IPC mechanism and for what we need more interface classes. But we use this names already for the ClangCodeModel implementation. So we rename the them to ClangCodeModel*. Change-Id: Ie320e0d3b993586a9bcc6a5aa0d32427af41202e Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -8,19 +8,19 @@ QT += network
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
SOURCES += $$PWD/ipcserverinterface.cpp \
|
||||
$$PWD/ipcserverproxy.cpp \
|
||||
$$PWD/ipcclientinterface.cpp \
|
||||
SOURCES += $$PWD/clangcodemodelserverinterface.cpp \
|
||||
$$PWD/clangcodemodelserverproxy.cpp \
|
||||
$$PWD/clangcodemodelclientinterface.cpp \
|
||||
$$PWD/cmbendmessage.cpp \
|
||||
$$PWD/cmbalivemessage.cpp \
|
||||
$$PWD/ipcclientproxy.cpp \
|
||||
$$PWD/clangcodemodelclientproxy.cpp \
|
||||
$$PWD/writemessageblock.cpp \
|
||||
$$PWD/readmessageblock.cpp \
|
||||
$$PWD/ipcinterface.cpp \
|
||||
$$PWD/connectionserver.cpp \
|
||||
$$PWD/connectionclient.cpp \
|
||||
$$PWD/cmbechomessage.cpp \
|
||||
$$PWD/ipcclientdispatcher.cpp \
|
||||
$$PWD/clangcodemodelclientdispatcher.cpp \
|
||||
$$PWD/cmbregistertranslationunitsforeditormessage.cpp \
|
||||
$$PWD/filecontainer.cpp \
|
||||
$$PWD/cmbunregistertranslationunitsforeditormessage.cpp \
|
||||
@@ -51,19 +51,19 @@ SOURCES += $$PWD/ipcserverinterface.cpp \
|
||||
$$PWD/messageenvelop.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/ipcserverinterface.h \
|
||||
$$PWD/ipcserverproxy.h \
|
||||
$$PWD/ipcclientinterface.h \
|
||||
$$PWD/clangcodemodelserverinterface.h \
|
||||
$$PWD/clangcodemodelserverproxy.h \
|
||||
$$PWD/clangcodemodelclientinterface.h \
|
||||
$$PWD/cmbendmessage.h \
|
||||
$$PWD/cmbalivemessage.h \
|
||||
$$PWD/ipcclientproxy.h \
|
||||
$$PWD/clangcodemodelclientproxy.h \
|
||||
$$PWD/writemessageblock.h \
|
||||
$$PWD/readmessageblock.h \
|
||||
$$PWD/ipcinterface.h \
|
||||
$$PWD/connectionserver.h \
|
||||
$$PWD/connectionclient.h \
|
||||
$$PWD/cmbechomessage.h \
|
||||
$$PWD/ipcclientdispatcher.h \
|
||||
$$PWD/clangcodemodelclientdispatcher.h \
|
||||
$$PWD/cmbregistertranslationunitsforeditormessage.h \
|
||||
$$PWD/filecontainer.h \
|
||||
$$PWD/cmbunregistertranslationunitsforeditormessage.h \
|
||||
|
||||
@@ -23,59 +23,59 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "ipcclientdispatcher.h"
|
||||
#include "clangcodemodelclientdispatcher.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
void IpcClientDispatcher::addClient(IpcClientInterface *client)
|
||||
void ClangCodeModelClientDispatcher::addClient(ClangCodeModelClientInterface *client)
|
||||
{
|
||||
clients.append(client);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::removeClient(IpcClientInterface *client)
|
||||
void ClangCodeModelClientDispatcher::removeClient(ClangCodeModelClientInterface *client)
|
||||
{
|
||||
clients.removeOne(client);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::alive()
|
||||
void ClangCodeModelClientDispatcher::alive()
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->alive();
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::echo(const EchoMessage &message)
|
||||
void ClangCodeModelClientDispatcher::echo(const EchoMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->echo(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::codeCompleted(const CodeCompletedMessage &message)
|
||||
void ClangCodeModelClientDispatcher::codeCompleted(const CodeCompletedMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->codeCompleted(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
|
||||
void ClangCodeModelClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->translationUnitDoesNotExist(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
|
||||
void ClangCodeModelClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->projectPartsDoNotExist(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
||||
void ClangCodeModelClientDispatcher::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->diagnosticsChanged(message);
|
||||
}
|
||||
|
||||
void IpcClientDispatcher::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
void ClangCodeModelClientDispatcher::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
{
|
||||
for (auto *client : clients)
|
||||
client->highlightingChanged(message);
|
||||
@@ -25,17 +25,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ipcclientinterface.h"
|
||||
#include "clangcodemodelclientinterface.h"
|
||||
|
||||
#include <QVector>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT IpcClientDispatcher : public ClangBackEnd::IpcClientInterface
|
||||
class CMBIPC_EXPORT ClangCodeModelClientDispatcher : public ClangBackEnd::ClangCodeModelClientInterface
|
||||
{
|
||||
public:
|
||||
void addClient(IpcClientInterface *client);
|
||||
void removeClient(IpcClientInterface *client);
|
||||
void addClient(ClangCodeModelClientInterface *client);
|
||||
void removeClient(ClangCodeModelClientInterface *client);
|
||||
|
||||
void alive() override;
|
||||
void echo(const EchoMessage &message) override;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void highlightingChanged(const HighlightingChangedMessage &message) override;
|
||||
|
||||
private:
|
||||
QVector<IpcClientInterface*> clients;
|
||||
QVector<ClangCodeModelClientInterface*> clients;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "ipcclientinterface.h"
|
||||
#include "clangcodemodelclientinterface.h"
|
||||
|
||||
#include "cmbcodecompletedmessage.h"
|
||||
#include "cmbechomessage.h"
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
{
|
||||
switch (messageEnvelop.messageType()) {
|
||||
case MessageType::AliveMessage:
|
||||
@@ -63,7 +63,7 @@ void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
highlightingChanged(messageEnvelop.message<HighlightingChangedMessage>());
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Unknown IpcClientMessage";
|
||||
qWarning() << "Unknown ClangCodeModelClientMessage";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class IpcServerInterface;
|
||||
class ClangCodeModelServerInterface;
|
||||
class RegisterTranslationUnitForEditorMessage;
|
||||
class UpdateTranslationUnitsForEditorMessage;
|
||||
class RegisterProjectPartsForEditorMessage;
|
||||
@@ -48,7 +48,7 @@ class UpdateVisibleTranslationUnitsMessage;
|
||||
class RequestHighlightingMessage;
|
||||
class HighlightingChangedMessage;
|
||||
|
||||
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
|
||||
class CMBIPC_EXPORT ClangCodeModelClientInterface : public IpcInterface
|
||||
{
|
||||
public:
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "ipcclientproxy.h"
|
||||
#include "clangcodemodelclientproxy.h"
|
||||
|
||||
#include "cmbalivemessage.h"
|
||||
#include "cmbcodecompletedmessage.h"
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "cmbregistertranslationunitsforeditormessage.h"
|
||||
#include "diagnosticschangedmessage.h"
|
||||
#include "highlightingchangedmessage.h"
|
||||
#include "ipcserverinterface.h"
|
||||
#include "clangcodemodelserverinterface.h"
|
||||
#include "messageenvelop.h"
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "translationunitdoesnotexistmessage.h"
|
||||
@@ -43,16 +43,16 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
IpcClientProxy::IpcClientProxy(IpcServerInterface *server, QIODevice *ioDevice)
|
||||
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice)
|
||||
: writeMessageBlock(ioDevice),
|
||||
readMessageBlock(ioDevice),
|
||||
server(server),
|
||||
ioDevice(ioDevice)
|
||||
{
|
||||
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcClientProxy::readMessages();});
|
||||
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {ClangCodeModelClientProxy::readMessages();});
|
||||
}
|
||||
|
||||
IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
|
||||
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelClientProxy &&other)
|
||||
: writeMessageBlock(std::move(other.writeMessageBlock)),
|
||||
readMessageBlock(std::move(other.readMessageBlock)),
|
||||
server(std::move(other.server)),
|
||||
@@ -61,7 +61,7 @@ IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
|
||||
|
||||
}
|
||||
|
||||
IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
|
||||
ClangCodeModelClientProxy &ClangCodeModelClientProxy::operator=(ClangCodeModelClientProxy &&other)
|
||||
{
|
||||
writeMessageBlock = std::move(other.writeMessageBlock);
|
||||
readMessageBlock = std::move(other.readMessageBlock);
|
||||
@@ -71,48 +71,48 @@ IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void IpcClientProxy::alive()
|
||||
void ClangCodeModelClientProxy::alive()
|
||||
{
|
||||
writeMessageBlock.write(AliveMessage());
|
||||
}
|
||||
|
||||
void IpcClientProxy::echo(const EchoMessage &message)
|
||||
void ClangCodeModelClientProxy::echo(const EchoMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message)
|
||||
void ClangCodeModelClientProxy::codeCompleted(const CodeCompletedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
|
||||
void ClangCodeModelClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
|
||||
void ClangCodeModelClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
||||
void ClangCodeModelClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
void ClangCodeModelClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::readMessages()
|
||||
void ClangCodeModelClientProxy::readMessages()
|
||||
{
|
||||
for (const MessageEnvelop &message : readMessageBlock.readAll())
|
||||
server->dispatch(message);
|
||||
}
|
||||
|
||||
bool IpcClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
|
||||
bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
|
||||
{
|
||||
return this->ioDevice == ioDevice;
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
#include "ipcclientinterface.h"
|
||||
#include "clangcodemodelclientinterface.h"
|
||||
#include "readmessageblock.h"
|
||||
#include "writemessageblock.h"
|
||||
|
||||
@@ -41,15 +41,15 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT IpcClientProxy : public IpcClientInterface
|
||||
class CMBIPC_EXPORT ClangCodeModelClientProxy : public ClangCodeModelClientInterface
|
||||
{
|
||||
public:
|
||||
explicit IpcClientProxy(IpcServerInterface *server, QIODevice *ioDevice);
|
||||
IpcClientProxy(const IpcClientProxy&) = delete;
|
||||
const IpcClientProxy &operator=(const IpcClientProxy&) = delete;
|
||||
explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice);
|
||||
ClangCodeModelClientProxy(const ClangCodeModelClientProxy&) = delete;
|
||||
const ClangCodeModelClientProxy &operator=(const ClangCodeModelClientProxy&) = delete;
|
||||
|
||||
IpcClientProxy(IpcClientProxy&&other);
|
||||
IpcClientProxy &operator=(IpcClientProxy&&other);
|
||||
ClangCodeModelClientProxy(ClangCodeModelClientProxy&&other);
|
||||
ClangCodeModelClientProxy &operator=(ClangCodeModelClientProxy&&other);
|
||||
|
||||
void alive() override;
|
||||
void echo(const EchoMessage &message) override;
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
private:
|
||||
ClangBackEnd::WriteMessageBlock writeMessageBlock;
|
||||
ClangBackEnd::ReadMessageBlock readMessageBlock;
|
||||
IpcServerInterface *server = nullptr;
|
||||
ClangCodeModelServerInterface *server = nullptr;
|
||||
QIODevice *ioDevice = nullptr;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "ipcserverinterface.h"
|
||||
#include "clangcodemodelserverinterface.h"
|
||||
|
||||
#include "cmbcompletecodemessage.h"
|
||||
#include "cmbregisterprojectsforeditormessage.h"
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
{
|
||||
switch (messageEnvelop.messageType()) {
|
||||
case MessageType::EndMessage:
|
||||
@@ -83,21 +83,21 @@ void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
updateVisibleTranslationUnits(messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>());
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Unknown IpcServerMessage";
|
||||
qWarning() << "Unknown ClangCodeModelServerMessage";
|
||||
}
|
||||
}
|
||||
|
||||
void IpcServerInterface::addClient(IpcClientInterface *client)
|
||||
void ClangCodeModelServerInterface::addClient(ClangCodeModelClientInterface *client)
|
||||
{
|
||||
clientDispatcher.addClient(client);
|
||||
}
|
||||
|
||||
void IpcServerInterface::removeClient(IpcClientInterface *client)
|
||||
void ClangCodeModelServerInterface::removeClient(ClangCodeModelClientInterface *client)
|
||||
{
|
||||
clientDispatcher.removeClient(client);
|
||||
}
|
||||
|
||||
IpcClientInterface *IpcServerInterface::client()
|
||||
ClangCodeModelClientInterface *ClangCodeModelServerInterface::client()
|
||||
{
|
||||
return &clientDispatcher;
|
||||
}
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
#include "ipcinterface.h"
|
||||
|
||||
#include "ipcclientdispatcher.h"
|
||||
#include "clangcodemodelclientdispatcher.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class IpcClientInterface;
|
||||
class ClangCodeModelClientInterface;
|
||||
|
||||
class CMBIPC_EXPORT IpcServerInterface : public IpcInterface
|
||||
class CMBIPC_EXPORT ClangCodeModelServerInterface : public IpcInterface
|
||||
{
|
||||
public:
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
@@ -51,13 +51,13 @@ public:
|
||||
virtual void requestHighlighting(const RequestHighlightingMessage &message) = 0;
|
||||
virtual void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) = 0;
|
||||
|
||||
void addClient(IpcClientInterface *client);
|
||||
void removeClient(IpcClientInterface *client);
|
||||
void addClient(ClangCodeModelClientInterface *client);
|
||||
void removeClient(ClangCodeModelClientInterface *client);
|
||||
|
||||
IpcClientInterface *client();
|
||||
ClangCodeModelClientInterface *client();
|
||||
|
||||
private:
|
||||
IpcClientDispatcher clientDispatcher;
|
||||
ClangCodeModelClientDispatcher clientDispatcher;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "ipcserverproxy.h"
|
||||
#include "clangcodemodelserverproxy.h"
|
||||
|
||||
#include <cmbalivemessage.h>
|
||||
#include <cmbcompletecodemessage.h>
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <cmbregistertranslationunitsforeditormessage.h>
|
||||
#include <cmbunregisterprojectsforeditormessage.h>
|
||||
#include <cmbunregistertranslationunitsforeditormessage.h>
|
||||
#include <ipcclientinterface.h>
|
||||
#include <clangcodemodelclientinterface.h>
|
||||
#include <messageenvelop.h>
|
||||
#include <registerunsavedfilesforeditormessage.h>
|
||||
#include <requestdiagnosticsmessage.h>
|
||||
@@ -47,82 +47,82 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
IpcServerProxy::IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
|
||||
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice)
|
||||
: writeMessageBlock(ioDevice),
|
||||
readMessageBlock(ioDevice),
|
||||
client(client)
|
||||
{
|
||||
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcServerProxy::readMessages();});
|
||||
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {ClangCodeModelServerProxy::readMessages();});
|
||||
}
|
||||
|
||||
void IpcServerProxy::readMessages()
|
||||
void ClangCodeModelServerProxy::readMessages()
|
||||
{
|
||||
for (const auto &message : readMessageBlock.readAll())
|
||||
client->dispatch(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::resetCounter()
|
||||
void ClangCodeModelServerProxy::resetCounter()
|
||||
{
|
||||
writeMessageBlock.resetCounter();
|
||||
readMessageBlock.resetCounter();
|
||||
}
|
||||
|
||||
void IpcServerProxy::end()
|
||||
void ClangCodeModelServerProxy::end()
|
||||
{
|
||||
writeMessageBlock.write(EndMessage());
|
||||
}
|
||||
|
||||
void IpcServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
|
||||
void ClangCodeModelServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
|
||||
void ClangCodeModelServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
|
||||
void ClangCodeModelServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
|
||||
void ClangCodeModelServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
|
||||
void ClangCodeModelServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void ClangBackEnd::IpcServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message)
|
||||
void ClangBackEnd::ClangCodeModelServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void ClangBackEnd::IpcServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message)
|
||||
void ClangBackEnd::ClangCodeModelServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::completeCode(const CompleteCodeMessage &message)
|
||||
void ClangCodeModelServerProxy::completeCode(const CompleteCodeMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
|
||||
void ClangCodeModelServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
|
||||
void ClangCodeModelServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
|
||||
void ClangCodeModelServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "ipcserverinterface.h"
|
||||
#include "clangcodemodelserverinterface.h"
|
||||
#include "readmessageblock.h"
|
||||
#include "writemessageblock.h"
|
||||
|
||||
@@ -42,12 +42,12 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT IpcServerProxy : public IpcServerInterface
|
||||
class CMBIPC_EXPORT ClangCodeModelServerProxy : public ClangCodeModelServerInterface
|
||||
{
|
||||
public:
|
||||
IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice);
|
||||
IpcServerProxy(const IpcServerProxy&) = delete;
|
||||
IpcServerProxy &operator=(const IpcServerProxy&) = delete;
|
||||
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
|
||||
ClangCodeModelServerProxy(const ClangCodeModelServerProxy&) = delete;
|
||||
ClangCodeModelServerProxy &operator=(const ClangCodeModelServerProxy&) = delete;
|
||||
|
||||
void end() override;
|
||||
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
private:
|
||||
ClangBackEnd::WriteMessageBlock writeMessageBlock;
|
||||
ClangBackEnd::ReadMessageBlock readMessageBlock;
|
||||
IpcClientInterface *client;
|
||||
ClangCodeModelClientInterface *client;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
@@ -56,7 +56,7 @@ QString connectionName()
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionClient::ConnectionClient(IpcClientInterface *client)
|
||||
ConnectionClient::ConnectionClient(ClangCodeModelClientInterface *client)
|
||||
: serverProxy_(client, &localSocket),
|
||||
isAliveTimerResetted(false),
|
||||
stdErrPrefixer("clangbackend.stderr: "),
|
||||
@@ -263,7 +263,7 @@ bool ConnectionClient::waitForEcho()
|
||||
return localSocket.waitForReadyRead();
|
||||
}
|
||||
|
||||
IpcServerProxy &ConnectionClient::serverProxy()
|
||||
ClangCodeModelServerProxy &ConnectionClient::serverProxy()
|
||||
{
|
||||
return serverProxy_;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ipcserverproxy.h"
|
||||
#include "clangcodemodelserverproxy.h"
|
||||
#include "lineprefixer.h"
|
||||
|
||||
#include <QLocalSocket>
|
||||
@@ -49,7 +49,7 @@ class CMBIPC_EXPORT ConnectionClient : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConnectionClient(IpcClientInterface *client);
|
||||
ConnectionClient(ClangCodeModelClientInterface *client);
|
||||
~ConnectionClient();
|
||||
|
||||
bool connectToServer();
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
bool waitForEcho();
|
||||
|
||||
IpcServerProxy &serverProxy();
|
||||
ClangCodeModelServerProxy &serverProxy();
|
||||
|
||||
QProcess *processForTestOnly() const;
|
||||
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
private:
|
||||
mutable std::unique_ptr<QProcess> process_;
|
||||
QLocalSocket localSocket;
|
||||
IpcServerProxy serverProxy_;
|
||||
ClangCodeModelServerProxy serverProxy_;
|
||||
QTimer processAliveTimer;
|
||||
QString processPath_;
|
||||
bool isAliveTimerResetted;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "connectionserver.h"
|
||||
|
||||
#include <ipcserverinterface.h>
|
||||
#include <clangcodemodelserverinterface.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QLocalSocket>
|
||||
@@ -62,7 +62,7 @@ void ConnectionServer::start()
|
||||
localServer.listen(connectionName);
|
||||
}
|
||||
|
||||
void ConnectionServer::setIpcServer(IpcServerInterface *ipcServer)
|
||||
void ConnectionServer::setClangCodeModelServer(ClangCodeModelServerInterface *ipcServer)
|
||||
{
|
||||
this->ipcServer = ipcServer;
|
||||
|
||||
@@ -70,7 +70,7 @@ void ConnectionServer::setIpcServer(IpcServerInterface *ipcServer)
|
||||
|
||||
int ConnectionServer::clientProxyCount() const
|
||||
{
|
||||
return static_cast<int>(ipcClientProxies.size());
|
||||
return static_cast<int>(ipcServerProxies.size());
|
||||
}
|
||||
|
||||
void ConnectionServer::timerEvent(QTimerEvent *timerEvent)
|
||||
@@ -83,9 +83,9 @@ void ConnectionServer::handleNewConnection()
|
||||
{
|
||||
QLocalSocket *localSocket(nextPendingConnection());
|
||||
|
||||
ipcClientProxies.emplace_back(ipcServer, localSocket);
|
||||
ipcServerProxies.emplace_back(ipcServer, localSocket);
|
||||
|
||||
ipcServer->addClient(&ipcClientProxies.back());
|
||||
ipcServer->addClient(&ipcServerProxies.back());
|
||||
|
||||
localSockets.push_back(localSocket);
|
||||
|
||||
@@ -111,9 +111,9 @@ void ConnectionServer::handleSocketDisconnect()
|
||||
|
||||
void ConnectionServer::removeClientProxyWithLocalSocket(QLocalSocket *localSocket)
|
||||
{
|
||||
ipcClientProxies.erase(std::remove_if(ipcClientProxies.begin(),
|
||||
ipcClientProxies.end(),
|
||||
[localSocket](const IpcClientProxy &client) { return client.isUsingThatIoDevice(localSocket);}));
|
||||
ipcServerProxies.erase(std::remove_if(ipcServerProxies.begin(),
|
||||
ipcServerProxies.end(),
|
||||
[localSocket](const ClangCodeModelClientProxy &client) { return client.isUsingThatIoDevice(localSocket);}));
|
||||
}
|
||||
|
||||
QLocalSocket *ConnectionServer::nextPendingConnection()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ipcclientproxy.h>
|
||||
#include <clangcodemodelclientproxy.h>
|
||||
|
||||
#include <QLocalServer>
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class IpcServerInterface;
|
||||
class IpcClientProxy;
|
||||
class ClangCodeModelServerInterface;
|
||||
class ClangCodeModelClientProxy;
|
||||
|
||||
class CMBIPC_EXPORT ConnectionServer : public QObject
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
~ConnectionServer();
|
||||
|
||||
void start();
|
||||
void setIpcServer(IpcServerInterface *ipcServer);
|
||||
void setClangCodeModelServer(ClangCodeModelServerInterface *ipcServer);
|
||||
|
||||
int clientProxyCount() const;
|
||||
|
||||
@@ -66,9 +66,9 @@ private:
|
||||
void exitApplicationIfNoSockedIsConnected();
|
||||
|
||||
private:
|
||||
std::vector<IpcClientProxy> ipcClientProxies;
|
||||
std::vector<ClangCodeModelClientProxy> ipcServerProxies;
|
||||
std::vector<QLocalSocket*> localSockets;
|
||||
IpcServerInterface *ipcServer;
|
||||
ClangCodeModelServerInterface *ipcServer;
|
||||
QLocalServer localServer;
|
||||
static QString connectionName;
|
||||
int aliveTimerId;
|
||||
|
||||
Reference in New Issue
Block a user