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

View File

@@ -49,16 +49,16 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <clangbackendipc/cmbcodecompletedcommand.h>
#include <clangbackendipc/cmbcompletecodecommand.h>
#include <clangbackendipc/cmbechocommand.h>
#include <clangbackendipc/cmbregistertranslationunitsforcodecompletioncommand.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletioncommand.h>
#include <clangbackendipc/cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <clangbackendipc/cmbunregisterprojectsforcodecompletioncommand.h>
#include <clangbackendipc/cmbcommands.h>
#include <clangbackendipc/projectpartsdonotexistcommand.h>
#include <clangbackendipc/translationunitdoesnotexistcommand.h>
#include <clangbackendipc/cmbcodecompletedmessage.h>
#include <clangbackendipc/cmbcompletecodemessage.h>
#include <clangbackendipc/cmbechomessage.h>
#include <clangbackendipc/cmbregistertranslationunitsforcodecompletionmessage.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletionmessage.h>
#include <clangbackendipc/cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <clangbackendipc/cmbunregisterprojectsforcodecompletionmessage.h>
#include <clangbackendipc/cmbmessages.h>
#include <clangbackendipc/projectpartsdonotexistmessage.h>
#include <clangbackendipc/translationunitdoesnotexistmessage.h>
#include <cplusplus/Icons.h>
@@ -99,7 +99,7 @@ void IpcReceiver::setAliveHandler(const IpcReceiver::AliveHandler &handler)
m_aliveHandler = handler;
}
void IpcReceiver::addExpectedCodeCompletedCommand(
void IpcReceiver::addExpectedCodeCompletedMessage(
quint64 ticket,
ClangCompletionAssistProcessor *processor)
{
@@ -129,39 +129,39 @@ void IpcReceiver::deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *t
void IpcReceiver::alive()
{
qCDebug(log) << "<<< AliveCommand";
qCDebug(log) << "<<< AliveMessage";
QTC_ASSERT(m_aliveHandler, return);
m_aliveHandler();
}
void IpcReceiver::echo(const EchoCommand &command)
void IpcReceiver::echo(const EchoMessage &message)
{
qCDebug(log) << "<<<" << command;
qCDebug(log) << "<<<" << message;
}
void IpcReceiver::codeCompleted(const CodeCompletedCommand &command)
void IpcReceiver::codeCompleted(const CodeCompletedMessage &message)
{
qCDebug(log) << "<<< CodeCompletedCommand with" << command.codeCompletions().size() << "items";
qCDebug(log) << "<<< CodeCompletedMessage with" << message.codeCompletions().size() << "items";
const quint64 ticket = command.ticketNumber();
const quint64 ticket = message.ticketNumber();
QScopedPointer<ClangCompletionAssistProcessor> processor(m_assistProcessorsTable.take(ticket));
if (processor) {
const bool finished = processor->handleAvailableAsyncCompletions(command.codeCompletions());
const bool finished = processor->handleAvailableAsyncCompletions(message.codeCompletions());
if (!finished)
processor.take();
}
}
void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command)
void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{
QTC_CHECK(!"Got TranslationUnitDoesNotExistCommand");
qCDebug(log) << "<<< ERROR:" << command;
QTC_CHECK(!"Got TranslationUnitDoesNotExistMessage");
qCDebug(log) << "<<< ERROR:" << message;
}
void IpcReceiver::projectPartsDoNotExist(const ProjectPartsDoNotExistCommand &command)
void IpcReceiver::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{
QTC_CHECK(!"Got ProjectPartsDoNotExistCommand");
qCDebug(log) << "<<< ERROR:" << command;
QTC_CHECK(!"Got ProjectPartsDoNotExistMessage");
qCDebug(log) << "<<< ERROR:" << message;
}
class IpcSender : public IpcSenderInterface
@@ -172,11 +172,11 @@ public:
{}
void end() override;
void registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand &command) override;
void unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand &command) override;
void registerProjectPartsForCodeCompletion(const ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand &command) override;
void unregisterProjectPartsForCodeCompletion(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand &command) override;
void completeCode(const ClangBackEnd::CompleteCodeCommand &command) override;
void registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage &message) override;
void unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage &message) override;
void registerProjectPartsForCodeCompletion(const ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage &message) override;
void unregisterProjectPartsForCodeCompletion(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage &message) override;
void completeCode(const ClangBackEnd::CompleteCodeMessage &message) override;
private:
ClangBackEnd::ConnectionClient &m_connection;
@@ -185,37 +185,37 @@ private:
void IpcSender::end()
{
QTC_CHECK(m_connection.isConnected());
m_connection.sendEndCommand();
m_connection.sendEndMessage();
}
void IpcSender::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command)
void IpcSender::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message)
{
QTC_CHECK(m_connection.isConnected());
m_connection.serverProxy().registerTranslationUnitsForCodeCompletion(command);
m_connection.serverProxy().registerTranslationUnitsForCodeCompletion(message);
}
void IpcSender::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command)
void IpcSender::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
QTC_CHECK(m_connection.isConnected());
m_connection.serverProxy().unregisterTranslationUnitsForCodeCompletion(command);
m_connection.serverProxy().unregisterTranslationUnitsForCodeCompletion(message);
}
void IpcSender::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command)
void IpcSender::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message)
{
QTC_CHECK(m_connection.isConnected());
m_connection.serverProxy().registerProjectPartsForCodeCompletion(command);
m_connection.serverProxy().registerProjectPartsForCodeCompletion(message);
}
void IpcSender::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command)
void IpcSender::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message)
{
QTC_CHECK(m_connection.isConnected());
m_connection.serverProxy().unregisterProjectPartsForCodeCompletion(command);
m_connection.serverProxy().unregisterProjectPartsForCodeCompletion(message);
}
void IpcSender::completeCode(const CompleteCodeCommand &command)
void IpcSender::completeCode(const CompleteCodeMessage &message)
{
QTC_CHECK(m_connection.isConnected());
m_connection.serverProxy().completeCode(command);
m_connection.serverProxy().completeCode(message);
}
IpcCommunicator::IpcCommunicator()
@@ -232,13 +232,13 @@ IpcCommunicator::IpcCommunicator()
initializeBackend();
}
static bool areCommandsRegistered = false;
static bool areMessagesRegistered = false;
void IpcCommunicator::initializeBackend()
{
if (!areCommandsRegistered) {
areCommandsRegistered = true;
Commands::registerCommands();
if (!areMessagesRegistered) {
areMessagesRegistered = true;
Messages::registerMessages();
}
const QString clangBackEndProcessPath = backendProcessPath();
@@ -294,7 +294,7 @@ void IpcCommunicator::registerCurrrentCodeModelUiHeaders()
updateUnsavedFile(es->fileName(), es->contents());
}
static QStringList projectPartCommandLine(const CppTools::ProjectPart::Ptr &projectPart)
static QStringList projectPartMessageLine(const CppTools::ProjectPart::Ptr &projectPart)
{
QStringList options = ClangCodeModel::Utils::createClangOptions(projectPart,
CppTools::ProjectFile::Unclassified); // No language option
@@ -306,7 +306,7 @@ static QStringList projectPartCommandLine(const CppTools::ProjectPart::Ptr &proj
static ClangBackEnd::ProjectPartContainer toProjectPartContainer(
const CppTools::ProjectPart::Ptr &projectPart)
{
const QStringList arguments = projectPartCommandLine(projectPart);
const QStringList arguments = projectPartMessageLine(projectPart);
return ClangBackEnd::ProjectPartContainer(projectPart->id(), Utf8StringVector(arguments));
}
@@ -387,9 +387,9 @@ void IpcCommunicator::initializeBackendWithCurrentData()
IpcSenderInterface *IpcCommunicator::setIpcSender(IpcSenderInterface *ipcSender)
{
IpcSenderInterface *previousCommandSender = m_ipcSender.take();
IpcSenderInterface *previousMessageSender = m_ipcSender.take();
m_ipcSender.reset(ipcSender);
return previousCommandSender;
return previousMessageSender;
}
void IpcCommunicator::killBackendProcess()
@@ -402,9 +402,9 @@ void IpcCommunicator::registerFilesForCodeCompletion(const FileContainers &fileC
if (m_sendMode == IgnoreSendRequests)
return;
const RegisterTranslationUnitForCodeCompletionCommand command(fileContainers);
qCDebug(log) << ">>>" << command;
m_ipcSender->registerTranslationUnitsForCodeCompletion(command);
const RegisterTranslationUnitForCodeCompletionMessage message(fileContainers);
qCDebug(log) << ">>>" << message;
m_ipcSender->registerTranslationUnitsForCodeCompletion(message);
}
void IpcCommunicator::unregisterFilesForCodeCompletion(const FileContainers &fileContainers)
@@ -412,9 +412,9 @@ void IpcCommunicator::unregisterFilesForCodeCompletion(const FileContainers &fil
if (m_sendMode == IgnoreSendRequests)
return;
const UnregisterTranslationUnitsForCodeCompletionCommand command(fileContainers);
qCDebug(log) << ">>>" << command;
m_ipcSender->unregisterTranslationUnitsForCodeCompletion(command);
const UnregisterTranslationUnitsForCodeCompletionMessage message(fileContainers);
qCDebug(log) << ">>>" << message;
m_ipcSender->unregisterTranslationUnitsForCodeCompletion(message);
}
void IpcCommunicator::registerProjectPartsForCodeCompletion(
@@ -423,9 +423,9 @@ void IpcCommunicator::registerProjectPartsForCodeCompletion(
if (m_sendMode == IgnoreSendRequests)
return;
const RegisterProjectPartsForCodeCompletionCommand command(projectPartContainers);
qCDebug(log) << ">>>" << command;
m_ipcSender->registerProjectPartsForCodeCompletion(command);
const RegisterProjectPartsForCodeCompletionMessage message(projectPartContainers);
qCDebug(log) << ">>>" << message;
m_ipcSender->registerProjectPartsForCodeCompletion(message);
}
void IpcCommunicator::unregisterProjectPartsForCodeCompletion(const QStringList &projectPartIds)
@@ -433,9 +433,9 @@ void IpcCommunicator::unregisterProjectPartsForCodeCompletion(const QStringList
if (m_sendMode == IgnoreSendRequests)
return;
const UnregisterProjectPartsForCodeCompletionCommand command((Utf8StringVector(projectPartIds)));
qCDebug(log) << ">>>" << command;
m_ipcSender->unregisterProjectPartsForCodeCompletion(command);
const UnregisterProjectPartsForCodeCompletionMessage message((Utf8StringVector(projectPartIds)));
qCDebug(log) << ">>>" << message;
m_ipcSender->unregisterProjectPartsForCodeCompletion(message);
}
void IpcCommunicator::completeCode(ClangCompletionAssistProcessor *assistProcessor,
@@ -447,8 +447,8 @@ void IpcCommunicator::completeCode(ClangCompletionAssistProcessor *assistProcess
if (m_sendMode == IgnoreSendRequests)
return;
const CompleteCodeCommand command(filePath, line, column, projectFilePath);
qCDebug(log) << ">>>" << command;
m_ipcSender->completeCode(command);
m_ipcReceiver.addExpectedCodeCompletedCommand(command.ticketNumber(), assistProcessor);
const CompleteCodeMessage message(filePath, line, column, projectFilePath);
qCDebug(log) << ">>>" << message;
m_ipcSender->completeCode(message);
m_ipcReceiver.addExpectedCodeCompletedMessage(message.ticketNumber(), assistProcessor);
}

View File

@@ -67,17 +67,17 @@ public:
using AliveHandler = std::function<void ()>;
void setAliveHandler(const AliveHandler &handler);
void addExpectedCodeCompletedCommand(quint64 ticket, ClangCompletionAssistProcessor *processor);
void addExpectedCodeCompletedMessage(quint64 ticket, ClangCompletionAssistProcessor *processor);
void deleteAndClearWaitingAssistProcessors();
void deleteProcessorsOfEditorWidget(TextEditor::TextEditorWidget *textEditorWidget);
private:
void alive() override;
void echo(const ClangBackEnd::EchoCommand &command) override;
void codeCompleted(const ClangBackEnd::CodeCompletedCommand &command) override;
void echo(const ClangBackEnd::EchoMessage &message) override;
void codeCompleted(const ClangBackEnd::CodeCompletedMessage &message) override;
void translationUnitDoesNotExist(const ClangBackEnd::TranslationUnitDoesNotExistCommand &command) override;
void projectPartsDoNotExist(const ClangBackEnd::ProjectPartsDoNotExistCommand &command) override;
void translationUnitDoesNotExist(const ClangBackEnd::TranslationUnitDoesNotExistMessage &message) override;
void projectPartsDoNotExist(const ClangBackEnd::ProjectPartsDoNotExistMessage &message) override;
private:
AliveHandler m_aliveHandler;
@@ -90,11 +90,11 @@ public:
virtual ~IpcSenderInterface() {}
virtual void end() = 0;
virtual void registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand &command) = 0;
virtual void unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand &command) = 0;
virtual void registerProjectPartsForCodeCompletion(const ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand &command) = 0;
virtual void unregisterProjectPartsForCodeCompletion(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand &command) = 0;
virtual void completeCode(const ClangBackEnd::CompleteCodeCommand &command) = 0;
virtual void registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage &message) = 0;
virtual void unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage &message) = 0;
virtual void registerProjectPartsForCodeCompletion(const ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage &message) = 0;
virtual void unregisterProjectPartsForCodeCompletion(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage &message) = 0;
virtual void completeCode(const ClangBackEnd::CompleteCodeMessage &message) = 0;
};
class IpcCommunicator : public QObject

