Clang: Use MessageEnvelop instead of QVariant

QVariant has unwanted dependencies so we provided our own simpler solution.
We want to support move only types and calling the copy constructor as you
move the value in and outside. This copying is adding unwanted overhead
too.

Change-Id: I2e27a7924868efe81e8b8ff3415499c9fa22c2bc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2016-02-08 13:23:28 +01:00
parent c3bbf389d9
commit 974070d2c8
80 changed files with 350 additions and 713 deletions

View File

@@ -14,7 +14,6 @@ SOURCES += $$PWD/ipcserverinterface.cpp \
$$PWD/cmbendmessage.cpp \ $$PWD/cmbendmessage.cpp \
$$PWD/cmbalivemessage.cpp \ $$PWD/cmbalivemessage.cpp \
$$PWD/ipcclientproxy.cpp \ $$PWD/ipcclientproxy.cpp \
$$PWD/cmbmessages.cpp \
$$PWD/writemessageblock.cpp \ $$PWD/writemessageblock.cpp \
$$PWD/readmessageblock.cpp \ $$PWD/readmessageblock.cpp \
$$PWD/ipcinterface.cpp \ $$PWD/ipcinterface.cpp \
@@ -57,7 +56,6 @@ HEADERS += \
$$PWD/cmbendmessage.h \ $$PWD/cmbendmessage.h \
$$PWD/cmbalivemessage.h \ $$PWD/cmbalivemessage.h \
$$PWD/ipcclientproxy.h \ $$PWD/ipcclientproxy.h \
$$PWD/cmbmessages.h \
$$PWD/writemessageblock.h \ $$PWD/writemessageblock.h \
$$PWD/readmessageblock.h \ $$PWD/readmessageblock.h \
$$PWD/ipcinterface.h \ $$PWD/ipcinterface.h \
@@ -77,7 +75,6 @@ HEADERS += \
$$PWD/codecompletionchunk.h \ $$PWD/codecompletionchunk.h \
$$PWD/projectpartcontainer.h \ $$PWD/projectpartcontainer.h \
$$PWD/projectpartsdonotexistmessage.h \ $$PWD/projectpartsdonotexistmessage.h \
$$PWD/container_common.h \
$$PWD/clangbackendipc_global.h \ $$PWD/clangbackendipc_global.h \
$$PWD/lineprefixer.h \ $$PWD/lineprefixer.h \
$$PWD/clangbackendipcdebugutils.h \ $$PWD/clangbackendipcdebugutils.h \
@@ -93,6 +90,7 @@ HEADERS += \
$$PWD/updatetranslationunitsforeditormessage.h \ $$PWD/updatetranslationunitsforeditormessage.h \
$$PWD/updatevisibletranslationunitsmessage.h \ $$PWD/updatevisibletranslationunitsmessage.h \
$$PWD/highlightingchangedmessage.h \ $$PWD/highlightingchangedmessage.h \
$$PWD/highlightingmarkcontainer.h $$PWD/highlightingmarkcontainer.h \
$$PWD/messageenvelop.h
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols

View File

@@ -79,5 +79,49 @@ enum class CompletionCorrection
DotToArrowCorrection DotToArrowCorrection
}; };
enum class MessageType : quint8 {
InvalidMessage,
AliveMessage,
EchoMessage,
EndMessage,
RegisterTranslationUnitForEditorMessage,
UpdateTranslationUnitsForEditorMessage,
UnregisterTranslationUnitsForEditorMessage,
RegisterUnsavedFilesForEditorMessage,
UnregisterUnsavedFilesForEditorMessage,
RegisterProjectPartsForEditorMessage,
UnregisterProjectPartsForEditorMessage,
RequestDiagnosticsMessage,
DiagnosticsChangedMessage,
RequestHighlightingMessage,
HighlightingChangedMessage,
UpdateVisibleTranslationUnitsMessage,
CompleteCodeMessage,
CodeCompletedMessage,
TranslationUnitDoesNotExistMessage,
ProjectPartsDoNotExistMessage
};
template<MessageType messageEnumeration>
struct MessageTypeTrait;
template<class Message>
struct MessageTrait;
#define DECLARE_MESSAGE(Message) \
template<> \
struct MessageTrait<Message> \
{ \
static const MessageType enumeration = MessageType::Message; \
};
} }
#endif // CLANGBACKENDIPC_GLOBAL_H #endif // CLANGBACKENDIPC_GLOBAL_H

View File

@@ -45,11 +45,6 @@ bool operator==(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
return true; return true;
} }
bool operator<(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
{
return true;
}
QDebug operator<<(QDebug debug, const AliveMessage &/*message*/) QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
{ {
return debug.nospace() << "AliveMessage()"; return debug.nospace() << "AliveMessage()";

View File

@@ -28,8 +28,6 @@
#include "clangbackendipc_global.h" #include "clangbackendipc_global.h"
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT AliveMessage class CMBIPC_EXPORT AliveMessage
@@ -39,12 +37,10 @@ class CMBIPC_EXPORT AliveMessage
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const AliveMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const AliveMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const AliveMessage &first, const AliveMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message);
DECLARE_MESSAGE(AliveMessage)
} }
Q_DECLARE_METATYPE(ClangBackEnd::AliveMessage)
#endif // CMBALIVEMESSAGE_H #endif // CMBALIVEMESSAGE_H

View File

@@ -86,11 +86,6 @@ bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &s
&& first.codeCompletions_ == second.codeCompletions_; && first.codeCompletions_ == second.codeCompletions_;
} }
bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second)
{
return first.ticketNumber_ < second.ticketNumber_;
}
#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)
{ {

View File

@@ -28,7 +28,6 @@
#include "codecompletion.h" #include "codecompletion.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT CodeCompletedMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os); friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
public: public:
@@ -64,13 +62,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os); void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(CodeCompletedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletedMessage)
#endif // CLANGBACKEND_CODECOMPLETEDMESSAGE_H #endif // CLANGBACKEND_CODECOMPLETEDMESSAGE_H

View File

@@ -99,15 +99,6 @@ bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &sec
&& first.column_ == second.column_; && first.column_ == second.column_;
} }
bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second)
{
return first.ticketNumber_ < second.ticketNumber_
&& first.filePath_ < second.filePath_
&& first.projectPartId_ < second.projectPartId_
&& first.line_ < second.line_
&& first.column_ < second.column_;
}
QDebug operator<<(QDebug debug, const CompleteCodeMessage &message) QDebug operator<<(QDebug debug, const CompleteCodeMessage &message)
{ {
debug.nospace() << "CompleteCodeMessage("; debug.nospace() << "CompleteCodeMessage(";

View File

@@ -30,8 +30,6 @@
#include <utf8string.h> #include <utf8string.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT CompleteCodeMessage class CMBIPC_EXPORT CompleteCodeMessage
@@ -39,7 +37,6 @@ class CMBIPC_EXPORT CompleteCodeMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
friend void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os); friend void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
@@ -70,13 +67,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os); void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(CompleteCodeMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::CompleteCodeMessage)
#endif // CLANGBACKEND_COMPLETECODEMESSAGE_H #endif // CLANGBACKEND_COMPLETECODEMESSAGE_H

View File

@@ -32,13 +32,12 @@
namespace ClangBackEnd { namespace ClangBackEnd {
EchoMessage::EchoMessage(const QVariant &message) EchoMessage::EchoMessage(const MessageEnvelop &message)
: message_(message) : message_(message)
{ {
} }
const QVariant &EchoMessage::message() const const MessageEnvelop &EchoMessage::message() const
{ {
return message_; return message_;
} }
@@ -62,24 +61,14 @@ bool operator==(const EchoMessage &first, const EchoMessage &second)
return first.message_ == second.message_; return first.message_ == second.message_;
} }
bool operator<(const EchoMessage &first, const EchoMessage &second) QDebug operator<<(QDebug debug, const EchoMessage &)
{ {
return first.message_ < second.message_; return debug.nospace() << "EchoMessage()";
} }
QDebug operator<<(QDebug debug, const EchoMessage &message) void PrintTo(const EchoMessage &, ::std::ostream* os)
{ {
return debug.nospace() << "EchoMessage(" << message.message() << ")"; *os << "EchoMessage()";
}
void PrintTo(const EchoMessage &message, ::std::ostream* os)
{
QString output;
QDebug debug(&output);
debug << message;
*os << output.toUtf8().constData();
} }
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -28,8 +28,7 @@
#include "clangbackendipc_global.h" #include "clangbackendipc_global.h"
#include <QMetaType> #include "messageenvelop.h"
#include <QVariant>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -37,27 +36,24 @@ class CMBIPC_EXPORT EchoMessage
{ {
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoMessage &message); 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);
friend CMBIPC_EXPORT bool operator<(const EchoMessage &first, const EchoMessage &second);
public: public:
EchoMessage() = default; EchoMessage() = default;
explicit EchoMessage(const QVariant &message); explicit EchoMessage(const MessageEnvelop &message);
const QVariant &message() const; const MessageEnvelop &message() const;
private: private:
QVariant message_; MessageEnvelop message_;
}; };
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EchoMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EchoMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const EchoMessage &first, const EchoMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message);
void PrintTo(const EchoMessage &message, ::std::ostream* os); void PrintTo(const EchoMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(EchoMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::EchoMessage)
#endif // CLANGBACKEND_ECHOMESSAGE_H #endif // CLANGBACKEND_ECHOMESSAGE_H

View File

@@ -47,11 +47,6 @@ bool operator==(const EndMessage &/*first*/, const EndMessage &/*second*/)
return true; return true;
} }
bool operator<(const EndMessage &/*first*/, const EndMessage &/*second*/)
{
return true;
}
QDebug operator<<(QDebug debug, const EndMessage &/*message*/) QDebug operator<<(QDebug debug, const EndMessage &/*message*/)
{ {
return debug.nospace() << "EndMessage()"; return debug.nospace() << "EndMessage()";
@@ -61,5 +56,6 @@ void PrintTo(const EndMessage &/*message*/, ::std::ostream* os)
{ {
*os << "EndMessage()"; *os << "EndMessage()";
} }
} }

View File

@@ -28,8 +28,6 @@
#include "clangbackendipc_global.h" #include "clangbackendipc_global.h"
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT EndMessage class CMBIPC_EXPORT EndMessage
@@ -39,12 +37,11 @@ class CMBIPC_EXPORT EndMessage
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EndMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EndMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const EndMessage &first, const EndMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message);
void PrintTo(const EndMessage &message, ::std::ostream* os); void PrintTo(const EndMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(EndMessage)
} }
Q_DECLARE_METATYPE(ClangBackEnd::EndMessage)
#endif // CMBENDMESSAGE_H #endif // CMBENDMESSAGE_H

