forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user