View File

@@ -67,7 +67,7 @@ QStringList createOptions(const QString &filePath,
return options;
}
QString commandLine(const QStringList &options, const QString &fileName)
QString messageLine(const QStringList &options, const QString &fileName)
{
const QStringList allOptions = QStringList(options)
<< QLatin1String("-fsyntax-only") << fileName;
@@ -100,10 +100,10 @@ void ClangEditorDocumentParser::updateHelper(const BaseEditorDocumentParser::InM
state_.projectPart = determineProjectPart(filePath(), configuration(), state_);
setState(state_);
// Determine command line arguments
// Determine message line arguments
const QStringList options = createOptions(filePath(), state_.projectPart, true);
qCDebug(log, "Reparse options (cmd line equivalent): %s",
commandLine(options, filePath()).toUtf8().constData());
messageLine(options, filePath()).toUtf8().constData());
// Run
QTime t; t.start();

View File

@@ -39,7 +39,7 @@
#include <cpptools/editordocumenthandle.h>
#include <projectexplorer/project.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletioncommand.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletionmessage.h>
#include <clangbackendipc/filecontainer.h>
#include <clangbackendipc/projectpartcontainer.h>
#include <utils/qtcassert.h>

View File

@@ -74,7 +74,7 @@ UnsavedFiles createUnsavedFiles(const WorkingCopy &workingCopy,
}
/**
* @brief Creates list of command-line arguments required for correct parsing
* @brief Creates list of message-line arguments required for correct parsing
* @param pPart Null if file isn't part of any project
* @param fileName Path to file, non-empty
*/
@@ -202,7 +202,7 @@ private:
};
/**
* @brief Creates list of command-line arguments required for correct parsing
* @brief Creates list of message-line arguments required for correct parsing
* @param pPart Null if file isn't part of any project
* @param fileKind Determines language and source/header state
*/

View File

