Clang: Rename command in message

Change-Id: I1e2671d15b0db3c670b86dd0d4bed5ee09e866f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2015-08-19 12:36:43 +02:00
parent 66df65b2dd
commit ec4d002857
68 changed files with 1296 additions and 1296 deletions

View File

@@ -13,29 +13,29 @@ INCLUDEPATH += $$PWD
SOURCES += $$PWD/ipcserverinterface.cpp \
$$PWD/ipcserverproxy.cpp \
$$PWD/ipcclientinterface.cpp \
$$PWD/cmbendcommand.cpp \
$$PWD/cmbalivecommand.cpp \
$$PWD/cmbendmessage.cpp \
$$PWD/cmbalivemessage.cpp \
$$PWD/ipcclientproxy.cpp \
$$PWD/cmbcommands.cpp \
$$PWD/writecommandblock.cpp \
$$PWD/readcommandblock.cpp \
$$PWD/cmbmessages.cpp \
$$PWD/writemessageblock.cpp \
$$PWD/readmessageblock.cpp \
$$PWD/ipcinterface.cpp \
$$PWD/connectionserver.cpp \
$$PWD/connectionclient.cpp \
$$PWD/cmbechocommand.cpp \
$$PWD/cmbechomessage.cpp \
$$PWD/ipcclientdispatcher.cpp \
$$PWD/cmbregistertranslationunitsforcodecompletioncommand.cpp \
$$PWD/cmbregistertranslationunitsforcodecompletionmessage.cpp \
$$PWD/filecontainer.cpp \
$$PWD/cmbunregistertranslationunitsforcodecompletioncommand.cpp \
$$PWD/cmbcompletecodecommand.cpp \
$$PWD/cmbcodecompletedcommand.cpp \
$$PWD/cmbunregistertranslationunitsforcodecompletionmessage.cpp \
$$PWD/cmbcompletecodemessage.cpp \
$$PWD/cmbcodecompletedmessage.cpp \
$$PWD/codecompletion.cpp \
$$PWD/cmbregisterprojectsforcodecompletioncommand.cpp \
$$PWD/cmbunregisterprojectsforcodecompletioncommand.cpp \
$$PWD/translationunitdoesnotexistcommand.cpp \
$$PWD/cmbregisterprojectsforcodecompletionmessage.cpp \
$$PWD/cmbunregisterprojectsforcodecompletionmessage.cpp \
$$PWD/translationunitdoesnotexistmessage.cpp \
$$PWD/codecompletionchunk.cpp \
$$PWD/projectpartcontainer.cpp \
$$PWD/projectpartsdonotexistcommand.cpp \
$$PWD/projectpartsdonotexistmessage.cpp \
$$PWD/lineprefixer.cpp \
$$PWD/clangbackendipcdebugutils.cpp
@@ -43,29 +43,29 @@ HEADERS += \
$$PWD/ipcserverinterface.h \
$$PWD/ipcserverproxy.h \
$$PWD/ipcclientinterface.h \
$$PWD/cmbendcommand.h \
$$PWD/cmbalivecommand.h \
$$PWD/cmbendmessage.h \
$$PWD/cmbalivemessage.h \
$$PWD/ipcclientproxy.h \
$$PWD/cmbcommands.h \
$$PWD/writecommandblock.h \
$$PWD/readcommandblock.h \
$$PWD/cmbmessages.h \
$$PWD/writemessageblock.h \
$$PWD/readmessageblock.h \
$$PWD/ipcinterface.h \
$$PWD/connectionserver.h \
$$PWD/connectionclient.h \
$$PWD/cmbechocommand.h \
$$PWD/cmbechomessage.h \
$$PWD/ipcclientdispatcher.h \
$$PWD/cmbregistertranslationunitsforcodecompletioncommand.h \
$$PWD/cmbregistertranslationunitsforcodecompletionmessage.h \
$$PWD/filecontainer.h \
$$PWD/cmbunregistertranslationunitsforcodecompletioncommand.h \
$$PWD/cmbcompletecodecommand.h \
$$PWD/cmbcodecompletedcommand.h \
$$PWD/cmbunregistertranslationunitsforcodecompletionmessage.h \
$$PWD/cmbcompletecodemessage.h \
$$PWD/cmbcodecompletedmessage.h \
$$PWD/codecompletion.h \
$$PWD/cmbregisterprojectsforcodecompletioncommand.h \
$$PWD/cmbunregisterprojectsforcodecompletioncommand.h \
$$PWD/translationunitdoesnotexistcommand.h \
$$PWD/cmbregisterprojectsforcodecompletionmessage.h \
$$PWD/cmbunregisterprojectsforcodecompletionmessage.h \
$$PWD/translationunitdoesnotexistmessage.h \
$$PWD/codecompletionchunk.h \
$$PWD/projectpartcontainer.h \
$$PWD/projectpartsdonotexistcommand.h \
$$PWD/projectpartsdonotexistmessage.h \
$$PWD/container_common.h \
$$PWD/clangbackendipc_global.h \
$$PWD/lineprefixer.h \

View File

