27 lines
657 B
C++
27 lines
657 B
C++
#include <psemek/util/uuid.hpp>
|
|
|
|
#include <iomanip>
|
|
|
|
namespace psemek::util
|
|
{
|
|
|
|
std::ostream & operator << (std::ostream & os, uuid const & uuid)
|
|
{
|
|
auto x0 = std::byteswap(uuid[0]);
|
|
auto x1 = std::byteswap(uuid[1]);
|
|
|
|
os << std::hex << std::setfill('0') << std::left;
|
|
os << std::setw(8) << (x0 & 0xffffffffull);
|
|
os << std::setw(1) << '-';
|
|
os << std::setw(4) << ((x0 >> 4) & 0xfffful);
|
|
os << std::setw(1) << '-';
|
|
os << std::setw(4) << ((x0 >> 6) & 0xfffful);
|
|
os << std::setw(1) << '-';
|
|
os << std::setw(4) << (x1 & 0xfffful);
|
|
os << std::setw(1) << '-';
|
|
os << std::setw(12) << ((x1 >> 2) & 0xffffffffffffull);
|
|
|
|
return os;
|
|
}
|
|
|
|
}
|