QmlDesigner: Use <=> for watcher types

Change-Id: I75d0f02a2655fee00b7fce699e57742c743833d9
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2025-03-14 18:19:44 +01:00
committed by Thomas Hartmann
parent c110aab7a1
commit aa1c0715c8

View File

@@ -40,30 +40,7 @@ public:
ProjectPartId id; ProjectPartId id;
SourceType sourceType; SourceType sourceType;
friend bool operator==(ProjectChunkId first, ProjectChunkId second) auto operator<=>(const ProjectChunkId &) const = default;
{
return first.id == second.id && first.sourceType == second.sourceType;
}
friend bool operator==(ProjectChunkId first, ProjectPartId second)
{
return first.id == second;
}
friend bool operator==(ProjectPartId first, ProjectChunkId second)
{
return first == second.id;
}
friend bool operator!=(ProjectChunkId first, ProjectChunkId second)
{
return !(first == second);
}
friend bool operator<(ProjectChunkId first, ProjectChunkId second)
{
return std::tie(first.id, first.sourceType) < std::tie(second.id, second.sourceType);
}
friend bool operator<(ProjectChunkId first, ProjectPartId second) { return first.id < second; } friend bool operator<(ProjectChunkId first, ProjectPartId second) { return first.id < second; }
@@ -129,20 +106,20 @@ public:
&& first.sourceId == second.sourceId; && first.sourceId == second.sourceId;
} }
friend bool operator<(WatcherEntry first, WatcherEntry second) friend auto operator<=>(const WatcherEntry &first, const WatcherEntry &second)
{ {
return std::tie(first.sourceContextId, first.sourceId, first.id) return std::tie(first.sourceContextId, first.sourceId, first.id)
< std::tie(second.sourceContextId, second.sourceId, second.id); <=> std::tie(second.sourceContextId, second.sourceId, second.id);
} }
friend bool operator<(SourceContextId sourceContextId, WatcherEntry entry) friend auto operator<=>(SourceContextId sourceContextId, WatcherEntry entry)
{ {
return sourceContextId < entry.sourceContextId; return sourceContextId <=> entry.sourceContextId;
} }
friend bool operator<(WatcherEntry entry, SourceContextId sourceContextId) friend auto operator<=>(WatcherEntry entry, SourceContextId sourceContextId)
{ {
return entry.sourceContextId < sourceContextId; return entry.sourceContextId <=> sourceContextId;
} }
operator SourceId() const { return sourceId; } operator SourceId() const { return sourceId; }