@@ -28,36 +28,36 @@
**
****************************************************************************/
#include "cmbalivecommand.h"
#include "cmbalivemessage.h"
#include <QDataStream>
#include <QDebug>
namespace ClangBackEnd {
QDataStream &operator<<(QDataStream &out, const AliveCommand &/*command*/)
QDataStream &operator<<(QDataStream &out, const AliveMessage &/*message*/)
{
return out;
}
QDataStream &operator>>(QDataStream &in, AliveCommand &/*command*/)
QDataStream &operator>>(QDataStream &in, AliveMessage &/*message*/)
{
return in;
}
bool operator==(const AliveCommand &/*first*/, const AliveCommand &/*second*/)
bool operator==(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
{
return true;
}
bool operator<(const AliveCommand &/*first*/, const AliveCommand &/*second*/)
bool operator<(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
{
return true;
}
QDebug operator<<(QDebug debug, const AliveCommand &/*command*/)
QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
{
return debug.nospace() << "AliveCommand()";
return debug.nospace() << "AliveMessage()";
}
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMBALIVECOMMAND_H
#define CMBALIVECOMMAND_H
#ifndef CMBALIVEMESSAGE_H
#define CMBALIVEMESSAGE_H
#include "clangbackendipc_global.h"
@@ -37,19 +37,19 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT AliveCommand
class CMBIPC_EXPORT AliveMessage
{
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const AliveCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, AliveCommand &command);
CMBIPC_EXPORT bool operator==(const AliveCommand &first, const AliveCommand &second);
CMBIPC_EXPORT bool operator<(const AliveCommand &first, const AliveCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const AliveMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, AliveMessage &message);
CMBIPC_EXPORT bool operator==(const AliveMessage &first, const AliveMessage &second);
CMBIPC_EXPORT bool operator<(const AliveMessage &first, const AliveMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const AliveCommand &command);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message);
}
Q_DECLARE_METATYPE(ClangBackEnd::AliveCommand)
Q_DECLARE_METATYPE(ClangBackEnd::AliveMessage)
#endif // CMBALIVECOMMAND_H
#endif // CMBALIVEMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbcodecompletedcommand.h"
#include "cmbcodecompletedmessage.h"
#include <QDataStream>
#include <QDebug>
@@ -37,66 +37,66 @@
namespace ClangBackEnd {
CodeCompletedCommand::CodeCompletedCommand(const CodeCompletions &codeCompletions, quint64 ticketNumber)
CodeCompletedMessage::CodeCompletedMessage(const CodeCompletions &codeCompletions, quint64 ticketNumber)
: codeCompletions_(codeCompletions),
ticketNumber_(ticketNumber)
{
}
const CodeCompletions &CodeCompletedCommand::codeCompletions() const
const CodeCompletions &CodeCompletedMessage::codeCompletions() const
{
return codeCompletions_;
}
quint64 CodeCompletedCommand::ticketNumber() const
quint64 CodeCompletedMessage::ticketNumber() const
{
return ticketNumber_;
}
QDataStream &operator<<(QDataStream &out, const CodeCompletedCommand &command)
QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message)
{
out << command.codeCompletions_;
out << command.ticketNumber_;
out << message.codeCompletions_;
out << message.ticketNumber_;
return out;
}
QDataStream &operator>>(QDataStream &in, CodeCompletedCommand &command)
QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message)
{
in >> command.codeCompletions_;
in >> command.ticketNumber_;
in >> message.codeCompletions_;
in >> message.ticketNumber_;
return in;
}
bool operator==(const CodeCompletedCommand &first, const CodeCompletedCommand &second)
bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second)
{
return first.ticketNumber_ == second.ticketNumber_
&& first.codeCompletions_ == second.codeCompletions_;
}
bool operator<(const CodeCompletedCommand &first, const CodeCompletedCommand &second)
bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second)
{
return first.ticketNumber_ < second.ticketNumber_;
}
QDebug operator<<(QDebug debug, const CodeCompletedCommand &command)
QDebug operator<<(QDebug debug, const CodeCompletedMessage &message)
{
debug.nospace() << "CodeCompletedCommand(";
debug.nospace() << "CodeCompletedMessage(";
debug.nospace() << command.codeCompletions_ << ", " << command.ticketNumber_;
debug.nospace() << message.codeCompletions_ << ", " << message.ticketNumber_;
debug.nospace() << ")";
return debug;
}
void PrintTo(const CodeCompletedCommand &command, ::std::ostream* os)
void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os)
{
QString output;
QDebug debug(&output);
debug << command;
debug << message;
*os << output.toUtf8().constData();
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_CODECOMPLETEDCOMMAND_H
#define CLANGBACKEND_CODECOMPLETEDCOMMAND_H
#ifndef CLANGBACKEND_CODECOMPLETEDMESSAGE_H
#define CLANGBACKEND_CODECOMPLETEDMESSAGE_H
#include "codecompletion.h"
@@ -38,17 +38,17 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT CodeCompletedCommand
class CMBIPC_EXPORT CodeCompletedMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletedCommand &command);
friend CMBIPC_EXPORT bool operator==(const CodeCompletedCommand &first, const CodeCompletedCommand &second);
friend CMBIPC_EXPORT bool operator<(const CodeCompletedCommand &first, const CodeCompletedCommand &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedCommand &command);
friend void PrintTo(const CodeCompletedCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message);
friend CMBIPC_EXPORT bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
friend CMBIPC_EXPORT bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
public:
CodeCompletedCommand() = default;
CodeCompletedCommand(const CodeCompletions &codeCompletions, quint64 ticketNumber);
CodeCompletedMessage() = default;
CodeCompletedMessage(const CodeCompletions &codeCompletions, quint64 ticketNumber);
const CodeCompletions &codeCompletions() const;
@@ -59,16 +59,16 @@ private:
quint64 ticketNumber_ = 0;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletedCommand &command);
CMBIPC_EXPORT bool operator==(const CodeCompletedCommand &first, const CodeCompletedCommand &second);
CMBIPC_EXPORT bool operator<(const CodeCompletedCommand &first, const CodeCompletedCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message);
CMBIPC_EXPORT bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
CMBIPC_EXPORT bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedCommand &command);
void PrintTo(const CodeCompletedCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletedCommand)
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletedMessage)
#endif // CLANGBACKEND_CODECOMPLETEDCOMMAND_H
#endif // CLANGBACKEND_CODECOMPLETEDMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbcompletecodecommand.h"
#include "cmbcompletecodemessage.h"
#include <QDataStream>
#include <QDebug>
@@ -37,9 +37,9 @@
namespace ClangBackEnd {
quint64 CompleteCodeCommand::ticketCounter = 0;
quint64 CompleteCodeMessage::ticketCounter = 0;
CompleteCodeCommand::CompleteCodeCommand(const Utf8String &filePath, quint32 line, quint32 column, const Utf8String &projectPartId)
CompleteCodeMessage::CompleteCodeMessage(const Utf8String &filePath, quint32 line, quint32 column, const Utf8String &projectPartId)
: filePath_(filePath),
projectPartId_(projectPartId),
ticketNumber_(++ticketCounter),
@@ -48,54 +48,54 @@ CompleteCodeCommand::CompleteCodeCommand(const Utf8String &filePath, quint32 lin
{
}
const Utf8String &CompleteCodeCommand::filePath() const
const Utf8String &CompleteCodeMessage::filePath() const
{
return filePath_;
}
const Utf8String &CompleteCodeCommand::projectPartId() const
const Utf8String &CompleteCodeMessage::projectPartId() const
{
return projectPartId_;
}
quint32 CompleteCodeCommand::line() const
quint32 CompleteCodeMessage::line() const
{
return line_;
}
quint32 CompleteCodeCommand::column() const
quint32 CompleteCodeMessage::column() const
{
return column_;
}
quint64 CompleteCodeCommand::ticketNumber() const
quint64 CompleteCodeMessage::ticketNumber() const
{
return ticketNumber_;
}
QDataStream &operator<<(QDataStream &out, const CompleteCodeCommand &command)
QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message)
{
out << command.filePath_;
out << command.projectPartId_;
out << command.ticketNumber_;
out << command.line_;
out << command.column_;
out << message.filePath_;
out << message.projectPartId_;
out << message.ticketNumber_;
out << message.line_;
out << message.column_;
return out;
}
QDataStream &operator>>(QDataStream &in, CompleteCodeCommand &command)
QDataStream &operator>>(QDataStream &in, CompleteCodeMessage &message)
{
in >> command.filePath_;
in >> command.projectPartId_;
in >> command.ticketNumber_;
in >> command.line_;
in >> command.column_;
in >> message.filePath_;
in >> message.projectPartId_;
in >> message.ticketNumber_;
in >> message.line_;
in >> message.column_;
return in;
}
bool operator==(const CompleteCodeCommand &first, const CompleteCodeCommand &second)
bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second)
{
return first.ticketNumber_ == second.ticketNumber_
&& first.filePath_ == second.filePath_
@@ -104,7 +104,7 @@ bool operator==(const CompleteCodeCommand &first, const CompleteCodeCommand &sec
&& first.column_ == second.column_;
}
bool operator<(const CompleteCodeCommand &first, const CompleteCodeCommand &second)
bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second)
{
return first.ticketNumber_ < second.ticketNumber_
&& first.filePath_ < second.filePath_
@@ -113,30 +113,30 @@ bool operator<(const CompleteCodeCommand &first, const CompleteCodeCommand &seco
&& first.column_ < second.column_;
}
QDebug operator<<(QDebug debug, const CompleteCodeCommand &command)
QDebug operator<<(QDebug debug, const CompleteCodeMessage &message)
{
debug.nospace() << "CompleteCodeCommand(";
debug.nospace() << "CompleteCodeMessage(";
debug.nospace() << command.filePath_ << ", ";
debug.nospace() << command.line_<< ", ";
debug.nospace() << command.column_<< ", ";
debug.nospace() << command.projectPartId_ << ", ";
debug.nospace() << command.ticketNumber_;
debug.nospace() << message.filePath_ << ", ";
debug.nospace() << message.line_<< ", ";
debug.nospace() << message.column_<< ", ";
debug.nospace() << message.projectPartId_ << ", ";
debug.nospace() << message.ticketNumber_;
debug.nospace() << ")";
return debug;
}
void PrintTo(const CompleteCodeCommand &command, ::std::ostream* os)
void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os)
{
*os << "CompleteCodeCommand(";
*os << "CompleteCodeMessage(";
*os << command.filePath_.constData() << ", ";
*os << command.line_ << ", ";
*os << command.column_ << ", ";
*os << command.projectPartId_.constData() << ", ";
*os << command.ticketNumber_;
*os << message.filePath_.constData() << ", ";
*os << message.line_ << ", ";
*os << message.column_ << ", ";
*os << message.projectPartId_.constData() << ", ";
*os << message.ticketNumber_;
*os << ")";
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_COMPLETECODECOMMAND_H
#define CLANGBACKEND_COMPLETECODECOMMAND_H
#ifndef CLANGBACKEND_COMPLETECODEMESSAGE_H
#define CLANGBACKEND_COMPLETECODEMESSAGE_H
#include "clangbackendipc_global.h"
@@ -39,18 +39,18 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT CompleteCodeCommand
class CMBIPC_EXPORT CompleteCodeMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CompleteCodeCommand &command);
friend CMBIPC_EXPORT bool operator==(const CompleteCodeCommand &first, const CompleteCodeCommand &second);
friend CMBIPC_EXPORT bool operator<(const CompleteCodeCommand &first, const CompleteCodeCommand &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeCommand &command);
friend void PrintTo(const CompleteCodeCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CompleteCodeMessage &message);
friend CMBIPC_EXPORT bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
friend CMBIPC_EXPORT bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
friend void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
public:
CompleteCodeCommand() = default;
CompleteCodeCommand(const Utf8String &filePath,
CompleteCodeMessage() = default;
CompleteCodeMessage(const Utf8String &filePath,
quint32 line,
quint32 column,
const Utf8String &projectPartId);
@@ -72,16 +72,16 @@ private:
quint32 column_ = 0;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CompleteCodeCommand &command);
CMBIPC_EXPORT bool operator==(const CompleteCodeCommand &first, const CompleteCodeCommand &second);
CMBIPC_EXPORT bool operator<(const CompleteCodeCommand &first, const CompleteCodeCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CompleteCodeMessage &message);
CMBIPC_EXPORT bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
CMBIPC_EXPORT bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeCommand &command);
void PrintTo(const CompleteCodeCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::CompleteCodeCommand)
Q_DECLARE_METATYPE(ClangBackEnd::CompleteCodeMessage)
#endif // CLANGBACKEND_COMPLETECODECOMMAND_H
#endif // CLANGBACKEND_COMPLETECODEMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbechocommand.h"
#include "cmbechomessage.h"
#include <QDataStream>
#include <QDebug>
@@ -37,52 +37,52 @@
namespace ClangBackEnd {
EchoCommand::EchoCommand(const QVariant &command)
: command_(command)
EchoMessage::EchoMessage(const QVariant &message)
: message_(message)
{
}
const QVariant &EchoCommand::command() const
const QVariant &EchoMessage::message() const
{
return command_;
return message_;
}
QDataStream &operator<<(QDataStream &out, const EchoCommand &command)
QDataStream &operator<<(QDataStream &out, const EchoMessage &message)
{
out << command.command();
out << message.message();
return out;
}
QDataStream &operator>>(QDataStream &in, EchoCommand &command)
QDataStream &operator>>(QDataStream &in, EchoMessage &message)
{
in >> command.command_;
in >> message.message_;
return in;
}
bool operator==(const EchoCommand &first, const EchoCommand &second)
bool operator==(const EchoMessage &first, const EchoMessage &second)
{
return first.command_ == second.command_;
return first.message_ == second.message_;
}
bool operator<(const EchoCommand &first, const EchoCommand &second)
bool operator<(const EchoMessage &first, const EchoMessage &second)
{
return first.command_ < second.command_;
return first.message_ < second.message_;
}
QDebug operator<<(QDebug debug, const EchoCommand &command)
QDebug operator<<(QDebug debug, const EchoMessage &message)
{
return debug.nospace() << "EchoCommand(" << command.command() << ")";
return debug.nospace() << "EchoMessage(" << message.message() << ")";
}
void PrintTo(const EchoCommand &command, ::std::ostream* os)
void PrintTo(const EchoMessage &message, ::std::ostream* os)
{
QString output;
QDebug debug(&output);
debug << command;
debug << message;
*os << output.toUtf8().constData();
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_ECHOCOMMAND_H
#define CLANGBACKEND_ECHOCOMMAND_H
#ifndef CLANGBACKEND_ECHOMESSAGE_H
#define CLANGBACKEND_ECHOMESSAGE_H
#include "clangbackendipc_global.h"
@@ -38,31 +38,31 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT EchoCommand
class CMBIPC_EXPORT EchoMessage
{
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoCommand &command);
friend CMBIPC_EXPORT bool operator==(const EchoCommand &first, const EchoCommand &second);
friend CMBIPC_EXPORT bool operator<(const EchoCommand &first, const EchoCommand &second);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoMessage &message);
friend CMBIPC_EXPORT bool operator==(const EchoMessage &first, const EchoMessage &second);
friend CMBIPC_EXPORT bool operator<(const EchoMessage &first, const EchoMessage &second);
public:
EchoCommand() = default;
explicit EchoCommand(const QVariant &command);
EchoMessage() = default;
explicit EchoMessage(const QVariant &message);
const QVariant &command() const;
const QVariant &message() const;
private:
QVariant command_;
QVariant message_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EchoCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoCommand &command);
CMBIPC_EXPORT bool operator==(const EchoCommand &first, const EchoCommand &second);
CMBIPC_EXPORT bool operator<(const EchoCommand &first, const EchoCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EchoMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoMessage &message);
CMBIPC_EXPORT bool operator==(const EchoMessage &first, const EchoMessage &second);
CMBIPC_EXPORT bool operator<(const EchoMessage &first, const EchoMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EchoCommand &command);
void PrintTo(const EchoCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message);
void PrintTo(const EchoMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::EchoCommand)
Q_DECLARE_METATYPE(ClangBackEnd::EchoMessage)
#endif // CLANGBACKEND_ECHOCOMMAND_H
#endif // CLANGBACKEND_ECHOMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbendcommand.h"
#include "cmbendmessage.h"
#include <QDataStream>
#include <QDebug>
@@ -37,34 +37,34 @@
namespace ClangBackEnd {
QDataStream &operator<<(QDataStream &out, const EndCommand &/*command*/)
QDataStream &operator<<(QDataStream &out, const EndMessage &/*message*/)
{
return out;
}
QDataStream &operator>>(QDataStream &in, EndCommand &/*command*/)
QDataStream &operator>>(QDataStream &in, EndMessage &/*message*/)
{
return in;
}
bool operator==(const EndCommand &/*first*/, const EndCommand &/*second*/)
bool operator==(const EndMessage &/*first*/, const EndMessage &/*second*/)
{
return true;
}
bool operator<(const EndCommand &/*first*/, const EndCommand &/*second*/)
bool operator<(const EndMessage &/*first*/, const EndMessage &/*second*/)
{
return true;
}
QDebug operator<<(QDebug debug, const EndCommand &/*command*/)
QDebug operator<<(QDebug debug, const EndMessage &/*message*/)
{
return debug.nospace() << "EndCommand()";
return debug.nospace() << "EndMessage()";
}
void PrintTo(const EndCommand &/*command*/, ::std::ostream* os)
void PrintTo(const EndMessage &/*message*/, ::std::ostream* os)
{
*os << "EndCommand()";
*os << "EndMessage()";
}
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CMBENDCOMMAND_H
#define CMBENDCOMMAND_H
#ifndef CMBENDMESSAGE_H
#define CMBENDMESSAGE_H
#include "clangbackendipc_global.h"
@@ -37,19 +37,19 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT EndCommand
class CMBIPC_EXPORT EndMessage
{
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EndCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EndCommand &command);
CMBIPC_EXPORT bool operator==(const EndCommand &first, const EndCommand &second);
CMBIPC_EXPORT bool operator<(const EndCommand &first, const EndCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EndMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EndMessage &message);
CMBIPC_EXPORT bool operator==(const EndMessage &first, const EndMessage &second);
CMBIPC_EXPORT bool operator<(const EndMessage &first, const EndMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EndCommand &command);
void PrintTo(const EndCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message);
void PrintTo(const EndMessage &message, ::std::ostream* os);
}
Q_DECLARE_METATYPE(ClangBackEnd::EndCommand)
Q_DECLARE_METATYPE(ClangBackEnd::EndMessage)
#endif // CMBENDCOMMAND_H
#endif // CMBENDMESSAGE_H

