mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
895 B
C++
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();
|
|
}
|
|
}
|