LSP: Make hash and debug operator hidden friends

Change-Id: I91e7f8d7e9d21faa5d9bcd3f2d43fa61d22ab44c
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2023-01-06 12:46:40 +01:00
parent 34ff9c97e6
commit bee489f9e2

View File

@@ -65,18 +65,17 @@ public:
return {};
}
friend auto qHash(const MessageId &id)
private:
friend size_t qHash(const MessageId &id)
{
if (std::holds_alternative<int>(id))
return QT_PREPEND_NAMESPACE(qHash(std::get<int>(id)));
return qHash(std::get<int>(id));
if (std::holds_alternative<QString>(id))
return QT_PREPEND_NAMESPACE(qHash(std::get<QString>(id)));
return QT_PREPEND_NAMESPACE(qHash(0));
return qHash(std::get<QString>(id));
return qHash(0);
}
};
template <typename Error>
inline QDebug operator<<(QDebug stream, const LanguageServerProtocol::MessageId &id)
friend QDebug operator<<(QDebug stream, const MessageId &id)
{
if (std::holds_alternative<int>(id))
stream << std::get<int>(id);
@@ -84,6 +83,7 @@ inline QDebug operator<<(QDebug stream, const LanguageServerProtocol::MessageId
stream << std::get<QString>(id);
return stream;
}
};
struct ResponseHandler
{