View File

@@ -1,106 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "cmbmessages.h"
#include "cmbalivemessage.h"
#include "cmbendmessage.h"
#include "cmbechomessage.h"
#include "cmbregistertranslationunitsforeditormessage.h"
#include "cmbunregistertranslationunitsforeditormessage.h"
#include "cmbregisterprojectsforeditormessage.h"
#include "cmbunregisterprojectsforeditormessage.h"
#include "cmbcompletecodemessage.h"
#include "cmbcodecompletedmessage.h"
#include "diagnosticcontainer.h"
#include "diagnosticschangedmessage.h"
#include "registerunsavedfilesforeditormessage.h"
#include "requestdiagnosticsmessage.h"
#include "requesthighlightingmessage.h"
#include "highlightingchangedmessage.h"
#include "highlightingmarkcontainer.h"
#include "projectpartsdonotexistmessage.h"
#include "sourcelocationcontainer.h"
#include "sourcerangecontainer.h"
#include "translationunitdoesnotexistmessage.h"
#include "unregisterunsavedfilesforeditormessage.h"
#include "updatetranslationunitsforeditormessage.h"
#include "updatevisibletranslationunitsmessage.h"
#include <QDataStream>
template <typename T>
static void registerMetaType()
{
qRegisterMetaType<T>();
qRegisterMetaTypeStreamOperators<T>();
QMetaType::registerComparators<T>();
}
namespace ClangBackEnd {
void Messages::registerMessages()
{
// Messages
registerMetaType<AliveMessage>();
registerMetaType<EchoMessage>();
registerMetaType<EndMessage>();
registerMetaType<RegisterTranslationUnitForEditorMessage>();
registerMetaType<UpdateTranslationUnitsForEditorMessage>();
registerMetaType<UnregisterTranslationUnitsForEditorMessage>();
registerMetaType<RegisterUnsavedFilesForEditorMessage>();
registerMetaType<UnregisterUnsavedFilesForEditorMessage>();
registerMetaType<RegisterProjectPartsForEditorMessage>();
registerMetaType<UnregisterProjectPartsForEditorMessage>();
registerMetaType<RequestDiagnosticsMessage>();
registerMetaType<DiagnosticsChangedMessage>();
registerMetaType<RequestHighlightingMessage>();
registerMetaType<HighlightingChangedMessage>();
registerMetaType<UpdateVisibleTranslationUnitsMessage>();
registerMetaType<CompleteCodeMessage>();
registerMetaType<CodeCompletedMessage>();
registerMetaType<CodeCompletion>();
registerMetaType<TranslationUnitDoesNotExistMessage>();
registerMetaType<ProjectPartsDoNotExistMessage>();
// Containers
registerMetaType<DiagnosticContainer>();
registerMetaType<HighlightingMarkContainer>();
registerMetaType<FileContainer>();
registerMetaType<ProjectPartContainer>();
registerMetaType<SourceLocationContainer>();
registerMetaType<SourceRangeContainer>();
}
} // namespace ClangBackEnd

View File

@@ -1,40 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef CLANGBACKEND_MESSAGES_H
#define CLANGBACKEND_MESSAGES_H
#include <clangbackendipc_global.h>
namespace ClangBackEnd {
namespace Messages
{
CMBIPC_EXPORT void registerMessages();
}
} // namespace ClangBackEnd
#endif // CLANGBACKEND_MESSAGES_H

View File

@@ -25,8 +25,6 @@
#include "cmbregisterprojectsforeditormessage.h" #include "cmbregisterprojectsforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -64,11 +62,6 @@ bool operator==(const RegisterProjectPartsForEditorMessage &first, const Registe
return first.projectContainers_ == second.projectContainers_; return first.projectContainers_ == second.projectContainers_;
} }
bool operator<(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second)
{
return compareContainer(first.projectContainers_, second.projectContainers_);
}
QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message) QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message)
{ {
debug.nospace() << "RegisterProjectPartsForEditorMessage("; debug.nospace() << "RegisterProjectPartsForEditorMessage(";

View File

@@ -28,7 +28,6 @@
#include "projectpartcontainer.h" #include "projectpartcontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT RegisterProjectPartsForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second);
friend void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os);
public: public:
RegisterProjectPartsForEditorMessage() = default; RegisterProjectPartsForEditorMessage() = default;
@@ -53,12 +51,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterProjectPartsForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterProjectPartsForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second); CMBIPC_EXPORT bool operator==(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const RegisterProjectPartsForEditorMessage &first, const RegisterProjectPartsForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message);
void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os); void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RegisterProjectPartsForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RegisterProjectPartsForEditorMessage)
#endif // CLANGBACKEND_REGISTERPROJECTSFOREDITORMESSAGE_H #endif // CLANGBACKEND_REGISTERPROJECTSFOREDITORMESSAGE_H

View File

@@ -25,8 +25,6 @@
#include "cmbregistertranslationunitsforeditormessage.h" #include "cmbregistertranslationunitsforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -82,13 +80,6 @@ bool operator==(const RegisterTranslationUnitForEditorMessage &first, const Regi
&& first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_; && first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_;
} }
bool operator<(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_)
&& first.currentEditorFilePath_ < second.currentEditorFilePath_
&& compareContainer(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

@@ -28,7 +28,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT RegisterTranslationUnitForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
friend void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
public: public:
RegisterTranslationUnitForEditorMessage() = default; RegisterTranslationUnitForEditorMessage() = default;
@@ -59,12 +57,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second); CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
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); void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RegisterTranslationUnitForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RegisterTranslationUnitForEditorMessage)
#endif // CLANGBACKEND_REGISTERFILEFORCODECOMPLITION_H #endif // CLANGBACKEND_REGISTERFILEFORCODECOMPLITION_H

View File

@@ -25,8 +25,6 @@
#include "cmbunregisterprojectsforeditormessage.h" #include "cmbunregisterprojectsforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -65,11 +63,6 @@ bool operator==(const UnregisterProjectPartsForEditorMessage &first, const Unreg
return first.projectPartIds_ == second.projectPartIds_; return first.projectPartIds_ == second.projectPartIds_;
} }
bool operator<(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second)
{
return compareContainer(first.projectPartIds_, second.projectPartIds_);
}
QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message) QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message)
{ {
debug.nospace() << "UnregisterProjectPartsForEditorMessage("; debug.nospace() << "UnregisterProjectPartsForEditorMessage(";

View File

@@ -30,8 +30,6 @@
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT UnregisterProjectPartsForEditorMessage class CMBIPC_EXPORT UnregisterProjectPartsForEditorMessage
@@ -39,7 +37,6 @@ class CMBIPC_EXPORT UnregisterProjectPartsForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second);
friend void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os);
public: public:
@@ -55,12 +52,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterProjectPartsForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterProjectPartsForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second); CMBIPC_EXPORT bool operator==(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const UnregisterProjectPartsForEditorMessage &first, const UnregisterProjectPartsForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message);
void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os); void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(UnregisterProjectPartsForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterProjectPartsForEditorMessage)
#endif // CLANGBACKEND_UNREGISTERPROJECTSFOREDITOR_H #endif // CLANGBACKEND_UNREGISTERPROJECTSFOREDITOR_H

View File

@@ -25,8 +25,6 @@
#include "cmbunregistertranslationunitsforeditormessage.h" #include "cmbunregistertranslationunitsforeditormessage.h"
#include "container_common.h"
#ifdef CLANGBACKEND_TESTS #ifdef CLANGBACKEND_TESTS
#include <gtest/gtest-printers.h> #include <gtest/gtest-printers.h>
#endif #endif
@@ -66,11 +64,6 @@ bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const U
return first.fileContainers_ == second.fileContainers_; return first.fileContainers_ == second.fileContainers_;
} }
bool operator<(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message) QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message)
{ {
debug.nospace() << "UnregisterTranslationUnitsForEditorMessage("; debug.nospace() << "UnregisterTranslationUnitsForEditorMessage(";

View File

@@ -30,7 +30,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -40,7 +39,6 @@ class CMBIPC_EXPORT UnregisterTranslationUnitsForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second);
friend void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os);
public: public:
@@ -56,14 +54,13 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterTranslationUnitsForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterTranslationUnitsForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second); CMBIPC_EXPORT bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const UnregisterTranslationUnitsForEditorMessage &first, const UnregisterTranslationUnitsForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message);
#ifdef CLANGBACKEND_TESTS #ifdef CLANGBACKEND_TESTS
void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os); void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os);
#endif #endif
DECLARE_MESSAGE(UnregisterTranslationUnitsForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterTranslationUnitsForEditorMessage)
#endif // CLANGBACKEND_UNRegisterTranslationUnitForEditorMessage_H #endif // CLANGBACKEND_UNRegisterTranslationUnitForEditorMessage_H

View File

