forked from qt-creator/qt-creator
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:
@@ -14,7 +14,6 @@ SOURCES += $$PWD/ipcserverinterface.cpp \
|
||||
$$PWD/cmbendmessage.cpp \
|
||||
$$PWD/cmbalivemessage.cpp \
|
||||
$$PWD/ipcclientproxy.cpp \
|
||||
$$PWD/cmbmessages.cpp \
|
||||
$$PWD/writemessageblock.cpp \
|
||||
$$PWD/readmessageblock.cpp \
|
||||
$$PWD/ipcinterface.cpp \
|
||||
@@ -57,7 +56,6 @@ HEADERS += \
|
||||
$$PWD/cmbendmessage.h \
|
||||
$$PWD/cmbalivemessage.h \
|
||||
$$PWD/ipcclientproxy.h \
|
||||
$$PWD/cmbmessages.h \
|
||||
$$PWD/writemessageblock.h \
|
||||
$$PWD/readmessageblock.h \
|
||||
$$PWD/ipcinterface.h \
|
||||
@@ -77,7 +75,6 @@ HEADERS += \
|
||||
$$PWD/codecompletionchunk.h \
|
||||
$$PWD/projectpartcontainer.h \
|
||||
$$PWD/projectpartsdonotexistmessage.h \
|
||||
$$PWD/container_common.h \
|
||||
$$PWD/clangbackendipc_global.h \
|
||||
$$PWD/lineprefixer.h \
|
||||
$$PWD/clangbackendipcdebugutils.h \
|
||||
@@ -93,6 +90,7 @@ HEADERS += \
|
||||
$$PWD/updatetranslationunitsforeditormessage.h \
|
||||
$$PWD/updatevisibletranslationunitsmessage.h \
|
||||
$$PWD/highlightingchangedmessage.h \
|
||||
$$PWD/highlightingmarkcontainer.h
|
||||
$$PWD/highlightingmarkcontainer.h \
|
||||
$$PWD/messageenvelop.h
|
||||
|
||||
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
|
||||
|
||||
@@ -79,5 +79,49 @@ enum class CompletionCorrection
|
||||
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
|
||||
|
||||
@@ -45,11 +45,6 @@ bool operator==(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
|
||||
{
|
||||
return debug.nospace() << "AliveMessage()";
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &in, AliveMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const AliveMessage &first, const AliveMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const AliveMessage &first, const AliveMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message);
|
||||
|
||||
DECLARE_MESSAGE(AliveMessage)
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::AliveMessage)
|
||||
|
||||
#endif // CMBALIVEMESSAGE_H
|
||||
|
||||
@@ -86,11 +86,6 @@ bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &s
|
||||
&& 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
|
||||
static const char *completionCorrectionToText(CompletionCorrection correction)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "codecompletion.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &in, CodeCompletedMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
|
||||
friend void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
@@ -64,13 +62,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CodeCompletedMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CodeCompletedMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const CodeCompletedMessage &first, const CodeCompletedMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletedMessage &message);
|
||||
void PrintTo(const CodeCompletedMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(CodeCompletedMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletedMessage)
|
||||
|
||||
#endif // CLANGBACKEND_CODECOMPLETEDMESSAGE_H
|
||||
|
||||
@@ -99,15 +99,6 @@ bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &sec
|
||||
&& 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)
|
||||
{
|
||||
debug.nospace() << "CompleteCodeMessage(";
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8string.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &in, CompleteCodeMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
|
||||
friend void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
|
||||
|
||||
@@ -70,13 +67,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const CompleteCodeMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, CompleteCodeMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const CompleteCodeMessage &first, const CompleteCodeMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CompleteCodeMessage &message);
|
||||
void PrintTo(const CompleteCodeMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(CompleteCodeMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::CompleteCodeMessage)
|
||||
|
||||
#endif // CLANGBACKEND_COMPLETECODEMESSAGE_H
|
||||
|
||||
@@ -32,13 +32,12 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
EchoMessage::EchoMessage(const QVariant &message)
|
||||
EchoMessage::EchoMessage(const MessageEnvelop &message)
|
||||
: message_(message)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const QVariant &EchoMessage::message() const
|
||||
const MessageEnvelop &EchoMessage::message() const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
@@ -62,24 +61,14 @@ bool operator==(const EchoMessage &first, const EchoMessage &second)
|
||||
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() << ")";
|
||||
}
|
||||
|
||||
void PrintTo(const EchoMessage &message, ::std::ostream* os)
|
||||
{
|
||||
QString output;
|
||||
QDebug debug(&output);
|
||||
|
||||
debug << message;
|
||||
|
||||
*os << output.toUtf8().constData();
|
||||
*os << "EchoMessage()";
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVariant>
|
||||
#include "messageenvelop.h"
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
@@ -37,27 +36,24 @@ class CMBIPC_EXPORT EchoMessage
|
||||
{
|
||||
friend CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const EchoMessage &first, const EchoMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const EchoMessage &first, const EchoMessage &second);
|
||||
public:
|
||||
EchoMessage() = default;
|
||||
explicit EchoMessage(const QVariant &message);
|
||||
explicit EchoMessage(const MessageEnvelop &message);
|
||||
|
||||
const QVariant &message() const;
|
||||
const MessageEnvelop &message() const;
|
||||
|
||||
private:
|
||||
QVariant message_;
|
||||
MessageEnvelop message_;
|
||||
};
|
||||
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const EchoMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, EchoMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const EchoMessage &first, const EchoMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const EchoMessage &first, const EchoMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message);
|
||||
void PrintTo(const EchoMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(EchoMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::EchoMessage)
|
||||
|
||||
#endif // CLANGBACKEND_ECHOMESSAGE_H
|
||||
|
||||
@@ -47,11 +47,6 @@ bool operator==(const EndMessage &/*first*/, const EndMessage &/*second*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator<(const EndMessage &/*first*/, const EndMessage &/*second*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const EndMessage &/*message*/)
|
||||
{
|
||||
return debug.nospace() << "EndMessage()";
|
||||
@@ -61,5 +56,6 @@ void PrintTo(const EndMessage &/*message*/, ::std::ostream* os)
|
||||
{
|
||||
*os << "EndMessage()";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &in, EndMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const EndMessage &first, const EndMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const EndMessage &first, const EndMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message);
|
||||
void PrintTo(const EndMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(EndMessage)
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::EndMessage)
|
||||
|
||||
#endif // CMBENDMESSAGE_H
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "cmbregisterprojectsforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -64,11 +62,6 @@ bool operator==(const RegisterProjectPartsForEditorMessage &first, const Registe
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "RegisterProjectPartsForEditorMessage(";
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "projectpartcontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
RegisterProjectPartsForEditorMessage() = default;
|
||||
@@ -53,12 +51,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const RegisterProjectPartsForEditorMessage &message);
|
||||
void PrintTo(const RegisterProjectPartsForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(RegisterProjectPartsForEditorMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RegisterProjectPartsForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REGISTERPROJECTSFOREDITORMESSAGE_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "cmbregistertranslationunitsforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -82,13 +80,6 @@ bool operator==(const RegisterTranslationUnitForEditorMessage &first, const Regi
|
||||
&& 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)
|
||||
{
|
||||
debug.nospace() << "RegisterTranslationUnitForEditorMessage(";
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
RegisterTranslationUnitForEditorMessage() = default;
|
||||
@@ -59,12 +57,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const RegisterTranslationUnitForEditorMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, RegisterTranslationUnitForEditorMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const RegisterTranslationUnitForEditorMessage &first, const RegisterTranslationUnitForEditorMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RegisterTranslationUnitForEditorMessage &message);
|
||||
void PrintTo(const RegisterTranslationUnitForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(RegisterTranslationUnitForEditorMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RegisterTranslationUnitForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REGISTERFILEFORCODECOMPLITION_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "cmbunregisterprojectsforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -65,11 +63,6 @@ bool operator==(const UnregisterProjectPartsForEditorMessage &first, const Unreg
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "UnregisterProjectPartsForEditorMessage(";
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8stringvector.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &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 void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
public:
|
||||
@@ -55,12 +52,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const UnregisterProjectPartsForEditorMessage &message);
|
||||
void PrintTo(const UnregisterProjectPartsForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(UnregisterProjectPartsForEditorMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterProjectPartsForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_UNREGISTERPROJECTSFOREDITOR_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "cmbunregistertranslationunitsforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#ifdef CLANGBACKEND_TESTS
|
||||
#include <gtest/gtest-printers.h>
|
||||
#endif
|
||||
@@ -66,11 +64,6 @@ bool operator==(const UnregisterTranslationUnitsForEditorMessage &first, const U
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "UnregisterTranslationUnitsForEditorMessage(";
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
public:
|
||||
@@ -56,14 +54,13 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const UnregisterTranslationUnitsForEditorMessage &message);
|
||||
#ifdef CLANGBACKEND_TESTS
|
||||
void PrintTo(const UnregisterTranslationUnitsForEditorMessage &message, ::std::ostream* os);
|
||||
#endif
|
||||
|
||||
DECLARE_MESSAGE(UnregisterTranslationUnitsForEditorMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterTranslationUnitsForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_UNRegisterTranslationUnitForEditorMessage_H
|
||||
|
||||
@@ -157,11 +157,6 @@ bool operator==(const CodeCompletion &first, const CodeCompletion &second)
|
||||
&& first.completionKind_ == second.completionKind_;
|
||||
}
|
||||
|
||||
bool operator<(const CodeCompletion &first, const CodeCompletion &second)
|
||||
{
|
||||
return first.text_ < second.text_;
|
||||
}
|
||||
|
||||
static const char *completionKindToString(CodeCompletion::Kind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include <utf8string.h>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &in, CodeCompletion &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const CodeCompletion &first, const CodeCompletion &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const CodeCompletion &first, const CodeCompletion &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
|
||||
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 &in, CodeCompletion &message);
|
||||
CMBIPC_EXPORT bool operator==(const CodeCompletion &first, const CodeCompletion &second);
|
||||
CMBIPC_EXPORT bool operator<(const CodeCompletion &first, const CodeCompletion &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
|
||||
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);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::CodeCompletion)
|
||||
|
||||
#endif // CLANGBACKEND_CODECOMPLETION_H
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -138,12 +138,6 @@ bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &sec
|
||||
&& 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)
|
||||
{
|
||||
switch (severity) {
|
||||
|
||||
@@ -40,7 +40,6 @@ class CMBIPC_EXPORT DiagnosticContainer
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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);
|
||||
|
||||
public:
|
||||
DiagnosticContainer() = default;
|
||||
@@ -81,13 +80,10 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const DiagnosticContainer &container);
|
||||
void PrintTo(const DiagnosticContainer &container, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::DiagnosticContainer)
|
||||
|
||||
#endif // CLANGBACKEND_DIAGNOSTICCONTAINER_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "diagnosticschangedmessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -73,12 +71,6 @@ bool operator==(const DiagnosticsChangedMessage &first, const DiagnosticsChanged
|
||||
&& 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)
|
||||
{
|
||||
debug.nospace() << "DiagnosticsChangedMessage("
|
||||
|
||||
@@ -39,7 +39,6 @@ class CMBIPC_EXPORT DiagnosticsChangedMessage
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message);
|
||||
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 &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 QDebug operator<<(QDebug debug, const DiagnosticsChangedMessage &message);
|
||||
void PrintTo(const DiagnosticsChangedMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(DiagnosticsChangedMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::DiagnosticsChangedMessage)
|
||||
|
||||
#endif // CLANGBACKEND_DIAGNOSTICSCHANGEDMESSAGE_H
|
||||
|
||||
@@ -118,14 +118,6 @@ bool operator==(const FileContainer &first, const FileContainer &second)
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "FileContainer("
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <utf8string.h>
|
||||
#include <utf8stringvector.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &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);
|
||||
public:
|
||||
FileContainer() = default;
|
||||
FileContainer(const Utf8String &filePath,
|
||||
@@ -72,13 +69,10 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const FileContainer &container);
|
||||
void PrintTo(const FileContainer &container, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::FileContainer)
|
||||
|
||||
#endif // CLANGBACKEND_FILECONTAINER_H
|
||||
|
||||
@@ -70,11 +70,6 @@ bool operator==(const FixItContainer &first, const FixItContainer &second)
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "FixItContainer("
|
||||
|
||||
@@ -35,8 +35,6 @@ class CMBIPC_EXPORT FixItContainer
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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);
|
||||
|
||||
public:
|
||||
FixItContainer() = default;
|
||||
FixItContainer(const Utf8String &text,
|
||||
@@ -53,7 +51,6 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const FixItContainer &container);
|
||||
void PrintTo(const FixItContainer &container, ::std::ostream* os);
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "highlightingchangedmessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -83,13 +81,6 @@ bool operator==(const HighlightingChangedMessage &first, const HighlightingChang
|
||||
&& 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)
|
||||
{
|
||||
debug.nospace() << "HighlightingChangedMessage("
|
||||
|
||||
@@ -40,7 +40,6 @@ class CMBIPC_EXPORT HighlightingChangedMessage
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
|
||||
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 &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 QDebug operator<<(QDebug debug, const HighlightingChangedMessage &message);
|
||||
void PrintTo(const HighlightingChangedMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(HighlightingChangedMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingChangedMessage)
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGCHANGEDMESSAGE_H
|
||||
|
||||
@@ -96,21 +96,6 @@ bool operator==(const HighlightingMarkContainer &first, const HighlightingMarkCo
|
||||
&& 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
|
||||
static const char *highlightingTypeToCStringLiteral(HighlightingType type)
|
||||
{
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include "clangbackendipc_global.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &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);
|
||||
|
||||
public:
|
||||
HighlightingMarkContainer() = default;
|
||||
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 &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 QDebug operator<<(QDebug debug, const HighlightingMarkContainer &container);
|
||||
CMBIPC_EXPORT void PrintTo(HighlightingType highlightingType, ::std::ostream *os);
|
||||
@@ -69,6 +64,4 @@ void PrintTo(const HighlightingMarkContainer &container, ::std::ostream *os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::HighlightingMarkContainer)
|
||||
|
||||
#endif // CLANGBACKEND_HIGHLIGHTINGMARKCONTAINER_H
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "cmbcodecompletedmessage.h"
|
||||
#include "cmbechomessage.h"
|
||||
#include "messageenvelop.h"
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "translationunitdoesnotexistmessage.h"
|
||||
#include "diagnosticschangedmessage.h"
|
||||
@@ -37,35 +38,33 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
|
||||
void IpcClientInterface::dispatch(const QVariant &message)
|
||||
void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
{
|
||||
static const int aliveMessageType = QMetaType::type("ClangBackEnd::AliveMessage");
|
||||
static const int echoMessageType = QMetaType::type("ClangBackEnd::EchoMessage");
|
||||
static const int codeCompletedMessageType = QMetaType::type("ClangBackEnd::CodeCompletedMessage");
|
||||
static const int translationUnitDoesNotExistMessage = QMetaType::type("ClangBackEnd::TranslationUnitDoesNotExistMessage");
|
||||
static const int projectPartsDoNotExistMessage = QMetaType::type("ClangBackEnd::ProjectPartsDoNotExistMessage");
|
||||
static const int diagnosticsChangedMessage = QMetaType::type("ClangBackEnd::DiagnosticsChangedMessage");
|
||||
static const int highlightingChangedMessage = QMetaType::type("ClangBackEnd::HighlightingChangedMessage");
|
||||
|
||||
int type = message.userType();
|
||||
|
||||
if (type == aliveMessageType)
|
||||
alive();
|
||||
else if (type == echoMessageType)
|
||||
echo(message.value<EchoMessage>());
|
||||
else if (type == codeCompletedMessageType)
|
||||
codeCompleted(message.value<CodeCompletedMessage>());
|
||||
else if (type == translationUnitDoesNotExistMessage)
|
||||
translationUnitDoesNotExist(message.value<TranslationUnitDoesNotExistMessage>());
|
||||
else if (type == projectPartsDoNotExistMessage)
|
||||
projectPartsDoNotExist(message.value<ProjectPartsDoNotExistMessage>());
|
||||
else if (type == diagnosticsChangedMessage)
|
||||
diagnosticsChanged(message.value<DiagnosticsChangedMessage>());
|
||||
else if (type == highlightingChangedMessage)
|
||||
highlightingChanged(message.value<HighlightingChangedMessage>());
|
||||
else
|
||||
qWarning() << "Unknown IpcClientMessage";
|
||||
switch (messageEnvelop.messageType()) {
|
||||
case MessageType::AliveMessage:
|
||||
alive();
|
||||
break;
|
||||
case MessageType::EchoMessage:
|
||||
echo(messageEnvelop.message<EchoMessage>());
|
||||
break;
|
||||
case MessageType::CodeCompletedMessage:
|
||||
codeCompleted(messageEnvelop.message<CodeCompletedMessage>());
|
||||
break;
|
||||
case MessageType::TranslationUnitDoesNotExistMessage:
|
||||
translationUnitDoesNotExist(messageEnvelop.message<TranslationUnitDoesNotExistMessage>());
|
||||
break;
|
||||
case MessageType::ProjectPartsDoNotExistMessage:
|
||||
projectPartsDoNotExist(messageEnvelop.message<ProjectPartsDoNotExistMessage>());
|
||||
break;
|
||||
case MessageType::DiagnosticsChangedMessage:
|
||||
diagnosticsChanged(messageEnvelop.message<DiagnosticsChangedMessage>());
|
||||
break;
|
||||
case MessageType::HighlightingChangedMessage:
|
||||
highlightingChanged(messageEnvelop.message<HighlightingChangedMessage>());
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Unknown IpcClientMessage";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
@@ -52,7 +52,7 @@ class HighlightingChangedMessage;
|
||||
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
|
||||
{
|
||||
public:
|
||||
void dispatch(const QVariant &message) override;
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
|
||||
virtual void alive() = 0;
|
||||
virtual void echo(const EchoMessage &message) = 0;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "diagnosticschangedmessage.h"
|
||||
#include "highlightingchangedmessage.h"
|
||||
#include "ipcserverinterface.h"
|
||||
#include "messageenvelop.h"
|
||||
#include "projectpartsdonotexistmessage.h"
|
||||
#include "translationunitdoesnotexistmessage.h"
|
||||
|
||||
@@ -72,42 +73,42 @@ IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
|
||||
|
||||
void IpcClientProxy::alive()
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(AliveMessage()));
|
||||
writeMessageBlock.write(AliveMessage());
|
||||
}
|
||||
|
||||
void IpcClientProxy::echo(const EchoMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcClientProxy::readMessages()
|
||||
{
|
||||
for (const QVariant &message : readMessageBlock.readAll())
|
||||
for (const MessageEnvelop &message : readMessageBlock.readAll())
|
||||
server->dispatch(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,17 +30,15 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QVariant;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class MessageEnvelop;
|
||||
|
||||
class CMBIPC_EXPORT IpcInterface
|
||||
{
|
||||
public:
|
||||
virtual ~IpcInterface();
|
||||
virtual void dispatch(const QVariant &message) = 0;
|
||||
virtual void dispatch(const MessageEnvelop &messageEnvelop) = 0;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "cmbregistertranslationunitsforeditormessage.h"
|
||||
#include "cmbunregisterprojectsforeditormessage.h"
|
||||
#include "cmbunregistertranslationunitsforeditormessage.h"
|
||||
#include "messageenvelop.h"
|
||||
#include "registerunsavedfilesforeditormessage.h"
|
||||
#include "requestdiagnosticsmessage.h"
|
||||
#include "requesthighlightingmessage.h"
|
||||
@@ -42,49 +43,48 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
void IpcServerInterface::dispatch(const QVariant &message)
|
||||
void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
||||
{
|
||||
static const int endMessageType = QMetaType::type("ClangBackEnd::EndMessage");
|
||||
static const int registerTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterTranslationUnitForEditorMessage");
|
||||
static const int updateTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::UpdateTranslationUnitsForEditorMessage");
|
||||
static const int unregisterTranslationUnitsForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterTranslationUnitsForEditorMessage");
|
||||
static const int registerProjectPartsForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterProjectPartsForEditorMessage");
|
||||
static const int unregisterProjectPartsForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterProjectPartsForEditorMessage");
|
||||
static const int registerUnsavedFilesForEditorMessageType = QMetaType::type("ClangBackEnd::RegisterUnsavedFilesForEditorMessage");
|
||||
static const int unregisterUnsavedFilesForEditorMessageType = QMetaType::type("ClangBackEnd::UnregisterUnsavedFilesForEditorMessage");
|
||||
static const int completeCodeMessageType = QMetaType::type("ClangBackEnd::CompleteCodeMessage");
|
||||
static const int requestDiagnosticsMessageType = QMetaType::type("ClangBackEnd::RequestDiagnosticsMessage");
|
||||
static const int requestHighlightingTypeMessage = QMetaType::type("ClangBackEnd::RequestHighlightingMessage");
|
||||
static const int updateVisibleTranslationUnitsMessageType = QMetaType::type("ClangBackEnd::UpdateVisibleTranslationUnitsMessage");
|
||||
|
||||
int type = message.userType();
|
||||
|
||||
if (type == endMessageType)
|
||||
end();
|
||||
else if (type == registerTranslationUnitsForEditorMessageType)
|
||||
registerTranslationUnitsForEditor(message.value<RegisterTranslationUnitForEditorMessage>());
|
||||
else if (type == updateTranslationUnitsForEditorMessageType)
|
||||
updateTranslationUnitsForEditor(message.value<UpdateTranslationUnitsForEditorMessage>());
|
||||
else if (type == unregisterTranslationUnitsForEditorMessageType)
|
||||
unregisterTranslationUnitsForEditor(message.value<UnregisterTranslationUnitsForEditorMessage>());
|
||||
else if (type == registerProjectPartsForEditorMessageType)
|
||||
registerProjectPartsForEditor(message.value<RegisterProjectPartsForEditorMessage>());
|
||||
else if (type == unregisterProjectPartsForEditorMessageType)
|
||||
unregisterProjectPartsForEditor(message.value<UnregisterProjectPartsForEditorMessage>());
|
||||
else if (type == registerUnsavedFilesForEditorMessageType)
|
||||
registerUnsavedFilesForEditor(message.value<RegisterUnsavedFilesForEditorMessage>());
|
||||
else if (type == unregisterUnsavedFilesForEditorMessageType)
|
||||
unregisterUnsavedFilesForEditor(message.value<UnregisterUnsavedFilesForEditorMessage>());
|
||||
else if (type == completeCodeMessageType)
|
||||
completeCode(message.value<CompleteCodeMessage>());
|
||||
else if (type == requestDiagnosticsMessageType)
|
||||
requestDiagnostics(message.value<RequestDiagnosticsMessage>());
|
||||
else if (type == requestHighlightingTypeMessage)
|
||||
requestHighlighting(message.value<RequestHighlightingMessage>());
|
||||
else if (type == updateVisibleTranslationUnitsMessageType)
|
||||
updateVisibleTranslationUnits(message.value<UpdateVisibleTranslationUnitsMessage>());
|
||||
else
|
||||
qWarning() << "Unknown IpcServerMessage";
|
||||
switch (messageEnvelop.messageType()) {
|
||||
case MessageType::EndMessage:
|
||||
end();
|
||||
break;
|
||||
case MessageType::RegisterTranslationUnitForEditorMessage:
|
||||
registerTranslationUnitsForEditor(messageEnvelop.message<RegisterTranslationUnitForEditorMessage>());
|
||||
break;
|
||||
case MessageType::UpdateTranslationUnitsForEditorMessage:
|
||||
updateTranslationUnitsForEditor(messageEnvelop.message<UpdateTranslationUnitsForEditorMessage>());
|
||||
break;
|
||||
case MessageType::UnregisterTranslationUnitsForEditorMessage:
|
||||
unregisterTranslationUnitsForEditor(messageEnvelop.message<UnregisterTranslationUnitsForEditorMessage>());
|
||||
break;
|
||||
case MessageType::RegisterProjectPartsForEditorMessage:
|
||||
registerProjectPartsForEditor(messageEnvelop.message<RegisterProjectPartsForEditorMessage>());
|
||||
break;
|
||||
case MessageType::UnregisterProjectPartsForEditorMessage:
|
||||
unregisterProjectPartsForEditor(messageEnvelop.message<UnregisterProjectPartsForEditorMessage>());
|
||||
break;
|
||||
case MessageType::RegisterUnsavedFilesForEditorMessage:
|
||||
registerUnsavedFilesForEditor(messageEnvelop.message<RegisterUnsavedFilesForEditorMessage>());
|
||||
break;
|
||||
case MessageType::UnregisterUnsavedFilesForEditorMessage:
|
||||
unregisterUnsavedFilesForEditor(messageEnvelop.message<UnregisterUnsavedFilesForEditorMessage>());
|
||||
break;
|
||||
case MessageType::CompleteCodeMessage:
|
||||
completeCode(messageEnvelop.message<CompleteCodeMessage>());
|
||||
break;
|
||||
case MessageType::RequestDiagnosticsMessage:
|
||||
requestDiagnostics(messageEnvelop.message<RequestDiagnosticsMessage>());
|
||||
break;
|
||||
case MessageType::RequestHighlightingMessage:
|
||||
requestHighlighting(messageEnvelop.message<RequestHighlightingMessage>());
|
||||
break;
|
||||
case MessageType::UpdateVisibleTranslationUnitsMessage:
|
||||
updateVisibleTranslationUnits(messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>());
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Unknown IpcServerMessage";
|
||||
}
|
||||
}
|
||||
|
||||
void IpcServerInterface::addClient(IpcClientInterface *client)
|
||||
|
||||
@@ -37,7 +37,7 @@ class IpcClientInterface;
|
||||
class CMBIPC_EXPORT IpcServerInterface : public IpcInterface
|
||||
{
|
||||
public:
|
||||
void dispatch(const QVariant &message) override;
|
||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
||||
|
||||
virtual void end() = 0;
|
||||
virtual void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) = 0;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <cmbunregisterprojectsforeditormessage.h>
|
||||
#include <cmbunregistertranslationunitsforeditormessage.h>
|
||||
#include <ipcclientinterface.h>
|
||||
#include <messageenvelop.h>
|
||||
#include <registerunsavedfilesforeditormessage.h>
|
||||
#include <requestdiagnosticsmessage.h>
|
||||
#include <requesthighlightingmessage.h>
|
||||
@@ -56,7 +57,7 @@ IpcServerProxy::IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
|
||||
|
||||
void IpcServerProxy::readMessages()
|
||||
{
|
||||
for (const QVariant &message : readMessageBlock.readAll())
|
||||
for (const auto &message : readMessageBlock.readAll())
|
||||
client->dispatch(message);
|
||||
}
|
||||
|
||||
@@ -68,62 +69,62 @@ void IpcServerProxy::resetCounter()
|
||||
|
||||
void IpcServerProxy::end()
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(EndMessage()));
|
||||
writeMessageBlock.write(EndMessage());
|
||||
}
|
||||
|
||||
void IpcServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(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)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::completeCode(const CompleteCodeMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
|
||||
{
|
||||
writeMessageBlock.write(QVariant::fromValue(message));
|
||||
writeMessageBlock.write(message);
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
112
src/libs/clangbackendipc/messageenvelop.h
Normal file
112
src/libs/clangbackendipc/messageenvelop.h
Normal 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
|
||||
@@ -73,11 +73,6 @@ bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &s
|
||||
return first.projectPartId_ == second.projectPartId_;
|
||||
}
|
||||
|
||||
bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second)
|
||||
{
|
||||
return first.projectPartId_ < second.projectPartId_;
|
||||
}
|
||||
|
||||
static Utf8String quotedArguments(const Utf8StringVector &arguments)
|
||||
{
|
||||
const Utf8String quote = Utf8String::fromUtf8("\"");
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8stringvector.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &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);
|
||||
public:
|
||||
ProjectPartContainer() = default;
|
||||
ProjectPartContainer(const Utf8String &projectPartId,
|
||||
@@ -56,13 +53,10 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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);
|
||||
|
||||
QDebug operator<<(QDebug debug, const ProjectPartContainer &container);
|
||||
void PrintTo(const ProjectPartContainer &container, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartContainer)
|
||||
|
||||
#endif // CLANGBACKEND_PROJECTCONTAINER_H
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
#include <container_common.h>
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
@@ -64,11 +62,6 @@ bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDo
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "ProjectPartDoesNotExistMessage(";
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8stringvector.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &in, ProjectPartsDoNotExistMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
|
||||
friend void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
@@ -55,13 +52,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message);
|
||||
void PrintTo(const ProjectPartsDoNotExistMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(ProjectPartsDoNotExistMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::ProjectPartsDoNotExistMessage)
|
||||
|
||||
#endif // CLANGBACKEND_PROJECTPARTSDONOTEXISTMESSAGE_H
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "readmessageblock.h"
|
||||
|
||||
#include "messageenvelop.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
@@ -54,11 +56,11 @@ void ReadMessageBlock::checkIfMessageIsLost(QDataStream &in)
|
||||
messageCounter = currentMessageCounter;
|
||||
}
|
||||
|
||||
QVariant ReadMessageBlock::read()
|
||||
MessageEnvelop ReadMessageBlock::read()
|
||||
{
|
||||
QDataStream in(ioDevice);
|
||||
|
||||
QVariant message;
|
||||
MessageEnvelop message;
|
||||
|
||||
if (isTheWholeMessageReadable(in)) {
|
||||
checkIfMessageIsLost(in);
|
||||
@@ -68,12 +70,12 @@ QVariant ReadMessageBlock::read()
|
||||
return message;
|
||||
}
|
||||
|
||||
QVector<QVariant> ReadMessageBlock::readAll()
|
||||
QVector<MessageEnvelop> ReadMessageBlock::readAll()
|
||||
{
|
||||
QVector<QVariant> messages;
|
||||
QVector<MessageEnvelop> messages;
|
||||
|
||||
while (true) {
|
||||
const QVariant message = read();
|
||||
const MessageEnvelop message = read();
|
||||
if (message.isValid())
|
||||
messages.append(message);
|
||||
else
|
||||
|
||||
@@ -29,20 +29,21 @@
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QVariant;
|
||||
class QDataStream;
|
||||
class QIODevice;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class MessageEnvelop;
|
||||
|
||||
class ReadMessageBlock
|
||||
{
|
||||
public:
|
||||
ReadMessageBlock(QIODevice *ioDevice = nullptr);
|
||||
|
||||
QVariant read();
|
||||
QVector<QVariant> readAll();
|
||||
MessageEnvelop read();
|
||||
QVector<MessageEnvelop> readAll();
|
||||
|
||||
void resetCounter();
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "registerunsavedfilesforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -63,11 +61,6 @@ bool operator==(const RegisterUnsavedFilesForEditorMessage &first, const Registe
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "RegisterUnsavedFilesForEditorMessage(";
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
RegisterUnsavedFilesForEditorMessage() = default;
|
||||
@@ -53,12 +51,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const RegisterUnsavedFilesForEditorMessage &message);
|
||||
void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(RegisterUnsavedFilesForEditorMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RegisterUnsavedFilesForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REGISTERUNSAVEDFILESFOREDITORMESSAGE_H
|
||||
|
||||
@@ -61,11 +61,6 @@ bool operator==(const RequestDiagnosticsMessage &first, const RequestDiagnostics
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "RequestDiagnosticsMessage("
|
||||
|
||||
@@ -35,7 +35,6 @@ class CMBIPC_EXPORT RequestDiagnosticsMessage
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message);
|
||||
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 &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 QDebug operator<<(QDebug debug, const RequestDiagnosticsMessage &message);
|
||||
void PrintTo(const RequestDiagnosticsMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(RequestDiagnosticsMessage);
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RequestDiagnosticsMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REQUESTDIAGNOSTICSMESSAGE_H
|
||||
|
||||
@@ -61,11 +61,6 @@ bool operator==(const RequestHighlightingMessage &first, const RequestHighlighti
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "RequestHighlightingMessage("
|
||||
|
||||
@@ -35,7 +35,6 @@ class CMBIPC_EXPORT RequestHighlightingMessage
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
|
||||
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 &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 QDebug operator<<(QDebug debug, const RequestHighlightingMessage &message);
|
||||
void PrintTo(const RequestHighlightingMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(RequestHighlightingMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::RequestHighlightingMessage)
|
||||
|
||||
#endif // CLANGBACKEND_REQUESTHIGHLIGHTING_H
|
||||
|
||||
@@ -87,13 +87,6 @@ bool operator!=(const SourceLocationContainer &first, const SourceLocationContai
|
||||
|| 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)
|
||||
{
|
||||
debug.nospace() << "SourceLocationContainer("
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8string.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class CMBIPC_EXPORT SourceLocationContainer
|
||||
@@ -40,8 +38,6 @@ class CMBIPC_EXPORT SourceLocationContainer
|
||||
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);
|
||||
|
||||
public:
|
||||
SourceLocationContainer() = default;
|
||||
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 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);
|
||||
void PrintTo(const SourceLocationContainer &container, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::SourceLocationContainer)
|
||||
|
||||
#endif // CLANGBACKEND_SOURCELOCATIONCONTAINER_H
|
||||
|
||||
@@ -69,12 +69,6 @@ bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &s
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "SourceRangeContainer("
|
||||
|
||||
@@ -35,8 +35,6 @@ class CMBIPC_EXPORT SourceRangeContainer
|
||||
friend CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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);
|
||||
|
||||
public:
|
||||
SourceRangeContainer() = default;
|
||||
SourceRangeContainer(SourceLocationContainer start,
|
||||
@@ -54,13 +52,10 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const SourceRangeContainer &container);
|
||||
void PrintTo(const SourceRangeContainer &container, ::std::ostream* os);
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::SourceRangeContainer)
|
||||
|
||||
#endif // CLANGBACKEND_SOURCERANGECONTAINER_H
|
||||
|
||||
@@ -76,11 +76,6 @@ bool operator==(const TranslationUnitDoesNotExistMessage &first, const Translati
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "TranslationUnitDoesNotExistMessage(";
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &in, TranslationUnitDoesNotExistMessage &message);
|
||||
friend CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
|
||||
friend CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
|
||||
friend CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
|
||||
friend void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
@@ -56,13 +53,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message);
|
||||
CMBIPC_EXPORT QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistMessage &message);
|
||||
CMBIPC_EXPORT bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
|
||||
CMBIPC_EXPORT bool operator<(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second);
|
||||
|
||||
CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message);
|
||||
void PrintTo(const TranslationUnitDoesNotExistMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(TranslationUnitDoesNotExistMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::TranslationUnitDoesNotExistMessage)
|
||||
|
||||
#endif // CLANGBACKEND_TRANSLATIONUNITDOESNOTEXISTSMESSAGE_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "unregisterunsavedfilesforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -63,11 +61,6 @@ bool operator==(const UnregisterUnsavedFilesForEditorMessage &first, const Unreg
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "UnregisterUnsavedFilesForEditorMessage(";
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
UnregisterUnsavedFilesForEditorMessage() = default;
|
||||
@@ -53,12 +51,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const UnregisterUnsavedFilesForEditorMessage &message);
|
||||
void PrintTo(const UnregisterUnsavedFilesForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(UnregisterUnsavedFilesForEditorMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::UnregisterUnsavedFilesForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_UNREGISTERTRANSLATIONUNITSFOREDITORMESSAGE_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "updatetranslationunitsforeditormessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -63,11 +61,6 @@ bool operator==(const UpdateTranslationUnitsForEditorMessage &first, const Updat
|
||||
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)
|
||||
{
|
||||
debug.nospace() << "UpdateTranslationUnitsForEditorMessage(";
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "filecontainer.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QVector>
|
||||
|
||||
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 &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 void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os);
|
||||
public:
|
||||
UpdateTranslationUnitsForEditorMessage() = default;
|
||||
@@ -53,12 +51,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const UpdateTranslationUnitsForEditorMessage &message);
|
||||
void PrintTo(const UpdateTranslationUnitsForEditorMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(UpdateTranslationUnitsForEditorMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::UpdateTranslationUnitsForEditorMessage)
|
||||
|
||||
#endif // CLANGBACKEND_UPDATEFILEFOREDITOR_H
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "updatevisibletranslationunitsmessage.h"
|
||||
|
||||
#include "container_common.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -76,12 +74,6 @@ bool operator==(const UpdateVisibleTranslationUnitsMessage &first, const UpdateV
|
||||
&& 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)
|
||||
{
|
||||
debug.nospace() << "UpdateVisibleTranslationUnitsMessage(";
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <utf8stringvector.h>
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
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 &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);
|
||||
|
||||
public:
|
||||
UpdateVisibleTranslationUnitsMessage() = default;
|
||||
UpdateVisibleTranslationUnitsMessage(const Utf8String ¤tEditorFilePath,
|
||||
@@ -57,12 +53,11 @@ private:
|
||||
CMBIPC_EXPORT QDataStream &operator<<(QDataStream &out, const 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 QDebug operator<<(QDebug debug, const UpdateVisibleTranslationUnitsMessage &message);
|
||||
void PrintTo(const UpdateVisibleTranslationUnitsMessage &message, ::std::ostream* os);
|
||||
|
||||
DECLARE_MESSAGE(UpdateVisibleTranslationUnitsMessage)
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Q_DECLARE_METATYPE(ClangBackEnd::UpdateVisibleTranslationUnitsMessage)
|
||||
|
||||
#endif // CLANGBACKEND_UPDATEVISIBLETRANSLATIONUNITSMESSAGE_H
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "writemessageblock.h"
|
||||
|
||||
#include "messageenvelop.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
@@ -38,7 +40,7 @@ WriteMessageBlock::WriteMessageBlock(QIODevice *ioDevice)
|
||||
{
|
||||
}
|
||||
|
||||
void WriteMessageBlock::write(const QVariant &message)
|
||||
void WriteMessageBlock::write(const MessageEnvelop &message)
|
||||
{
|
||||
QByteArray block;
|
||||
QDataStream out(&block, QIODevice::WriteOnly);
|
||||
|
||||
@@ -36,12 +36,14 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class MessageEnvelop;
|
||||
|
||||
class WriteMessageBlock
|
||||
{
|
||||
public:
|
||||
WriteMessageBlock(QIODevice *ioDevice = nullptr);
|
||||
|
||||
void write(const QVariant &message);
|
||||
void write(const MessageEnvelop &message);
|
||||
|
||||
qint64 counter() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user