1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-12-08 18:34:32 +00:00
openmw/components/esm/refid.cpp
florent.teppe c721a6cafa Initial commit to load ESM4
Some data is actually loaded and store in ESM Store
Any new ESM4 will go through the same code path and be automatically sent to the right store
2023-01-01 16:22:57 +01:00

53 lines
1.1 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);
}
bool RefId::operator>(const RefId& rhs) const
{
return Misc::StringUtils::ciGreater(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());
}