OpenShot Library | libopenshot-audio
0.2.0
|
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;
bool isNull() const noexcept
Returns true if the ID is zero.
uint32 getTimeLow() const noexcept
Returns the time-low section of the UUID.
~Uuid() noexcept
Destructor.
uint64 getNode() const noexcept
Returns the node section of the UUID.
String toString() const
Returns a stringified version of this UUID.
Uuid()
Creates a new unique ID, compliant with RFC 4122 version 4.
uint16 getTimeHighAndVersion() const noexcept
Returns the time-high-and-version section of the UUID.
A universally unique 128-bit identifier.
int nextInt() noexcept
Returns the next random 32 bit integer.
void copyTo(void *destData, int sourceOffset, size_t numBytes) const noexcept
Copies data from this MemoryBlock to a memory address.
Uuid & operator=(const Uuid &) noexcept
Copies another UUID.
static String toHexString(IntegerType number)
Returns a string representing this numeric value in hexadecimal.
A random number generator.
uint8 getClockSeqLow() const noexcept
Returns the clock-seq-low section of the UUID.
void ensureSize(const size_t minimumSize, bool initialiseNewSpaceToZero=false)
Increases the block's size only if it's smaller than a given size.
uint64 hash() const noexcept
Returns a hash of the UUID.
String toDashedString() const
Returns a stringified version of this UUID, separating it into sections with dashes.
uint16 getTimeMid() const noexcept
Returns the time-mid section of the UUID.
void loadFromHexString(StringRef sourceHexString)
Parses a string of hexadecimal numbers and writes this data into the memory block.
static JUCE_CONSTEXPR uint16 bigEndianShort(const void *bytes) noexcept
Turns 2 bytes into a big-endian integer.
uint8 getClockSeqAndReserved() const noexcept
Returns the clock-seq-and-reserved section of the UUID.
static JUCE_CONSTEXPR uint32 bigEndianInt(const void *bytes) noexcept
Turns 4 bytes into a big-endian integer.
static Uuid null() noexcept
Returns a null Uuid object.
A class to hold a resizable block of raw data.