View File

@@ -28,80 +28,80 @@
**
****************************************************************************/
#include "cmbcommands.h"
#include "cmbmessages.h"
#include "cmbalivecommand.h"
#include "cmbendcommand.h"
#include "cmbechocommand.h"
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbunregistertranslationunitsforcodecompletioncommand.h"
#include "cmbregisterprojectsforcodecompletioncommand.h"
#include "cmbunregisterprojectsforcodecompletioncommand.h"
#include "cmbcompletecodecommand.h"
#include "cmbcodecompletedcommand.h"
#include "projectpartsdonotexistcommand.h"
#include "translationunitdoesnotexistcommand.h"
#include "cmbalivemessage.h"
#include "cmbendmessage.h"
#include "cmbechomessage.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "cmbunregistertranslationunitsforcodecompletionmessage.h"
#include "cmbregisterprojectsforcodecompletionmessage.h"
#include "cmbunregisterprojectsforcodecompletionmessage.h"
#include "cmbcompletecodemessage.h"
#include "cmbcodecompletedmessage.h"
#include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h"
#include <QDataStream>
namespace ClangBackEnd {
void Commands::registerCommands()
void Messages::registerMessages()
{
qRegisterMetaType<EndCommand>();
qRegisterMetaTypeStreamOperators<EndCommand>();
QMetaType::registerComparators<EndCommand>();
qRegisterMetaType<EndMessage>();
qRegisterMetaTypeStreamOperators<EndMessage>();
QMetaType::registerComparators<EndMessage>();
qRegisterMetaType<AliveCommand>();
qRegisterMetaTypeStreamOperators<AliveCommand>();
QMetaType::registerComparators<AliveCommand>();
qRegisterMetaType<AliveMessage>();
qRegisterMetaTypeStreamOperators<AliveMessage>();
QMetaType::registerComparators<AliveMessage>();
qRegisterMetaType<EchoCommand>();
qRegisterMetaTypeStreamOperators<EchoCommand>();
qRegisterMetaType<EchoMessage>();
qRegisterMetaTypeStreamOperators<EchoMessage>();
qRegisterMetaType<RegisterTranslationUnitForCodeCompletionCommand>();
qRegisterMetaTypeStreamOperators<RegisterTranslationUnitForCodeCompletionCommand>();
QMetaType::registerComparators<RegisterTranslationUnitForCodeCompletionCommand>();
qRegisterMetaType<RegisterTranslationUnitForCodeCompletionMessage>();
qRegisterMetaTypeStreamOperators<RegisterTranslationUnitForCodeCompletionMessage>();
QMetaType::registerComparators<RegisterTranslationUnitForCodeCompletionMessage>();
qRegisterMetaType<FileContainer>();
qRegisterMetaTypeStreamOperators<FileContainer>();
QMetaType::registerComparators<FileContainer>();
qRegisterMetaType<UnregisterTranslationUnitsForCodeCompletionCommand>();
qRegisterMetaTypeStreamOperators<UnregisterTranslationUnitsForCodeCompletionCommand>();
QMetaType::registerComparators<UnregisterTranslationUnitsForCodeCompletionCommand>();
qRegisterMetaType<UnregisterTranslationUnitsForCodeCompletionMessage>();
qRegisterMetaTypeStreamOperators<UnregisterTranslationUnitsForCodeCompletionMessage>();
QMetaType::registerComparators<UnregisterTranslationUnitsForCodeCompletionMessage>();
qRegisterMetaType<CompleteCodeCommand>();
qRegisterMetaTypeStreamOperators<CompleteCodeCommand>();
QMetaType::registerComparators<CompleteCodeCommand>();
qRegisterMetaType<CompleteCodeMessage>();
qRegisterMetaTypeStreamOperators<CompleteCodeMessage>();
QMetaType::registerComparators<CompleteCodeMessage>();
qRegisterMetaType<CodeCompletion>();
qRegisterMetaTypeStreamOperators<CodeCompletion>();
QMetaType::registerComparators<CodeCompletion>();
qRegisterMetaType<CodeCompletedCommand>();
qRegisterMetaTypeStreamOperators<CodeCompletedCommand>();
QMetaType::registerComparators<CodeCompletedCommand>();
qRegisterMetaType<CodeCompletedMessage>();
qRegisterMetaTypeStreamOperators<CodeCompletedMessage>();
QMetaType::registerComparators<CodeCompletedMessage>();
qRegisterMetaType<RegisterProjectPartsForCodeCompletionCommand>();
qRegisterMetaTypeStreamOperators<RegisterProjectPartsForCodeCompletionCommand>();
QMetaType::registerComparators<RegisterProjectPartsForCodeCompletionCommand>();
qRegisterMetaType<RegisterProjectPartsForCodeCompletionMessage>();
qRegisterMetaTypeStreamOperators<RegisterProjectPartsForCodeCompletionMessage>();
QMetaType::registerComparators<RegisterProjectPartsForCodeCompletionMessage>();
qRegisterMetaType<ProjectPartContainer>();
qRegisterMetaTypeStreamOperators<ProjectPartContainer>();
QMetaType::registerComparators<ProjectPartContainer>();
qRegisterMetaType<UnregisterProjectPartsForCodeCompletionCommand>();
qRegisterMetaTypeStreamOperators<UnregisterProjectPartsForCodeCompletionCommand>();
QMetaType::registerComparators<UnregisterProjectPartsForCodeCompletionCommand>();
qRegisterMetaType<UnregisterProjectPartsForCodeCompletionMessage>();
qRegisterMetaTypeStreamOperators<UnregisterProjectPartsForCodeCompletionMessage>();
QMetaType::registerComparators<UnregisterProjectPartsForCodeCompletionMessage>();
qRegisterMetaType<TranslationUnitDoesNotExistCommand>();
qRegisterMetaTypeStreamOperators<TranslationUnitDoesNotExistCommand>();
QMetaType::registerComparators<TranslationUnitDoesNotExistCommand>();
qRegisterMetaType<TranslationUnitDoesNotExistMessage>();
qRegisterMetaTypeStreamOperators<TranslationUnitDoesNotExistMessage>();
QMetaType::registerComparators<TranslationUnitDoesNotExistMessage>();
qRegisterMetaType<ProjectPartsDoNotExistCommand>();
qRegisterMetaTypeStreamOperators<ProjectPartsDoNotExistCommand>();
QMetaType::registerComparators<ProjectPartsDoNotExistCommand>();
qRegisterMetaType<ProjectPartsDoNotExistMessage>();
qRegisterMetaTypeStreamOperators<ProjectPartsDoNotExistMessage>();
QMetaType::registerComparators<ProjectPartsDoNotExistMessage>();
}
} // namespace ClangBackEnd

View File