@@ -54,12 +54,12 @@
#include <texteditor/textdocument.h>
#include <texteditor/texteditor.h>
#include <clangbackendipc/cmbcompletecodecommand.h>
#include <clangbackendipc/cmbendcommand.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletioncommand.h>
#include <clangbackendipc/cmbregistertranslationunitsforcodecompletioncommand.h>
#include <clangbackendipc/cmbunregisterprojectsforcodecompletioncommand.h>
#include <clangbackendipc/cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <clangbackendipc/cmbcompletecodemessage.h>
#include <clangbackendipc/cmbendmessage.h>
#include <clangbackendipc/cmbregisterprojectsforcodecompletionmessage.h>
#include <clangbackendipc/cmbregistertranslationunitsforcodecompletionmessage.h>
#include <clangbackendipc/cmbunregisterprojectsforcodecompletionmessage.h>
#include <clangbackendipc/cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <utils/changeset.h>
#include <utils/qtcassert.h>
@@ -305,73 +305,73 @@ QString toString(const QVector<ProjectPartContainer> &projectPartContainers)
return out;
}
QString toString(const EndCommand &)
QString toString(const EndMessage &)
{
return QLatin1String("EndCommand\n");
return QLatin1String("EndMessage\n");
}
QString toString(const RegisterTranslationUnitForCodeCompletionCommand &command)
QString toString(const RegisterTranslationUnitForCodeCompletionMessage &message)
{
QString out;
QTextStream ts(&out);
ts << "RegisterTranslationUnitForCodeCompletionCommand\n"
<< toString(command.fileContainers());
ts << "RegisterTranslationUnitForCodeCompletionMessage\n"
<< toString(message.fileContainers());
return out;
return QLatin1String("RegisterTranslationUnitForCodeCompletionCommand\n");
return QLatin1String("RegisterTranslationUnitForCodeCompletionMessage\n");
}
QString toString(const UnregisterTranslationUnitsForCodeCompletionCommand &)
QString toString(const UnregisterTranslationUnitsForCodeCompletionMessage &)
{
return QLatin1String("UnregisterTranslationUnitsForCodeCompletionCommand\n");
return QLatin1String("UnregisterTranslationUnitsForCodeCompletionMessage\n");
}
QString toString(const RegisterProjectPartsForCodeCompletionCommand &command)
QString toString(const RegisterProjectPartsForCodeCompletionMessage &message)
{
QString out;
QTextStream ts(&out);
ts << "RegisterProjectPartsForCodeCompletionCommand\n"
<< toString(command.projectContainers()) << "\n";
ts << "RegisterProjectPartsForCodeCompletionMessage\n"
<< toString(message.projectContainers()) << "\n";
return out;
}
QString toString(const UnregisterProjectPartsForCodeCompletionCommand &command)
QString toString(const UnregisterProjectPartsForCodeCompletionMessage &message)
{
QString out;
QTextStream ts(&out);
ts << "UnregisterProjectPartsForCodeCompletionCommand\n"
<< command.projectPartIds().join(Utf8String::fromUtf8(",")).toByteArray() << "\n";
ts << "UnregisterProjectPartsForCodeCompletionMessage\n"
<< message.projectPartIds().join(Utf8String::fromUtf8(",")).toByteArray() << "\n";
return out;
}
QString toString(const CompleteCodeCommand &)
QString toString(const CompleteCodeMessage &)
{
return QLatin1String("CompleteCodeCommand\n");
return QLatin1String("CompleteCodeMessage\n");
}
class IpcSenderSpy : public IpcSenderInterface
{
public:
void end() override
{ senderLog.append(toString(EndCommand())); }
{ senderLog.append(toString(EndMessage())); }
void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command) override
{ senderLog.append(toString(command)); }
void registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message) override
{ senderLog.append(toString(message)); }
void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command) override
{ senderLog.append(toString(command)); }
void unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message) override
{ senderLog.append(toString(message)); }
void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command) override
{ senderLog.append(toString(command)); }
void registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message) override
{ senderLog.append(toString(message)); }
void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command) override
{ senderLog.append(toString(command)); }
void unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message) override
{ senderLog.append(toString(message)); }
void completeCode(const CompleteCodeCommand &command) override
{ senderLog.append(toString(command)); }
void completeCode(const CompleteCodeMessage &message) override
{ senderLog.append(toString(message)); }
public:
QString senderLog;
@@ -1100,18 +1100,18 @@ void ClangCodeCompletionTest::testUpdateBackendAfterRestart()
OpenEditorAtCursorPosition openSource(testDocument);
QVERIFY(openSource.succeeded());
// Check commands that would have been sent
// Check messages that would have been sent
QVERIFY(compare(LogOutput(spy.senderLog),
LogOutput(
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: myheader.h ProjectPart: \n"
"RegisterProjectPartsForCodeCompletionCommand\n"
"RegisterProjectPartsForCodeCompletionMessage\n"
" ProjectPartContainer id: qt-widgets-app.pro qt-widgets-app\n"
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: ui_mainwindow.h ProjectPart: \n"
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: myheader.h ProjectPart: \n"
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: mainwindow.cpp ProjectPart: qt-widgets-app.pro qt-widgets-app\n"
)));
spy.senderLog.clear();
@@ -1126,13 +1126,13 @@ void ClangCodeCompletionTest::testUpdateBackendAfterRestart()
// ...and check if code model backend would have been provided with current data
QVERIFY(compare(LogOutput(spy.senderLog),
LogOutput(
"RegisterProjectPartsForCodeCompletionCommand\n"
"RegisterProjectPartsForCodeCompletionMessage\n"
" ProjectPartContainer id: \n"
"RegisterProjectPartsForCodeCompletionCommand\n"
"RegisterProjectPartsForCodeCompletionMessage\n"
" ProjectPartContainer id: qt-widgets-app.pro qt-widgets-app\n"
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: myheader.h ProjectPart: \n"
"RegisterTranslationUnitForCodeCompletionCommand\n"
"RegisterTranslationUnitForCodeCompletionMessage\n"
" Path: ui_mainwindow.h ProjectPart: \n"
)));
}

View File

@@ -32,7 +32,7 @@
#include <QLoggingCategory>
#include <connectionserver.h>
#include <cmbcommands.h>
#include <cmbmessages.h>
#include <clangipcserver.h>
int main(int argc, char *argv[])
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
return 1;
}
ClangBackEnd::Commands::registerCommands();
ClangBackEnd::Messages::registerMessages();
ClangBackEnd::ClangIpcServer clangIpcServer;
ClangBackEnd::ConnectionServer connectionServer(application.arguments()[1]);

View File

@@ -31,14 +31,14 @@
#include "clangipcserver.h"
#include <clangbackendipcdebugutils.h>
#include <cmbcodecompletedcommand.h>
#include <cmbcompletecodecommand.h>
#include <cmbregisterprojectsforcodecompletioncommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregisterprojectsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <projectpartsdonotexistcommand.h>
#include <translationunitdoesnotexistcommand.h>
#include <cmbcodecompletedmessage.h>
#include <cmbcompletecodemessage.h>
#include <cmbregisterprojectsforcodecompletionmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregisterprojectsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <projectpartsdonotexistmessage.h>
#include <translationunitdoesnotexistmessage.h>
#include "codecompleter.h"
#include "projectpartsdonotexistexception.h"
@@ -63,73 +63,73 @@ void ClangIpcServer::end()
QCoreApplication::exit();
}
void ClangIpcServer::registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand &command)
void ClangIpcServer::registerTranslationUnitsForCodeCompletion(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::registerTranslationUnitsForCodeCompletion");
try {
translationUnits.createOrUpdate(command.fileContainers());
unsavedFiles.createOrUpdate(command.fileContainers());
translationUnits.createOrUpdate(message.fileContainers());
unsavedFiles.createOrUpdate(message.fileContainers());
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds()));
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::registerTranslationUnitsForCodeCompletion:" << exception.what();
}
}
void ClangIpcServer::unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand &command)
void ClangIpcServer::unregisterTranslationUnitsForCodeCompletion(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::unregisterTranslationUnitsForCodeCompletion");
try {
translationUnits.remove(command.fileContainers());
translationUnits.remove(message.fileContainers());
} catch (const TranslationUnitDoesNotExistException &exception) {
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistCommand(exception.fileContainer()));
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds()));
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::unregisterTranslationUnitsForCodeCompletion:" << exception.what();
}
}
void ClangIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command)
void ClangIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::registerProjectPartsForCodeCompletion");
try {
projects.createOrUpdate(command.projectContainers());
projects.createOrUpdate(message.projectContainers());
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::registerProjectPartsForCodeCompletion:" << exception.what();
}
}
void ClangIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command)
void ClangIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::unregisterProjectPartsForCodeCompletion");
try {
projects.remove(command.projectPartIds());
projects.remove(message.projectPartIds());
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds()));
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::unregisterProjectPartsForCodeCompletion:" << exception.what();
}
}
void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeCommand &command)
void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::completeCode");
try {
CodeCompleter codeCompleter(translationUnits.translationUnit(command.filePath(), command.projectPartId()));
CodeCompleter codeCompleter(translationUnits.translationUnit(message.filePath(), message.projectPartId()));
const auto codeCompletions = codeCompleter.complete(command.line(), command.column());
const auto codeCompletions = codeCompleter.complete(message.line(), message.column());
client()->codeCompleted(CodeCompletedCommand(codeCompletions, command.ticketNumber()));
client()->codeCompleted(CodeCompletedMessage(codeCompletions, message.ticketNumber()));
} catch (const TranslationUnitDoesNotExistException &exception) {
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistCommand(exception.fileContainer()));
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistCommand(exception.projectPartIds()));
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::completeCode:" << exception.what();
}

