30 for (
size_t i = 0; i <
sizeof (uuid); ++i)
31 uuid[i] = (uint8) (r.
nextInt (256));
34 uuid[6] = (uuid[6] & 0x0f) | 0x40;
35 uuid[8] = (uuid[8] & 0x3f) | 0x80;
42 memcpy (uuid, other.uuid, sizeof (uuid));
47 memcpy (uuid, other.uuid, sizeof (uuid));
51 bool Uuid::operator== (
const Uuid& other)
const noexcept {
return memcmp (uuid, other.uuid, sizeof (uuid)) == 0; }
52 bool Uuid::operator!= (
const Uuid& other)
const noexcept {
return ! operator== (other); }
54 bool Uuid::operator< (
const Uuid& other)
const noexcept {
return compare (other) < 0; }
55 bool Uuid::operator> (
const Uuid& other)
const noexcept {
return compare (other) > 0; }
56 bool Uuid::operator<= (
const Uuid& other)
const noexcept {
return compare (other) <= 0; }
57 bool Uuid::operator>= (
const Uuid& other)
const noexcept {
return compare (other) >= 0; }
59 int Uuid::compare (
Uuid other)
const noexcept
61 for (
size_t i = 0; i <
sizeof (uuid); ++i)
62 if (
int diff = uuid[i] - (
int) other.uuid[i])
63 return diff > 0 ? 1 : -1;
70 return Uuid ((
const uint8*)
nullptr);
82 String Uuid::getHexRegion (
int start,
int length)
const 89 return getHexRegion (0, 16);
94 return getHexRegion (0, 4)
95 +
"-" + getHexRegion (4, 2)
96 +
"-" + getHexRegion (6, 2)
97 +
"-" + getHexRegion (8, 2)
98 +
"-" + getHexRegion (10, 6);
111 mb.
copyTo (uuid, 0,
sizeof (uuid));
122 if (rawData !=
nullptr)
123 memcpy (uuid, rawData,
sizeof (uuid));
125 zeromem (uuid,
sizeof (uuid));
142 result = ((uint64) 101) * result + n;
static Uuid null() noexcept
uint64 getNode() const noexcept
void ensureSize(const size_t minimumSize, bool initialiseNewSpaceToZero=false)
static JUCE_CONSTEXPR uint32 bigEndianInt(const void *bytes) noexcept
uint32 getTimeLow() const noexcept
void copyTo(void *destData, int sourceOffset, size_t numBytes) const noexcept
Uuid & operator=(const Uuid &) noexcept
static String toHexString(IntegerType number)
uint16 getTimeHighAndVersion() const noexcept
uint8 getClockSeqAndReserved() const noexcept
uint8 getClockSeqLow() const noexcept
bool isNull() const noexcept
static JUCE_CONSTEXPR uint16 bigEndianShort(const void *bytes) noexcept
uint64 hash() const noexcept
String toDashedString() const
void loadFromHexString(StringRef sourceHexString)
uint16 getTimeMid() const noexcept