@@ -28,18 +28,18 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_COMMANDS_H
#define CLANGBACKEND_COMMANDS_H
#ifndef CLANGBACKEND_MESSAGES_H
#define CLANGBACKEND_MESSAGES_H
#include <clangbackendipc_global.h>
namespace ClangBackEnd {
namespace Commands
namespace Messages
{
CMBIPC_EXPORT void registerCommands();
CMBIPC_EXPORT void registerMessages();
}
} // namespace ClangBackEnd
#endif // CLANGBACKEND_COMMANDS_H
#endif // CLANGBACKEND_MESSAGES_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbregisterprojectsforcodecompletioncommand.h"
#include "cmbregisterprojectsforcodecompletionmessage.h"
#include "container_common.h"
@@ -40,45 +40,45 @@
namespace ClangBackEnd {
RegisterProjectPartsForCodeCompletionCommand::RegisterProjectPartsForCodeCompletionCommand(const QVector<ProjectPartContainer> &projectContainers)
RegisterProjectPartsForCodeCompletionMessage::RegisterProjectPartsForCodeCompletionMessage(const QVector<ProjectPartContainer> &projectContainers)
:projectContainers_(projectContainers)
{
}
const QVector<ProjectPartContainer> &RegisterProjectPartsForCodeCompletionCommand::projectContainers() const
const QVector<ProjectPartContainer> &RegisterProjectPartsForCodeCompletionMessage::projectContainers() const
{
return projectContainers_;
}
QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command)
QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionMessage &message)
{
out << command.projectContainers_;
out << message.projectContainers_;
return out;
}
QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command)
QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionMessage &message)
{
in >> command.projectContainers_;
in >> message.projectContainers_;
return in;
}
bool operator==(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second)
bool operator==(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second)
{
return first.projectContainers_ == second.projectContainers_;
}
bool operator<(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second)
bool operator<(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second)
{
return compareContainer(first.projectContainers_, second.projectContainers_);
}
QDebug operator<<(QDebug debug, const RegisterProjectPartsForCodeCompletionCommand &command)
QDebug operator<<(QDebug debug, const RegisterProjectPartsForCodeCompletionMessage &message)
{
debug.nospace() << "RegisterProjectPartsForCodeCompletionCommand(";
debug.nospace() << "RegisterProjectPartsForCodeCompletionMessage(";
for (const ProjectPartContainer &projectContainer : command.projectContainers())
for (const ProjectPartContainer &projectContainer : message.projectContainers())
debug.nospace() << projectContainer<< ", ";
debug.nospace() << ")";
@@ -86,11 +86,11 @@ QDebug operator<<(QDebug debug, const RegisterProjectPartsForCodeCompletionComma
return debug;
}
void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os)
void PrintTo(const RegisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os)
{
*os << "RegisterProjectPartsForCodeCompletionCommand(";
*os << "RegisterProjectPartsForCodeCompletionMessage(";
for (const ProjectPartContainer &projectContainer : command.projectContainers())
for (const ProjectPartContainer &projectContainer : message.projectContainers())
PrintTo(projectContainer, os);
*os << ")";

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONCOMAND_H
#define CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONCOMAND_H
#ifndef CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONMESSAGE_H
#define CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONMESSAGE_H
#include "projectpartcontainer.h"
@@ -38,16 +38,16 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT RegisterProjectPartsForCodeCompletionCommand
class CMBIPC_EXPORT RegisterProjectPartsForCodeCompletionMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second);
friend CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second);
friend void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second);
friend CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second);
friend void PrintTo(const RegisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os);
public:
RegisterProjectPartsForCodeCompletionCommand() = default;
RegisterProjectPartsForCodeCompletionCommand(const QVector<ProjectPartContainer> &projectContainers);
RegisterProjectPartsForCodeCompletionMessage() = default;
RegisterProjectPartsForCodeCompletionMessage(const QVector<ProjectPartContainer> &projectContainers);
const QVector<ProjectPartContainer> &projectContainers() const;
@@ -55,15 +55,15 @@ private:
QVector<ProjectPartContainer> projectContainers_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionCommand &command);
CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second);
CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForCodeCompletionCommand &first, const RegisterProjectPartsForCodeCompletionCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForCodeCompletionMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForCodeCompletionMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second);
CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForCodeCompletionMessage &first, const RegisterProjectPartsForCodeCompletionMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterProjectPartsForCodeCompletionCommand &command);
void PrintTo(const RegisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterProjectPartsForCodeCompletionMessage &message);
void PrintTo(const RegisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand)
Q_DECLARE_METATYPE(ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage)
#endif // CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONCOMAND_H
#endif // CLANGBACKEND_REGISTERPROJECTSFORCODECOMPLETIONMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "container_common.h"
@@ -39,45 +39,45 @@
namespace ClangBackEnd {
RegisterTranslationUnitForCodeCompletionCommand::RegisterTranslationUnitForCodeCompletionCommand(const QVector<FileContainer> &fileContainers)
RegisterTranslationUnitForCodeCompletionMessage::RegisterTranslationUnitForCodeCompletionMessage(const QVector<FileContainer> &fileContainers)
: fileContainers_(fileContainers)
{
}
const QVector<FileContainer> &RegisterTranslationUnitForCodeCompletionCommand::fileContainers() const
const QVector<FileContainer> &RegisterTranslationUnitForCodeCompletionMessage::fileContainers() const
{
return fileContainers_;
}
QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionCommand &command)
QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionMessage &message)
{
out << command.fileContainers_;
out << message.fileContainers_;
return out;
}
QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionCommand &command)
QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionMessage &message)
{
in >> command.fileContainers_;
in >> message.fileContainers_;
return in;
}
bool operator==(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second)
bool operator==(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second)
{
return first.fileContainers_ == second.fileContainers_;
}
bool operator<(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second)
bool operator<(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const RegisterTranslationUnitForCodeCompletionCommand &command)
QDebug operator<<(QDebug debug, const RegisterTranslationUnitForCodeCompletionMessage &message)
{
debug.nospace() << "RegisterTranslationUnitForCodeCompletionCommand(";
debug.nospace() << "RegisterTranslationUnitForCodeCompletionMessage(";
for (const FileContainer &fileContainer : command.fileContainers())
for (const FileContainer &fileContainer : message.fileContainers())
debug.nospace() << fileContainer<< ", ";
debug.nospace() << ")";
@@ -85,11 +85,11 @@ QDebug operator<<(QDebug debug, const RegisterTranslationUnitForCodeCompletionCo
return debug;
}
void PrintTo(const RegisterTranslationUnitForCodeCompletionCommand &command, ::std::ostream* os)
void PrintTo(const RegisterTranslationUnitForCodeCompletionMessage &message, ::std::ostream* os)
{
*os << "RegisterTranslationUnitForCodeCompletionCommand(";
*os << "RegisterTranslationUnitForCodeCompletionMessage(";
for (const FileContainer &fileContainer : command.fileContainers())
for (const FileContainer &fileContainer : message.fileContainers())
PrintTo(fileContainer, os);
*os << ")";

View File

@@ -38,16 +38,16 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT RegisterTranslationUnitForCodeCompletionCommand
class CMBIPC_EXPORT RegisterTranslationUnitForCodeCompletionMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionCommand &command);
friend CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second);
friend CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second);
friend void PrintTo(const RegisterTranslationUnitForCodeCompletionCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second);
friend CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second);
friend void PrintTo(const RegisterTranslationUnitForCodeCompletionMessage &message, ::std::ostream* os);
public:
RegisterTranslationUnitForCodeCompletionCommand() = default;
RegisterTranslationUnitForCodeCompletionCommand(const QVector<FileContainer> &fileContainers);
RegisterTranslationUnitForCodeCompletionMessage() = default;
RegisterTranslationUnitForCodeCompletionMessage(const QVector<FileContainer> &fileContainers);
const QVector<FileContainer> &fileContainers() const;
@@ -55,15 +55,15 @@ private:
QVector<FileContainer> fileContainers_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionCommand &command);
CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second);
CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForCodeCompletionCommand &first, const RegisterTranslationUnitForCodeCompletionCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForCodeCompletionMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForCodeCompletionMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second);
CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForCodeCompletionMessage &first, const RegisterTranslationUnitForCodeCompletionMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForCodeCompletionCommand &command);
void PrintTo(const RegisterTranslationUnitForCodeCompletionCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForCodeCompletionMessage &message);
void PrintTo(const RegisterTranslationUnitForCodeCompletionMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand)
Q_DECLARE_METATYPE(ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage)
#endif // CLANGBACKEND_REGISTERFILEFORCODECOMPLITION_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbunregisterprojectsforcodecompletioncommand.h"
#include "cmbunregisterprojectsforcodecompletionmessage.h"
#include "container_common.h"
@@ -41,45 +41,45 @@
namespace ClangBackEnd {
UnregisterProjectPartsForCodeCompletionCommand::UnregisterProjectPartsForCodeCompletionCommand(const Utf8StringVector &filePaths)
UnregisterProjectPartsForCodeCompletionMessage::UnregisterProjectPartsForCodeCompletionMessage(const Utf8StringVector &filePaths)
: projectPartIds_(filePaths)
{
}
const Utf8StringVector &UnregisterProjectPartsForCodeCompletionCommand::projectPartIds() const
const Utf8StringVector &UnregisterProjectPartsForCodeCompletionMessage::projectPartIds() const
{
return projectPartIds_;
}
QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command)
QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionMessage &message)
{
out << command.projectPartIds_;
out << message.projectPartIds_;
return out;
}
QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command)
QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionMessage &message)
{
in >> command.projectPartIds_;
in >> message.projectPartIds_;
return in;
}
bool operator==(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second)
bool operator==(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second)
{
return first.projectPartIds_ == second.projectPartIds_;
}
bool operator<(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second)
bool operator<(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second)
{
return compareContainer(first.projectPartIds_, second.projectPartIds_);
}
QDebug operator<<(QDebug debug, const UnregisterProjectPartsForCodeCompletionCommand &command)
QDebug operator<<(QDebug debug, const UnregisterProjectPartsForCodeCompletionMessage &message)
{
debug.nospace() << "UnregisterProjectPartsForCodeCompletionCommand(";
debug.nospace() << "UnregisterProjectPartsForCodeCompletionMessage(";
for (const Utf8String &fileNames_ : command.projectPartIds())
for (const Utf8String &fileNames_ : message.projectPartIds())
debug.nospace() << fileNames_ << ", ";
debug.nospace() << ")";
@@ -87,11 +87,11 @@ QDebug operator<<(QDebug debug, const UnregisterProjectPartsForCodeCompletionCom
return debug;
}
void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os)
void PrintTo(const UnregisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os)
{
*os << "UnregisterProjectPartsForCodeCompletionCommand(";
*os << "UnregisterProjectPartsForCodeCompletionMessage(";
for (const Utf8String &fileNames_ : command.projectPartIds())
for (const Utf8String &fileNames_ : message.projectPartIds())
*os << fileNames_.constData() << ", ";
*os << ")";

View File

@@ -39,17 +39,17 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT UnregisterProjectPartsForCodeCompletionCommand
class CMBIPC_EXPORT UnregisterProjectPartsForCodeCompletionMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second);
friend void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second);
friend void PrintTo(const UnregisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os);
public:
UnregisterProjectPartsForCodeCompletionCommand() = default;
UnregisterProjectPartsForCodeCompletionCommand(const Utf8StringVector &projectPartIds);
UnregisterProjectPartsForCodeCompletionMessage() = default;
UnregisterProjectPartsForCodeCompletionMessage(const Utf8StringVector &projectPartIds);
const Utf8StringVector &projectPartIds() const;
@@ -57,15 +57,15 @@ private:
Utf8StringVector projectPartIds_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionCommand &command);
CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second);
CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForCodeCompletionCommand &first, const UnregisterProjectPartsForCodeCompletionCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForCodeCompletionMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForCodeCompletionMessage &message);
CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second);
CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForCodeCompletionMessage &first, const UnregisterProjectPartsForCodeCompletionMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterProjectPartsForCodeCompletionCommand &command);
void PrintTo(const UnregisterProjectPartsForCodeCompletionCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterProjectPartsForCodeCompletionMessage &message);
void PrintTo(const UnregisterProjectPartsForCodeCompletionMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand)
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage)
#endif // CLANGBACKEND_UNREGISTERPROJECTSFORCODECOMPLETION_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "cmbunregistertranslationunitsforcodecompletioncommand.h"
#include "cmbunregistertranslationunitsforcodecompletionmessage.h"
#include "container_common.h"
@@ -42,45 +42,45 @@
namespace ClangBackEnd {
UnregisterTranslationUnitsForCodeCompletionCommand::UnregisterTranslationUnitsForCodeCompletionCommand(const QVector<FileContainer> &fileContainers)
UnregisterTranslationUnitsForCodeCompletionMessage::UnregisterTranslationUnitsForCodeCompletionMessage(const QVector<FileContainer> &fileContainers)
: fileContainers_(fileContainers)
{
}
const QVector<FileContainer> &UnregisterTranslationUnitsForCodeCompletionCommand::fileContainers() const
const QVector<FileContainer> &UnregisterTranslationUnitsForCodeCompletionMessage::fileContainers() const
{
return fileContainers_;
}
QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionCommand &command)
QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
out << command.fileContainers_;
out << message.fileContainers_;
return out;
}
QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionCommand &command)
QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
in >> command.fileContainers_;
in >> message.fileContainers_;
return in;
}
bool operator==(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second)
bool operator==(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second)
{
return first.fileContainers_ == second.fileContainers_;
}
bool operator<(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second)
bool operator<(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForCodeCompletionCommand &command)
QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
debug.nospace() << "UnregisterTranslationUnitsForCodeCompletionCommand(";
debug.nospace() << "UnregisterTranslationUnitsForCodeCompletionMessage(";
for (const FileContainer &fileContainer : command.fileContainers())
for (const FileContainer &fileContainer : message.fileContainers())
debug.nospace() << fileContainer << ", ";
debug.nospace() << ")";
@@ -89,11 +89,11 @@ QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForCodeCompletio
}
#ifdef CLANGBACKEND_TESTS
void PrintTo(const UnregisterTranslationUnitsForCodeCompletionCommand &command, ::std::ostream* os)
void PrintTo(const UnregisterTranslationUnitsForCodeCompletionMessage &message, ::std::ostream* os)
{
*os << "UnregisterTranslationUnitsForCodeCompletionCommand(";
*os << "UnregisterTranslationUnitsForCodeCompletionMessage(";
for (const FileContainer &fileContainer : command.fileContainers())
for (const FileContainer &fileContainer : message.fileContainers())
*os << ::testing::PrintToString(fileContainer) << ", ";
*os << ")";

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionCommand_H
#define CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionCommand_H
#ifndef CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionMessage_H
#define CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionMessage_H
#include "clangbackendipc_global.h"
@@ -40,17 +40,17 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT UnregisterTranslationUnitsForCodeCompletionCommand
class CMBIPC_EXPORT UnregisterTranslationUnitsForCodeCompletionMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionCommand &command);
friend CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second);
friend void PrintTo(const UnregisterTranslationUnitsForCodeCompletionCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionMessage &message);
friend CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second);
friend void PrintTo(const UnregisterTranslationUnitsForCodeCompletionMessage &message, ::std::ostream* os);
public:
UnregisterTranslationUnitsForCodeCompletionCommand() = default;
UnregisterTranslationUnitsForCodeCompletionCommand(const QVector<FileContainer> &fileContainers);
UnregisterTranslationUnitsForCodeCompletionMessage() = default;
UnregisterTranslationUnitsForCodeCompletionMessage(const QVector<FileContainer> &fileContainers);
const QVector<FileContainer> &fileContainers() const;
@@ -58,17 +58,17 @@ private:
QVector<FileContainer> fileContainers_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionCommand &command);
CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second);
CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForCodeCompletionCommand &first, const UnregisterTranslationUnitsForCodeCompletionCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForCodeCompletionMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForCodeCompletionMessage &message);
CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second);
CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForCodeCompletionMessage &first, const UnregisterTranslationUnitsForCodeCompletionMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForCodeCompletionCommand &command);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForCodeCompletionMessage &message);
#ifdef CLANGBACKEND_TESTS
void PrintTo(const UnregisterTranslationUnitsForCodeCompletionCommand &command, ::std::ostream* os);
void PrintTo(const UnregisterTranslationUnitsForCodeCompletionMessage &message, ::std::ostream* os);
#endif
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand)
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage)
#endif // CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionCommand_H
#endif // CLANGBACKEND_UNRegisterTranslationUnitForCodeCompletionMessage_H