View File

@@ -51,11 +51,11 @@ public:
ClangIpcServer();
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;
private:
ProjectParts projects;

View File

@@ -30,14 +30,14 @@
#include "echoipcserver.h"
#include "cmbcodecompletedcommand.h"
#include "cmbcompletecodecommand.h"
#include "cmbechocommand.h"
#include "cmbendcommand.h"
#include "cmbregisterprojectsforcodecompletioncommand.h"
#include "cmbregistertranslationunitsforcodecompletioncommand.h"
#include "cmbunregisterprojectsforcodecompletioncommand.h"
#include "cmbunregistertranslationunitsforcodecompletioncommand.h"
#include "cmbcodecompletedmessage.h"
#include "cmbcompletecodemessage.h"
#include "cmbechomessage.h"
#include "cmbendmessage.h"
#include "cmbregisterprojectsforcodecompletionmessage.h"
#include "cmbregistertranslationunitsforcodecompletionmessage.h"
#include "cmbunregisterprojectsforcodecompletionmessage.h"
#include "cmbunregistertranslationunitsforcodecompletionmessage.h"
#include "connectionserver.h"
#include <QCoreApplication>
@@ -46,9 +46,9 @@
namespace ClangBackEnd {
void EchoIpcServer::dispatch(const QVariant &command)
void EchoIpcServer::dispatch(const QVariant &message)
{
IpcServerInterface::dispatch(command);
IpcServerInterface::dispatch(message);
}
void EchoIpcServer::end()
@@ -57,34 +57,34 @@ void EchoIpcServer::end()
QCoreApplication::quit();
}
void EchoIpcServer::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionCommand &command)
void EchoIpcServer::registerTranslationUnitsForCodeCompletion(const RegisterTranslationUnitForCodeCompletionMessage &message)
{
echoCommand(QVariant::fromValue(command));
echoMessage(QVariant::fromValue(message));
}
void EchoIpcServer::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionCommand &command)
void EchoIpcServer::unregisterTranslationUnitsForCodeCompletion(const UnregisterTranslationUnitsForCodeCompletionMessage &message)
{
echoCommand(QVariant::fromValue(command));
echoMessage(QVariant::fromValue(message));
}
void EchoIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionCommand &command)
void EchoIpcServer::registerProjectPartsForCodeCompletion(const RegisterProjectPartsForCodeCompletionMessage &message)
{
echoCommand(QVariant::fromValue(command));
echoMessage(QVariant::fromValue(message));
}
void EchoIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionCommand &command)
void EchoIpcServer::unregisterProjectPartsForCodeCompletion(const UnregisterProjectPartsForCodeCompletionMessage &message)
{
echoCommand(QVariant::fromValue(command));
echoMessage(QVariant::fromValue(message));
}
void EchoIpcServer::completeCode(const CompleteCodeCommand &command)
void EchoIpcServer::completeCode(const CompleteCodeMessage &message)
{
echoCommand(QVariant::fromValue(command));
echoMessage(QVariant::fromValue(message));
}
void EchoIpcServer::echoCommand(const QVariant &command)
void EchoIpcServer::echoMessage(const QVariant &message)
{
client()->echo(EchoCommand(command));
client()->echo(EchoMessage(message));
}
} // namespace ClangBackEnd

View File

@@ -38,16 +38,16 @@ namespace ClangBackEnd {
class EchoIpcServer : public IpcServerInterface
{
public:
void dispatch(const QVariant &command) override;
void dispatch(const QVariant &message) override;
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;
private:
void echoCommand(const QVariant &command);
void echoMessage(const QVariant &message);
};
} // namespace ClangBackEnd

View File

@@ -23,6 +23,6 @@ HEADERS += \
echoipcserver.h
DEFINES += CLANGBACKENDIPC_TESTS
DEFINES += DONT_CHECK_COMMAND_COUNTER
DEFINES += DONT_CHECK_MESSAGE_COUNTER
win32:DESTDIR = ..

View File

@@ -30,7 +30,7 @@
#include "echoipcserver.h"
#include <cmbcommands.h>
#include <cmbmessages.h>
#include <connectionserver.h>
#include <QCoreApplication>
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
return 1;
}
ClangBackEnd::Commands::registerCommands();
ClangBackEnd::Messages::registerMessages();
ClangBackEnd::EchoIpcServer echoIpcServer;
ClangBackEnd::ConnectionServer connectionServer(application.arguments()[1]);

View File

