1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/components/esm/refid.cpp
psi29a 83718878b2 Merge branch 'Load_ESM4' into 'master'
Loading ESM4 data and storing them in the ESMStore

See merge request OpenMW/openmw!2557
2023-01-07 22:17:17 +00:00

49 lines
1.0 KiB
C++

#include "refid.hpp"
#include <iostream>
#include "components/misc/strings/algorithm.hpp"
namespace ESM
{
bool RefId::operator==(const RefId& rhs) const
{
return Misc::StringUtils::ciEqual(mId, rhs.mId);
}
bool RefId::operator<(const RefId& rhs) const
{
return Misc::StringUtils::ciLess(mId, rhs.mId);
}
std::ostream& operator<<(std::ostream& os, const RefId& refId)
{
os << refId.getRefIdString();
return os;
}
RefId RefId::stringRefId(std::string_view id)
{
RefId newRefId;
newRefId.mId = id;
return newRefId;
}
RefId RefId::formIdRefId(const ESM4::FormId id)
{
return ESM::RefId::stringRefId(ESM4::formIdToString(id));
}
bool RefId::operator==(std::string_view rhs) const
{
return Misc::StringUtils::ciEqual(mId, rhs);
}
const RefId RefId::sEmpty = {};
}
std::size_t std::hash<ESM::RefId>::operator()(const ESM::RefId& k) const
{
return Misc::StringUtils::CiHash()(k.getRefIdString());
}