View File

@@ -120,26 +120,26 @@ quint32 &CodeCompletion::availabilityAsInt()
return reinterpret_cast<quint32&>(availability_);
}
QDataStream &operator<<(QDataStream &out, const CodeCompletion &command)
QDataStream &operator<<(QDataStream &out, const CodeCompletion &message)
{
out << command.text_;
out << command.chunks_;
out << command.priority_;
out << command.completionKind_;
out << command.availability_;
out << command.hasParameters_;
out << message.text_;
out << message.chunks_;
out << message.priority_;
out << message.completionKind_;
out << message.availability_;
out << message.hasParameters_;
return out;
}
QDataStream &operator>>(QDataStream &in, CodeCompletion &command)
QDataStream &operator>>(QDataStream &in, CodeCompletion &message)
{
in >> command.text_;
in >> command.chunks_;
in >> command.priority_;
in >> command.completionKindAsInt();
in >> command.availabilityAsInt();
in >> command.hasParameters_;
in >> message.text_;
in >> message.chunks_;
in >> message.priority_;
in >> message.completionKindAsInt();
in >> message.availabilityAsInt();
in >> message.hasParameters_;
return in;
}
@@ -191,30 +191,30 @@ static const char *availabilityToString(CodeCompletion::Availability availabilit
return nullptr;
}
QDebug operator<<(QDebug debug, const CodeCompletion &command)
QDebug operator<<(QDebug debug, const CodeCompletion &message)
{
debug.nospace() << "CodeCompletion(";
debug.nospace() << command.text_ << ", ";
debug.nospace() << command.priority_ << ", ";
debug.nospace() << completionKindToString(command.completionKind_) << ", ";
debug.nospace() << availabilityToString(command.availability_) << ", ";
debug.nospace() << command.hasParameters_;
debug.nospace() << message.text_ << ", ";
debug.nospace() << message.priority_ << ", ";
debug.nospace() << completionKindToString(message.completionKind_) << ", ";
debug.nospace() << availabilityToString(message.availability_) << ", ";
debug.nospace() << message.hasParameters_;
debug.nospace() << ")";
return debug;
}
void PrintTo(const CodeCompletion &command, ::std::ostream* os)
void PrintTo(const CodeCompletion &message, ::std::ostream* os)
{
*os << "CodeCompletion(";
*os << command.text_.constData() << ", ";
*os << command.priority_ << ", ";
*os << completionKindToString(command.completionKind_) << ", ";
*os << availabilityToString(command.availability_) << ", ";
*os << command.hasParameters_;
*os << message.text_.constData() << ", ";
*os << message.priority_ << ", ";
*os << completionKindToString(message.completionKind_) << ", ";
*os << availabilityToString(message.availability_) << ", ";
*os << message.hasParameters_;
*os << ")";
}

View File

@@ -46,12 +46,12 @@ using CodeCompletions = QVector<CodeCompletion>;
class CMBIPC_EXPORT CodeCompletion
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletion &command);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletion &message);
friend CMBIPC_EXPORT bool operator==(const CodeCompletion &first, const CodeCompletion &second);
friend CMBIPC_EXPORT bool operator<(const CodeCompletion &first, const CodeCompletion &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &command);
friend void PrintTo(const CodeCompletion &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
friend void PrintTo(const CodeCompletion &message, ::std::ostream* os);
public:
enum Kind : quint32 {
@@ -120,15 +120,15 @@ private:
bool hasParameters_ = false;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletion &command);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletion &message);
CMBIPC_EXPORT bool operator==(const CodeCompletion &first, const CodeCompletion &second);
CMBIPC_EXPORT bool operator<(const CodeCompletion &first, const CodeCompletion &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &command);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, CodeCompletion::Kind kind);
void PrintTo(const CodeCompletion &command, ::std::ostream* os);
void PrintTo(const CodeCompletion &message, ::std::ostream* os);
void PrintTo(CodeCompletion::Kind kind, ::std::ostream *os);
void PrintTo(CodeCompletion::Availability availability, ::std::ostream *os);
} // namespace ClangBackEnd

View File

@@ -31,9 +31,9 @@
#include "connectionclient.h"
#include "clangbackendipcdebugutils.h"
#include "cmbcompletecodecommand.h"
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbunregistertranslationunitsforcodecompletioncommand.h"
#include "cmbcompletecodemessage.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "cmbunregistertranslationunitsforcodecompletionmessage.h"
#include <QCoreApplication>
#include <QProcess>
@@ -100,17 +100,17 @@ bool ConnectionClient::isConnected() const
return localSocket.state() == QLocalSocket::ConnectedState;
}
void ConnectionClient::ensureCommandIsWritten()
void ConnectionClient::ensureMessageIsWritten()
{
while (isConnected() && localSocket.bytesToWrite() > 0)
localSocket.waitForBytesWritten(50);
}
void ConnectionClient::sendEndCommand()
void ConnectionClient::sendEndMessage()
{
serverProxy_.end();
localSocket.flush();
ensureCommandIsWritten();
ensureMessageIsWritten();
}
void ConnectionClient::resetProcessAliveTimer()
@@ -180,7 +180,7 @@ bool ConnectionClient::connectToLocalSocket()
void ConnectionClient::endProcess()
{
if (isProcessIsRunning()) {
sendEndCommand();
sendEndMessage();
process()->waitForFinished();
}
}

View File