@@ -36,15 +36,15 @@
#include <translationunitdoesnotexistexception.h>
#include <translationunitparseerrorexception.h>
#include <cmbcodecompletedcommand.h>
#include <cmbcompletecodecommand.h>
#include <cmbechocommand.h>
#include <cmbregisterprojectsforcodecompletioncommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregisterprojectsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <projectpartsdonotexistcommand.h>
#include <translationunitdoesnotexistcommand.h>
#include <cmbcodecompletedmessage.h>
#include <cmbcompletecodemessage.h>
#include <cmbechomessage.h>
#include <cmbregisterprojectsforcodecompletionmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregisterprojectsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <projectpartsdonotexistmessage.h>
#include <translationunitdoesnotexistmessage.h>
#include <QBuffer>
#include <QFile>
@@ -61,17 +61,17 @@ using testing::Eq;
namespace {
using ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand;
using ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand;
using ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand;
using ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand;
using ClangBackEnd::CompleteCodeCommand;
using ClangBackEnd::CodeCompletedCommand;
using ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage;
using ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage;
using ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage;
using ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage;
using ClangBackEnd::CompleteCodeMessage;
using ClangBackEnd::CodeCompletedMessage;
using ClangBackEnd::CodeCompletion;
using ClangBackEnd::FileContainer;
using ClangBackEnd::ProjectPartContainer;
using ClangBackEnd::TranslationUnitDoesNotExistCommand;
using ClangBackEnd::ProjectPartsDoNotExistCommand;
using ClangBackEnd::TranslationUnitDoesNotExistMessage;
using ClangBackEnd::ProjectPartsDoNotExistMessage;
class ClangIpcServer : public ::testing::Test
{
@@ -105,31 +105,31 @@ void ClangIpcServer::SetUp()
void ClangIpcServer::registerFiles()
{
RegisterTranslationUnitForCodeCompletionCommand command({FileContainer(functionTestFilePath, projectPartId, unsavedContent(unsavedTestFilePath), true),
RegisterTranslationUnitForCodeCompletionMessage message({FileContainer(functionTestFilePath, projectPartId, unsavedContent(unsavedTestFilePath), true),
FileContainer(variableTestFilePath, projectPartId)});
clangServer.registerTranslationUnitsForCodeCompletion(command);
clangServer.registerTranslationUnitsForCodeCompletion(message);
}
void ClangIpcServer::registerProjectPart()
{
RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId)});
RegisterProjectPartsForCodeCompletionMessage message({ProjectPartContainer(projectPartId)});
clangServer.registerProjectPartsForCodeCompletion(command);
clangServer.registerProjectPartsForCodeCompletion(message);
}
void ClangIpcServer::changeProjectPartArguments()
{
RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DArgumentDefinition")})});
RegisterProjectPartsForCodeCompletionMessage message({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DArgumentDefinition")})});
clangServer.registerProjectPartsForCodeCompletion(command);
clangServer.registerProjectPartsForCodeCompletion(message);
}
void ClangIpcServer::changeProjectPartArgumentsToWrongValues()
{
RegisterProjectPartsForCodeCompletionCommand command({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-blah")})});
RegisterProjectPartsForCodeCompletionMessage message({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-blah")})});
clangServer.registerProjectPartsForCodeCompletion(command);
clangServer.registerProjectPartsForCodeCompletion(message);
}
const Utf8String ClangIpcServer::unsavedContent(const QString &unsavedFilePath)
@@ -144,7 +144,7 @@ const Utf8String ClangIpcServer::unsavedContent(const QString &unsavedFilePath)
TEST_F(ClangIpcServer, GetCodeCompletion)
{
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
@@ -152,15 +152,15 @@ TEST_F(ClangIpcServer, GetCodeCompletion)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
{
CompleteCodeCommand completeCodeCommand(variableTestFilePath,
CompleteCodeMessage completeCodeMessage(variableTestFilePath,
35,
1,
projectPartId);
@@ -168,44 +168,44 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
34,
CodeCompletion::VariableCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
changeProjectPartArguments();
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCodeCompletionOnNonExistingTranslationUnit)
{
CompleteCodeCommand completeCodeCommand(Utf8StringLiteral("dontexists.cpp"),
CompleteCodeMessage completeCodeMessage(Utf8StringLiteral("dontexists.cpp"),
34,
1,
projectPartId);
TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(Utf8StringLiteral("dontexists.cpp"), projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(Utf8StringLiteral("dontexists.cpp"), projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCompletingUnregisteredFile)
{
CompleteCodeCommand completeCodeCommand(parseErrorTestFilePath,
CompleteCodeMessage completeCodeMessage(parseErrorTestFilePath,
20,
1,
projectPartId);
TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(parseErrorTestFilePath, projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
{
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
@@ -213,16 +213,16 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
{
clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionCommand({FileContainer(functionTestFilePath, projectPartId)}));
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionMessage({FileContainer(functionTestFilePath, projectPartId)}));
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
@@ -230,19 +230,19 @@ TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Not(Contains(codeCompletion)))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Not(Contains(codeCompletion)))))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
{
clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionCommand({FileContainer(functionTestFilePath,
clangServer.registerTranslationUnitsForCodeCompletion(RegisterTranslationUnitForCodeCompletionMessage({FileContainer(functionTestFilePath,
projectPartId,
unsavedContent(updatedUnsavedTestFilePath),
true)}));
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
@@ -250,109 +250,109 @@ TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForUnregisterTranslationUnitWithWrongFilePath)
{
FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectPartId);
UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer});
TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(fileContainer);
UnregisterTranslationUnitsForCodeCompletionMessage message({fileContainer});
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.unregisterTranslationUnitsForCodeCompletion(command);
clangServer.unregisterTranslationUnitsForCodeCompletion(message);
}
TEST_F(ClangIpcServer, UnregisterTranslationUnitAndTestFailingCompletion)
{
FileContainer fileContainer(functionTestFilePath, projectPartId);
UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer});
clangServer.unregisterTranslationUnitsForCodeCompletion(command);
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
UnregisterTranslationUnitsForCodeCompletionMessage message({fileContainer});
clangServer.unregisterTranslationUnitsForCodeCompletion(message);
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(fileContainer);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterProjectPartInexistingProjectPart)
{
Utf8StringVector inexistingProjectPartFilePath = {Utf8StringLiteral("projectpartsdoesnotexist.pro"), Utf8StringLiteral("project2doesnotexists.pro")};
UnregisterProjectPartsForCodeCompletionCommand unregisterProjectPartsForCodeCompletionCommand(inexistingProjectPartFilePath);
ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand(inexistingProjectPartFilePath);
UnregisterProjectPartsForCodeCompletionMessage unregisterProjectPartsForCodeCompletionMessage(inexistingProjectPartFilePath);
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage(inexistingProjectPartFilePath);
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand))
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionCommand);
clangServer.unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistRegisterTranslationUnitWithInexistingProjectPart)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
RegisterTranslationUnitForCodeCompletionCommand registerFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)});
ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath});
RegisterTranslationUnitForCodeCompletionMessage registerFileForCodeCompletionMessage({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)});
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand))
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.registerTranslationUnitsForCodeCompletion(registerFileForCodeCompletionCommand);
clangServer.registerTranslationUnitsForCodeCompletion(registerFileForCodeCompletionMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterTranslationUnitWithInexistingProjectPart)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
UnregisterTranslationUnitsForCodeCompletionCommand unregisterFileForCodeCompletionCommand({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)});
ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath});
UnregisterTranslationUnitsForCodeCompletionMessage unregisterFileForCodeCompletionMessage({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)});
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand))
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.unregisterTranslationUnitsForCodeCompletion(unregisterFileForCodeCompletionCommand);
clangServer.unregisterTranslationUnitsForCodeCompletion(unregisterFileForCodeCompletionMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingProjectPartFile)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
CompleteCodeCommand completeCodeCommand(variableTestFilePath,
CompleteCodeMessage completeCodeMessage(variableTestFilePath,
20,
1,
inexistingProjectPartFilePath);
ProjectPartsDoNotExistCommand projectPartsDoNotExistCommand({inexistingProjectPartFilePath});
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistCommand))
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingUnregisteredFile)
{
CompleteCodeCommand completeCodeCommand(parseErrorTestFilePath,
CompleteCodeMessage completeCodeMessage(parseErrorTestFilePath,
20,
1,
projectPartId);
TranslationUnitDoesNotExistCommand translationUnitDoesNotExistCommand(parseErrorTestFilePath, projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(parseErrorTestFilePath, projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistCommand))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, TicketNumberIsForwarded)
{
CompleteCodeCommand completeCodeCommand(functionTestFilePath,
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
1,
projectPartId);
@@ -360,9 +360,9 @@ TEST_F(ClangIpcServer, TicketNumberIsForwarded)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedCommand::ticketNumber, Eq(completeCodeCommand.ticketNumber()))))
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::ticketNumber, Eq(completeCodeMessage.ticketNumber()))))
.Times(1);
clangServer.completeCode(completeCodeCommand);
clangServer.completeCode(completeCodeMessage);
}
}

View File

