Clang: Inline RegisterTranslationUnitForEditorMessage

Change-Id: I07b28a757dfc019a46617433491756385d646d96
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Marco Bubke
2016-07-19 11:49:59 +02:00
committed by Tim Jenssen
parent 73c12e7ebc
commit 32d8e4a74f
2 changed files with 47 additions and 63 deletions

View File

@@ -25,61 +25,12 @@
#include "cmbregistertranslationunitsforeditormessage.h" #include "cmbregistertranslationunitsforeditormessage.h"
#include <QDataStream>
#include <QDebug> #include <QDebug>
#include <ostream> #include <ostream>
namespace ClangBackEnd { namespace ClangBackEnd {
RegisterTranslationUnitForEditorMessage::RegisterTranslationUnitForEditorMessage(const QVector<FileContainer> &fileContainers,
const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorFilePaths)
: fileContainers_(fileContainers),
currentEditorFilePath_(currentEditorFilePath),
visibleEditorFilePaths_(visibleEditorFilePaths)
{
}
const QVector<FileContainer> &RegisterTranslationUnitForEditorMessage::fileContainers() const
{
return fileContainers_;
}
const Utf8String &RegisterTranslationUnitForEditorMessage::currentEditorFilePath() const
{
return currentEditorFilePath_;
}
const Utf8StringVector &RegisterTranslationUnitForEditorMessage::visibleEditorFilePaths() const
{
return visibleEditorFilePaths_;
}
QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message)
{
out << message.fileContainers_;
out << message.currentEditorFilePath_;
out << message.visibleEditorFilePaths_;
return out;
}
QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message)
{
in >> message.fileContainers_;
in >> message.currentEditorFilePath_;
in >> message.visibleEditorFilePaths_;
return in;
}
bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second)
{
return first.fileContainers_ == second.fileContainers_
&& first.currentEditorFilePath_ == second.currentEditorFilePath_
&& first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_;
}
QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message) QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message)
{ {
debug.nospace() << "RegisterTranslationUnitForEditorMessage("; debug.nospace() << "RegisterTranslationUnitForEditorMessage(";

View File

@@ -27,38 +27,71 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QDataStream>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT RegisterTranslationUnitForEditorMessage class RegisterTranslationUnitForEditorMessage
{ {
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
friend void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
public: public:
RegisterTranslationUnitForEditorMessage() = default; RegisterTranslationUnitForEditorMessage() = default;
RegisterTranslationUnitForEditorMessage(const QVector<FileContainer> &fileContainers, RegisterTranslationUnitForEditorMessage(const QVector<FileContainer> &fileContainers,
const Utf8String &currentEditorFilePath, const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorFilePaths); const Utf8StringVector &visibleEditorFilePaths)
: fileContainers_(fileContainers),
currentEditorFilePath_(currentEditorFilePath),
visibleEditorFilePaths_(visibleEditorFilePaths)
{
}
const QVector<FileContainer> &fileContainers() const; const QVector<FileContainer> &fileContainers() const
const Utf8String &currentEditorFilePath() const; {
const Utf8StringVector &visibleEditorFilePaths() const; return fileContainers_;
}
const Utf8String &currentEditorFilePath() const
{
return currentEditorFilePath_;
}
const Utf8StringVector &visibleEditorFilePaths() const
{
return visibleEditorFilePaths_;
}
friend QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message)
{
out << message.fileContainers_;
out << message.currentEditorFilePath_;
out << message.visibleEditorFilePaths_;
return out;
}
friend QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message)
{
in >> message.fileContainers_;
in >> message.currentEditorFilePath_;
in >> message.visibleEditorFilePaths_;
return in;
}
friend bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second)
{
return first.fileContainers_ == second.fileContainers_
&& first.currentEditorFilePath_ == second.currentEditorFilePath_
&& first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_;
}
friend void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
private: private:
QVector<FileContainer> fileContainers_; QVector<FileContainer> fileContainers_;
Utf8String currentEditorFilePath_; Utf8String currentEditorFilePath_;
Utf8StringVector visibleEditorFilePaths_; Utf8StringVector visibleEditorFilePaths_;
}; };
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message);
void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RegisterTranslationUnitForEditorMessage); DECLARE_MESSAGE(RegisterTranslationUnitForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd