Commit 2897414d authored by Eike Ziller's avatar Eike Ziller

Add std::hash for FileName

Change-Id: Iaef49c826c0febf3a9cb1fdc97de9f92c261cf40
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent a3653681
......@@ -27,7 +27,6 @@
#include "savefile.h"
#include "algorithm.h"
#include "hostosinfo.h"
#include "qtcassert.h"
#include <QDir>
......
......@@ -27,6 +27,8 @@
#include "utils_global.h"
#include "hostosinfo.h"
#include <QCoreApplication>
#include <QXmlStreamWriter> // Mac.
#include <QMetaType>
......@@ -233,4 +235,18 @@ QT_BEGIN_NAMESPACE
QTCREATOR_UTILS_EXPORT uint qHash(const Utils::FileName &a);
QT_END_NAMESPACE
namespace std {
template<> struct hash<Utils::FileName>
{
using argument_type = Utils::FileName;
using result_type = size_t;
result_type operator()(const argument_type &fn) const
{
if (Utils::HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive)
return hash<string>()(fn.toString().toUpper().toStdString());
return hash<string>()(fn.toString().toStdString());
}
};
} // namespace std
Q_DECLARE_METATYPE(Utils::FileName)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment