1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-29 09:45:34 +00:00
openmw/components/esm/refid.cpp
florent.teppe dc21df97c8 Fixed issue with getSummonedCreature( that returned a reference to a non const static value
Fix compile, and apply review comment

Fixed greater vs more typo.

getCellname is back to a string view.

Because in most cases was used as a strong not a refId.
and there was a fundamental issue with region names used as a cellname
2022-12-27 19:16:22 +01:00

48 lines
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;
}
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());
}