@@ -157,11 +157,6 @@ bool operator==(const CodeCompletion &first, const CodeCompletion &second)
&& first.completionKind_ == second.completionKind_; && first.completionKind_ == second.completionKind_;
} }
bool operator<(const CodeCompletion &first, const CodeCompletion &second)
{
return first.text_ < second.text_;
}
static const char *completionKindToString(CodeCompletion::Kind kind) static const char *completionKindToString(CodeCompletion::Kind kind)
{ {
switch (kind) { switch (kind) {

View File

@@ -31,7 +31,6 @@
#include <utf8string.h> #include <utf8string.h>
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -44,7 +43,6 @@ class CMBIPC_EXPORT CodeCompletion
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CodeCompletion &first, const CodeCompletion &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
friend void PrintTo(const CodeCompletion &message, ::std::ostream* os); friend void PrintTo(const CodeCompletion &message, ::std::ostream* os);
@@ -123,7 +121,6 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletion &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const CodeCompletion &first, const CodeCompletion &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, CodeCompletion::Kind kind); CMBIPC_EXPORT QDebug operator<<(QDebug debug, CodeCompletion::Kind kind);
@@ -133,6 +130,4 @@ void PrintTo(CodeCompletion::Kind kind, ::std::ostream *os);
void PrintTo(CodeCompletion::Availability availability, ::std::ostream *os); void PrintTo(CodeCompletion::Availability availability, ::std::ostream *os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletion)
#endif // CLANGBACKEND_CODECOMPLETION_H #endif // CLANGBACKEND_CODECOMPLETION_H

View File

@@ -1,57 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef CONTAINER_COMMON_H
#define CONTAINER_COMMON_H
namespace ClangBackEnd {
template <typename Container>
bool compareContainer(const Container &first, const Container &second)
{
if (first.size() != second.size())
return first.size() < second.size();
Container firstCopy = first;
Container secondCopy = second;
std::sort(firstCopy.begin(), firstCopy.end());
std::sort(secondCopy.begin(), secondCopy.end());
auto isProjectPartContainerSmaller = [] (decltype(*first.cbegin()) &firstElement,
decltype(*second.cbegin()) &secondElement) {
return firstElement < secondElement;
};
return std::equal(firstCopy.cbegin(),
firstCopy.cend(),
secondCopy.cbegin(),
isProjectPartContainerSmaller);
}
}
#endif // CONTAINER_COMMON_H

View File

@@ -138,12 +138,6 @@ bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &sec
&& first.location_ == second.location_; && first.location_ == second.location_;
} }
bool operator<(const DiagnosticContainer &first, const DiagnosticContainer &second)
{
return first.text_ < second.text_
|| (first.text_ == second.text_ && first.location_ < second.location_);
}
static const char *severityToText(DiagnosticSeverity severity) static const char *severityToText(DiagnosticSeverity severity)
{ {
switch (severity) { switch (severity) {

View File

@@ -40,7 +40,6 @@ class CMBIPC_EXPORT DiagnosticContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container);
friend CMBIPC_EXPORT bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second); friend CMBIPC_EXPORT bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second);
friend CMBIPC_EXPORT bool operator<(const DiagnosticContainer &first, const DiagnosticContainer &second);
public: public:
DiagnosticContainer() = default; DiagnosticContainer() = default;
@@ -81,13 +80,10 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container);
CMBIPC_EXPORT bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second); CMBIPC_EXPORT bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second);
CMBIPC_EXPORT bool operator<(const DiagnosticContainer &first, const DiagnosticContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticContainer &container);
void PrintTo(const DiagnosticContainer &container, ::std::ostream* os); void PrintTo(const DiagnosticContainer &container, ::std::ostream* os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::DiagnosticContainer)
#endif // CLANGBACKEND_DIAGNOSTICCONTAINER_H #endif // CLANGBACKEND_DIAGNOSTICCONTAINER_H

View File

@@ -25,8 +25,6 @@
#include "diagnosticschangedmessage.h" #include "diagnosticschangedmessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -73,12 +71,6 @@ bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChanged
&& first.diagnostics_ == second.diagnostics_; && first.diagnostics_ == second.diagnostics_;
} }
bool operator<(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second)
{
return first.file_ < second.file_
&& compareContainer(first.diagnostics_, second.diagnostics_);
}
QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message) QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message)
{ {
debug.nospace() << "DiagnosticsChangedMessage(" debug.nospace() << "DiagnosticsChangedMessage("

View File

@@ -39,7 +39,6 @@ class CMBIPC_EXPORT DiagnosticsChangedMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticsChangedMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticsChangedMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticsChangedMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticsChangedMessage &message);
friend CMBIPC_EXPORT bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second); friend CMBIPC_EXPORT bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second);
friend CMBIPC_EXPORT bool operator<(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message);
friend void PrintTo(const DiagnosticsChangedMessage &message, ::std::ostream* os); friend void PrintTo(const DiagnosticsChangedMessage &message, ::std::ostream* os);
@@ -59,13 +58,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticsChangedMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const DiagnosticsChangedMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticsChangedMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, DiagnosticsChangedMessage &message);
CMBIPC_EXPORT bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second); CMBIPC_EXPORT bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second);
CMBIPC_EXPORT bool operator<(const DiagnosticsChangedMessage &first, const DiagnosticsChangedMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message);
void PrintTo(const DiagnosticsChangedMessage &message, ::std::ostream* os); void PrintTo(const DiagnosticsChangedMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(DiagnosticsChangedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::DiagnosticsChangedMessage)
#endif // CLANGBACKEND_DIAGNOSTICSCHANGEDMESSAGE_H #endif // CLANGBACKEND_DIAGNOSTICSCHANGEDMESSAGE_H

View File

@@ -118,14 +118,6 @@ bool operator==(const FileContainer &first, const FileContainer &second)
return first.filePath_ == second.filePath_ && first.projectPartId_ == second.projectPartId_; return first.filePath_ == second.filePath_ && first.projectPartId_ == second.projectPartId_;
} }
bool operator<(const FileContainer &first, const FileContainer &second)
{
if (first.filePath_ == second.filePath_)
return first.projectPartId_ < second.projectPartId_;
return first.filePath_ < second.filePath_;
}
QDebug operator<<(QDebug debug, const FileContainer &container) QDebug operator<<(QDebug debug, const FileContainer &container)
{ {
debug.nospace() << "FileContainer(" debug.nospace() << "FileContainer("

View File

@@ -31,8 +31,6 @@
#include <utf8string.h> #include <utf8string.h>
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT FileContainer class CMBIPC_EXPORT FileContainer
@@ -40,7 +38,6 @@ class CMBIPC_EXPORT FileContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FileContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FileContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FileContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FileContainer &container);
friend CMBIPC_EXPORT bool operator==(const FileContainer &first, const FileContainer &second); friend CMBIPC_EXPORT bool operator==(const FileContainer &first, const FileContainer &second);
friend CMBIPC_EXPORT bool operator<(const FileContainer &first, const FileContainer &second);
public: public:
FileContainer() = default; FileContainer() = default;
FileContainer(const Utf8String &filePath, FileContainer(const Utf8String &filePath,
@@ -72,13 +69,10 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FileContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FileContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FileContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FileContainer &container);
CMBIPC_EXPORT bool operator==(const FileContainer &first, const FileContainer &second); CMBIPC_EXPORT bool operator==(const FileContainer &first, const FileContainer &second);
CMBIPC_EXPORT bool operator<(const FileContainer &first, const FileContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container);
void PrintTo(const FileContainer &container, ::std::ostream* os); void PrintTo(const FileContainer &container, ::std::ostream* os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::FileContainer)
#endif // CLANGBACKEND_FILECONTAINER_H #endif // CLANGBACKEND_FILECONTAINER_H

View File

@@ -70,11 +70,6 @@ bool operator==(const FixItContainer &first, const FixItContainer &second)
return first.text_ == second.text_ && first.range_ == second.range_; return first.text_ == second.text_ && first.range_ == second.range_;
} }
bool operator<(const FixItContainer &first, const FixItContainer &second)
{
return first.range_ < second.range_;
}
QDebug operator<<(QDebug debug, const FixItContainer &container) QDebug operator<<(QDebug debug, const FixItContainer &container)
{ {
debug.nospace() << "FixItContainer(" debug.nospace() << "FixItContainer("

View File

@@ -35,8 +35,6 @@ class CMBIPC_EXPORT FixItContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FixItContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FixItContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FixItContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FixItContainer &container);
friend CMBIPC_EXPORT bool operator==(const FixItContainer &first, const FixItContainer &second); friend CMBIPC_EXPORT bool operator==(const FixItContainer &first, const FixItContainer &second);
friend CMBIPC_EXPORT bool operator<(const FixItContainer &first, const FixItContainer &second);
public: public:
FixItContainer() = default; FixItContainer() = default;
FixItContainer(const Utf8String &text, FixItContainer(const Utf8String &text,
@@ -53,7 +51,6 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FixItContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const FixItContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FixItContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, FixItContainer &container);
CMBIPC_EXPORT bool operator==(const FixItContainer &first, const FixItContainer &second); CMBIPC_EXPORT bool operator==(const FixItContainer &first, const FixItContainer &second);
CMBIPC_EXPORT bool operator<(const FixItContainer &first, const FixItContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const FixItContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const FixItContainer &container);
void PrintTo(const FixItContainer &container, ::std::ostream* os); void PrintTo(const FixItContainer &container, ::std::ostream* os);

View File

@@ -25,8 +25,6 @@
#include "highlightingchangedmessage.h" #include "highlightingchangedmessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -83,13 +81,6 @@ bool operator==(const HighlightingChangedMessage &first, const HighlightingChang
&& first.skippedPreprocessorRanges_ == second.skippedPreprocessorRanges_; && first.skippedPreprocessorRanges_ == second.skippedPreprocessorRanges_;
} }
bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second)
{
return first.file_ < second.file_
&& compareContainer(first.highlightingMarks_, second.highlightingMarks_)
&& compareContainer(first.skippedPreprocessorRanges_, second.skippedPreprocessorRanges_);
}
QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message) QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message)
{ {
debug.nospace() << "HighlightingChangedMessage(" debug.nospace() << "HighlightingChangedMessage("

View File

@@ -40,7 +40,6 @@ class CMBIPC_EXPORT HighlightingChangedMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message);
friend CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second); friend CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
friend CMBIPC_EXPORT bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
friend void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os); friend void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os);
@@ -63,13 +62,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingChangedMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingChangedMessage &message);
CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second); CMBIPC_EXPORT bool operator==(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
CMBIPC_EXPORT bool operator<(const HighlightingChangedMessage &first, const HighlightingChangedMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os); void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(HighlightingChangedMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingChangedMessage)
#endif // CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H #endif // CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H

View File

@@ -96,21 +96,6 @@ bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkCo
&& first.type_ == second.type_; && first.type_ == second.type_;
} }
bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second)
{
if (first.line() == second.line()) {
if (first.column() == second.column()) {
if (first.length() == second.length())
return first.type() < second.type();
return first.length() < second.length();
}
return first.column() < second.column();
}
return first.line() < second.line();
}
#define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue #define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue
static const char *highlightingTypeToCStringLiteral(HighlightingType type) static const char *highlightingTypeToCStringLiteral(HighlightingType type)
{ {

View File

@@ -28,8 +28,6 @@
#include "clangbackendipc_global.h" #include "clangbackendipc_global.h"
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT HighlightingMarkContainer class CMBIPC_EXPORT HighlightingMarkContainer
@@ -37,8 +35,6 @@ class CMBIPC_EXPORT HighlightingMarkContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container);
friend CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second); friend CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
friend CMBIPC_EXPORT bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
public: public:
HighlightingMarkContainer() = default; HighlightingMarkContainer() = default;
HighlightingMarkContainer(uint line, uint column, uint length, HighlightingType type); HighlightingMarkContainer(uint line, uint column, uint length, HighlightingType type);
@@ -61,7 +57,6 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const HighlightingMarkContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, HighlightingMarkContainer &container);
CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second); CMBIPC_EXPORT bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
CMBIPC_EXPORT bool operator<(const HighlightingMarkContainer &first, const HighlightingMarkContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingMarkContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const HighlightingMarkContainer &container);
CMBIPC_EXPORT void PrintTo(HighlightingType highlightingType, ::std::ostream *os); CMBIPC_EXPORT void PrintTo(HighlightingType highlightingType, ::std::ostream *os);
@@ -69,6 +64,4 @@ void PrintTo(const HighlightingMarkContainer &container, ::std::ostream *os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingMarkContainer)
#endif // CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H #endif // CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H

