1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 01:10:10 +00:00
OpenMW/components/esm/formidrefid.cpp
2023-04-09 00:23:32 +02:00

34 lines
902 B
C++

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