@@ -61,7 +61,7 @@ public:
bool disconnectFromServer();
bool isConnected() const;
void sendEndCommand();
void sendEndMessage();
void resetProcessAliveTimer();
void setProcessAliveTimerInterval(int processTimerInterval);
@@ -98,7 +98,7 @@ private:
void disconnectProcessFinished() const;
void connectStandardOutputAndError() const;
void ensureCommandIsWritten();
void ensureMessageIsWritten();
private:
mutable std::unique_ptr<QProcess> process_;

View File

@@ -80,7 +80,7 @@ int ConnectionServer::clientProxyCount() const
void ConnectionServer::timerEvent(QTimerEvent *timerEvent)
{
if (aliveTimerId == timerEvent->timerId())
sendAliveCommand();
sendAliveMessage();
}
void ConnectionServer::handleNewConnection()
@@ -96,7 +96,7 @@ void ConnectionServer::handleNewConnection()
emit newConnection();
}
void ConnectionServer::sendAliveCommand()
void ConnectionServer::sendAliveMessage()
{
ipcServer->client()->alive();
}

View File

@@ -64,7 +64,7 @@ protected:
private:
void handleNewConnection();
void sendAliveCommand();
void sendAliveMessage();
void handleSocketDisconnect();
void removeClientProxyWithLocalSocket(QLocalSocket *localSocket);
QLocalSocket *nextPendingConnection();

View File

@@ -50,28 +50,28 @@ void IpcClientDispatcher::alive()
client->alive();
}
void IpcClientDispatcher::echo(const EchoCommand &command)
void IpcClientDispatcher::echo(const EchoMessage &message)
{
for (auto *client : clients)
client->echo(command);
client->echo(message);
}
void IpcClientDispatcher::codeCompleted(const CodeCompletedCommand &command)
void IpcClientDispatcher::codeCompleted(const CodeCompletedMessage &message)
{
for (auto *client : clients)
client->codeCompleted(command);
client->codeCompleted(message);
}
void IpcClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command)
void IpcClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{
for (auto *client : clients)
client->translationUnitDoesNotExist(command);
client->translationUnitDoesNotExist(message);
}
void IpcClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command)
void IpcClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{
for (auto *client : clients)
client->projectPartsDoNotExist(command);
client->projectPartsDoNotExist(message);
}
} // namespace ClangBackEnd

View File

@@ -44,10 +44,10 @@ public:
void removeClient(IpcClientInterface *client);
void alive() override;
void echo(const EchoCommand &command) override;
void codeCompleted(const CodeCompletedCommand &command) override;
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) override;
void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) override;
void echo(const EchoMessage &message) override;
void codeCompleted(const CodeCompletedMessage &message) override;
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) override;
void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) override;
private:
QVector<IpcClientInterface*> clients;

View File

@@ -30,10 +30,10 @@
#include "ipcclientinterface.h"
#include "cmbcodecompletedcommand.h"
#include "cmbechocommand.h"
#include "projectpartsdonotexistcommand.h"
#include "translationunitdoesnotexistcommand.h"
#include "cmbcodecompletedmessage.h"
#include "cmbechomessage.h"
#include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h"
#include <QDebug>
#include <QVariant>
@@ -41,28 +41,28 @@
namespace ClangBackEnd {
void IpcClientInterface::dispatch(const QVariant &command)
void IpcClientInterface::dispatch(const QVariant &message)
{
static const int aliveCommandType = QMetaType::type("ClangBackEnd::AliveCommand");
static const int echoCommandType = QMetaType::type("ClangBackEnd::EchoCommand");
static const int codeCompletedCommandType = QMetaType::type("ClangBackEnd::CodeCompletedCommand");
static const int translationUnitDoesNotExistCommand = QMetaType::type("ClangBackEnd::TranslationUnitDoesNotExistCommand");
static const int projectPartsDoNotExistCommand = QMetaType::type("ClangBackEnd::ProjectPartsDoNotExistCommand");
static const int aliveMessageType = QMetaType::type("ClangBackEnd::AliveMessage");
static const int echoMessageType = QMetaType::type("ClangBackEnd::EchoMessage");
static const int codeCompletedMessageType = QMetaType::type("ClangBackEnd::CodeCompletedMessage");
static const int translationUnitDoesNotExistMessage = QMetaType::type("ClangBackEnd::TranslationUnitDoesNotExistMessage");
static const int projectPartsDoNotExistMessage = QMetaType::type("ClangBackEnd::ProjectPartsDoNotExistMessage");
int type = command.userType();
int type = message.userType();
if (type == aliveCommandType)
if (type == aliveMessageType)
alive();
else if (type == echoCommandType)
echo(command.value<EchoCommand>());
else if (type == codeCompletedCommandType)
codeCompleted(command.value<CodeCompletedCommand>());
else if (type == translationUnitDoesNotExistCommand)
translationUnitDoesNotExist(command.value<TranslationUnitDoesNotExistCommand>());
else if (type == projectPartsDoNotExistCommand)
projectPartsDoNotExist(command.value<ProjectPartsDoNotExistCommand>());
else if (type == echoMessageType)
echo(message.value<EchoMessage>());
else if (type == codeCompletedMessageType)
codeCompleted(message.value<CodeCompletedMessage>());
else if (type == translationUnitDoesNotExistMessage)
translationUnitDoesNotExist(message.value<TranslationUnitDoesNotExistMessage>());
else if (type == projectPartsDoNotExistMessage)
projectPartsDoNotExist(message.value<ProjectPartsDoNotExistMessage>());
else
qWarning() << "Unknown IpcClientCommand";
qWarning() << "Unknown IpcClientMessage";
}
} // namespace ClangBackEnd

View File

@@ -36,26 +36,26 @@
namespace ClangBackEnd {
class IpcServerInterface;
class RegisterTranslationUnitForCodeCompletionCommand;
class RegisterProjectPartsForCodeCompletionCommand;
class UnregisterTranslationUnitsForCodeCompletionCommand;
class UnregisterProjectPartsForCodeCompletionCommand;
class EchoCommand;
class CompleteCodeCommand;
class CodeCompletedCommand;
class TranslationUnitDoesNotExistCommand;
class ProjectPartsDoNotExistCommand;
class RegisterTranslationUnitForCodeCompletionMessage;
class RegisterProjectPartsForCodeCompletionMessage;
class UnregisterTranslationUnitsForCodeCompletionMessage;
class UnregisterProjectPartsForCodeCompletionMessage;
class EchoMessage;
class CompleteCodeMessage;
class CodeCompletedMessage;
class TranslationUnitDoesNotExistMessage;
class ProjectPartsDoNotExistMessage;
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
{
public:
void dispatch(const QVariant &command) override;
void dispatch(const QVariant &message) override;
virtual void alive() = 0;
virtual void echo(const EchoCommand &command) = 0;
virtual void codeCompleted(const CodeCompletedCommand &command) = 0;
virtual void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) = 0;
virtual void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) = 0;
virtual void echo(const EchoMessage &message) = 0;
virtual void codeCompleted(const CodeCompletedMessage &message) = 0;
virtual void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) = 0;
virtual void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) = 0;
};
} // namespace ClangBackEnd

View File

@@ -30,13 +30,13 @@
#include "ipcclientproxy.h"
#include "cmbalivecommand.h"
#include "cmbcodecompletedcommand.h"
#include "cmbechocommand.h"
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbalivemessage.h"
#include "cmbcodecompletedmessage.h"
#include "cmbechomessage.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "ipcserverinterface.h"
#include "projectpartsdonotexistcommand.h"
#include "translationunitdoesnotexistcommand.h"
#include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h"
#include <QDebug>
#include <QIODevice>
@@ -46,17 +46,17 @@
namespace ClangBackEnd {
IpcClientProxy::IpcClientProxy(IpcServerInterface *server, QIODevice *ioDevice)
: writeCommandBlock(ioDevice),
readCommandBlock(ioDevice),
: writeMessageBlock(ioDevice),
readMessageBlock(ioDevice),
server(server),
ioDevice(ioDevice)
{
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcClientProxy::readCommands();});
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcClientProxy::readMessages();});
}
IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
: writeCommandBlock(std::move(other.writeCommandBlock)),
readCommandBlock(std::move(other.readCommandBlock)),
: writeMessageBlock(std::move(other.writeMessageBlock)),
readMessageBlock(std::move(other.readMessageBlock)),
server(std::move(other.server)),
ioDevice(std::move(other.ioDevice))
{
@@ -65,8 +65,8 @@ IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
{
writeCommandBlock = std::move(other.writeCommandBlock);
readCommandBlock = std::move(other.readCommandBlock);
writeMessageBlock = std::move(other.writeMessageBlock);
readMessageBlock = std::move(other.readMessageBlock);
server = std::move(other.server);
ioDevice = std::move(other.ioDevice);
@@ -75,33 +75,33 @@ IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
void IpcClientProxy::alive()
{
writeCommandBlock.write(QVariant::fromValue(AliveCommand()));
writeMessageBlock.write(QVariant::fromValue(AliveMessage()));
}
void IpcClientProxy::echo(const EchoCommand &command)
void IpcClientProxy::echo(const EchoMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcClientProxy::codeCompleted(const CodeCompletedCommand &command)
void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command)
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command)
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcClientProxy::readCommands()
void IpcClientProxy::readMessages()
{
for (const QVariant &command : readCommandBlock.readAll())
server->dispatch(command);
for (const QVariant &message : readMessageBlock.readAll())
server->dispatch(message);
}
bool IpcClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const

View File

@@ -33,8 +33,8 @@
#include "clangbackendipc_global.h"
#include "ipcclientinterface.h"
#include "readcommandblock.h"
#include "writecommandblock.h"
#include "readmessageblock.h"
#include "writemessageblock.h"
#include <QtGlobal>
@@ -58,18 +58,18 @@ public:
IpcClientProxy &operator=(IpcClientProxy&&other);
void alive() override;
void echo(const EchoCommand &command) override;
void codeCompleted(const CodeCompletedCommand &command) override;
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command) override;
void projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command) override;
void echo(const EchoMessage &message) override;
void codeCompleted(const CodeCompletedMessage &message) override;
void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) override;
void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) override;
void readCommands();
void readMessages();
bool isUsingThatIoDevice(QIODevice *ioDevice) const;
private:
ClangBackEnd::WriteCommandBlock writeCommandBlock;
ClangBackEnd::ReadCommandBlock readCommandBlock;
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
IpcServerInterface *server = nullptr;
QIODevice *ioDevice = nullptr;
};

View File

@@ -45,7 +45,7 @@ class CMBIPC_EXPORT IpcInterface
{
public:
virtual ~IpcInterface();
virtual void dispatch(const QVariant &command) = 0;
virtual void dispatch(const QVariant &message) = 0;
};
} // namespace ClangBackEnd

View File

@@ -30,42 +30,42 @@
#include "ipcserverinterface.h"
#include "cmbcompletecodecommand.h"
#include "cmbregisterprojectsforcodecompletioncommand.h"
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbunregisterprojectsforcodecompletioncommand.h"
#include "cmbunregistertranslationunitsforcodecompletioncommand.h"
#include "cmbcompletecodemessage.h"
#include "cmbregisterprojectsforcodecompletionmessage.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "cmbunregisterprojectsforcodecompletionmessage.h"
#include "cmbunregistertranslationunitsforcodecompletionmessage.h"
#include <QDebug>
#include <QVariant>
namespace ClangBackEnd {
void IpcServerInterface::dispatch(const QVariant &command)
void IpcServerInterface::dispatch(const QVariant &message)
{
static const int endCommandType = QMetaType::type("ClangBackEnd::EndCommand");
static const int registerTranslationUnitsForCodeCompletionCommandType = QMetaType::type("ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand");
static const int unregisterTranslationUnitsForCodeCompletionCommandType = QMetaType::type("ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand");
static const int registerProjectPartsForCodeCompletionCommandType = QMetaType::type("ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand");
static const int unregisterProjectPartsForCodeCompletionCommandType = QMetaType::type("ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand");
static const int completeCodeCommandType = QMetaType::type("ClangBackEnd::CompleteCodeCommand");
static const int endMessageType = QMetaType::type("ClangBackEnd::EndMessage");
static const int registerTranslationUnitsForCodeCompletionMessageType = QMetaType::type("ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage");
static const int unregisterTranslationUnitsForCodeCompletionMessageType = QMetaType::type("ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage");
static const int registerProjectPartsForCodeCompletionMessageType = QMetaType::type("ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage");
static const int unregisterProjectPartsForCodeCompletionMessageType = QMetaType::type("ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage");
static const int completeCodeMessageType = QMetaType::type("ClangBackEnd::CompleteCodeMessage");
int type = command.userType();
int type = message.userType();
if (type == endCommandType)
if (type == endMessageType)
end();
else if (type == registerTranslationUnitsForCodeCompletionCommandType)
registerTranslationUnitsForCodeCompletion(command.value<RegisterTranslationUnitForCodeCompletionCommand>());
else if (type == unregisterTranslationUnitsForCodeCompletionCommandType)
unregisterTranslationUnitsForCodeCompletion(command.value<UnregisterTranslationUnitsForCodeCompletionCommand>());
else if (type == registerProjectPartsForCodeCompletionCommandType)
registerProjectPartsForCodeCompletion(command.value<RegisterProjectPartsForCodeCompletionCommand>());
else if (type == unregisterProjectPartsForCodeCompletionCommandType)
unregisterProjectPartsForCodeCompletion(command.value<UnregisterProjectPartsForCodeCompletionCommand>());
else if (type == completeCodeCommandType)
completeCode(command.value<CompleteCodeCommand>());
else if (type == registerTranslationUnitsForCodeCompletionMessageType)
registerTranslationUnitsForCodeCompletion(message.value<RegisterTranslationUnitForCodeCompletionMessage>());
else if (type == unregisterTranslationUnitsForCodeCompletionMessageType)
unregisterTranslationUnitsForCodeCompletion(message.value<UnregisterTranslationUnitsForCodeCompletionMessage>());
else if (type == registerProjectPartsForCodeCompletionMessageType)
registerProjectPartsForCodeCompletion(message.value<RegisterProjectPartsForCodeCompletionMessage>());
else if (type == unregisterProjectPartsForCodeCompletionMessageType)
unregisterProjectPartsForCodeCompletion(message.value<UnregisterProjectPartsForCodeCompletionMessage>());
else if (type == completeCodeMessageType)
completeCode(message.value<CompleteCodeMessage>());
else
qWarning() << "Unknown IpcServerCommand";
qWarning() << "Unknown IpcServerMessage";
}
void IpcServerInterface::addClient(IpcClientInterface *client)

View File

@@ -42,14 +42,14 @@ class IpcClientInterface;
class CMBIPC_EXPORT IpcServerInterface : public IpcInterface
{
public:
void dispatch(const QVariant &command) override;
void dispatch(const QVariant &message) override;
virtual void end() = 0;
virtual void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) = 0;
virtual void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) = 0;
virtual void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) = 0;
virtual void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) = 0;
virtual void completeCode(const CompleteCodeCommand &command) = 0;
virtual void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message) = 0;
virtual void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message) = 0;
virtual void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message) = 0;
virtual void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message) = 0;
virtual void completeCode(const CompleteCodeMessage &message) = 0;
void addClient(IpcClientInterface *client);
void removeClient(IpcClientInterface *client);

View File

@@ -30,13 +30,13 @@
#include "ipcserverproxy.h"
#include <cmbalivecommand.h>
#include <cmbcompletecodecommand.h>
#include <cmbendcommand.h>
#include <cmbregisterprojectsforcodecompletioncommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregisterprojectsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <cmbalivemessage.h>
#include <cmbcompletecodemessage.h>
#include <cmbendmessage.h>
#include <cmbregisterprojectsforcodecompletionmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregisterprojectsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <ipcclientinterface.h>
#include <QLocalServer>
@@ -46,53 +46,53 @@
namespace ClangBackEnd {
IpcServerProxy::IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
: writeCommandBlock(ioDevice),
readCommandBlock(ioDevice),
: writeMessageBlock(ioDevice),
readMessageBlock(ioDevice),
client(client)
{
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcServerProxy::readCommands();});
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcServerProxy::readMessages();});
}
void IpcServerProxy::readCommands()
void IpcServerProxy::readMessages()
{
for (const QVariant &command : readCommandBlock.readAll())
client->dispatch(command);
for (const QVariant &message : readMessageBlock.readAll())
client->dispatch(message);
}
void IpcServerProxy::resetCounter()
{
writeCommandBlock.resetCounter();
readCommandBlock.resetCounter();
writeMessageBlock.resetCounter();
readMessageBlock.resetCounter();
}
void IpcServerProxy::end()
{
writeCommandBlock.write(QVariant::fromValue(EndCommand()));
writeMessageBlock.write(QVariant::fromValue(EndMessage()));
}
void IpcServerProxy::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command)
void IpcServerProxy::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcServerProxy::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command)
void IpcServerProxy::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcServerProxy::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command)
void IpcServerProxy::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcServerProxy::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command)
void IpcServerProxy::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
void IpcServerProxy::completeCode(const CompleteCodeCommand &command)
void IpcServerProxy::completeCode(const CompleteCodeMessage &message)
{
writeCommandBlock.write(QVariant::fromValue(command));
writeMessageBlock.write(QVariant::fromValue(message));
}
} // namespace ClangBackEnd

View File