View File

@@ -27,6 +27,7 @@
#include "cmbcodecompletedmessage.h" #include "cmbcodecompletedmessage.h"
#include "cmbechomessage.h" #include "cmbechomessage.h"
#include "messageenvelop.h"
#include "projectpartsdonotexistmessage.h" #include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h" #include "translationunitdoesnotexistmessage.h"
#include "diagnosticschangedmessage.h" #include "diagnosticschangedmessage.h"
@@ -37,35 +38,33 @@
namespace ClangBackEnd { namespace ClangBackEnd {
void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
void IpcClientInterface::dispatch(const QVariant &message)
{ {
static const int aliveMessageType = QMetaType::type("ClangBackEnd::AliveMessage"); switch (messageEnvelop.messageType()) {
static const int echoMessageType = QMetaType::type("ClangBackEnd::EchoMessage"); case MessageType::AliveMessage:
static const int codeCompletedMessageType = QMetaType::type("ClangBackEnd::CodeCompletedMessage"); alive();
static const int translationUnitDoesNotExistMessage = QMetaType::type("ClangBackEnd::TranslationUnitDoesNotExistMessage"); break;
static const int projectPartsDoNotExistMessage = QMetaType::type("ClangBackEnd::ProjectPartsDoNotExistMessage"); case MessageType::EchoMessage:
static const int diagnosticsChangedMessage = QMetaType::type("ClangBackEnd::DiagnosticsChangedMessage"); echo(messageEnvelop.message<EchoMessage>());
static const int highlightingChangedMessage = QMetaType::type("ClangBackEnd::HighlightingChangedMessage"); break;
case MessageType::CodeCompletedMessage:
int type = message.userType(); codeCompleted(messageEnvelop.message<CodeCompletedMessage>());
break;
if (type == aliveMessageType) case MessageType::TranslationUnitDoesNotExistMessage:
alive(); translationUnitDoesNotExist(messageEnvelop.message<TranslationUnitDoesNotExistMessage>());
else if (type == echoMessageType) break;
echo(message.value<EchoMessage>()); case MessageType::ProjectPartsDoNotExistMessage:
else if (type == codeCompletedMessageType) projectPartsDoNotExist(messageEnvelop.message<ProjectPartsDoNotExistMessage>());
codeCompleted(message.value<CodeCompletedMessage>()); break;
else if (type == translationUnitDoesNotExistMessage) case MessageType::DiagnosticsChangedMessage:
translationUnitDoesNotExist(message.value<TranslationUnitDoesNotExistMessage>()); diagnosticsChanged(messageEnvelop.message<DiagnosticsChangedMessage>());
else if (type == projectPartsDoNotExistMessage) break;
projectPartsDoNotExist(message.value<ProjectPartsDoNotExistMessage>()); case MessageType::HighlightingChangedMessage:
else if (type == diagnosticsChangedMessage) highlightingChanged(messageEnvelop.message<HighlightingChangedMessage>());
diagnosticsChanged(message.value<DiagnosticsChangedMessage>()); break;
else if (type == highlightingChangedMessage) default:
highlightingChanged(message.value<HighlightingChangedMessage>()); qWarning() << "Unknown IpcClientMessage";
else }
qWarning() << "Unknown IpcClientMessage";
} }
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -52,7 +52,7 @@ class HighlightingChangedMessage;
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
{ {
public: public:
void dispatch(const QVariant &message) override; void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void alive() = 0; virtual void alive() = 0;
virtual void echo(const EchoMessage &message) = 0; virtual void echo(const EchoMessage &message) = 0;

View File

@@ -32,6 +32,7 @@
#include "diagnosticschangedmessage.h" #include "diagnosticschangedmessage.h"
#include "highlightingchangedmessage.h" #include "highlightingchangedmessage.h"
#include "ipcserverinterface.h" #include "ipcserverinterface.h"
#include "messageenvelop.h"
#include "projectpartsdonotexistmessage.h" #include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h" #include "translationunitdoesnotexistmessage.h"
@@ -72,42 +73,42 @@ IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
void IpcClientProxy::alive() void IpcClientProxy::alive()
{ {
writeMessageBlock.write(QVariant::fromValue(AliveMessage())); writeMessageBlock.write(AliveMessage());
} }
void IpcClientProxy::echo(const EchoMessage &message) void IpcClientProxy::echo(const EchoMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message) void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message) void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message) void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcClientProxy::readMessages() void IpcClientProxy::readMessages()
{ {
for (const QVariant &message : readMessageBlock.readAll()) for (const MessageEnvelop &message : readMessageBlock.readAll())
server->dispatch(message); server->dispatch(message);
} }

View File

@@ -30,17 +30,15 @@
#include <QtGlobal> #include <QtGlobal>
QT_BEGIN_NAMESPACE
class QVariant;
QT_END_NAMESPACE
namespace ClangBackEnd { namespace ClangBackEnd {
class MessageEnvelop;
class CMBIPC_EXPORT IpcInterface class CMBIPC_EXPORT IpcInterface
{ {
public: public:
virtual ~IpcInterface(); virtual ~IpcInterface();
virtual void dispatch(const QVariant &message) = 0; virtual void dispatch(const MessageEnvelop &messageEnvelop) = 0;
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -30,6 +30,7 @@
#include "cmbregistertranslationunitsforeditormessage.h" #include "cmbregistertranslationunitsforeditormessage.h"
#include "cmbunregisterprojectsforeditormessage.h" #include "cmbunregisterprojectsforeditormessage.h"
#include "cmbunregistertranslationunitsforeditormessage.h" #include "cmbunregistertranslationunitsforeditormessage.h"
#include "messageenvelop.h"
#include "registerunsavedfilesforeditormessage.h" #include "registerunsavedfilesforeditormessage.h"
#include "requestdiagnosticsmessage.h" #include "requestdiagnosticsmessage.h"
#include "requesthighlightingmessage.h" #include "requesthighlightingmessage.h"
@@ -42,49 +43,48 @@
namespace ClangBackEnd { namespace ClangBackEnd {
void IpcServerInterface::dispatch(const QVariant &message) void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
{ {
static const int endMessageType = QMetaType::type("ClangBackEnd::EndMessage"); switch (messageEnvelop.messageType()) {
static const int registerTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterTranslationUnitForEditorMessage"); case MessageType::EndMessage:
static const int updateTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::UpdateTranslationUnitsForEditorMessage"); end();
static const int unregisterTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterTranslationUnitsForEditorMessage"); break;
static const int registerProjectPartsForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterProjectPartsForEditorMessage"); case MessageType::RegisterTranslationUnitForEditorMessage:
static const int unregisterProjectPartsForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterProjectPartsForEditorMessage"); registerTranslationUnitsForEditor(messageEnvelop.message<RegisterTranslationUnitForEditorMessage>());
static const int registerUnsavedFilesForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterUnsavedFilesForEditorMessage"); break;
static const int unregisterUnsavedFilesForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterUnsavedFilesForEditorMessage"); case MessageType::UpdateTranslationUnitsForEditorMessage:
static const int completeCodeMessageType = QMetaType::type("ClangBackEnd::CompleteCodeMessage"); updateTranslationUnitsForEditor(messageEnvelop.message<UpdateTranslationUnitsForEditorMessage>());
static const int requestDiagnosticsMessageType = QMetaType::type("ClangBackEnd::RequestDiagnosticsMessage"); break;
static const int requestHighlightingTypeMessage = QMetaType::type("ClangBackEnd::RequestHighlightingMessage"); case MessageType::UnregisterTranslationUnitsForEditorMessage:
static const int updateVisibleTranslationUnitsMessageType = QMetaType::type("ClangBackEnd::UpdateVisibleTranslationUnitsMessage"); unregisterTranslationUnitsForEditor(messageEnvelop.message<UnregisterTranslationUnitsForEditorMessage>());
break;
int type = message.userType(); case MessageType::RegisterProjectPartsForEditorMessage:
registerProjectPartsForEditor(messageEnvelop.message<RegisterProjectPartsForEditorMessage>());
if (type == endMessageType) break;
end(); case MessageType::UnregisterProjectPartsForEditorMessage:
else if (type == registerTranslationUnitsForEditorMessageType) unregisterProjectPartsForEditor(messageEnvelop.message<UnregisterProjectPartsForEditorMessage>());
registerTranslationUnitsForEditor(message.value<RegisterTranslationUnitForEditorMessage>()); break;
else if (type == updateTranslationUnitsForEditorMessageType) case MessageType::RegisterUnsavedFilesForEditorMessage:
updateTranslationUnitsForEditor(message.value<UpdateTranslationUnitsForEditorMessage>()); registerUnsavedFilesForEditor(messageEnvelop.message<RegisterUnsavedFilesForEditorMessage>());
else if (type == unregisterTranslationUnitsForEditorMessageType) break;
unregisterTranslationUnitsForEditor(message.value<UnregisterTranslationUnitsForEditorMessage>()); case MessageType::UnregisterUnsavedFilesForEditorMessage:
else if (type == registerProjectPartsForEditorMessageType) unregisterUnsavedFilesForEditor(messageEnvelop.message<UnregisterUnsavedFilesForEditorMessage>());
registerProjectPartsForEditor(message.value<RegisterProjectPartsForEditorMessage>()); break;
else if (type == unregisterProjectPartsForEditorMessageType) case MessageType::CompleteCodeMessage:
unregisterProjectPartsForEditor(message.value<UnregisterProjectPartsForEditorMessage>()); completeCode(messageEnvelop.message<CompleteCodeMessage>());
else if (type == registerUnsavedFilesForEditorMessageType) break;
registerUnsavedFilesForEditor(message.value<RegisterUnsavedFilesForEditorMessage>()); case MessageType::RequestDiagnosticsMessage:
else if (type == unregisterUnsavedFilesForEditorMessageType) requestDiagnostics(messageEnvelop.message<RequestDiagnosticsMessage>());
unregisterUnsavedFilesForEditor(message.value<UnregisterUnsavedFilesForEditorMessage>()); break;
else if (type == completeCodeMessageType) case MessageType::RequestHighlightingMessage:
completeCode(message.value<CompleteCodeMessage>()); requestHighlighting(messageEnvelop.message<RequestHighlightingMessage>());
else if (type == requestDiagnosticsMessageType) break;
requestDiagnostics(message.value<RequestDiagnosticsMessage>()); case MessageType::UpdateVisibleTranslationUnitsMessage:
else if (type == requestHighlightingTypeMessage) updateVisibleTranslationUnits(messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>());
requestHighlighting(message.value<RequestHighlightingMessage>()); break;
else if (type == updateVisibleTranslationUnitsMessageType) default:
updateVisibleTranslationUnits(message.value<UpdateVisibleTranslationUnitsMessage>()); qWarning() << "Unknown IpcServerMessage";
else }
qWarning() << "Unknown IpcServerMessage";
} }
void IpcServerInterface::addClient(IpcClientInterface *client) void IpcServerInterface::addClient(IpcClientInterface *client)

View File

@@ -37,7 +37,7 @@ class IpcClientInterface;
class CMBIPC_EXPORT IpcServerInterface : public IpcInterface class CMBIPC_EXPORT IpcServerInterface : public IpcInterface
{ {
public: public:
void dispatch(const QVariant &message) override; void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0; virtual void end() = 0;
virtual void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) = 0; virtual void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) = 0;

View File

@@ -33,6 +33,7 @@
#include <cmbunregisterprojectsforeditormessage.h> #include <cmbunregisterprojectsforeditormessage.h>
#include <cmbunregistertranslationunitsforeditormessage.h> #include <cmbunregistertranslationunitsforeditormessage.h>
#include <ipcclientinterface.h> #include <ipcclientinterface.h>
#include <messageenvelop.h>
#include <registerunsavedfilesforeditormessage.h> #include <registerunsavedfilesforeditormessage.h>
#include <requestdiagnosticsmessage.h> #include <requestdiagnosticsmessage.h>
#include <requesthighlightingmessage.h> #include <requesthighlightingmessage.h>
@@ -56,7 +57,7 @@ IpcServerProxy::IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
void IpcServerProxy::readMessages() void IpcServerProxy::readMessages()
{ {
for (const QVariant &message : readMessageBlock.readAll()) for (const auto &message : readMessageBlock.readAll())
client->dispatch(message); client->dispatch(message);
} }
@@ -68,62 +69,62 @@ void IpcServerProxy::resetCounter()
void IpcServerProxy::end() void IpcServerProxy::end()
{ {
writeMessageBlock.write(QVariant::fromValue(EndMessage())); writeMessageBlock.write(EndMessage());
} }
void IpcServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) void IpcServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message) void IpcServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) void IpcServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) void IpcServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) void IpcServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void ClangBackEnd::IpcServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message) void ClangBackEnd::IpcServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void ClangBackEnd::IpcServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message) void ClangBackEnd::IpcServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::completeCode(const CompleteCodeMessage &message) void IpcServerProxy::completeCode(const CompleteCodeMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message) void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message) void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
{ {
writeMessageBlock.write(QVariant::fromValue(message)); writeMessageBlock.write(message);
} }
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -0,0 +1,112 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef CLANGBACKEND_MESSAGEENVELOP_H
#define CLANGBACKEND_MESSAGEENVELOP_H
#include "clangbackendipc_global.h"
#include <QByteArray>
#include <QDataStream>
namespace ClangBackEnd {
class MessageEnvelop
{
public:
MessageEnvelop() = default;
template <class Message>
MessageEnvelop(const Message &message)
: messageType_(MessageTrait<Message>::enumeration)
{
QDataStream stream(&data, QIODevice::WriteOnly);
stream << message;
}
template <class Message>
Message message() const
{
Message message;
QDataStream stream(&data, QIODevice::ReadOnly);
stream >> message;
return message;
}
MessageType messageType() const
{
return messageType_;
}
bool isValid() const
{
return messageType_ != MessageType::InvalidMessage;
}
friend
QDataStream &operator >>(QDataStream& in, MessageType& messageType)
{
quint32 messageTypeAsInt;
in >> messageTypeAsInt;
messageType = MessageType(messageTypeAsInt);
return in;
}
friend
QDataStream &operator<<(QDataStream &out, const MessageEnvelop &messageEnvelop)
{
out << reinterpret_cast<const quint8&>(messageEnvelop.messageType_);
out << messageEnvelop.data;
return out;
}
friend
QDataStream &operator>>(QDataStream &in, MessageEnvelop &messageEnvelop)
{
in >> reinterpret_cast<quint8&>(messageEnvelop.messageType_);
in >> messageEnvelop.data;
return in;
}
friend
bool operator==(const MessageEnvelop &first, const MessageEnvelop &second)
{
return first.messageType_ == second.messageType_
&& first.data == second.data;
}
private:
mutable QByteArray data;
MessageType messageType_ = MessageType::InvalidMessage;
};
} // namespace ClangBackEnd
#endif // CLANGBACKEND_MESSAGEENVELOP_H

