forked from qt-creator/qt-creator
Clang: Inline CodeCompletedMessage
Change-Id: I9f65bd95efe3a02848db6e9cadddc22c88b19902 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -25,66 +25,12 @@
|
|||||||
|
|
||||||
#include "cmbcodecompletedmessage.h"
|
#include "cmbcodecompletedmessage.h"
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
CodeCompletedMessage::CodeCompletedMessage(const CodeCompletions &codeCompletions,
|
|
||||||
CompletionCorrection neededCorrection,
|
|
||||||
quint64 ticketNumber)
|
|
||||||
: codeCompletions_(codeCompletions),
|
|
||||||
ticketNumber_(ticketNumber),
|
|
||||||
neededCorrection_(neededCorrection)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const CodeCompletions &CodeCompletedMessage::codeCompletions() const
|
|
||||||
{
|
|
||||||
return codeCompletions_;
|
|
||||||
}
|
|
||||||
|
|
||||||
CompletionCorrection CodeCompletedMessage::neededCorrection() const
|
|
||||||
{
|
|
||||||
return neededCorrection_;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint64 CodeCompletedMessage::ticketNumber() const
|
|
||||||
{
|
|
||||||
return ticketNumber_;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.codeCompletions_;
|
|
||||||
out << static_cast<quint32>(message.neededCorrection_);
|
|
||||||
out << message.ticketNumber_;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message)
|
|
||||||
{
|
|
||||||
quint32 neededCorrection;
|
|
||||||
|
|
||||||
in >> message.codeCompletions_;
|
|
||||||
in >> neededCorrection;
|
|
||||||
in >> message.ticketNumber_;
|
|
||||||
|
|
||||||
message.neededCorrection_ = static_cast<CompletionCorrection>(neededCorrection);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber_ == second.ticketNumber_
|
|
||||||
&& first.neededCorrection_ == second.neededCorrection_
|
|
||||||
&& first.codeCompletions_ == second.codeCompletions_;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RETURN_TEXT_FOR_CASE(enumValue) case CompletionCorrection::enumValue: return #enumValue
|
#define RETURN_TEXT_FOR_CASE(enumValue) case CompletionCorrection::enumValue: return #enumValue
|
||||||
static const char *completionCorrectionToText(CompletionCorrection correction)
|
static const char *completionCorrectionToText(CompletionCorrection correction)
|
||||||
{
|
{
|
||||||
|
@@ -27,27 +27,70 @@
|
|||||||
|
|
||||||
#include "codecompletion.h"
|
#include "codecompletion.h"
|
||||||
|
|
||||||
|
#include <QDataStream>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
class CMBIPC_EXPORT CodeCompletedMessage
|
class CodeCompletedMessage
|
||||||
{
|
{
|
||||||
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 QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
|
|
||||||
friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
|
|
||||||
public:
|
public:
|
||||||
CodeCompletedMessage() = default;
|
CodeCompletedMessage() = default;
|
||||||
CodeCompletedMessage(const CodeCompletions &codeCompletions,
|
CodeCompletedMessage(const CodeCompletions &codeCompletions,
|
||||||
CompletionCorrection neededCorrection,
|
CompletionCorrection neededCorrection,
|
||||||
quint64 ticketNumber);
|
quint64 ticketNumber)
|
||||||
|
: codeCompletions_(codeCompletions),
|
||||||
|
ticketNumber_(ticketNumber),
|
||||||
|
neededCorrection_(neededCorrection)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const CodeCompletions &codeCompletions() const;
|
const CodeCompletions &codeCompletions() const
|
||||||
CompletionCorrection neededCorrection() const;
|
{
|
||||||
|
return codeCompletions_;
|
||||||
|
}
|
||||||
|
|
||||||
quint64 ticketNumber() const;
|
CompletionCorrection neededCorrection() const
|
||||||
|
{
|
||||||
|
return neededCorrection_;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 ticketNumber() const
|
||||||
|
{
|
||||||
|
return ticketNumber_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message)
|
||||||
|
{
|
||||||
|
out << message.codeCompletions_;
|
||||||
|
out << static_cast<quint32>(message.neededCorrection_);
|
||||||
|
out << message.ticketNumber_;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message)
|
||||||
|
{
|
||||||
|
quint32 neededCorrection;
|
||||||
|
|
||||||
|
in >> message.codeCompletions_;
|
||||||
|
in >> neededCorrection;
|
||||||
|
in >> message.ticketNumber_;
|
||||||
|
|
||||||
|
message.neededCorrection_ = static_cast<CompletionCorrection>(neededCorrection);
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second)
|
||||||
|
{
|
||||||
|
return first.ticketNumber_ == second.ticketNumber_
|
||||||
|
&& first.neededCorrection_ == second.neededCorrection_
|
||||||
|
&& first.codeCompletions_ == second.codeCompletions_;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
|
||||||
|
friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CodeCompletions codeCompletions_;
|
CodeCompletions codeCompletions_;
|
||||||
@@ -55,12 +98,5 @@ private:
|
|||||||
CompletionCorrection neededCorrection_ = CompletionCorrection::NoCorrection;
|
CompletionCorrection neededCorrection_ = CompletionCorrection::NoCorrection;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
|
|
||||||
void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(CodeCompletedMessage)
|
DECLARE_MESSAGE(CodeCompletedMessage)
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
Reference in New Issue
Block a user