2023-02-20 22:11:18 +00:00
|
|
|
#include "formidrefid.hpp"
|
|
|
|
|
2023-04-07 00:14:32 +00:00
|
|
|
#include <cassert>
|
2023-02-20 22:11:18 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
2023-04-07 00:14:32 +00:00
|
|
|
#include "serializerefid.hpp"
|
|
|
|
|
2023-02-20 22:11:18 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
std::string FormIdRefId::toString() const
|
|
|
|
{
|
2023-03-24 11:31:37 +00:00
|
|
|
std::string result;
|
2023-04-07 00:14:32 +00:00
|
|
|
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);
|
2023-03-24 11:31:37 +00:00
|
|
|
return result;
|
2023-02-20 22:11:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string FormIdRefId::toDebugString() const
|
|
|
|
{
|
2023-03-24 11:31:37 +00:00
|
|
|
std::string result;
|
2023-04-07 00:14:32 +00:00
|
|
|
assert((mValue.mIndex & 0xff000000) == 0);
|
|
|
|
size_t v = (static_cast<size_t>(mValue.mContentFile) << 24) | mValue.mIndex;
|
|
|
|
serializeRefIdValue(v, formIdRefIdPrefix, result);
|
2023-03-24 11:31:37 +00:00
|
|
|
return result;
|
2023-02-20 22:11:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& stream, FormIdRefId value)
|
|
|
|
{
|
2023-03-24 11:31:37 +00:00
|
|
|
return stream << value.toDebugString();
|
2023-02-20 22:11:18 +00:00
|
|
|
}
|
|
|
|
}
|