View File

@@ -73,11 +73,6 @@ bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &s
return first.projectPartId_ == second.projectPartId_; return first.projectPartId_ == second.projectPartId_;
} }
bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second)
{
return first.projectPartId_ < second.projectPartId_;
}
static Utf8String quotedArguments(const Utf8StringVector &arguments) static Utf8String quotedArguments(const Utf8StringVector &arguments)
{ {
const Utf8String quote = Utf8String::fromUtf8("\""); const Utf8String quote = Utf8String::fromUtf8("\"");

View File

@@ -30,8 +30,6 @@
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT ProjectPartContainer class CMBIPC_EXPORT ProjectPartContainer
@@ -39,7 +37,6 @@ class CMBIPC_EXPORT ProjectPartContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container);
friend CMBIPC_EXPORT bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second); friend CMBIPC_EXPORT bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second);
friend CMBIPC_EXPORT bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second);
public: public:
ProjectPartContainer() = default; ProjectPartContainer() = default;
ProjectPartContainer(const Utf8String &projectPartId, ProjectPartContainer(const Utf8String &projectPartId,
@@ -56,13 +53,10 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container);
CMBIPC_EXPORT bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second); CMBIPC_EXPORT bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second);
CMBIPC_EXPORT bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second);
QDebug operator<<(QDebug debug, const ProjectPartContainer &container); QDebug operator<<(QDebug debug, const ProjectPartContainer &container);
void PrintTo(const ProjectPartContainer &container, ::std::ostream* os); void PrintTo(const ProjectPartContainer &container, ::std::ostream* os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartContainer)
#endif // CLANGBACKEND_PROJECTCONTAINER_H #endif // CLANGBACKEND_PROJECTCONTAINER_H

View File

@@ -28,8 +28,6 @@
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
#include <container_common.h>
#include <ostream> #include <ostream>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -64,11 +62,6 @@ bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDo
return first.projectPartIds_ == second.projectPartIds_; return first.projectPartIds_ == second.projectPartIds_;
} }
bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second)
{
return compareContainer(first.projectPartIds_, second.projectPartIds_);
}
QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message) QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message)
{ {
debug.nospace() << "ProjectPartDoesNotExistMessage("; debug.nospace() << "ProjectPartDoesNotExistMessage(";

View File

@@ -30,8 +30,6 @@
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT ProjectPartsDoNotExistMessage class CMBIPC_EXPORT ProjectPartsDoNotExistMessage
@@ -39,7 +37,6 @@ class CMBIPC_EXPORT ProjectPartsDoNotExistMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
friend void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os); friend void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
public: public:
@@ -55,13 +52,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os); void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(ProjectPartsDoNotExistMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartsDoNotExistMessage)
#endif // CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H #endif // CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H

View File

