aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2021-12-06 05:11:04 +0100
committerhjk <hjk@qt.io>2021-12-06 17:10:49 +0000
commit104ea4accc8bf7d2e317c10638a299c3af267ede (patch)
tree8ab53d49a45cb72372a5294d272a7e43c815d661 /src/plugins
parent8cb5c3cfdd07f98449d3df0a676c5026c33f6b7a (diff)
Make some qHash and comparison operators overloads hidden friends
Restricts lookup scope more to necessary bits. Change-Id: Ia42c95aaa70534843b7f6a90bfc56d2a1202c612 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/clangtools/clangfileinfo.h9
-rw-r--r--src/plugins/clangtools/clangtoolsdiagnostic.h7
-rw-r--r--src/plugins/clangtools/clangtoolsprojectsettings.h14
-rw-r--r--src/plugins/classview/classviewsymbolinformation.h10
-rw-r--r--src/plugins/clearcase/clearcasesettings.h10
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeconfigitem.h3
-rw-r--r--src/plugins/cmakeprojectmanager/fileapidataextractor.h3
-rw-r--r--src/plugins/coreplugin/find/findplugin.cpp20
-rw-r--r--src/plugins/coreplugin/find/searchresultcolor.h14
-rw-r--r--src/plugins/coreplugin/icontext.h3
-rw-r--r--src/plugins/cppeditor/cppcodemodelsettings.h27
-rw-r--r--src/plugins/cppeditor/cppprojectfile.h10
-rw-r--r--src/plugins/cppeditor/cppuseselections_test.cpp10
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp14
-rw-r--r--src/plugins/debugger/analyzer/diagnosticlocation.h8
-rw-r--r--src/plugins/debugger/cdb/cdbparsehelpers.h4
-rw-r--r--src/plugins/git/gerrit/gerritparameters.h10
-rw-r--r--src/plugins/languageclient/semantichighlightsupport.h12
-rw-r--r--src/plugins/marketplace/productlistmodel.h24
-rw-r--r--src/plugins/nim/suggest/clientrequests.cpp9
-rw-r--r--src/plugins/nim/suggest/clientrequests.h4
-rw-r--r--src/plugins/projectexplorer/abi.h19
-rw-r--r--src/plugins/projectexplorer/buildtargetinfo.h40
-rw-r--r--src/plugins/projectexplorer/deployablefile.h24
-rw-r--r--src/plugins/projectexplorer/headerpath.h10
-rw-r--r--src/plugins/projectexplorer/projectexplorersettings.h38
-rw-r--r--src/plugins/projectexplorer/projectmacro.h28
-rw-r--r--src/plugins/projectexplorer/task.h9
-rw-r--r--src/plugins/qmakeprojectmanager/qmakestep.h40
-rw-r--r--src/plugins/qmljseditor/qmljseditingsettingspage.h56
-rw-r--r--src/plugins/qmlprofiler/qmleventlocation.h43
-rw-r--r--src/plugins/qmlprofiler/qmleventtype.h3
-rw-r--r--src/plugins/qmlprofiler/qmlnote.h11
-rw-r--r--src/plugins/qtsupport/codegensettings.h6
-rw-r--r--src/plugins/remotelinux/deploymenttimeinfo.cpp7
-rw-r--r--src/plugins/texteditor/behaviorsettings.h6
-rw-r--r--src/plugins/texteditor/colorscheme.h18
-rw-r--r--src/plugins/texteditor/commentssettings.h12
-rw-r--r--src/plugins/texteditor/completionsettings.h6
-rw-r--r--src/plugins/texteditor/displaysettings.h6
-rw-r--r--src/plugins/texteditor/extraencodingsettings.h12
-rw-r--r--src/plugins/texteditor/fontsettings.h6
-rw-r--r--src/plugins/texteditor/marginsettings.h10
-rw-r--r--src/plugins/texteditor/snippets/snippetssettings.h11
-rw-r--r--src/plugins/texteditor/storagesettings.h7
-rw-r--r--src/plugins/texteditor/tabsettings.h6
-rw-r--r--src/plugins/texteditor/textdocumentlayout.h10
-rw-r--r--src/plugins/texteditor/typingsettings.h6
-rw-r--r--src/plugins/vcsbase/commonvcssettings.h5
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h12
50 files changed, 332 insertions, 360 deletions
diff --git a/src/plugins/clangtools/clangfileinfo.h b/src/plugins/clangtools/clangfileinfo.h
index 5052af23ad..7f2e94a82f 100644
--- a/src/plugins/clangtools/clangfileinfo.h
+++ b/src/plugins/clangtools/clangfileinfo.h
@@ -46,16 +46,17 @@ public:
, kind(kind)
, projectPart(projectPart)
{}
+
+ friend bool operator==(const FileInfo &lhs, const FileInfo &rhs) {
+ return lhs.file == rhs.file;
+ }
+
Utils::FilePath file;
CppEditor::ProjectFile::Kind kind;
CppEditor::ProjectPart::ConstPtr projectPart;
};
using FileInfos = std::vector<FileInfo>;
-inline bool operator==(const FileInfo &lhs, const FileInfo &rhs) {
- return lhs.file == rhs.file;
-}
-
class FileInfoSelection {
public:
QSet<Utils::FilePath> dirs;
diff --git a/src/plugins/clangtools/clangtoolsdiagnostic.h b/src/plugins/clangtools/clangtoolsdiagnostic.h
index 10534ff0b2..58961d0ca9 100644
--- a/src/plugins/clangtools/clangtoolsdiagnostic.h
+++ b/src/plugins/clangtools/clangtoolsdiagnostic.h
@@ -57,6 +57,9 @@ public:
bool isValid() const;
QIcon icon() const;
+ friend bool operator==(const Diagnostic &lhs, const Diagnostic &rhs);
+ friend Utils::QHashValueType qHash(const Diagnostic &diagnostic);
+
QString name;
QString description;
QString category;
@@ -66,12 +69,8 @@ public:
bool hasFixits = false;
};
-bool operator==(const Diagnostic &lhs, const Diagnostic &rhs);
-
using Diagnostics = QList<Diagnostic>;
-Utils::QHashValueType qHash(const Diagnostic &diagnostic);
-
} // namespace Internal
} // namespace ClangTools
diff --git a/src/plugins/clangtools/clangtoolsprojectsettings.h b/src/plugins/clangtools/clangtoolsprojectsettings.h
index 686aafedfb..be68e5d80b 100644
--- a/src/plugins/clangtools/clangtoolsprojectsettings.h
+++ b/src/plugins/clangtools/clangtoolsprojectsettings.h
@@ -47,18 +47,18 @@ public:
SuppressedDiagnostic(const Diagnostic &diag);
+ friend bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
+ {
+ return d1.filePath == d2.filePath
+ && d1.description == d2.description
+ && d1.uniquifier == d2.uniquifier;
+ }
+
Utils::FilePath filePath; // Relative for files in project, absolute otherwise.
QString description;
int uniquifier;
};
-inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
-{
- return d1.filePath == d2.filePath
- && d1.description == d2.description
- && d1.uniquifier == d2.uniquifier;
-}
-
using SuppressedDiagnosticsList = QList<SuppressedDiagnostic>;
class ClangToolsProjectSettings : public QObject
diff --git a/src/plugins/classview/classviewsymbolinformation.h b/src/plugins/classview/classviewsymbolinformation.h
index c6189c0b39..3e719bf89b 100644
--- a/src/plugins/classview/classviewsymbolinformation.h
+++ b/src/plugins/classview/classviewsymbolinformation.h
@@ -55,21 +55,15 @@ public:
int iconTypeSortOrder() const;
+ friend auto qHash(const SymbolInformation &information) { return information.hash(); }
+
private:
const int m_iconType;
const Utils::QHashValueType m_hash; // precalculated hash value - to speed up qHash
const QString m_name; // symbol name (e.g. SymbolInformation)
const QString m_type; // symbol type (e.g. (int char))
-
};
-//! qHash overload for QHash/QSet
-inline auto qHash(const SymbolInformation &information)
-{
- return information.hash();
-}
-
-
} // namespace Internal
} // namespace ClassView
diff --git a/src/plugins/clearcase/clearcasesettings.h b/src/plugins/clearcase/clearcasesettings.h
index e3700239f3..03391af6ae 100644
--- a/src/plugins/clearcase/clearcasesettings.h
+++ b/src/plugins/clearcase/clearcasesettings.h
@@ -54,6 +54,11 @@ public:
bool equals(const ClearCaseSettings &s) const;
+ friend bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
+ { return p1.equals(p2); }
+ friend bool operator!=(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
+ { return !p1.equals(p2); }
+
QString ccCommand;
QString ccBinaryPath;
DiffType diffType = GraphicalDiff;
@@ -71,10 +76,5 @@ public:
int timeOutS;
};
-inline bool operator==(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
-{ return p1.equals(p2); }
-inline bool operator!=(const ClearCaseSettings &p1, const ClearCaseSettings &p2)
-{ return !p1.equals(p2); }
-
} // namespace Internal
} // namespace ClearCase
diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigitem.h b/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
index 19bbbfd7d6..f94674f623 100644
--- a/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
+++ b/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
@@ -68,6 +68,7 @@ public:
QString toCMakeSetLine(const Utils::MacroExpander *expander = nullptr) const;
bool operator==(const CMakeConfigItem &o) const;
+ friend Utils::QHashValueType qHash(const CMakeConfigItem &it); // needed for MSVC
QByteArray key;
Type type = STRING;
@@ -79,8 +80,6 @@ public:
QStringList values;
};
-Utils::QHashValueType qHash(const CMakeConfigItem &it); // needed for MSVC
-
class CMAKE_EXPORT CMakeConfig : public QList<CMakeConfigItem>
{
public:
diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.h b/src/plugins/cmakeprojectmanager/fileapidataextractor.h
index 1bc99bf1a8..6a5b905a6e 100644
--- a/src/plugins/cmakeprojectmanager/fileapidataextractor.h
+++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.h
@@ -48,6 +48,7 @@ class CMakeFileInfo
{
public:
bool operator==(const CMakeFileInfo& other) const { return path == other.path; }
+ friend auto qHash(const CMakeFileInfo &info, uint seed = 0) { return info.path.hash(seed); }
Utils::FilePath path;
bool isCMake = false;
@@ -56,8 +57,6 @@ public:
bool isGenerated = false;
};
-inline auto qHash(const CMakeFileInfo &info, uint seed = 0) { return info.path.hash(seed); }
-
class FileApiQtcData
{
public:
diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp
index 4376553bee..57b6a5649e 100644
--- a/src/plugins/coreplugin/find/findplugin.cpp
+++ b/src/plugins/coreplugin/find/findplugin.cpp
@@ -75,20 +75,20 @@ namespace Core {
struct CompletionEntry
{
+ friend QDebug operator<<(QDebug d, const CompletionEntry &e)
+ {
+ QDebugStateSaver saver(d);
+ d.noquote();
+ d.nospace();
+ d << "CompletionEntry(\"" << e.text << "\", flags="
+ << "0x" << QString::number(e.findFlags, 16) << ')';
+ return d;
+ }
+
QString text;
FindFlags findFlags;
};
-QDebug operator<<(QDebug d, const CompletionEntry &e)
-{
- QDebugStateSaver saver(d);
- d.noquote();
- d.nospace();
- d << "CompletionEntry(\"" << e.text << "\", flags="
- << "0x" << QString::number(e.findFlags, 16) << ')';
- return d;
-}
-
class CompletionModel : public QAbstractListModel
{
public:
diff --git a/src/plugins/coreplugin/find/searchresultcolor.h b/src/plugins/coreplugin/find/searchresultcolor.h
index ec1b4c1bd4..9a68f1c35a 100644
--- a/src/plugins/coreplugin/find/searchresultcolor.h
+++ b/src/plugins/coreplugin/find/searchresultcolor.h
@@ -32,7 +32,8 @@
namespace Core {
-class CORE_EXPORT SearchResultColor {
+class CORE_EXPORT SearchResultColor
+{
public:
enum class Style { Default, Alt1, Alt2 };
@@ -48,18 +49,17 @@ public:
highlightForeground = textForeground;
}
+ friend auto qHash(SearchResultColor::Style style)
+ {
+ return QT_PREPEND_NAMESPACE(qHash(int(style)));
+ }
+
QColor textBackground;
QColor textForeground;
QColor highlightBackground;
QColor highlightForeground;
};
-
-inline auto qHash(SearchResultColor::Style style)
-{
- return QT_PREPEND_NAMESPACE(qHash(int(style)));
-}
-
using SearchResultColors = QHash<SearchResultColor::Style, SearchResultColor>;
} // namespace Core
diff --git a/src/plugins/coreplugin/icontext.h b/src/plugins/coreplugin/icontext.h
index 792217edb9..9ba7f5c219 100644
--- a/src/plugins/coreplugin/icontext.h
+++ b/src/plugins/coreplugin/icontext.h
@@ -82,6 +82,8 @@ public:
virtual void setWidget(QWidget *widget) { m_widget = widget; }
virtual void setContextHelp(const HelpItem &id) { m_contextHelp = id; }
+ friend CORE_EXPORT QDebug operator<<(QDebug debug, const Core::Context &context);
+
protected:
Context m_context;
QPointer<QWidget> m_widget;
@@ -89,4 +91,3 @@ protected:
};
} // namespace Core
-CORE_EXPORT QDebug operator<<(QDebug debug, const Core::Context &context);
diff --git a/src/plugins/cppeditor/cppcodemodelsettings.h b/src/plugins/cppeditor/cppcodemodelsettings.h
index afebead552..3508233575 100644
--- a/src/plugins/cppeditor/cppcodemodelsettings.h
+++ b/src/plugins/cppeditor/cppcodemodelsettings.h
@@ -107,6 +107,18 @@ public:
QVariantMap toMap() const;
void fromMap(const QVariantMap &map);
+ friend bool operator==(const Data &s1, const Data &s2)
+ {
+ return s1.useClangd == s2.useClangd
+ && s1.executableFilePath == s2.executableFilePath
+ && s1.sessionsWithOneClangd == s2.sessionsWithOneClangd
+ && s1.workerThreadLimit == s2.workerThreadLimit
+ && s1.enableIndexing == s2.enableIndexing
+ && s1.autoIncludeHeaders == s2.autoIncludeHeaders
+ && s1.documentUpdateThreshold == s2.documentUpdateThreshold;
+ }
+ friend bool operator!=(const Data &s1, const Data &s2) { return !(s1 == s2); }
+
Utils::FilePath executableFilePath;
QStringList sessionsWithOneClangd;
int workerThreadLimit = 0;
@@ -153,21 +165,6 @@ private:
Data m_data;
};
-inline bool operator==(const ClangdSettings::Data &s1, const ClangdSettings::Data &s2)
-{
- return s1.useClangd == s2.useClangd
- && s1.executableFilePath == s2.executableFilePath
- && s1.sessionsWithOneClangd == s2.sessionsWithOneClangd
- && s1.workerThreadLimit == s2.workerThreadLimit
- && s1.enableIndexing == s2.enableIndexing
- && s1.autoIncludeHeaders == s2.autoIncludeHeaders
- && s1.documentUpdateThreshold == s2.documentUpdateThreshold;
-}
-inline bool operator!=(const ClangdSettings::Data &s1, const ClangdSettings::Data &s2)
-{
- return !(s1 == s2);
-}
-
class CPPEDITOR_EXPORT ClangdProjectSettings
{
public:
diff --git a/src/plugins/cppeditor/cppprojectfile.h b/src/plugins/cppeditor/cppprojectfile.h
index 1bd80fdf65..52b3f5b4c3 100644
--- a/src/plugins/cppeditor/cppprojectfile.h
+++ b/src/plugins/cppeditor/cppprojectfile.h
@@ -50,6 +50,9 @@ public:
OpenCLSource,
};
+ ProjectFile() = default;
+ ProjectFile(const QString &filePath, Kind kind, bool active = true);
+
static Kind classifyByMimeType(const QString &mt);
static Kind classify(const QString &filePath);
@@ -69,12 +72,10 @@ public:
bool isC() const;
bool isCxx() const;
-public:
- ProjectFile() = default;
- ProjectFile(const QString &filePath, Kind kind, bool active = true);
-
bool operator==(const ProjectFile &other) const;
+ friend QDebug operator<<(QDebug stream, const CppEditor::ProjectFile &projectFile);
+public:
QString path;
Kind kind = Unclassified;
bool active = true;
@@ -83,6 +84,5 @@ public:
using ProjectFiles = QVector<ProjectFile>;
const char *projectFileKindToText(ProjectFile::Kind kind);
-QDebug operator<<(QDebug stream, const CppEditor::ProjectFile &projectFile);
} // namespace CppEditor
diff --git a/src/plugins/cppeditor/cppuseselections_test.cpp b/src/plugins/cppeditor/cppuseselections_test.cpp
index ecf27e406a..2bf5e6271c 100644
--- a/src/plugins/cppeditor/cppuseselections_test.cpp
+++ b/src/plugins/cppeditor/cppuseselections_test.cpp
@@ -33,8 +33,13 @@
#include <QtTest>
// Uses 1-based line and 0-based column.
-struct Selection {
+struct Selection
+{
Selection(int line, int column, int length) : line(line), column(column), length(length) {}
+
+ friend bool operator==(const Selection &l, const Selection &r)
+ { return l.line == r.line && l.column == r.column && l.length == r.length; }
+
int line;
int column;
int length;
@@ -42,9 +47,6 @@ struct Selection {
typedef QList<Selection> SelectionList;
Q_DECLARE_METATYPE(SelectionList)
-inline bool operator==(const Selection &l, const Selection &r)
-{ return l.line == r.line && l.column == r.column && l.length == r.length; }
-
QT_BEGIN_NAMESPACE
namespace QTest {
template<> char *toString(const Selection &selection)
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 59bd65c092..8cfff10c65 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -82,27 +82,29 @@ using namespace TextEditor;
using namespace Core;
using namespace ProjectExplorer;
-class OverrideItem {
+class OverrideItem
+{
public:
OverrideItem() : line(0) {}
OverrideItem(const QString &text, int line = 0) : text(text), line(line) {}
+
bool isValid() { return line != 0; }
QByteArray toByteArray() const
{
return "OverrideItem(" + text.toLatin1() + ", " + QByteArray::number(line) + ')';
}
+ friend bool operator==(const OverrideItem &lhs, const OverrideItem &rhs)
+ {
+ return lhs.text == rhs.text && lhs.line == rhs.line;
+ }
+
QString text;
int line;
};
typedef QList<OverrideItem> OverrideItemList;
Q_DECLARE_METATYPE(OverrideItem)
-inline bool operator==(const OverrideItem &lhs, const OverrideItem &rhs)
-{
- return lhs.text == rhs.text && lhs.line == rhs.line;
-}
-
QT_BEGIN_NAMESPACE
namespace QTest {
template<> char *toString(const OverrideItem &data)
diff --git a/src/plugins/debugger/analyzer/diagnosticlocation.h b/src/plugins/debugger/analyzer/diagnosticlocation.h
index 76459d7661..fe52fe9248 100644
--- a/src/plugins/debugger/analyzer/diagnosticlocation.h
+++ b/src/plugins/debugger/analyzer/diagnosticlocation.h
@@ -43,6 +43,10 @@ public:
bool isValid() const;
+ DEBUGGER_EXPORT friend bool operator==(const DiagnosticLocation &first, const DiagnosticLocation &second);
+ DEBUGGER_EXPORT friend bool operator<(const DiagnosticLocation &first, const DiagnosticLocation &second);
+ DEBUGGER_EXPORT friend QDebug operator<<(QDebug dbg, const DiagnosticLocation &location);
+
Utils::FilePath filePath;
// Both values start at 1.
@@ -50,10 +54,6 @@ public:
int column = 0;
};
-DEBUGGER_EXPORT bool operator==(const DiagnosticLocation &first, const DiagnosticLocation &second);
-DEBUGGER_EXPORT bool operator<(const DiagnosticLocation &first, const DiagnosticLocation &second);
-DEBUGGER_EXPORT QDebug operator<<(QDebug dbg, const DiagnosticLocation &location);
-
} // namespace Debugger
Q_DECLARE_METATYPE(Debugger::DiagnosticLocation)
diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.h b/src/plugins/debugger/cdb/cdbparsehelpers.h
index 5053a6de7e..ab39ebc612 100644
--- a/src/plugins/debugger/cdb/cdbparsehelpers.h
+++ b/src/plugins/debugger/cdb/cdbparsehelpers.h
@@ -79,6 +79,8 @@ struct WinException
void fromGdbMI(const GdbMi &);
QString toString(bool includeLocation = false) const;
+ friend QDebug operator<<(QDebug s, const WinException &e);
+
unsigned exceptionCode = 0;
unsigned exceptionFlags = 0;
quint64 exceptionAddress = 0;
@@ -90,7 +92,5 @@ struct WinException
QString function;
};
-QDebug operator<<(QDebug s, const WinException &e);
-
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/git/gerrit/gerritparameters.h b/src/plugins/git/gerrit/gerritparameters.h
index 96e03fd559..5c0d89a3e4 100644
--- a/src/plugins/git/gerrit/gerritparameters.h
+++ b/src/plugins/git/gerrit/gerritparameters.h
@@ -46,6 +46,11 @@ public:
void fromSettings(const QSettings *);
void setPortFlagBySshType();
+ friend bool operator==(const GerritParameters &p1, const GerritParameters &p2)
+ { return p1.equals(p2); }
+ friend bool operator!=(const GerritParameters &p1, const GerritParameters &p2)
+ { return !p1.equals(p2); }
+
GerritServer server;
Utils::FilePath ssh;
Utils::FilePath curl;
@@ -54,10 +59,5 @@ public:
QString portFlag;
};
-inline bool operator==(const GerritParameters &p1, const GerritParameters &p2)
-{ return p1.equals(p2); }
-inline bool operator!=(const GerritParameters &p1, const GerritParameters &p2)
-{ return !p1.equals(p2); }
-
} // namespace Internal
} // namespace Gerrit
diff --git a/src/plugins/languageclient/semantichighlightsupport.h b/src/plugins/languageclient/semantichighlightsupport.h
index 724e85f837..d6a9fc314d 100644
--- a/src/plugins/languageclient/semantichighlightsupport.h
+++ b/src/plugins/languageclient/semantichighlightsupport.h
@@ -44,17 +44,19 @@ class Client;
class LANGUAGECLIENT_EXPORT ExpandedSemanticToken
{
public:
+ friend bool operator==(const ExpandedSemanticToken &t1, const ExpandedSemanticToken &t2)
+ {
+ return t1.line == t2.line && t1.column == t2.column && t1.length == t2.length
+ && t1.type == t2.type && t1.modifiers == t2.modifiers;
+ }
+
int line = -1;
int column = -1;
int length = -1;
QString type;
QStringList modifiers;
};
-inline bool operator==(const ExpandedSemanticToken &t1, const ExpandedSemanticToken &t2)
-{
- return t1.line == t2.line && t1.column == t2.column && t1.length == t2.length
- && t1.type == t2.type && t1.modifiers == t2.modifiers;
-}
+
using SemanticTokensHandler = std::function<void(TextEditor::TextDocument *,
const QList<ExpandedSemanticToken> &, int, bool)>;
diff --git a/src/plugins/marketplace/productlistmodel.h b/src/plugins/marketplace/productlistmodel.h
index df2070f213..6581bc344a 100644
--- a/src/plugins/marketplace/productlistmodel.h
+++ b/src/plugins/marketplace/productlistmodel.h
@@ -60,22 +60,22 @@ protected:
struct Section
{
+ friend bool operator<(const Section &lhs, const Section &rhs)
+ {
+ if (lhs.priority < rhs.priority)
+ return true;
+ return lhs.priority > rhs.priority ? false : lhs.name < rhs.name;
+ }
+
+ friend bool operator==(const Section &lhs, const Section &rhs)
+ {
+ return lhs.priority == rhs.priority && lhs.name == rhs.name;
+ }
+
QString name;
int priority;
};
-inline bool operator<(const Section &lhs, const Section &rhs)
-{
- if (lhs.priority < rhs.priority)
- return true;
- return lhs.priority > rhs.priority ? false : lhs.name < rhs.name;
-}
-
-inline bool operator==(const Section &lhs, const Section &rhs)
-{
- return lhs.priority == rhs.priority && lhs.name == rhs.name;
-}
-
class SectionedProducts : public QStackedWidget
{
Q_OBJECT
diff --git a/src/plugins/nim/suggest/clientrequests.cpp b/src/plugins/nim/suggest/clientrequests.cpp
index 4b1429a204..7dc7d9260f 100644
--- a/src/plugins/nim/suggest/clientrequests.cpp
+++ b/src/plugins/nim/suggest/clientrequests.cpp
@@ -51,14 +51,13 @@ NimSuggestClientRequest::NimSuggestClientRequest(quint64 id)
: m_id(id)
{}
-
-} // namespace Suggest
-} // namespace Nim
-
-QDebug operator<<(QDebug debug, const Nim::Suggest::Line &c)
+QDebug operator<<(QDebug debug, const Line &c)
{
QDebugStateSaver saver(debug);
debug.space() << c.line_type << c.symbol_kind << c.symbol_type << c.data << c.row << c.column <<
c.abs_path;
return debug;
}
+
+} // namespace Suggest
+} // namespace Nim
diff --git a/src/plugins/nim/suggest/clientrequests.h b/src/plugins/nim/suggest/clientrequests.h
index 39c6719929..e9ca91b205 100644
--- a/src/plugins/nim/suggest/clientrequests.h
+++ b/src/plugins/nim/suggest/clientrequests.h
@@ -83,6 +83,8 @@ public:
static bool fromString(LineType &type, const std::string &str);
static bool fromString(SymbolKind &type, const std::string &str);
+ friend QDebug operator<<(QDebug debug, const Line &c);
+
LineType line_type;
SymbolKind symbol_kind;
QString abs_path;
@@ -133,5 +135,3 @@ private:
} // namespace Suggest
} // namespace Nim
-
-QDebug operator<<(QDebug debug, const Nim::Suggest::Line &c);
diff --git a/src/plugins/projectexplorer/abi.h b/src/plugins/projectexplorer/abi.h
index 56272baced..a1f7142991 100644
--- a/src/plugins/projectexplorer/abi.h
+++ b/src/plugins/projectexplorer/abi.h
@@ -184,6 +184,15 @@ public:
static Abi hostAbi();
static Abis abisOfBinary(const Utils::FilePath &path);
+ friend auto qHash(const ProjectExplorer::Abi &abi)
+ {
+ int h = abi.architecture()
+ + (abi.os() << 3)
+ + (abi.osFlavor() << 6)
+ + (abi.binaryFormat() << 10)
+ + (abi.wordWidth() << 13);
+ return QT_PREPEND_NAMESPACE(qHash)(h);
+ }
private:
Architecture m_architecture;
@@ -194,14 +203,4 @@ private:
QString m_param;
};
-inline auto qHash(const ProjectExplorer::Abi &abi)
-{
- int h = abi.architecture()
- + (abi.os() << 3)
- + (abi.osFlavor() << 6)
- + (abi.binaryFormat() << 10)
- + (abi.wordWidth() << 13);
- return QT_PREPEND_NAMESPACE(qHash)(h);
-}
-
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/buildtargetinfo.h b/src/plugins/projectexplorer/buildtargetinfo.h
index 34d5f19624..7b5ef1984b 100644
--- a/src/plugins/projectexplorer/buildtargetinfo.h
+++ b/src/plugins/projectexplorer/buildtargetinfo.h
@@ -52,28 +52,28 @@ public:
Utils::QHashValueType runEnvModifierHash = 0; // Make sure to update this when runEnvModifier changes!
std::function<void(Utils::Environment &, bool)> runEnvModifier;
-};
-inline bool operator==(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
-{
- return ti1.buildKey == ti2.buildKey
- && ti1.displayName == ti2.displayName
- && ti1.targetFilePath == ti2.targetFilePath
- && ti1.projectFilePath == ti2.projectFilePath
- && ti1.workingDirectory == ti2.workingDirectory
- && ti1.isQtcRunnable == ti2.isQtcRunnable
- && ti1.usesTerminal == ti2.usesTerminal
- && ti1.runEnvModifierHash == ti2.runEnvModifierHash;
-}
+ friend bool operator==(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
+ {
+ return ti1.buildKey == ti2.buildKey
+ && ti1.displayName == ti2.displayName
+ && ti1.targetFilePath == ti2.targetFilePath
+ && ti1.projectFilePath == ti2.projectFilePath
+ && ti1.workingDirectory == ti2.workingDirectory
+ && ti1.isQtcRunnable == ti2.isQtcRunnable
+ && ti1.usesTerminal == ti2.usesTerminal
+ && ti1.runEnvModifierHash == ti2.runEnvModifierHash;
+ }
-inline bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
-{
- return !(ti1 == ti2);
-}
+ friend bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
+ {
+ return !(ti1 == ti2);
+ }
-inline auto qHash(const BuildTargetInfo &ti)
-{
- return qHash(ti.displayName) ^ qHash(ti.buildKey);
-}
+ friend auto qHash(const BuildTargetInfo &ti)
+ {
+ return qHash(ti.displayName) ^ qHash(ti.buildKey);
+ }
+};
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/deployablefile.h b/src/plugins/projectexplorer/deployablefile.h
index e3760e4a02..cc3273623e 100644
--- a/src/plugins/projectexplorer/deployablefile.h
+++ b/src/plugins/projectexplorer/deployablefile.h
@@ -55,23 +55,21 @@ public:
bool isExecutable() const;
+ friend bool operator==(const DeployableFile &d1, const DeployableFile &d2)
+ {
+ return d1.localFilePath() == d2.localFilePath() && d1.remoteDirectory() == d2.remoteDirectory();
+ }
+
+ friend bool operator!=(const DeployableFile &d1, const DeployableFile &d2)
+ {
+ return !(d1 == d2);
+ }
+ friend PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const DeployableFile &d);
+
private:
Utils::FilePath m_localFilePath;
QString m_remoteDir;
Type m_type = TypeNormal;
};
-
-inline bool operator==(const DeployableFile &d1, const DeployableFile &d2)
-{
- return d1.localFilePath() == d2.localFilePath() && d1.remoteDirectory() == d2.remoteDirectory();
-}
-
-inline bool operator!=(const DeployableFile &d1, const DeployableFile &d2)
-{
- return !(d1 == d2);
-}
-
-PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const DeployableFile &d);
-
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/headerpath.h b/src/plugins/projectexplorer/headerpath.h
index 37492fe9f1..ef7d7b3d7d 100644
--- a/src/plugins/projectexplorer/headerpath.h
+++ b/src/plugins/projectexplorer/headerpath.h
@@ -76,15 +76,15 @@ public:
return {fp, HeaderPathType::Framework};
}
+ friend auto qHash(const HeaderPath &key, uint seed = 0)
+ {
+ return ((qHash(key.path) << 2) | uint(key.type)) ^ seed;
+ }
+
QString path;
HeaderPathType type = HeaderPathType::User;
};
-inline auto qHash(const HeaderPath &key, uint seed = 0)
-{
- return ((qHash(key.path) << 2) | uint(key.type)) ^ seed;
-}
-
using HeaderPaths = QVector<HeaderPath>;
template<typename C> HeaderPaths toHeaderPaths(const C &list, HeaderPathType type)
{
diff --git a/src/plugins/projectexplorer/projectexplorersettings.h b/src/plugins/projectexplorer/projectexplorersettings.h
index b5cbd7db3f..818651e7da 100644
--- a/src/plugins/projectexplorer/projectexplorersettings.h
+++ b/src/plugins/projectexplorer/projectexplorersettings.h
@@ -43,6 +43,25 @@ enum class StopBeforeBuild { None, SameProject, All, SameBuildDir, SameApp };
class ProjectExplorerSettings
{
public:
+ friend bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerSettings &p2)
+ {
+ return p1.buildBeforeDeploy == p2.buildBeforeDeploy
+ && p1.deployBeforeRun == p2.deployBeforeRun
+ && p1.saveBeforeBuild == p2.saveBeforeBuild
+ && p1.useJom == p2.useJom
+ && p1.autorestoreLastSession == p2.autorestoreLastSession
+ && p1.prompToStopRunControl == p2.prompToStopRunControl
+ && p1.automaticallyCreateRunConfigurations == p2.automaticallyCreateRunConfigurations
+ && p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv
+ && p1.environmentId == p2.environmentId
+ && p1.stopBeforeBuild == p2.stopBeforeBuild
+ && p1.terminalMode == p2.terminalMode
+ && p1.closeSourceFilesWithProject == p2.closeSourceFilesWithProject
+ && p1.clearIssuesOnRebuild == p2.clearIssuesOnRebuild
+ && p1.abortBuildAllOnError == p2.abortBuildAllOnError
+ && p1.lowBuildPriority == p2.lowBuildPriority;
+ }
+
BuildBeforeRunMode buildBeforeDeploy = BuildBeforeRunMode::WholeProject;
bool deployBeforeRun = true;
bool saveBeforeBuild = false;
@@ -66,25 +85,6 @@ public:
QUuid environmentId;
};
-inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerSettings &p2)
-{
- return p1.buildBeforeDeploy == p2.buildBeforeDeploy
- && p1.deployBeforeRun == p2.deployBeforeRun
- && p1.saveBeforeBuild == p2.saveBeforeBuild
- && p1.useJom == p2.useJom
- && p1.autorestoreLastSession == p2.autorestoreLastSession
- && p1.prompToStopRunControl == p2.prompToStopRunControl
- && p1.automaticallyCreateRunConfigurations == p2.automaticallyCreateRunConfigurations
- && p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv
- && p1.environmentId == p2.environmentId
- && p1.stopBeforeBuild == p2.stopBeforeBuild
- && p1.terminalMode == p2.terminalMode
- && p1.closeSourceFilesWithProject == p2.closeSourceFilesWithProject
- && p1.clearIssuesOnRebuild == p2.clearIssuesOnRebuild
- && p1.abortBuildAllOnError == p2.abortBuildAllOnError
- && p1.lowBuildPriority == p2.lowBuildPriority;
-}
-
class AppOutputSettings
{
public:
diff --git a/src/plugins/projectexplorer/projectmacro.h b/src/plugins/projectexplorer/projectmacro.h
index 76125b53af..0cdef8fee3 100644
--- a/src/plugins/projectexplorer/projectmacro.h
+++ b/src/plugins/projectexplorer/projectmacro.h
@@ -70,6 +70,19 @@ public:
static Macro fromKeyValue(const QByteArray &text);
QByteArray toKeyValue(const QByteArray &prefix) const;
+ friend auto qHash(const Macro &macro)
+ {
+ using QT_PREPEND_NAMESPACE(qHash);
+ return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type));
+ }
+
+ friend bool operator==(const Macro &first, const Macro &second)
+ {
+ return first.type == second.type
+ && first.key == second.key
+ && first.value == second.value;
+ }
+
public:
QByteArray key;
QByteArray value;
@@ -84,19 +97,4 @@ private:
static Macros tokensLinesToMacros(const QList<QList<QByteArray>> &tokensLines);
};
-inline
-auto qHash(const Macro &macro)
-{
- using QT_PREPEND_NAMESPACE(qHash);
- return qHash(macro.key) ^ qHash(macro.value) ^ qHash(int(macro.type));
-}
-
-inline
-bool operator==(const Macro &first, const Macro &second)
-{
- return first.type == second.type
- && first.key == second.key
- && first.value == second.value;
-}
-
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h
index b95d51d34e..52cebcfc04 100644
--- a/src/plugins/projectexplorer/task.h
+++ b/src/plugins/projectexplorer/task.h
@@ -77,6 +77,10 @@ public:
QString description() const;
QIcon icon() const;
+ friend PROJECTEXPLORER_EXPORT bool operator==(const Task &t1, const Task &t2);
+ friend PROJECTEXPLORER_EXPORT bool operator<(const Task &a, const Task &b);
+ friend PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const Task &task);
+
unsigned int taskId = 0;
TaskType type = Unknown;
Options options = AddTextMark | FlashWorthy;
@@ -136,11 +140,6 @@ public:
using Tasks = QVector<Task>;
-PROJECTEXPLORER_EXPORT bool operator==(const Task &t1, const Task &t2);
-PROJECTEXPLORER_EXPORT Utils::QHashValueType qHash(const Task &task);
-
-PROJECTEXPLORER_EXPORT bool operator<(const Task &a, const Task &b);
-
PROJECTEXPLORER_EXPORT QString toHtml(const Tasks &issues);
PROJECTEXPLORER_EXPORT bool containsType(const Tasks &issues, Task::TaskType);
diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h
index 17e1fe2f13..c028dbce18 100644
--- a/src/plugins/qmakeprojectmanager/qmakestep.h
+++ b/src/plugins/qmakeprojectmanager/qmakestep.h
@@ -78,6 +78,25 @@ public:
QStringList toArguments() const;
+ friend bool operator==(const QMakeStepConfig &a, const QMakeStepConfig &b)
+ {
+ return std::tie(a.archConfig, a.osType, a.linkQmlDebuggingQQ2)
+ == std::tie(b.archConfig, b.osType, b.linkQmlDebuggingQQ2)
+ && std::tie(a.useQtQuickCompiler, a.separateDebugInfo)
+ == std::tie(b.useQtQuickCompiler, b.separateDebugInfo);
+ }
+
+ friend bool operator!=(const QMakeStepConfig &a, const QMakeStepConfig &b) { return !(a == b); }
+
+ friend QDebug operator<<(QDebug dbg, const QMakeStepConfig &c)
+ {
+ dbg << c.archConfig << c.osType
+ << (c.linkQmlDebuggingQQ2 == Utils::TriState::Enabled)
+ << (c.useQtQuickCompiler == Utils::TriState::Enabled)
+ << (c.separateDebugInfo == Utils::TriState::Enabled);
+ return dbg;
+ }
+
// Actual data
QString sysRoot;
QString targetTriple;
@@ -89,27 +108,6 @@ public:
Utils::TriState useQtQuickCompiler;
};
-
-inline bool operator ==(const QMakeStepConfig &a, const QMakeStepConfig &b) {
- return std::tie(a.archConfig, a.osType, a.linkQmlDebuggingQQ2)
- == std::tie(b.archConfig, b.osType, b.linkQmlDebuggingQQ2)
- && std::tie(a.useQtQuickCompiler, a.separateDebugInfo)
- == std::tie(b.useQtQuickCompiler, b.separateDebugInfo);
-}
-
-inline bool operator !=(const QMakeStepConfig &a, const QMakeStepConfig &b) {
- return !(a == b);
-}
-
-inline QDebug operator<<(QDebug dbg, const QMakeStepConfig &c)
-{
- dbg << c.archConfig << c.osType
- << (c.linkQmlDebuggingQQ2 == Utils::TriState::Enabled)
- << (c.useQtQuickCompiler == Utils::TriState::Enabled)
- << (c.separateDebugInfo == Utils::TriState::Enabled);
- return dbg;
-}
-
class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
diff --git a/src/plugins/qmljseditor/qmljseditingsettingspage.h b/src/plugins/qmljseditor/qmljseditingsettingspage.h
index e3536a44ef..296bc64b41 100644
--- a/src/plugins/qmljseditor/qmljseditingsettingspage.h
+++ b/src/plugins/qmljseditor/qmljseditingsettingspage.h
@@ -36,46 +36,46 @@ QT_END_NAMESPACE
namespace QmlJSEditor {
- class QmlJsEditingSettings {
- public:
- QmlJsEditingSettings();
-
- static QmlJsEditingSettings get();
- void set();
+class QmlJsEditingSettings
+{
+public:
+ QmlJsEditingSettings();
- void fromSettings(QSettings *);
- void toSettings(QSettings *) const;
+ static QmlJsEditingSettings get();
+ void set();
- bool equals(const QmlJsEditingSettings &other) const;
+ void fromSettings(QSettings *);
+ void toSettings(QSettings *) const;
- bool enableContextPane() const;
- void setEnableContextPane(const bool enableContextPane);
+ bool equals(const QmlJsEditingSettings &other) const;
- bool pinContextPane() const;
- void setPinContextPane(const bool pinContextPane);
+ bool enableContextPane() const;
+ void setEnableContextPane(const bool enableContextPane);
- bool autoFormatOnSave() const;
- void setAutoFormatOnSave(const bool autoFormatOnSave);
+ bool pinContextPane() const;
+ void setPinContextPane(const bool pinContextPane);
- bool autoFormatOnlyCurrentProject() const;
- void setAutoFormatOnlyCurrentProject(const bool autoFormatOnlyCurrentProject);
+ bool autoFormatOnSave() const;
+ void setAutoFormatOnSave(const bool autoFormatOnSave);
- bool foldAuxData() const;
- void setFoldAuxData(const bool foldAuxData);
+ bool autoFormatOnlyCurrentProject() const;
+ void setAutoFormatOnlyCurrentProject(const bool autoFormatOnlyCurrentProject);
- private:
- bool m_enableContextPane;
- bool m_pinContextPane;
- bool m_autoFormatOnSave;
- bool m_autoFormatOnlyCurrentProject;
- bool m_foldAuxData;
- };
+ bool foldAuxData() const;
+ void setFoldAuxData(const bool foldAuxData);
- inline bool operator==(const QmlJsEditingSettings &s1, const QmlJsEditingSettings &s2)
+ friend bool operator==(const QmlJsEditingSettings &s1, const QmlJsEditingSettings &s2)
{ return s1.equals(s2); }
- inline bool operator!=(const QmlJsEditingSettings &s1, const QmlJsEditingSettings &s2)
+ friend bool operator!=(const QmlJsEditingSettings &s1, const QmlJsEditingSettings &s2)
{ return !s1.equals(s2); }
+private:
+ bool m_enableContextPane;
+ bool m_pinContextPane;
+ bool m_autoFormatOnSave;
+ bool m_autoFormatOnlyCurrentProject;
+ bool m_foldAuxData;
+};
namespace Internal {
diff --git a/src/plugins/qmlprofiler/qmleventlocation.h b/src/plugins/qmlprofiler/qmleventlocation.h
index 5faf907101..0c6fb2007d 100644
--- a/src/plugins/qmlprofiler/qmleventlocation.h
+++ b/src/plugins/qmlprofiler/qmleventlocation.h
@@ -55,6 +55,26 @@ public:
int line() const { return m_line; }
int column() const { return m_column; }
+ friend bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2)
+ {
+ // compare filename last as it's expensive.
+ return location1.line() == location2.line() && location1.column() == location2.column()
+ && location1.filename() == location2.filename();
+ }
+
+ friend bool operator!=(const QmlEventLocation &location1, const QmlEventLocation &location2)
+ {
+ return !(location1 == location2);
+ }
+
+ friend auto qHash(const QmlEventLocation &location)
+ {
+ return qHash(location.filename())
+ ^ ((location.line() & 0xfff) // 12 bits of line number
+ | ((location.column() << 16) & 0xff0000)); // 8 bits of column
+
+ }
+
private:
friend QDataStream &operator>>(QDataStream &stream, QmlEventLocation &location);
friend QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location);
@@ -64,29 +84,6 @@ private:
int m_column = -1;
};
-inline bool operator==(const QmlEventLocation &location1, const QmlEventLocation &location2)
-{
- // compare filename last as it's expensive.
- return location1.line() == location2.line() && location1.column() == location2.column()
- && location1.filename() == location2.filename();
-}
-
-inline bool operator!=(const QmlEventLocation &location1, const QmlEventLocation &location2)
-{
- return !(location1 == location2);
-}
-
-inline auto qHash(const QmlEventLocation &location)
-{
- return qHash(location.filename())
- ^ ((location.line() & 0xfff) // 12 bits of line number
- | ((location.column() << 16) & 0xff0000)); // 8 bits of column
-
-}
-
-QDataStream &operator>>(QDataStream &stream, QmlEventLocation &location);
-QDataStream &operator<<(QDataStream &stream, const QmlEventLocation &location);
-
} // namespace QmlProfiler
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/qmlprofiler/qmleventtype.h b/src/plugins/qmlprofiler/qmleventtype.h
index ee87dc94d2..9eb9954075 100644
--- a/src/plugins/qmlprofiler/qmleventtype.h
+++ b/src/plugins/qmlprofiler/qmleventtype.h
@@ -63,9 +63,6 @@ private:
int m_detailType; // can be EventType, BindingType, PixmapEventType or SceneGraphFrameType
};
-QDataStream &operator>>(QDataStream &stream, QmlEventType &type);
-QDataStream &operator<<(QDataStream &stream, const QmlEventType &type);
-
} // namespace QmlProfiler
Q_DECLARE_METATYPE(QmlProfiler::QmlEventType)
diff --git a/src/plugins/qmlprofiler/qmlnote.h b/src/plugins/qmlprofiler/qmlnote.h
index 1178ccaca6..919d215faf 100644
--- a/src/plugins/qmlprofiler/qmlnote.h
+++ b/src/plugins/qmlprofiler/qmlnote.h
@@ -48,10 +48,13 @@ public:
void setText(const QString &text) { m_text = text; }
void setLoaded(bool loaded) { m_loaded = loaded; }
-private:
+ friend bool operator==(const QmlNote &note1, const QmlNote &note2);
+ friend bool operator!=(const QmlNote &note1, const QmlNote &note2);
+
friend QDataStream &operator>>(QDataStream &stream, QmlNote &note);
friend QDataStream &operator<<(QDataStream &stream, const QmlNote &note);
+private:
int m_typeIndex;
int m_collapsedRow;
qint64 m_startTime;
@@ -60,12 +63,6 @@ private:
bool m_loaded;
};
-bool operator==(const QmlNote &note1, const QmlNote &note2);
-bool operator!=(const QmlNote &note1, const QmlNote &note2);
-
-QDataStream &operator>>(QDataStream &stream, QmlNote &note);
-QDataStream &operator<<(QDataStream &stream, const QmlNote &note);
-
} // namespace QmlProfiler
Q_DECLARE_METATYPE(QmlProfiler::QmlNote)
diff --git a/src/plugins/qtsupport/codegensettings.h b/src/plugins/qtsupport/codegensettings.h
index a5973683a2..22187df9de 100644
--- a/src/plugins/qtsupport/codegensettings.h
+++ b/src/plugins/qtsupport/codegensettings.h
@@ -48,13 +48,13 @@ public:
void fromSettings(const QSettings *settings);
void toSettings(QSettings *settings) const;
+ friend bool operator==(const CodeGenSettings &p1, const CodeGenSettings &p2) { return p1.equals(p2); }
+ friend bool operator!=(const CodeGenSettings &p1, const CodeGenSettings &p2) { return !p1.equals(p2); }
+
UiClassEmbedding embedding;
bool retranslationSupport; // Add handling for language change events
bool includeQtModule; // Include "<QtGui/[Class]>" or just "<[Class]>"
bool addQtVersionCheck; // Include #ifdef when using "#include <QtGui/..."
};
-inline bool operator==(const CodeGenSettings &p1, const CodeGenSettings &p2) { return p1.equals(p2); }
-inline bool operator!=(const CodeGenSettings &p1, const CodeGenSettings &p2) { return !p1.equals(p2); }
-
} // namespace QtSupport
diff --git a/src/plugins/remotelinux/deploymenttimeinfo.cpp b/src/plugins/remotelinux/deploymenttimeinfo.cpp
index 81eb9417e3..eef2b77cf4 100644
--- a/src/plugins/remotelinux/deploymenttimeinfo.cpp
+++ b/src/plugins/remotelinux/deploymenttimeinfo.cpp
@@ -55,16 +55,15 @@ public:
bool operator==(const DeployParameters &other) const {
return file == other.file && host == other.host && sysroot == other.sysroot;
}
+ friend auto qHash(const DeployParameters &p) {
+ return qHash(qMakePair(qMakePair(p.file, p.host), p.sysroot));
+ }
DeployableFile file;
QString host;
QString sysroot;
};
-auto qHash(const DeployParameters &p) {
- return qHash(qMakePair(qMakePair(p.file, p.host), p.sysroot));
-}
-
} // anonymous namespace
class DeploymentTimeInfoPrivate
diff --git a/src/plugins/texteditor/behaviorsettings.h b/src/plugins/texteditor/behaviorsettings.h
index 8a9a0d5979..7acb3bf1e6 100644
--- a/src/plugins/texteditor/behaviorsettings.h
+++ b/src/plugins/texteditor/behaviorsettings.h
@@ -52,6 +52,9 @@ public:
bool equals(const BehaviorSettings &bs) const;
+ friend bool operator==(const BehaviorSettings &t1, const BehaviorSettings &t2) { return t1.equals(t2); }
+ friend bool operator!=(const BehaviorSettings &t1, const BehaviorSettings &t2) { return !t1.equals(t2); }
+
bool m_mouseHiding;
bool m_mouseNavigation;
bool m_scrollWheelZooming;
@@ -61,7 +64,4 @@ public:
bool m_smartSelectionChanging;
};
-inline bool operator==(const BehaviorSettings &t1, const BehaviorSettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const BehaviorSettings &t1, const BehaviorSettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/colorscheme.h b/src/plugins/texteditor/colorscheme.h
index 22b625ec24..6548742dae 100644
--- a/src/plugins/texteditor/colorscheme.h
+++ b/src/plugins/texteditor/colorscheme.h
@@ -81,6 +81,9 @@ public:
QString toString() const;
bool fromString(const QString &str);
+ friend bool operator==(const Format &f1, const Format &f2) { return f1.equals(f2); }
+ friend bool operator!=(const Format &f1, const Format &f2) { return !f1.equals(f2); }
+
private:
QColor m_foreground;
QColor m_background;
@@ -94,10 +97,6 @@ private:
bool m_italic = false;
};
-inline bool operator==(const Format &f1, const Format &f2) { return f1.equals(f2); }
-inline bool operator!=(const Format &f1, const Format &f2) { return !f1.equals(f2); }
-
-
/*! A color scheme combines a set of formats for different highlighting
categories. It also provides saving and loading of the scheme to a file.
*/
@@ -125,20 +124,19 @@ public:
bool save(const QString &fileName, QWidget *parent) const;
bool load(const QString &fileName);
- inline bool equals(const ColorScheme &cs) const
+ bool equals(const ColorScheme &cs) const
{
- return m_formats == cs.m_formats
- && m_displayName == cs.m_displayName;
+ return m_formats == cs.m_formats && m_displayName == cs.m_displayName;
}
static QString readNameOfScheme(const QString &fileName);
+ friend bool operator==(const ColorScheme &cs1, const ColorScheme &cs2) { return cs1.equals(cs2); }
+ friend bool operator!=(const ColorScheme &cs1, const ColorScheme &cs2) { return !cs1.equals(cs2); }
+
private:
QMap<TextStyle, Format> m_formats;
QString m_displayName;
};
-inline bool operator==(const ColorScheme &cs1, const ColorScheme &cs2) { return cs1.equals(cs2); }
-inline bool operator!=(const ColorScheme &cs1, const ColorScheme &cs2) { return !cs1.equals(cs2); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/commentssettings.h b/src/plugins/texteditor/commentssettings.h
index 23a7545122..c1a20a650f 100644
--- a/src/plugins/texteditor/commentssettings.h
+++ b/src/plugins/texteditor/commentssettings.h
@@ -43,15 +43,15 @@ public:
bool equals(const CommentsSettings &other) const;
+ friend bool operator==(const CommentsSettings &a, const CommentsSettings &b)
+ { return a.equals(b); }
+
+ friend bool operator!=(const CommentsSettings &a, const CommentsSettings &b)
+ { return !(a == b); }
+
bool m_enableDoxygen;
bool m_generateBrief;
bool m_leadingAsterisks;
};
-inline bool operator==(const CommentsSettings &a, const CommentsSettings &b)
-{ return a.equals(b); }
-
-inline bool operator!=(const CommentsSettings &a, const CommentsSettings &b)
-{ return !(a == b); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/completionsettings.h b/src/plugins/texteditor/completionsettings.h
index fd274a42c0..fb153f85f5 100644
--- a/src/plugins/texteditor/completionsettings.h
+++ b/src/plugins/texteditor/completionsettings.h
@@ -56,6 +56,9 @@ public:
bool equals(const CompletionSettings &bs) const;
+ friend bool operator==(const CompletionSettings &t1, const CompletionSettings &t2) { return t1.equals(t2); }
+ friend bool operator!=(const CompletionSettings &t1, const CompletionSettings &t2) { return !t1.equals(t2); }
+
CaseSensitivity m_caseSensitivity = CaseInsensitive;
CompletionTrigger m_completionTrigger = AutomaticCompletion;
int m_automaticProposalTimeoutInMs = 400;
@@ -74,7 +77,4 @@ public:
bool m_overwriteClosingChars = false;
};
-inline bool operator==(const CompletionSettings &t1, const CompletionSettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const CompletionSettings &t1, const CompletionSettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/displaysettings.h b/src/plugins/texteditor/displaysettings.h
index 73114e6538..ae87f76dfb 100644
--- a/src/plugins/texteditor/displaysettings.h
+++ b/src/plugins/texteditor/displaysettings.h
@@ -52,6 +52,9 @@ public:
void toSettings(const QString &category, QSettings *s) const;
void fromSettings(const QString &category, const QSettings *s);
+ friend bool operator==(const DisplaySettings &t1, const DisplaySettings &t2) { return t1.equals(t2); }
+ friend bool operator!=(const DisplaySettings &t1, const DisplaySettings &t2) { return !t1.equals(t2); }
+
bool m_displayLineNumbers = true;
bool m_textWrapping = false;
bool m_visualizeWhitespace = false;
@@ -78,9 +81,6 @@ public:
static QLabel *createAnnotationSettingsLink();
};
-inline bool operator==(const DisplaySettings &t1, const DisplaySettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const DisplaySettings &t1, const DisplaySettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
Q_DECLARE_METATYPE(TextEditor::AnnotationAlignment)
diff --git a/src/plugins/texteditor/extraencodingsettings.h b/src/plugins/texteditor/extraencodingsettings.h
index ee45b58ace..ce16ae46fc 100644
--- a/src/plugins/texteditor/extraencodingsettings.h
+++ b/src/plugins/texteditor/extraencodingsettings.h
@@ -49,6 +49,12 @@ public:
bool equals(const ExtraEncodingSettings &s) const;
+ friend bool operator==(const ExtraEncodingSettings &a, const ExtraEncodingSettings &b)
+ { return a.equals(b); }
+
+ friend bool operator!=(const ExtraEncodingSettings &a, const ExtraEncodingSettings &b)
+ { return !a.equals(b); }
+
static QStringList lineTerminationModeNames();
enum Utf8BomSetting {
@@ -59,10 +65,4 @@ public:
Utf8BomSetting m_utf8BomSetting;
};
-inline bool operator==(const ExtraEncodingSettings &a, const ExtraEncodingSettings &b)
-{ return a.equals(b); }
-
-inline bool operator!=(const ExtraEncodingSettings &a, const ExtraEncodingSettings &b)
-{ return !a.equals(b); }
-
} // TextEditor
diff --git a/src/plugins/texteditor/fontsettings.h b/src/plugins/texteditor/fontsettings.h
index 9447141434..e476951eac 100644
--- a/src/plugins/texteditor/fontsettings.h
+++ b/src/plugins/texteditor/fontsettings.h
@@ -98,6 +98,9 @@ public:
static QString defaultSchemeFileName(const QString &fileName = QString());
+ friend bool operator==(const FontSettings &f1, const FontSettings &f2) { return f1.equals(f2); }
+ friend bool operator!=(const FontSettings &f1, const FontSettings &f2) { return !f1.equals(f2); }
+
private:
void addMixinStyle(QTextCharFormat &textCharFormat, const MixinTextStyles &mixinStyles) const;
@@ -112,7 +115,4 @@ private:
mutable QHash<TextStyles, QTextCharFormat> m_textCharFormatCache;
};
-inline bool operator==(const FontSettings &f1, const FontSettings &f2) { return f1.equals(f2); }
-inline bool operator!=(const FontSettings &f1, const FontSettings &f2) { return !f1.equals(f2); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/marginsettings.h b/src/plugins/texteditor/marginsettings.h
index e7f6d3bac6..d9c5eeed7f 100644
--- a/src/plugins/texteditor/marginsettings.h
+++ b/src/plugins/texteditor/marginsettings.h
@@ -48,14 +48,14 @@ public:
bool equals(const MarginSettings &other) const;
+ friend bool operator==(const MarginSettings &one, const MarginSettings &two)
+ { return one.equals(two); }
+ friend bool operator!=(const MarginSettings &one, const MarginSettings &two)
+ { return !one.equals(two); }
+
bool m_showMargin;
bool m_useIndenter;
int m_marginColumn;
};
-inline bool operator==(const MarginSettings &one, const MarginSettings &two)
-{ return one.equals(two); }
-inline bool operator!=(const MarginSettings &one, const MarginSettings &two)
-{ return !one.equals(two); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/snippets/snippetssettings.h b/src/plugins/texteditor/snippets/snippetssettings.h
index 88df3ad0e8..f8e27ee11e 100644
--- a/src/plugins/texteditor/snippets/snippetssettings.h
+++ b/src/plugins/texteditor/snippets/snippetssettings.h
@@ -46,14 +46,13 @@ public:
bool equals(const SnippetsSettings &snippetsSettings) const;
+ friend bool operator==(const SnippetsSettings &a, const SnippetsSettings &b)
+ { return a.equals(b); }
+ friend bool operator!=(const SnippetsSettings &a, const SnippetsSettings &b)
+ { return !a.equals(b); }
+
private:
QString m_lastUsedSnippetGroup;
};
-inline bool operator==(const SnippetsSettings &a, const SnippetsSettings &b)
-{ return a.equals(b); }
-
-inline bool operator!=(const SnippetsSettings &a, const SnippetsSettings &b)
-{ return !a.equals(b); }
-
} // TextEditor
diff --git a/src/plugins/texteditor/storagesettings.h b/src/plugins/texteditor/storagesettings.h
index 70dc5b784b..6755dffa67 100644
--- a/src/plugins/texteditor/storagesettings.h
+++ b/src/plugins/texteditor/storagesettings.h
@@ -50,6 +50,10 @@ public:
bool removeTrailingWhitespace(const QString &filePattern) const;
bool equals(const StorageSettings &ts) const;
+ friend bool operator==(const StorageSettings &t1, const StorageSettings &t2)
+ { return t1.equals(t2); }
+ friend bool operator!=(const StorageSettings &t1, const StorageSettings &t2)
+ { return !t1.equals(t2); }
QString m_ignoreFileTypes;
bool m_cleanWhitespace;
@@ -59,7 +63,4 @@ public:
bool m_skipTrailingWhitespace;
};
-inline bool operator==(const StorageSettings &t1, const StorageSettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const StorageSettings &t1, const StorageSettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
diff --git a/src/plugins/texteditor/tabsettings.h b/src/plugins/texteditor/tabsettings.h
index 731dd75caf..274dd44576 100644
--- a/src/plugins/texteditor/tabsettings.h
+++ b/src/plugins/texteditor/tabsettings.h
@@ -81,6 +81,9 @@ public:
bool isIndentationClean(const QTextBlock &block, const int indent) const;
bool guessSpacesForTabs(const QTextBlock &block) const;
+ friend bool operator==(const TabSettings &t1, const TabSettings &t2) { return t1.equals(t2); }
+ friend bool operator!=(const TabSettings &t1, const TabSettings &t2) { return !t1.equals(t2); }
+
static int firstNonSpace(const QString &text);
static inline bool onlySpace(const QString &text) { return firstNonSpace(text) == text.length(); }
static int spacesLeftFromPosition(const QString &text, int position);
@@ -96,9 +99,6 @@ public:
bool equals(const TabSettings &ts) const;
};
-inline bool operator==(const TabSettings &t1, const TabSettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const TabSettings &t1, const TabSettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
Q_DECLARE_METATYPE(TextEditor::TabSettings)
diff --git a/src/plugins/texteditor/textdocumentlayout.h b/src/plugins/texteditor/textdocumentlayout.h
index ce86ad4296..5b8a0447c2 100644
--- a/src/plugins/texteditor/textdocumentlayout.h
+++ b/src/plugins/texteditor/textdocumentlayout.h
@@ -43,9 +43,11 @@ struct TEXTEDITOR_EXPORT Parenthesis
{
enum Type : char { Opened, Closed };
- inline Parenthesis() = default;
- inline Parenthesis(Type t, QChar c, int position)
- : pos(position), chr(c), type(t) {}
+ Parenthesis() = default;
+ Parenthesis(Type t, QChar c, int position) : pos(position), chr(c), type(t) {}
+
+ friend TEXTEDITOR_EXPORT QDebug operator<<(QDebug debug, const Parenthesis &parenthesis);
+
int pos = -1;
QChar chr;
Utils::Id source;
@@ -56,8 +58,6 @@ struct TEXTEDITOR_EXPORT Parenthesis
using Parentheses = QVector<Parenthesis>;
TEXTEDITOR_EXPORT void insertSorted(Parentheses &list, const Parenthesis &elem);
-TEXTEDITOR_EXPORT QDebug operator<<(QDebug debug, const Parenthesis &parenthesis);
-
class TEXTEDITOR_EXPORT CodeFormatterData
{
public:
diff --git a/src/plugins/texteditor/typingsettings.h b/src/plugins/texteditor/typingsettings.h
index 39254b14a8..2a023d39fa 100644
--- a/src/plugins/texteditor/typingsettings.h
+++ b/src/plugins/texteditor/typingsettings.h
@@ -66,6 +66,9 @@ public:
bool equals(const TypingSettings &ts) const;
+ friend bool operator==(const TypingSettings &t1, const TypingSettings &t2) { return t1.equals(t2); }
+ friend bool operator!=(const TypingSettings &t1, const TypingSettings &t2) { return !t1.equals(t2); }
+
bool m_autoIndent;
TabKeyBehavior m_tabKeyBehavior;
SmartBackspaceBehavior m_smartBackspaceBehavior;
@@ -73,9 +76,6 @@ public:
bool m_preferSingleLineComments;
};
-inline bool operator==(const TypingSettings &t1, const TypingSettings &t2) { return t1.equals(t2); }
-inline bool operator!=(const TypingSettings &t1, const TypingSettings &t2) { return !t1.equals(t2); }
-
} // namespace TextEditor
Q_DECLARE_METATYPE(TextEditor::TypingSettings)
diff --git a/src/plugins/vcsbase/commonvcssettings.h b/src/plugins/vcsbase/commonvcssettings.h
index fdcafb0f49..975e2c6060 100644
--- a/src/plugins/vcsbase/commonvcssettings.h
+++ b/src/plugins/vcsbase/commonvcssettings.h
@@ -40,6 +40,8 @@ class CommonVcsSettings : public Utils::AspectContainer
public:
CommonVcsSettings();
+ friend QDebug operator<<(QDebug, const CommonVcsSettings &);
+
Utils::StringAspect nickNameMailMap;
Utils::StringAspect nickNameFieldListFile;
@@ -52,9 +54,6 @@ public:
Utils::IntegerAspect lineWrapWidth;
};
-
-QDebug operator<<(QDebug, const CommonVcsSettings &);
-
class CommonOptionsPage final : public Core::IOptionsPage
{
Q_OBJECT
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index 461b902c12..03f70603df 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -106,6 +106,11 @@ public:
friend VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state);
+ friend bool operator==(const VcsBasePluginState &s1, const VcsBasePluginState &s2)
+ { return s1.equals(s2); }
+ friend bool operator!=(const VcsBasePluginState &s1, const VcsBasePluginState &s2)
+ { return !s1.equals(s2); }
+
private:
friend class VcsBasePluginPrivate;
bool equals(const Internal::State &s) const;
@@ -114,13 +119,6 @@ private:
QSharedDataPointer<VcsBasePluginStateData> data;
};
-VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state);
-
-inline bool operator==(const VcsBasePluginState &s1, const VcsBasePluginState &s2)
-{ return s1.equals(s2); }
-inline bool operator!=(const VcsBasePluginState &s1, const VcsBasePluginState &s2)
-{ return !s1.equals(s2); }
-
// Convenience that searches for the repository specifically for version control
// systems that do not have directories like "CVS" in each managed subdirectory
// but have a directory at the top of the repository like ".git" containing