@@ -34,21 +34,21 @@
#include <ipcclientproxy.h>
#include <ipcserverproxy.h>
#include <projectpartsdonotexistcommand.h>
#include <projectpartsdonotexistmessage.h>
#include <cmbalivecommand.h>
#include <cmbcodecompletedcommand.h>
#include <cmbcommands.h>
#include <cmbcompletecodecommand.h>
#include <cmbechocommand.h>
#include <cmbendcommand.h>
#include <cmbregisterprojectsforcodecompletioncommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregisterprojectsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <readcommandblock.h>
#include <translationunitdoesnotexistcommand.h>
#include <writecommandblock.h>
#include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h>
#include <cmbmessages.h>
#include <cmbcompletecodemessage.h>
#include <cmbechomessage.h>
#include <cmbendmessage.h>
#include <cmbregisterprojectsforcodecompletionmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregisterprojectsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <readmessageblock.h>
#include <translationunitdoesnotexistmessage.h>
#include <writemessageblock.h>
#include <QBuffer>
#include <QString>
@@ -78,8 +78,8 @@ protected:
void TearDown();
void scheduleServerCommands();
void scheduleClientCommands();
void scheduleServerMessages();
void scheduleClientMessages();
QBuffer buffer;
MockIpcClient mockIpcClient;
@@ -89,118 +89,118 @@ protected:
ClangBackEnd::IpcClientProxy clientProxy;
};
TEST_F(ClientServerInProcess, SendEndCommand)
TEST_F(ClientServerInProcess, SendEndMessage)
{
EXPECT_CALL(mockIpcServer, end())
.Times(1);
serverProxy.end();
scheduleServerCommands();
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendAliveCommand)
TEST_F(ClientServerInProcess, SendAliveMessage)
{
EXPECT_CALL(mockIpcClient, alive())
.Times(1);
clientProxy.alive();
scheduleClientCommands();
scheduleClientMessages();
}
TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForCodeCompletionCommand)
TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForCodeCompletionMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_function.cpp"),
Utf8StringLiteral("pathToProjectPart.pro"));
ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand command({fileContainer});
ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, registerTranslationUnitsForCodeCompletion(command))
EXPECT_CALL(mockIpcServer, registerTranslationUnitsForCodeCompletion(message))
.Times(1);
serverProxy.registerTranslationUnitsForCodeCompletion(command);
scheduleServerCommands();
serverProxy.registerTranslationUnitsForCodeCompletion(message);
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendUnregisterTranslationUnitsForCodeCompletionCommand)
TEST_F(ClientServerInProcess, SendUnregisterTranslationUnitsForCodeCompletionMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProjectPart.pro"));
ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand command({fileContainer});
ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, unregisterTranslationUnitsForCodeCompletion(command))
EXPECT_CALL(mockIpcServer, unregisterTranslationUnitsForCodeCompletion(message))
.Times(1);
serverProxy.unregisterTranslationUnitsForCodeCompletion(command);
scheduleServerCommands();
serverProxy.unregisterTranslationUnitsForCodeCompletion(message);
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendCompleteCodeCommand)
TEST_F(ClientServerInProcess, SendCompleteCodeMessage)
{
ClangBackEnd::CompleteCodeCommand command(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
ClangBackEnd::CompleteCodeMessage message(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EXPECT_CALL(mockIpcServer, completeCode(command))
EXPECT_CALL(mockIpcServer, completeCode(message))
.Times(1);
serverProxy.completeCode(command);
scheduleServerCommands();
serverProxy.completeCode(message);
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendCodeCompletedCommand)
TEST_F(ClientServerInProcess, SendCodeCompletedMessage)
{
ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")});
ClangBackEnd::CodeCompletedCommand command(codeCompletions, 1);
ClangBackEnd::CodeCompletedMessage message(codeCompletions, 1);
EXPECT_CALL(mockIpcClient, codeCompleted(command))
EXPECT_CALL(mockIpcClient, codeCompleted(message))
.Times(1);
clientProxy.codeCompleted(command);
scheduleClientCommands();
clientProxy.codeCompleted(message);
scheduleClientMessages();
}
TEST_F(ClientServerInProcess, SendRegisterProjectPartsForCodeCompletionCommand)
TEST_F(ClientServerInProcess, SendRegisterProjectPartsForCodeCompletionMessage)
{
ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro"));
ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand command({projectContainer});
ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage message({projectContainer});
EXPECT_CALL(mockIpcServer, registerProjectPartsForCodeCompletion(command))
EXPECT_CALL(mockIpcServer, registerProjectPartsForCodeCompletion(message))
.Times(1);
serverProxy.registerProjectPartsForCodeCompletion(command);
scheduleServerCommands();
serverProxy.registerProjectPartsForCodeCompletion(message);
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendUnregisterProjectPartsForCodeCompletionCommand)
TEST_F(ClientServerInProcess, SendUnregisterProjectPartsForCodeCompletionMessage)
{
ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand command({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage message({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EXPECT_CALL(mockIpcServer, unregisterProjectPartsForCodeCompletion(command))
EXPECT_CALL(mockIpcServer, unregisterProjectPartsForCodeCompletion(message))
.Times(1);
serverProxy.unregisterProjectPartsForCodeCompletion(command);
scheduleServerCommands();
serverProxy.unregisterProjectPartsForCodeCompletion(message);
scheduleServerMessages();
}
TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistCommand)
TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_function.cpp"),
Utf8StringLiteral("pathToProjectPart.pro"));
ClangBackEnd::TranslationUnitDoesNotExistCommand command(fileContainer);
ClangBackEnd::TranslationUnitDoesNotExistMessage message(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(command))
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(message))
.Times(1);
clientProxy.translationUnitDoesNotExist(command);
scheduleClientCommands();
clientProxy.translationUnitDoesNotExist(message);
scheduleClientMessages();
}
TEST_F(ClientServerInProcess, SendProjectPartDoesNotExistCommand)
TEST_F(ClientServerInProcess, SendProjectPartDoesNotExistMessage)
{
ClangBackEnd::ProjectPartsDoNotExistCommand command({Utf8StringLiteral("pathToProjectPart.pro")});
ClangBackEnd::ProjectPartsDoNotExistMessage message({Utf8StringLiteral("pathToProjectPart.pro")});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(command))
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(message))
.Times(1);
clientProxy.projectPartsDoNotExist(command);
scheduleClientCommands();
clientProxy.projectPartsDoNotExist(message);
scheduleClientMessages();
}
ClientServerInProcess::ClientServerInProcess()
: serverProxy(&mockIpcClient, &buffer),
@@ -218,17 +218,17 @@ void ClientServerInProcess::TearDown()
buffer.close();
}
void ClientServerInProcess::scheduleServerCommands()
void ClientServerInProcess::scheduleServerMessages()
{
buffer.seek(0);
clientProxy.readCommands();
clientProxy.readMessages();
buffer.buffer().clear();
}
void ClientServerInProcess::scheduleClientCommands()
void ClientServerInProcess::scheduleClientMessages()
{
buffer.seek(0);
serverProxy.readCommands();
serverProxy.readMessages();
buffer.buffer().clear();
}

View File