@@ -25,6 +25,8 @@
#include "readmessageblock.h" #include "readmessageblock.h"
#include "messageenvelop.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
#include <QIODevice> #include <QIODevice>
@@ -54,11 +56,11 @@ void ReadMessageBlock::checkIfMessageIsLost(QDataStream &in)
messageCounter = currentMessageCounter; messageCounter = currentMessageCounter;
} }
QVariant ReadMessageBlock::read() MessageEnvelop ReadMessageBlock::read()
{ {
QDataStream in(ioDevice); QDataStream in(ioDevice);
QVariant message; MessageEnvelop message;
if (isTheWholeMessageReadable(in)) { if (isTheWholeMessageReadable(in)) {
checkIfMessageIsLost(in); checkIfMessageIsLost(in);
@@ -68,12 +70,12 @@ QVariant ReadMessageBlock::read()
return message; return message;
} }
QVector<QVariant> ReadMessageBlock::readAll() QVector<MessageEnvelop> ReadMessageBlock::readAll()
{ {
QVector<QVariant> messages; QVector<MessageEnvelop> messages;
while (true) { while (true) {
const QVariant message = read(); const MessageEnvelop message = read();
if (message.isValid()) if (message.isValid())
messages.append(message); messages.append(message);
else else

View File

@@ -29,20 +29,21 @@
#include <QtGlobal> #include <QtGlobal>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QVariant;
class QDataStream; class QDataStream;
class QIODevice; class QIODevice;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace ClangBackEnd { namespace ClangBackEnd {
class MessageEnvelop;
class ReadMessageBlock class ReadMessageBlock
{ {
public: public:
ReadMessageBlock(QIODevice *ioDevice = nullptr); ReadMessageBlock(QIODevice *ioDevice = nullptr);
QVariant read(); MessageEnvelop read();
QVector<QVariant> readAll(); QVector<MessageEnvelop> readAll();
void resetCounter(); void resetCounter();

View File

@@ -25,8 +25,6 @@
#include "registerunsavedfilesforeditormessage.h" #include "registerunsavedfilesforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -63,11 +61,6 @@ bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const Registe
return first.fileContainers_ == second.fileContainers_; return first.fileContainers_ == second.fileContainers_;
} }
bool operator<(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message) QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message)
{ {
debug.nospace() << "RegisterUnsavedFilesForEditorMessage("; debug.nospace() << "RegisterUnsavedFilesForEditorMessage(";

View File

@@ -28,7 +28,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT RegisterUnsavedFilesForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second);
friend void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
public: public:
RegisterUnsavedFilesForEditorMessage() = default; RegisterUnsavedFilesForEditorMessage() = default;
@@ -53,12 +51,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterUnsavedFilesForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterUnsavedFilesForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second); CMBIPC_EXPORT bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const RegisterUnsavedFilesForEditorMessage &first, const RegisterUnsavedFilesForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message);
void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os); void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RegisterUnsavedFilesForEditorMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RegisterUnsavedFilesForEditorMessage)
#endif // CLANGBACKEND_REGISTERUNSAVEDFILESFOREDITORMESSAGE_H #endif // CLANGBACKEND_REGISTERUNSAVEDFILESFOREDITORMESSAGE_H

View File

@@ -61,11 +61,6 @@ bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnostics
return first.file_ == second.file_; return first.file_ == second.file_;
} }
bool operator<(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second)
{
return first.file_ < second.file_;
}
QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message) QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message)
{ {
debug.nospace() << "RequestDiagnosticsMessage(" debug.nospace() << "RequestDiagnosticsMessage("

View File

@@ -35,7 +35,6 @@ class CMBIPC_EXPORT RequestDiagnosticsMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestDiagnosticsMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestDiagnosticsMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestDiagnosticsMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestDiagnosticsMessage &message);
friend CMBIPC_EXPORT bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second); friend CMBIPC_EXPORT bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second);
friend CMBIPC_EXPORT bool operator<(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message);
friend void PrintTo(const RequestDiagnosticsMessage &message, ::std::ostream* os); friend void PrintTo(const RequestDiagnosticsMessage &message, ::std::ostream* os);
@@ -53,13 +52,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestDiagnosticsMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestDiagnosticsMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestDiagnosticsMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestDiagnosticsMessage &message);
CMBIPC_EXPORT bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second); CMBIPC_EXPORT bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second);
CMBIPC_EXPORT bool operator<(const RequestDiagnosticsMessage &first, const RequestDiagnosticsMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message);
void PrintTo(const RequestDiagnosticsMessage &message, ::std::ostream* os); void PrintTo(const RequestDiagnosticsMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RequestDiagnosticsMessage);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RequestDiagnosticsMessage)
#endif // CLANGBACKEND_REQUESTDIAGNOSTICSMESSAGE_H #endif // CLANGBACKEND_REQUESTDIAGNOSTICSMESSAGE_H

View File

@@ -61,11 +61,6 @@ bool operator==(const RequestHighlightingMessage &first, const RequestHighlighti
return first.fileContainer_ == second.fileContainer_; return first.fileContainer_ == second.fileContainer_;
} }
bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second)
{
return first.fileContainer_ < second.fileContainer_;
}
QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message) QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message)
{ {
debug.nospace() << "RequestHighlightingMessage(" debug.nospace() << "RequestHighlightingMessage("

View File

@@ -35,7 +35,6 @@ class CMBIPC_EXPORT RequestHighlightingMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message);
friend CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second); friend CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
friend CMBIPC_EXPORT bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
friend void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os); friend void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os);
@@ -52,13 +51,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RequestHighlightingMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RequestHighlightingMessage &message);
CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second); CMBIPC_EXPORT bool operator==(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
CMBIPC_EXPORT bool operator<(const RequestHighlightingMessage &first, const RequestHighlightingMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os); void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(RequestHighlightingMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::RequestHighlightingMessage)
#endif // CLANGBACKEND_REQUESTHIGHLIGHTING_H #endif // CLANGBACKEND_REQUESTHIGHLIGHTING_H

View File

@@ -87,13 +87,6 @@ bool operator!=(const SourceLocationContainer &first, const SourceLocationContai
|| first.filePath_ != second.filePath_; || first.filePath_ != second.filePath_;
} }
bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second)
{
return first.filePath_ < second.filePath_
|| (first.filePath_ == second.filePath_ && first.line_ < second.line_)
|| (first.filePath_ == second.filePath_ && first.line_ == second.line_ && first.column_ < second.column_);
}
QDebug operator<<(QDebug debug, const SourceLocationContainer &container) QDebug operator<<(QDebug debug, const SourceLocationContainer &container)
{ {
debug.nospace() << "SourceLocationContainer(" debug.nospace() << "SourceLocationContainer("

View File

@@ -30,8 +30,6 @@
#include <utf8string.h> #include <utf8string.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT SourceLocationContainer class CMBIPC_EXPORT SourceLocationContainer
@@ -40,8 +38,6 @@ class CMBIPC_EXPORT SourceLocationContainer
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container);
friend CMBIPC_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second); friend CMBIPC_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second);
friend CMBIPC_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second); friend CMBIPC_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second);
friend CMBIPC_EXPORT bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second);
public: public:
SourceLocationContainer() = default; SourceLocationContainer() = default;
SourceLocationContainer(const Utf8String &filePath, SourceLocationContainer(const Utf8String &filePath,
@@ -62,13 +58,10 @@ CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationCont
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container);
CMBIPC_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second); CMBIPC_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second);
CMBIPC_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second); CMBIPC_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second);
CMBIPC_EXPORT bool operator<(const SourceLocationContainer &first, const SourceLocationContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const SourceLocationContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const SourceLocationContainer &container);
void PrintTo(const SourceLocationContainer &container, ::std::ostream* os); void PrintTo(const SourceLocationContainer &container, ::std::ostream* os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::SourceLocationContainer)
#endif // CLANGBACKEND_SOURCELOCATIONCONTAINER_H #endif // CLANGBACKEND_SOURCELOCATIONCONTAINER_H

View File

@@ -69,12 +69,6 @@ bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &s
return first.start_ == second.start_ && first.end_ == second.end_; return first.start_ == second.start_ && first.end_ == second.end_;
} }
bool operator<(const SourceRangeContainer &first, const SourceRangeContainer &second)
{
return first.start_ < second.start_
|| (first.start_ == second.start_ && first.end_ < second.end_);
}
QDebug operator<<(QDebug debug, const SourceRangeContainer &container) QDebug operator<<(QDebug debug, const SourceRangeContainer &container)
{ {
debug.nospace() << "SourceRangeContainer(" debug.nospace() << "SourceRangeContainer("

View File

@@ -35,8 +35,6 @@ class CMBIPC_EXPORT SourceRangeContainer
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container);
friend CMBIPC_EXPORT bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second); friend CMBIPC_EXPORT bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second);
friend CMBIPC_EXPORT bool operator<(const SourceRangeContainer &first, const SourceRangeContainer &second);
public: public:
SourceRangeContainer() = default; SourceRangeContainer() = default;
SourceRangeContainer(SourceLocationContainer start, SourceRangeContainer(SourceLocationContainer start,
@@ -54,13 +52,10 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container);
CMBIPC_EXPORT bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second); CMBIPC_EXPORT bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second);
CMBIPC_EXPORT bool operator<(const SourceRangeContainer &first, const SourceRangeContainer &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const SourceRangeContainer &container); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const SourceRangeContainer &container);
void PrintTo(const SourceRangeContainer &container, ::std::ostream* os); void PrintTo(const SourceRangeContainer &container, ::std::ostream* os);
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::SourceRangeContainer)
#endif // CLANGBACKEND_SOURCERANGECONTAINER_H #endif // CLANGBACKEND_SOURCERANGECONTAINER_H

View File

@@ -76,11 +76,6 @@ bool operator==(const TranslationUnitDoesNotExistMessage &first, const Translati
return first.fileContainer_ == second.fileContainer_; return first.fileContainer_ == second.fileContainer_;
} }
bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second)
{
return first.fileContainer_ < second.fileContainer_;
}
QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message) QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message)
{ {
debug.nospace() << "TranslationUnitDoesNotExistMessage("; debug.nospace() << "TranslationUnitDoesNotExistMessage(";

View File

@@ -28,8 +28,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT TranslationUnitDoesNotExistMessage class CMBIPC_EXPORT TranslationUnitDoesNotExistMessage
@@ -37,7 +35,6 @@ class CMBIPC_EXPORT TranslationUnitDoesNotExistMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message); friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
friend void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os); friend void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
public: public:
@@ -56,13 +53,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, 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 bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os); void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(TranslationUnitDoesNotExistMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::TranslationUnitDoesNotExistMessage)
#endif // CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H #endif // CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H

View File

@@ -25,8 +25,6 @@
#include "unregisterunsavedfilesforeditormessage.h" #include "unregisterunsavedfilesforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -63,11 +61,6 @@ bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const Unreg
return first.fileContainers_ == second.fileContainers_; return first.fileContainers_ == second.fileContainers_;
} }
bool operator<(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message) QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message)
{ {
debug.nospace() << "UnregisterUnsavedFilesForEditorMessage("; debug.nospace() << "UnregisterUnsavedFilesForEditorMessage(";

View File

@@ -28,7 +28,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT UnregisterUnsavedFilesForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second);
friend void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
public: public:
UnregisterUnsavedFilesForEditorMessage() = default; UnregisterUnsavedFilesForEditorMessage() = default;
@@ -53,12 +51,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UnregisterUnsavedFilesForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UnregisterUnsavedFilesForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second); CMBIPC_EXPORT bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const UnregisterUnsavedFilesForEditorMessage &first, const UnregisterUnsavedFilesForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message);
void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os); void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(UnregisterUnsavedFilesForEditorMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterUnsavedFilesForEditorMessage)
#endif // CLANGBACKEND_UNREGISTERTRANSLATIONUNITSFOREDITORMESSAGE_H #endif // CLANGBACKEND_UNREGISTERTRANSLATIONUNITSFOREDITORMESSAGE_H

View File

