1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-28 00:15:06 +00:00
OpenMW/components/esm/formidrefid.cpp
2023-04-20 02:19:05 +02:00

39 lines
895 B
C++

#include "formidrefid.hpp"
#include <ostream>
#include "serializerefid.hpp"
namespace ESM
{
namespace
{
std::uint64_t truncate(FormId value)
{
return (static_cast<std::uint64_t>(value.mContentFile) << 24) | value.mIndex;
}
}
std::string FormIdRefId::toString() const
{
std::string result;
const std::uint64_t v = truncate(mValue);
result.resize(getHexIntegralSizeWith0x(v), '\0');
serializeHexIntegral(v, 0, result);
return result;
}
std::string FormIdRefId::toDebugString() const
{
std::string result;
const std::uint64_t v = truncate(mValue);
serializeRefIdValue(v, formIdRefIdPrefix, result);
return result;
}
std::ostream& operator<<(std::ostream& stream, FormIdRefId value)
{
return stream << value.toDebugString();
}
}