@@ -31,8 +31,8 @@
#ifndef CLANGBACKEND_IPCSERVERPROXY_H
#define CLANGBACKEND_IPCSERVERPROXY_H
#include "ipcserverinterface.h"
#include "readcommandblock.h"
#include "writecommandblock.h"
#include "readmessageblock.h"
#include "writemessageblock.h"
#include <QtGlobal>
#include <QTimer>
@@ -56,19 +56,19 @@ public:
IpcServerProxy &operator=(const IpcServerProxy&) = delete;
void end() override;
void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) override;
void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) override;
void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) override;
void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) override;
void completeCode(const CompleteCodeCommand &command) override;
void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message) override;
void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message) override;
void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message) override;
void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message) override;
void completeCode(const CompleteCodeMessage &message) override;
void readCommands();
void readMessages();
void resetCounter();
private:
ClangBackEnd::WriteCommandBlock writeCommandBlock;
ClangBackEnd::ReadCommandBlock readCommandBlock;
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
IpcClientInterface *client;
};

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "projectpartsdonotexistcommand.h"
#include "projectpartsdonotexistmessage.h"
#include <QDataStream>
#include <QDebug>
@@ -39,58 +39,58 @@
namespace ClangBackEnd {
ProjectPartsDoNotExistCommand::ProjectPartsDoNotExistCommand(const Utf8StringVector &projectPartIds)
ProjectPartsDoNotExistMessage::ProjectPartsDoNotExistMessage(const Utf8StringVector &projectPartIds)
: projectPartIds_(projectPartIds)
{
}
const Utf8StringVector &ProjectPartsDoNotExistCommand::projectPartIds() const
const Utf8StringVector &ProjectPartsDoNotExistMessage::projectPartIds() const
{
return projectPartIds_;
}
QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command)
QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message)
{
out << command.projectPartIds_;
out << message.projectPartIds_;
return out;
}
QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command)
QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistMessage &message)
{
in >> command.projectPartIds_;
in >> message.projectPartIds_;
return in;
}
bool operator==(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second)
bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second)
{
return first.projectPartIds_ == second.projectPartIds_;
}
bool operator<(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second)
bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second)
{
return compareContainer(first.projectPartIds_, second.projectPartIds_);
}
QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistCommand &command)
QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message)
{
debug.nospace() << "ProjectPartDoesNotExistCommand(";
debug.nospace() << "ProjectPartDoesNotExistMessage(";
debug.nospace() << command.projectPartIds_;
debug.nospace() << message.projectPartIds_;
debug.nospace() << ")";
return debug;
}
void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os)
void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os)
{
QString output;
QDebug debug(&output);
debug << command;
debug << message;
*os << output.toUtf8().constData();
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H
#define CLANGBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H
#ifndef CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H
#define CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H
#include "clangbackendipc_global.h"
@@ -39,17 +39,17 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT ProjectPartsDoNotExistCommand
class CMBIPC_EXPORT ProjectPartsDoNotExistMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command);
friend CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second);
friend CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistCommand &command);
friend void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistMessage &message);
friend CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
friend CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
friend void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
public:
ProjectPartsDoNotExistCommand() = default;
ProjectPartsDoNotExistCommand(const Utf8StringVector &projectPartIds);
ProjectPartsDoNotExistMessage() = default;
ProjectPartsDoNotExistMessage(const Utf8StringVector &projectPartIds);
const Utf8StringVector &projectPartIds() const;
@@ -57,16 +57,16 @@ private:
Utf8StringVector projectPartIds_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistCommand &command);
CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second);
CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistCommand &first, const ProjectPartsDoNotExistCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistMessage &message);
CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistCommand &command);
void PrintTo(const ProjectPartsDoNotExistCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartsDoNotExistCommand)
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartsDoNotExistMessage)
#endif // CLANGBACKEND_PROJECTPARTSDONOTEXISTCOMMAND_H
#endif // CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "readcommandblock.h"
#include "readmessageblock.h"
#include <QDataStream>
#include <QDebug>
@@ -37,63 +37,63 @@
namespace ClangBackEnd {
ReadCommandBlock::ReadCommandBlock(QIODevice *ioDevice)
ReadMessageBlock::ReadMessageBlock(QIODevice *ioDevice)
: ioDevice(ioDevice),
commandCounter(0),
messageCounter(0),
blockSize(0)
{
}
void ReadCommandBlock::checkIfCommandIsLost(QDataStream &in)
void ReadMessageBlock::checkIfMessageIsLost(QDataStream &in)
{
qint64 currentCommandCounter;
qint64 currentMessageCounter;
in >> currentCommandCounter;
in >> currentMessageCounter;
#ifndef DONT_CHECK_COMMAND_COUNTER
bool commandLost = !((currentCommandCounter == 0 && commandCounter == 0) || (commandCounter + 1 == currentCommandCounter));
if (commandLost)
qWarning() << "client command lost: " << commandCounter << currentCommandCounter;
#ifndef DONT_CHECK_MESSAGE_COUNTER
bool messageLost = !((currentMessageCounter == 0 && messageCounter == 0) || (messageCounter + 1 == currentMessageCounter));
if (messageLost)
qWarning() << "client message lost: " << messageCounter << currentMessageCounter;
#endif
commandCounter = currentCommandCounter;
messageCounter = currentMessageCounter;
}
QVariant ReadCommandBlock::read()
QVariant ReadMessageBlock::read()
{
QDataStream in(ioDevice);
QVariant command;
QVariant message;
if (isTheWholeCommandReadable(in)) {
checkIfCommandIsLost(in);
in >> command;
if (isTheWholeMessageReadable(in)) {
checkIfMessageIsLost(in);
in >> message;
}
return command;
return message;
}
QVector<QVariant> ReadCommandBlock::readAll()
QVector<QVariant> ReadMessageBlock::readAll()
{
QVector<QVariant> commands;
QVector<QVariant> messages;
while (true) {
const QVariant command = read();
if (command.isValid())
commands.append(command);
const QVariant message = read();
if (message.isValid())
messages.append(message);
else
return commands;
return messages;
}
Q_UNREACHABLE();
}
void ReadCommandBlock::resetCounter()
void ReadMessageBlock::resetCounter()
{
commandCounter = 0;
messageCounter = 0;
}
bool ReadCommandBlock::isTheWholeCommandReadable(QDataStream &in)
bool ReadMessageBlock::isTheWholeMessageReadable(QDataStream &in)
{
if (ioDevice->bytesAvailable() == 0)
return false;

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_READCOMMANDBLOCK_H
#define CLANGBACKEND_READCOMMANDBLOCK_H
#ifndef CLANGBACKEND_READMESSAGEBLOCK_H
#define CLANGBACKEND_READMESSAGEBLOCK_H
#include <QtGlobal>
@@ -41,10 +41,10 @@ QT_END_NAMESPACE
namespace ClangBackEnd {
class ReadCommandBlock
class ReadMessageBlock
{
public:
ReadCommandBlock(QIODevice *ioDevice = nullptr);
ReadMessageBlock(QIODevice *ioDevice = nullptr);
QVariant read();
QVector<QVariant> readAll();
@@ -52,15 +52,15 @@ public:
void resetCounter();
private:
bool isTheWholeCommandReadable(QDataStream &in);
void checkIfCommandIsLost(QDataStream &in);
bool isTheWholeMessageReadable(QDataStream &in);
void checkIfMessageIsLost(QDataStream &in);
private:
QIODevice *ioDevice;
qint64 commandCounter;
qint64 messageCounter;
qint32 blockSize;
};
} // namespace ClangBackEnd
#endif // CLANGBACKEND_READCOMMANDBLOCK_H
#endif // CLANGBACKEND_READMESSAGEBLOCK_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "translationunitdoesnotexistcommand.h"
#include "translationunitdoesnotexistmessage.h"
#include <QDataStream>
#include <QDebug>
@@ -37,72 +37,72 @@
namespace ClangBackEnd {
TranslationUnitDoesNotExistCommand::TranslationUnitDoesNotExistCommand(const FileContainer &fileContainer)
TranslationUnitDoesNotExistMessage::TranslationUnitDoesNotExistMessage(const FileContainer &fileContainer)
: fileContainer_(fileContainer)
{
}
TranslationUnitDoesNotExistCommand::TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectPartId)
TranslationUnitDoesNotExistMessage::TranslationUnitDoesNotExistMessage(const Utf8String &filePath, const Utf8String &projectPartId)
: fileContainer_(filePath, projectPartId)
{
}
const FileContainer &TranslationUnitDoesNotExistCommand::fileContainer() const
const FileContainer &TranslationUnitDoesNotExistMessage::fileContainer() const
{
return fileContainer_;
}
const Utf8String &TranslationUnitDoesNotExistCommand::filePath() const
const Utf8String &TranslationUnitDoesNotExistMessage::filePath() const
{
return fileContainer_.filePath();
}
const Utf8String &TranslationUnitDoesNotExistCommand::projectPartId() const
const Utf8String &TranslationUnitDoesNotExistMessage::projectPartId() const
{
return fileContainer_.projectPartId();
}
QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistCommand &command)
QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message)
{
out << command.fileContainer_;
out << message.fileContainer_;
return out;
}
QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistCommand &command)
QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistMessage &message)
{
in >> command.fileContainer_;
in >> message.fileContainer_;
return in;
}
bool operator==(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second)
bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second)
{
return first.fileContainer_ == second.fileContainer_;
}
bool operator<(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second)
bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second)
{
return first.fileContainer_ < second.fileContainer_;
}
QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistCommand &command)
QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message)
{
debug.nospace() << "TranslationUnitDoesNotExistCommand(";
debug.nospace() << "TranslationUnitDoesNotExistMessage(";
debug.nospace() << command.fileContainer_;
debug.nospace() << message.fileContainer_;
debug.nospace() << ")";
return debug;
}
void PrintTo(const TranslationUnitDoesNotExistCommand &command, ::std::ostream* os)
void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os)
{
QString output;
QDebug debug(&output);
debug << command;
debug << message;
*os << output.toUtf8().constData();
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSCOMMAND_H
#define CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSCOMMAND_H
#ifndef CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H
#define CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H
#include "filecontainer.h"
@@ -37,18 +37,18 @@
namespace ClangBackEnd {
class CMBIPC_EXPORT TranslationUnitDoesNotExistCommand
class CMBIPC_EXPORT TranslationUnitDoesNotExistMessage
{
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistCommand &command);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistCommand &command);
friend CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second);
friend CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistCommand &command);
friend void PrintTo(const TranslationUnitDoesNotExistCommand &command, ::std::ostream* os);
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistMessage &message);
friend CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
friend CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
friend void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
public:
TranslationUnitDoesNotExistCommand() = default;
TranslationUnitDoesNotExistCommand(const FileContainer &fileContainer);
TranslationUnitDoesNotExistCommand(const Utf8String &filePath, const Utf8String &projectPartId);
TranslationUnitDoesNotExistMessage() = default;
TranslationUnitDoesNotExistMessage(const FileContainer &fileContainer);
TranslationUnitDoesNotExistMessage(const Utf8String &filePath, const Utf8String &projectPartId);
const FileContainer &fileContainer() const;
const Utf8String &filePath() const;
@@ -58,16 +58,16 @@ private:
FileContainer fileContainer_;
};
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistCommand &command);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistCommand &command);
CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second);
CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistCommand &first, const TranslationUnitDoesNotExistCommand &second);
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistMessage &message);
CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistCommand &command);
void PrintTo(const TranslationUnitDoesNotExistCommand &command, ::std::ostream* os);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
} // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::TranslationUnitDoesNotExistCommand)
Q_DECLARE_METATYPE(ClangBackEnd::TranslationUnitDoesNotExistMessage)
#endif // CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSCOMMAND_H
#endif // CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H

View File

@@ -28,7 +28,7 @@
**
****************************************************************************/
#include "writecommandblock.h"
#include "writemessageblock.h"
#include <QDataStream>
#include <QDebug>
@@ -37,13 +37,13 @@
namespace ClangBackEnd {
WriteCommandBlock::WriteCommandBlock(QIODevice *ioDevice)
: commandCounter(0),
WriteMessageBlock::WriteMessageBlock(QIODevice *ioDevice)
: messageCounter(0),
ioDevice(ioDevice)
{
}
void WriteCommandBlock::write(const QVariant &command)
void WriteMessageBlock::write(const QVariant &message)
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
@@ -51,26 +51,26 @@ void WriteCommandBlock::write(const QVariant &command)
const qint32 dummyBockSize = 0;
out << dummyBockSize;
out << commandCounter;
out << messageCounter;
out << command;
out << message;
out.device()->seek(0);
out << qint32(block.size() - sizeof(qint32));
++commandCounter;
++messageCounter;
ioDevice->write(block);
}
qint64 WriteCommandBlock::counter() const
qint64 WriteMessageBlock::counter() const
{
return commandCounter;
return messageCounter;
}
void WriteCommandBlock::resetCounter()
void WriteMessageBlock::resetCounter()
{
commandCounter = 0;
messageCounter = 0;
}

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef CLANGBACKEND_WRITECOMMANDBLOCK_H
#define CLANGBACKEND_WRITECOMMANDBLOCK_H
#ifndef CLANGBACKEND_WRITEMESSAGEBLOCK_H
#define CLANGBACKEND_WRITEMESSAGEBLOCK_H
#include <QtGlobal>
@@ -41,22 +41,22 @@ QT_END_NAMESPACE
namespace ClangBackEnd {
class WriteCommandBlock
class WriteMessageBlock
{
public:
WriteCommandBlock(QIODevice *ioDevice = nullptr);
WriteMessageBlock(QIODevice *ioDevice = nullptr);
void write(const QVariant &command);
void write(const QVariant &message);
qint64 counter() const;
void resetCounter();
private:
qint64 commandCounter;
qint64 messageCounter;
QIODevice *ioDevice;
};
} // namespace ClangBackEnd
#endif // CLANGBACKEND_WRITECOMMANDBLOCK_H
#endif // CLANGBACKEND_WRITEMESSAGEBLOCK_H