@@ -25,8 +25,6 @@
#include "updatetranslationunitsforeditormessage.h" #include "updatetranslationunitsforeditormessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -63,11 +61,6 @@ bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const Updat
return first.fileContainers_ == second.fileContainers_; return first.fileContainers_ == second.fileContainers_;
} }
bool operator<(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second)
{
return compareContainer(first.fileContainers_, second.fileContainers_);
}
QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message) QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message)
{ {
debug.nospace() << "UpdateTranslationUnitsForEditorMessage("; debug.nospace() << "UpdateTranslationUnitsForEditorMessage(";

View File

@@ -28,7 +28,6 @@
#include "filecontainer.h" #include "filecontainer.h"
#include <QMetaType>
#include <QVector> #include <QVector>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -38,7 +37,6 @@ class CMBIPC_EXPORT UpdateTranslationUnitsForEditorMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message);
friend CMBIPC_EXPORT bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second); friend CMBIPC_EXPORT bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second);
friend CMBIPC_EXPORT bool operator<(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second);
friend void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os); friend void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os);
public: public:
UpdateTranslationUnitsForEditorMessage() = default; UpdateTranslationUnitsForEditorMessage() = default;
@@ -53,12 +51,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateTranslationUnitsForEditorMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateTranslationUnitsForEditorMessage &message);
CMBIPC_EXPORT bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second); CMBIPC_EXPORT bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second);
CMBIPC_EXPORT bool operator<(const UpdateTranslationUnitsForEditorMessage &first, const UpdateTranslationUnitsForEditorMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message);
void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os); void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(UpdateTranslationUnitsForEditorMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UpdateTranslationUnitsForEditorMessage)
#endif // CLANGBACKEND_UPDATEFILEFOREDITOR_H #endif // CLANGBACKEND_UPDATEFILEFOREDITOR_H

View File

@@ -25,8 +25,6 @@
#include "updatevisibletranslationunitsmessage.h" #include "updatevisibletranslationunitsmessage.h"
#include "container_common.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
@@ -76,12 +74,6 @@ bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateV
&& first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_; && first.visibleEditorFilePaths_ == second.visibleEditorFilePaths_;
} }
bool operator<(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second)
{
return first.currentEditorFilePath_ < second.currentEditorFilePath_
&& compareContainer(first.visibleEditorFilePaths_, second.visibleEditorFilePaths_);
}
QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message) QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message)
{ {
debug.nospace() << "UpdateVisibleTranslationUnitsMessage("; debug.nospace() << "UpdateVisibleTranslationUnitsMessage(";

View File

@@ -30,8 +30,6 @@
#include <utf8stringvector.h> #include <utf8stringvector.h>
#include <QMetaType>
namespace ClangBackEnd { namespace ClangBackEnd {
class CMBIPC_EXPORT UpdateVisibleTranslationUnitsMessage class CMBIPC_EXPORT UpdateVisibleTranslationUnitsMessage
@@ -39,8 +37,6 @@ class CMBIPC_EXPORT UpdateVisibleTranslationUnitsMessage
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateVisibleTranslationUnitsMessage &message); friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateVisibleTranslationUnitsMessage &message);
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateVisibleTranslationUnitsMessage &message); friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateVisibleTranslationUnitsMessage &message);
friend CMBIPC_EXPORT bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second); friend CMBIPC_EXPORT bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second);
friend CMBIPC_EXPORT bool operator<(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second);
public: public:
UpdateVisibleTranslationUnitsMessage() = default; UpdateVisibleTranslationUnitsMessage() = default;
UpdateVisibleTranslationUnitsMessage(const Utf8String &currentEditorFilePath, UpdateVisibleTranslationUnitsMessage(const Utf8String &currentEditorFilePath,
@@ -57,12 +53,11 @@ private:
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateVisibleTranslationUnitsMessage &message); CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const UpdateVisibleTranslationUnitsMessage &message);
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateVisibleTranslationUnitsMessage &message); CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, UpdateVisibleTranslationUnitsMessage &message);
CMBIPC_EXPORT bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second); CMBIPC_EXPORT bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second);
CMBIPC_EXPORT bool operator<(const UpdateVisibleTranslationUnitsMessage &first, const UpdateVisibleTranslationUnitsMessage &second);
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message); CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message);
void PrintTo(const UpdateVisibleTranslationUnitsMessage &message, ::std::ostream* os); void PrintTo(const UpdateVisibleTranslationUnitsMessage &message, ::std::ostream* os);
DECLARE_MESSAGE(UpdateVisibleTranslationUnitsMessage)
} // namespace ClangBackEnd } // namespace ClangBackEnd
Q_DECLARE_METATYPE(ClangBackEnd::UpdateVisibleTranslationUnitsMessage)
#endif // CLANGBACKEND_UPDATEVISIBLETRANSLATIONUNITSMESSAGE_H #endif // CLANGBACKEND_UPDATEVISIBLETRANSLATIONUNITSMESSAGE_H

View File

@@ -25,6 +25,8 @@
#include "writemessageblock.h" #include "writemessageblock.h"
#include "messageenvelop.h"
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
#include <QIODevice> #include <QIODevice>
@@ -38,7 +40,7 @@ WriteMessageBlock::WriteMessageBlock(QIODevice *ioDevice)
{ {
} }
void WriteMessageBlock::write(const QVariant &message) void WriteMessageBlock::write(const MessageEnvelop &message)
{ {
QByteArray block; QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly); QDataStream out(&block, QIODevice::WriteOnly);

View File

@@ -36,12 +36,14 @@ QT_END_NAMESPACE
namespace ClangBackEnd { namespace ClangBackEnd {
class MessageEnvelop;
class WriteMessageBlock class WriteMessageBlock
{ {
public: public:
WriteMessageBlock(QIODevice *ioDevice = nullptr); WriteMessageBlock(QIODevice *ioDevice = nullptr);
void write(const QVariant &message); void write(const MessageEnvelop &message);
qint64 counter() const; qint64 counter() const;

View File

@@ -57,7 +57,6 @@
#include <clangbackendipc/cmbregisterprojectsforeditormessage.h> #include <clangbackendipc/cmbregisterprojectsforeditormessage.h>
#include <clangbackendipc/cmbunregistertranslationunitsforeditormessage.h> #include <clangbackendipc/cmbunregistertranslationunitsforeditormessage.h>
#include <clangbackendipc/cmbunregisterprojectsforeditormessage.h> #include <clangbackendipc/cmbunregisterprojectsforeditormessage.h>
#include <clangbackendipc/cmbmessages.h>
#include <clangbackendipc/registerunsavedfilesforeditormessage.h> #include <clangbackendipc/registerunsavedfilesforeditormessage.h>
#include <clangbackendipc/requestdiagnosticsmessage.h> #include <clangbackendipc/requestdiagnosticsmessage.h>
#include <clangbackendipc/requesthighlightingmessage.h> #include <clangbackendipc/requesthighlightingmessage.h>
@@ -323,15 +322,8 @@ IpcCommunicator::IpcCommunicator()
initializeBackend(); initializeBackend();
} }
static bool areMessagesRegistered = false;
void IpcCommunicator::initializeBackend() void IpcCommunicator::initializeBackend()
{ {
if (!areMessagesRegistered) {
areMessagesRegistered = true;
Messages::registerMessages();
}
const QString clangBackEndProcessPath = backendProcessPath(); const QString clangBackEndProcessPath = backendProcessPath();
qCDebug(log) << "Starting" << clangBackEndProcessPath; qCDebug(log) << "Starting" << clangBackEndProcessPath;
QTC_ASSERT(QFileInfo(clangBackEndProcessPath).exists(), return); QTC_ASSERT(QFileInfo(clangBackEndProcessPath).exists(), return);

View File

@@ -28,7 +28,6 @@
#include <QLoggingCategory> #include <QLoggingCategory>
#include <connectionserver.h> #include <connectionserver.h>
#include <cmbmessages.h>
#include <clangipcserver.h> #include <clangipcserver.h>
QString processArguments(QCoreApplication &application) QString processArguments(QCoreApplication &application)
@@ -60,8 +59,6 @@ int main(int argc, char *argv[])
const QString connection = processArguments(application); const QString connection = processArguments(application);
ClangBackEnd::Messages::registerMessages();
clang_toggleCrashRecovery(true); clang_toggleCrashRecovery(true);
clang_enableStackTraces(); clang_enableStackTraces();

View File

@@ -47,7 +47,7 @@
namespace ClangBackEnd { namespace ClangBackEnd {
void EchoIpcServer::dispatch(const QVariant &message) void EchoIpcServer::dispatch(const MessageEnvelop &message)
{ {
IpcServerInterface::dispatch(message); IpcServerInterface::dispatch(message);
} }
@@ -60,60 +60,60 @@ void EchoIpcServer::end()
void EchoIpcServer::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) void EchoIpcServer::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) void EchoIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message) void EchoIpcServer::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message) void EchoIpcServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message) void EchoIpcServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message) void EchoIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message) void EchoIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::completeCode(const CompleteCodeMessage &message) void EchoIpcServer::completeCode(const CompleteCodeMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message) void EchoIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::requestHighlighting(const RequestHighlightingMessage &message) void EchoIpcServer::requestHighlighting(const RequestHighlightingMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) void EchoIpcServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
{ {
echoMessage(QVariant::fromValue(message)); echoMessage(message);
} }
void EchoIpcServer::echoMessage(const QVariant &message) void EchoIpcServer::echoMessage(const MessageEnvelop &message)
{ {
client()->echo(EchoMessage(message)); client()->echo(EchoMessage(message));
} }

View File

@@ -33,7 +33,7 @@ namespace ClangBackEnd {
class EchoIpcServer : public IpcServerInterface class EchoIpcServer : public IpcServerInterface
{ {
public: public:
void dispatch(const QVariant &message) override; void dispatch(const MessageEnvelop &message) override;
void end() override; void end() override;
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override; void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;
void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) override; void updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message) override;
@@ -48,7 +48,7 @@ public:
void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) override; void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) override;
private: private:
void echoMessage(const QVariant &message); void echoMessage(const MessageEnvelop &message);
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -25,7 +25,6 @@
#include "echoipcserver.h" #include "echoipcserver.h"
#include <cmbmessages.h>
#include <connectionserver.h> #include <connectionserver.h>
#include <QCoreApplication> #include <QCoreApplication>
@@ -44,8 +43,6 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
ClangBackEnd::Messages::registerMessages();
ClangBackEnd::EchoIpcServer echoIpcServer; ClangBackEnd::EchoIpcServer echoIpcServer;
ClangBackEnd::ConnectionServer connectionServer(application.arguments()[1]); ClangBackEnd::ConnectionServer connectionServer(application.arguments()[1]);
connectionServer.start(); connectionServer.start();

View File

@@ -35,7 +35,6 @@
#include <cmbcompletecodemessage.h> #include <cmbcompletecodemessage.h>
#include <cmbechomessage.h> #include <cmbechomessage.h>
#include <cmbendmessage.h> #include <cmbendmessage.h>
#include <cmbmessages.h>
#include <cmbregisterprojectsforeditormessage.h> #include <cmbregisterprojectsforeditormessage.h>
#include <cmbregistertranslationunitsforeditormessage.h> #include <cmbregistertranslationunitsforeditormessage.h>
#include <cmbunregisterprojectsforeditormessage.h> #include <cmbunregisterprojectsforeditormessage.h>