@@ -30,21 +30,21 @@
#include "mockipclient.h"
#include <cmbalivecommand.h>
#include <cmbcodecompletedcommand.h>
#include <cmbcommands.h>
#include <cmbcompletecodecommand.h>
#include <cmbechocommand.h>
#include <cmbendcommand.h>
#include <cmbregisterprojectsforcodecompletioncommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregisterprojectsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h>
#include <cmbmessages.h>
#include <cmbcompletecodemessage.h>
#include <cmbechomessage.h>
#include <cmbendmessage.h>
#include <cmbregisterprojectsforcodecompletionmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregisterprojectsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <connectionclient.h>
#include <projectpartsdonotexistcommand.h>
#include <readcommandblock.h>
#include <translationunitdoesnotexistcommand.h>
#include <writecommandblock.h>
#include <projectpartsdonotexistmessage.h>
#include <readmessageblock.h>
#include <translationunitdoesnotexistmessage.h>
#include <writemessageblock.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
@@ -111,66 +111,66 @@ TEST_F(ClientServerOutsideProcess, RestartProcessAfterTermination)
ASSERT_TRUE(clientSpy.wait(100000));
}
TEST_F(ClientServerOutsideProcess, SendRegisterTranslationUnitForCodeCompletionCommand)
TEST_F(ClientServerOutsideProcess, SendRegisterTranslationUnitForCodeCompletionMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo"), Utf8StringLiteral("pathToProjectPart.pro"));
ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand registerTranslationUnitForCodeCompletionCommand({fileContainer});
EchoCommand echoCommand(QVariant::fromValue(registerTranslationUnitForCodeCompletionCommand));
ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage registerTranslationUnitForCodeCompletionMessage({fileContainer});
EchoMessage echoMessage(QVariant::fromValue(registerTranslationUnitForCodeCompletionMessage));
EXPECT_CALL(mockIpcClient, echo(echoCommand))
EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1);
client.serverProxy().registerTranslationUnitsForCodeCompletion(registerTranslationUnitForCodeCompletionCommand);
client.serverProxy().registerTranslationUnitsForCodeCompletion(registerTranslationUnitForCodeCompletionMessage);
ASSERT_TRUE(client.waitForEcho());
}
TEST_F(ClientServerOutsideProcess, SendUnregisterTranslationUnitsForCodeCompletionCommand)
TEST_F(ClientServerOutsideProcess, SendUnregisterTranslationUnitsForCodeCompletionMessage)
{
FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("bar.pro"));
ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand unregisterTranslationUnitsForCodeCompletionCommand ({fileContainer});
EchoCommand echoCommand(QVariant::fromValue(unregisterTranslationUnitsForCodeCompletionCommand));
ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage unregisterTranslationUnitsForCodeCompletionMessage ({fileContainer});
EchoMessage echoMessage(QVariant::fromValue(unregisterTranslationUnitsForCodeCompletionMessage));
EXPECT_CALL(mockIpcClient, echo(echoCommand))
EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1);
client.serverProxy().unregisterTranslationUnitsForCodeCompletion(unregisterTranslationUnitsForCodeCompletionCommand);
client.serverProxy().unregisterTranslationUnitsForCodeCompletion(unregisterTranslationUnitsForCodeCompletionMessage);
ASSERT_TRUE(client.waitForEcho());
}
TEST_F(ClientServerOutsideProcess, SendCompleteCodeCommand)
TEST_F(ClientServerOutsideProcess, SendCompleteCodeMessage)
{
CompleteCodeCommand codeCompleteCommand(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EchoCommand echoCommand(QVariant::fromValue(codeCompleteCommand));
CompleteCodeMessage codeCompleteMessage(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EchoMessage echoMessage(QVariant::fromValue(codeCompleteMessage));
EXPECT_CALL(mockIpcClient, echo(echoCommand))
EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1);
client.serverProxy().completeCode(codeCompleteCommand);
client.serverProxy().completeCode(codeCompleteMessage);
ASSERT_TRUE(client.waitForEcho());
}
TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForCodeCompletionCommand)
TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForCodeCompletionMessage)
{
ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro"));
ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand registerProjectPartsForCodeCompletionCommand({projectContainer});
EchoCommand echoCommand(QVariant::fromValue(registerProjectPartsForCodeCompletionCommand));
ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage registerProjectPartsForCodeCompletionMessage({projectContainer});
EchoMessage echoMessage(QVariant::fromValue(registerProjectPartsForCodeCompletionMessage));
EXPECT_CALL(mockIpcClient, echo(echoCommand))
EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1);
client.serverProxy().registerProjectPartsForCodeCompletion(registerProjectPartsForCodeCompletionCommand);
client.serverProxy().registerProjectPartsForCodeCompletion(registerProjectPartsForCodeCompletionMessage);
ASSERT_TRUE(client.waitForEcho());
}
TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForCodeCompletionCommand)
TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForCodeCompletionMessage)
{
ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand unregisterProjectPartsForCodeCompletionCommand({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EchoCommand echoCommand(QVariant::fromValue(unregisterProjectPartsForCodeCompletionCommand));
ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage unregisterProjectPartsForCodeCompletionMessage({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EchoMessage echoMessage(QVariant::fromValue(unregisterProjectPartsForCodeCompletionMessage));
EXPECT_CALL(mockIpcClient, echo(echoCommand))
EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1);
client.serverProxy().unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionCommand);
client.serverProxy().unregisterProjectPartsForCodeCompletion(unregisterProjectPartsForCodeCompletionMessage);
ASSERT_TRUE(client.waitForEcho());
}

View File

@@ -30,7 +30,7 @@
#include <sqliteglobal.h>
#include <cmbcommands.h>
#include <cmbmessages.h>
#include <QCoreApplication>
@@ -39,7 +39,7 @@
int main(int argc, char *argv[])
{
ClangBackEnd::Commands::registerCommands();
ClangBackEnd::Messages::registerMessages();
Sqlite::registerTypes();
QCoreApplication application(argc, argv);

View File

@@ -43,13 +43,13 @@ class MockIpcClient : public ClangBackEnd::IpcClientInterface {
MOCK_METHOD0(alive,
void());
MOCK_METHOD1(echo,
void(const ClangBackEnd::EchoCommand &command));
void(const ClangBackEnd::EchoMessage &message));
MOCK_METHOD1(codeCompleted,
void(const ClangBackEnd::CodeCompletedCommand &command));
void(const ClangBackEnd::CodeCompletedMessage &message));
MOCK_METHOD1(translationUnitDoesNotExist,
void(const ClangBackEnd::TranslationUnitDoesNotExistCommand &command));
void(const ClangBackEnd::TranslationUnitDoesNotExistMessage &message));
MOCK_METHOD1(projectPartsDoNotExist,
void(const ClangBackEnd::ProjectPartsDoNotExistCommand &command));
void(const ClangBackEnd::ProjectPartsDoNotExistMessage &message));
};
#endif // MOCKIPCLIENT_H

View File

@@ -43,15 +43,15 @@ class MockIpcServer : public ClangBackEnd::IpcServerInterface {
MOCK_METHOD0(end,
void());
MOCK_METHOD1(registerTranslationUnitsForCodeCompletion,
void(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand &command));
void(const ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage &message));
MOCK_METHOD1(unregisterTranslationUnitsForCodeCompletion,
void(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand &command));
void(const ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage &message));
MOCK_METHOD1(registerProjectPartsForCodeCompletion,
void(const ClangBackEnd::RegisterProjectPartsForCodeCompletionCommand &command));
void(const ClangBackEnd::RegisterProjectPartsForCodeCompletionMessage &message));
MOCK_METHOD1(unregisterProjectPartsForCodeCompletion,
void(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionCommand &command));
void(const ClangBackEnd::UnregisterProjectPartsForCodeCompletionMessage &message));
MOCK_METHOD1(completeCode,
void(const ClangBackEnd::CompleteCodeCommand &command));
void(const ClangBackEnd::CompleteCodeMessage &message));
};
#endif // MOCKIPCSERVER_H

View File

@@ -1,224 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include <cmbalivecommand.h>
#include <cmbcodecompletedcommand.h>
#include <cmbcommands.h>
#include <cmbcompletecodecommand.h>
#include <cmbendcommand.h>
#include <cmbregistertranslationunitsforcodecompletioncommand.h>
#include <cmbunregistertranslationunitsforcodecompletioncommand.h>
#include <readcommandblock.h>
#include <writecommandblock.h>
#include <QBuffer>
#include <QString>
#include <QVariant>
#include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace testing;
namespace CodeModelBackeEndTest {
class ReadAndWriteCommandBlockTest : public ::testing::Test
{
protected:
ReadAndWriteCommandBlockTest();
virtual void SetUp() override;
virtual void TearDown() override;
template<class Type>
void CompareCommand(const Type &command);
QVariant writeCodeCompletedCommand();
void popLastCharacterFromBuffer();
void pushLastCharacterToBuffer();
void readPartialCommand();
protected:
QBuffer buffer;
ClangBackEnd::WriteCommandBlock writeCommandBlock;
ClangBackEnd::ReadCommandBlock readCommandBlock;
char lastCharacter = 0;
};
ReadAndWriteCommandBlockTest::ReadAndWriteCommandBlockTest()
: writeCommandBlock(&buffer),
readCommandBlock(&buffer)
{
}
void ReadAndWriteCommandBlockTest::SetUp()
{
buffer.open(QIODevice::ReadWrite);
writeCommandBlock = ClangBackEnd::WriteCommandBlock(&buffer);
readCommandBlock = ClangBackEnd::ReadCommandBlock(&buffer);
}
void ReadAndWriteCommandBlockTest::TearDown()
{
buffer.close();
}
TEST_F(ReadAndWriteCommandBlockTest, WriteCommandAndTestSize)
{
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
ASSERT_EQ(46, buffer.size());
}
TEST_F(ReadAndWriteCommandBlockTest, WriteSecondCommandAndTestSize)
{
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
ASSERT_EQ(46, buffer.size());
}
TEST_F(ReadAndWriteCommandBlockTest, WriteTwoCommandsAndTestCount)
{
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
ASSERT_EQ(2, writeCommandBlock.counter());
}
TEST_F(ReadAndWriteCommandBlockTest, ReadThreeCommandsAndTestCount)
{
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
writeCommandBlock.write(QVariant::fromValue(ClangBackEnd::EndCommand()));
buffer.seek(0);
ASSERT_EQ(3, readCommandBlock.readAll().count());
}
TEST_F(ReadAndWriteCommandBlockTest, CompareEndCommand)
{
CompareCommand(ClangBackEnd::EndCommand());
}
TEST_F(ReadAndWriteCommandBlockTest, CompareAliveCommand)
{
CompareCommand(ClangBackEnd::AliveCommand());
}
TEST_F(ReadAndWriteCommandBlockTest, CompareRegisterTranslationUnitForCodeCompletionCommand)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro"));
QVector<ClangBackEnd::FileContainer> fileContainers({fileContainer});
CompareCommand(ClangBackEnd::RegisterTranslationUnitForCodeCompletionCommand(fileContainers));
}
TEST_F(ReadAndWriteCommandBlockTest, CompareUnregisterFileForCodeCompletionCommand)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro"));
CompareCommand(ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionCommand({fileContainer}));
}
TEST_F(ReadAndWriteCommandBlockTest, CompareCompleteCodeCommand)
{
CompareCommand(ClangBackEnd::CompleteCodeCommand(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want")));
}
TEST_F(ReadAndWriteCommandBlockTest, CompareCodeCompletedCommand)
{
ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")});
CompareCommand(ClangBackEnd::CodeCompletedCommand(codeCompletions, 1));
}
TEST_F(ReadAndWriteCommandBlockTest, GetInvalidCommandForAPartialBuffer)
{
writeCodeCompletedCommand();
popLastCharacterFromBuffer();
buffer.seek(0);
readPartialCommand();
}
TEST_F(ReadAndWriteCommandBlockTest, ReadCommandAfterInterruption)
{
const QVariant writeCommand = writeCodeCompletedCommand();
popLastCharacterFromBuffer();
buffer.seek(0);
readPartialCommand();
pushLastCharacterToBuffer();
ASSERT_EQ(readCommandBlock.read(), writeCommand);
}
QVariant ReadAndWriteCommandBlockTest::writeCodeCompletedCommand()
{
ClangBackEnd::CodeCompletedCommand command(ClangBackEnd::CodeCompletions({Utf8StringLiteral("newFunction()")}), 1);
const QVariant writeCommand = QVariant::fromValue(command);
writeCommandBlock.write(writeCommand);
return writeCommand;
}
void ReadAndWriteCommandBlockTest::popLastCharacterFromBuffer()
{
auto &internalBuffer = buffer.buffer();
lastCharacter = internalBuffer.at(internalBuffer.size() - 1);
internalBuffer.chop(1);
}
void ReadAndWriteCommandBlockTest::pushLastCharacterToBuffer()
{
buffer.buffer().push_back(lastCharacter);
}
void ReadAndWriteCommandBlockTest::readPartialCommand()
{
QVariant readCommand = readCommandBlock.read();
ASSERT_FALSE(readCommand.isValid());
}
template<class Type>
void ReadAndWriteCommandBlockTest::CompareCommand(const Type &command)
{
const QVariant writeCommand = QVariant::fromValue(command);
writeCommandBlock.write(writeCommand);
buffer.seek(0);
const QVariant readCommand = readCommandBlock.read();
ASSERT_EQ(writeCommand, readCommand);
}
}

View File

@@ -0,0 +1,224 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h>
#include <cmbmessages.h>
#include <cmbcompletecodemessage.h>
#include <cmbendmessage.h>
#include <cmbregistertranslationunitsforcodecompletionmessage.h>
#include <cmbunregistertranslationunitsforcodecompletionmessage.h>
#include <readmessageblock.h>
#include <writemessageblock.h>
#include <QBuffer>
#include <QString>
#include <QVariant>
#include <vector>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
using namespace testing;
namespace CodeModelBackeEndTest {
class ReadAndWriteMessageBlockTest : public ::testing::Test
{
protected:
ReadAndWriteMessageBlockTest();
virtual void SetUp() override;
virtual void TearDown() override;
template<class Type>
void CompareMessage(const Type &message);
QVariant writeCodeCompletedMessage();
void popLastCharacterFromBuffer();
void pushLastCharacterToBuffer();
void readPartialMessage();
protected:
QBuffer buffer;
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
char lastCharacter = 0;
};
ReadAndWriteMessageBlockTest::ReadAndWriteMessageBlockTest()
: writeMessageBlock(&buffer),
readMessageBlock(&buffer)
{
}
void ReadAndWriteMessageBlockTest::SetUp()
{
buffer.open(QIODevice::ReadWrite);
writeMessageBlock = ClangBackEnd::WriteMessageBlock(&buffer);
readMessageBlock = ClangBackEnd::ReadMessageBlock(&buffer);
}
void ReadAndWriteMessageBlockTest::TearDown()
{
buffer.close();
}
TEST_F(ReadAndWriteMessageBlockTest, WriteMessageAndTestSize)
{
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
ASSERT_EQ(46, buffer.size());
}
TEST_F(ReadAndWriteMessageBlockTest, WriteSecondMessageAndTestSize)
{
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
ASSERT_EQ(46, buffer.size());
}
TEST_F(ReadAndWriteMessageBlockTest, WriteTwoMessagesAndTestCount)
{
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
ASSERT_EQ(2, writeMessageBlock.counter());
}
TEST_F(ReadAndWriteMessageBlockTest, ReadThreeMessagesAndTestCount)
{
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage()));
buffer.seek(0);
ASSERT_EQ(3, readMessageBlock.readAll().count());
}
TEST_F(ReadAndWriteMessageBlockTest, CompareEndMessage)
{
CompareMessage(ClangBackEnd::EndMessage());
}
TEST_F(ReadAndWriteMessageBlockTest, CompareAliveMessage)
{
CompareMessage(ClangBackEnd::AliveMessage());
}
TEST_F(ReadAndWriteMessageBlockTest, CompareRegisterTranslationUnitForCodeCompletionMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro"));
QVector<ClangBackEnd::FileContainer> fileContainers({fileContainer});
CompareMessage(ClangBackEnd::RegisterTranslationUnitForCodeCompletionMessage(fileContainers));
}
TEST_F(ReadAndWriteMessageBlockTest, CompareUnregisterFileForCodeCompletionMessage)
{
ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro"));
CompareMessage(ClangBackEnd::UnregisterTranslationUnitsForCodeCompletionMessage({fileContainer}));
}
TEST_F(ReadAndWriteMessageBlockTest, CompareCompleteCodeMessage)
{
CompareMessage(ClangBackEnd::CompleteCodeMessage(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want")));
}
TEST_F(ReadAndWriteMessageBlockTest, CompareCodeCompletedMessage)
{
ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")});
CompareMessage(ClangBackEnd::CodeCompletedMessage(codeCompletions, 1));
}
TEST_F(ReadAndWriteMessageBlockTest, GetInvalidMessageForAPartialBuffer)
{
writeCodeCompletedMessage();
popLastCharacterFromBuffer();
buffer.seek(0);
readPartialMessage();
}
TEST_F(ReadAndWriteMessageBlockTest, ReadMessageAfterInterruption)
{
const QVariant writeMessage = writeCodeCompletedMessage();
popLastCharacterFromBuffer();
buffer.seek(0);
readPartialMessage();
pushLastCharacterToBuffer();
ASSERT_EQ(readMessageBlock.read(), writeMessage);
}
QVariant ReadAndWriteMessageBlockTest::writeCodeCompletedMessage()
{
ClangBackEnd::CodeCompletedMessage message(ClangBackEnd::CodeCompletions({Utf8StringLiteral("newFunction()")}), 1);
const QVariant writeMessage = QVariant::fromValue(message);
writeMessageBlock.write(writeMessage);
return writeMessage;
}
void ReadAndWriteMessageBlockTest::popLastCharacterFromBuffer()
{
auto &internalBuffer = buffer.buffer();
lastCharacter = internalBuffer.at(internalBuffer.size() - 1);
internalBuffer.chop(1);
}
void ReadAndWriteMessageBlockTest::pushLastCharacterToBuffer()
{
buffer.buffer().push_back(lastCharacter);
}
void ReadAndWriteMessageBlockTest::readPartialMessage()
{
QVariant readMessage = readMessageBlock.read();
ASSERT_FALSE(readMessage.isValid());
}
template<class Type>
void ReadAndWriteMessageBlockTest::CompareMessage(const Type &message)
{
const QVariant writeMessage = QVariant::fromValue(message);
writeMessageBlock.write(writeMessage);
buffer.seek(0);
const QVariant readMessage = readMessageBlock.read();
ASSERT_EQ(writeMessage, readMessage);
}
}

View File

@@ -13,7 +13,7 @@ osx:QMAKE_CXXFLAGS = -stdlib=libc++
DEFINES += \
QT_NO_CAST_FROM_ASCII \
CLANGBACKEND_TESTS \
DONT_CHECK_COMMAND_COUNTER \
DONT_CHECK_MESSAGE_COUNTER \
TESTDATA_DIR=\"R\\\"xxx($$PWD/data)xxx\\\"\"
win32:DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echo)xxx\\\"\"
unix: DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echoserver/echo)xxx\\\"\"
@@ -34,7 +34,7 @@ SOURCES += \
lineprefixertest.cpp \
main.cpp \
projecttest.cpp \
readandwritecommandblocktest.cpp \
readandwritemessageblocktest.cpp \
spydummy.cpp \
sqlitecolumntest.cpp \
sqlitedatabasebackendtest.cpp \