View File

@@ -27,7 +27,6 @@
#include <cmbalivemessage.h> #include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h> #include <cmbcodecompletedmessage.h>
#include <cmbmessages.h>
#include <cmbcompletecodemessage.h> #include <cmbcompletecodemessage.h>
#include <cmbechomessage.h> #include <cmbechomessage.h>
#include <cmbendmessage.h> #include <cmbendmessage.h>
@@ -115,7 +114,7 @@ TEST_F(ClientServerOutsideProcess, SendRegisterTranslationUnitForEditorMessage)
ClangBackEnd::RegisterTranslationUnitForEditorMessage registerTranslationUnitForEditorMessage({fileContainer}, ClangBackEnd::RegisterTranslationUnitForEditorMessage registerTranslationUnitForEditorMessage({fileContainer},
filePath, filePath,
{filePath}); {filePath});
EchoMessage echoMessage(QVariant::fromValue(registerTranslationUnitForEditorMessage)); EchoMessage echoMessage(registerTranslationUnitForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage)) EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1); .Times(1);
@@ -128,7 +127,7 @@ TEST_F(ClientServerOutsideProcess, SendUnregisterTranslationUnitsForEditorMessag
{ {
FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("projectId")); FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("projectId"));
ClangBackEnd::UnregisterTranslationUnitsForEditorMessage unregisterTranslationUnitsForEditorMessage ({fileContainer}); ClangBackEnd::UnregisterTranslationUnitsForEditorMessage unregisterTranslationUnitsForEditorMessage ({fileContainer});
EchoMessage echoMessage(QVariant::fromValue(unregisterTranslationUnitsForEditorMessage)); EchoMessage echoMessage(unregisterTranslationUnitsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage)) EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1); .Times(1);
@@ -140,7 +139,7 @@ TEST_F(ClientServerOutsideProcess, SendUnregisterTranslationUnitsForEditorMessag
TEST_F(ClientServerOutsideProcess, SendCompleteCodeMessage) TEST_F(ClientServerOutsideProcess, SendCompleteCodeMessage)
{ {
CompleteCodeMessage codeCompleteMessage(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want")); CompleteCodeMessage codeCompleteMessage(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EchoMessage echoMessage(QVariant::fromValue(codeCompleteMessage)); EchoMessage echoMessage(codeCompleteMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage)) EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1); .Times(1);
@@ -153,7 +152,7 @@ TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForEditorMessage)
{ {
ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro")); ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro"));
ClangBackEnd::RegisterProjectPartsForEditorMessage registerProjectPartsForEditorMessage({projectContainer}); ClangBackEnd::RegisterProjectPartsForEditorMessage registerProjectPartsForEditorMessage({projectContainer});
EchoMessage echoMessage(QVariant::fromValue(registerProjectPartsForEditorMessage)); EchoMessage echoMessage(registerProjectPartsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage)) EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1); .Times(1);
@@ -165,7 +164,7 @@ TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForEditorMessage)
TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForEditorMessage) TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForEditorMessage)
{ {
ClangBackEnd::UnregisterProjectPartsForEditorMessage unregisterProjectPartsForEditorMessage({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")}); ClangBackEnd::UnregisterProjectPartsForEditorMessage unregisterProjectPartsForEditorMessage({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EchoMessage echoMessage(QVariant::fromValue(unregisterProjectPartsForEditorMessage)); EchoMessage echoMessage(unregisterProjectPartsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage)) EXPECT_CALL(mockIpcClient, echo(echoMessage))
.Times(1); .Times(1);

View File

@@ -25,8 +25,6 @@
#include <sqliteglobal.h> #include <sqliteglobal.h>
#include <cmbmessages.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QLoggingCategory> #include <QLoggingCategory>
@@ -35,7 +33,6 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
ClangBackEnd::Messages::registerMessages();
Sqlite::registerTypes(); Sqlite::registerTypes();
QCoreApplication application(argc, argv); QCoreApplication application(argc, argv);

View File

@@ -27,13 +27,13 @@
#include <cmbcodecompletedmessage.h> #include <cmbcodecompletedmessage.h>
#include <cmbcompletecodemessage.h> #include <cmbcompletecodemessage.h>
#include <cmbendmessage.h> #include <cmbendmessage.h>
#include <cmbmessages.h>
#include <cmbregistertranslationunitsforeditormessage.h> #include <cmbregistertranslationunitsforeditormessage.h>
#include <cmbunregistertranslationunitsforeditormessage.h> #include <cmbunregistertranslationunitsforeditormessage.h>
#include <diagnosticcontainer.h> #include <diagnosticcontainer.h>
#include <diagnosticschangedmessage.h> #include <diagnosticschangedmessage.h>
#include <highlightingchangedmessage.h> #include <highlightingchangedmessage.h>
#include <highlightingmarkcontainer.h> #include <highlightingmarkcontainer.h>
#include <messageenvelop.h>
#include <requestdiagnosticsmessage.h> #include <requestdiagnosticsmessage.h>
#include <requesthighlightingmessage.h> #include <requesthighlightingmessage.h>
#include <readmessageblock.h> #include <readmessageblock.h>
@@ -68,7 +68,7 @@ protected:
template<class Type> template<class Type>
void CompareMessage(const Type &message); void CompareMessage(const Type &message);
QVariant writeCodeCompletedMessage(); ClangBackEnd::MessageEnvelop writeCodeCompletedMessage();
void popLastCharacterFromBuffer(); void popLastCharacterFromBuffer();
void pushLastCharacterToBuffer(); void pushLastCharacterToBuffer();
void readPartialMessage(); void readPartialMessage();
@@ -106,31 +106,31 @@ void ReadAndWriteMessageBlock::TearDown()
TEST_F(ReadAndWriteMessageBlock, WriteMessageAndTestSize) TEST_F(ReadAndWriteMessageBlock, WriteMessageAndTestSize)
{ {
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
ASSERT_EQ(46, buffer.size()); ASSERT_EQ(17, buffer.size());
} }
TEST_F(ReadAndWriteMessageBlock, WriteSecondMessageAndTestSize) TEST_F(ReadAndWriteMessageBlock, WriteSecondMessageAndTestSize)
{ {
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
ASSERT_EQ(46, buffer.size()); ASSERT_EQ(17, buffer.size());
} }
TEST_F(ReadAndWriteMessageBlock, WriteTwoMessagesAndTestCount) TEST_F(ReadAndWriteMessageBlock, WriteTwoMessagesAndTestCount)
{ {
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
ASSERT_EQ(2, writeMessageBlock.counter()); ASSERT_EQ(2, writeMessageBlock.counter());
} }
TEST_F(ReadAndWriteMessageBlock, ReadThreeMessagesAndTestCount) TEST_F(ReadAndWriteMessageBlock, ReadThreeMessagesAndTestCount)
{ {
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
writeMessageBlock.write(QVariant::fromValue(ClangBackEnd::EndMessage())); writeMessageBlock.write(ClangBackEnd::EndMessage());
buffer.seek(0); buffer.seek(0);
ASSERT_EQ(3, readMessageBlock.readAll().count()); ASSERT_EQ(3, readMessageBlock.readAll().count());
@@ -232,7 +232,7 @@ TEST_F(ReadAndWriteMessageBlock, GetInvalidMessageForAPartialBuffer)
TEST_F(ReadAndWriteMessageBlock, ReadMessageAfterInterruption) TEST_F(ReadAndWriteMessageBlock, ReadMessageAfterInterruption)
{ {
const QVariant writeMessage = writeCodeCompletedMessage(); const auto writeMessage = writeCodeCompletedMessage();
popLastCharacterFromBuffer(); popLastCharacterFromBuffer();
buffer.seek(0); buffer.seek(0);
readPartialMessage(); readPartialMessage();
@@ -241,16 +241,16 @@ TEST_F(ReadAndWriteMessageBlock, ReadMessageAfterInterruption)
ASSERT_EQ(readMessageBlock.read(), writeMessage); ASSERT_EQ(readMessageBlock.read(), writeMessage);
} }
QVariant ReadAndWriteMessageBlock::writeCodeCompletedMessage() ClangBackEnd::MessageEnvelop ReadAndWriteMessageBlock::writeCodeCompletedMessage()
{ {
ClangBackEnd::CodeCompletedMessage message( ClangBackEnd::CodeCompletedMessage message(
ClangBackEnd::CodeCompletions({Utf8StringLiteral("newFunction()")}), ClangBackEnd::CodeCompletions({Utf8StringLiteral("newFunction()")}),
ClangBackEnd::CompletionCorrection::NoCorrection, ClangBackEnd::CompletionCorrection::NoCorrection,
1); 1);
const QVariant writeMessage = QVariant::fromValue(message);
writeMessageBlock.write(writeMessage);
return writeMessage; writeMessageBlock.write(message);
return message;
} }
void ReadAndWriteMessageBlock::popLastCharacterFromBuffer() void ReadAndWriteMessageBlock::popLastCharacterFromBuffer()
@@ -267,7 +267,7 @@ void ReadAndWriteMessageBlock::pushLastCharacterToBuffer()
void ReadAndWriteMessageBlock::readPartialMessage() void ReadAndWriteMessageBlock::readPartialMessage()
{ {
QVariant readMessage = readMessageBlock.read(); const ClangBackEnd::MessageEnvelop readMessage = readMessageBlock.read();
ASSERT_FALSE(readMessage.isValid()); ASSERT_FALSE(readMessage.isValid());
} }
@@ -275,11 +275,11 @@ void ReadAndWriteMessageBlock::readPartialMessage()
template<class Type> template<class Type>
void ReadAndWriteMessageBlock::CompareMessage(const Type &message) void ReadAndWriteMessageBlock::CompareMessage(const Type &message)
{ {
const QVariant writeMessage = QVariant::fromValue(message); const ClangBackEnd::MessageEnvelop writeMessage = message;
writeMessageBlock.write(writeMessage); writeMessageBlock.write(writeMessage);
buffer.seek(0); buffer.seek(0);
const QVariant readMessage = readMessageBlock.read(); const ClangBackEnd::MessageEnvelop readMessage = readMessageBlock.read();
ASSERT_EQ(writeMessage, readMessage); ASSERT_EQ(writeMessage, readMessage);
} }