Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
cUUID Class Reference

#include <UUID.h>

Public Member Functions

int Compare (const cUUID &a_Other) const
 Lexicographically compare bytes with another UUID. More...
 
 cUUID ()
 Default constructed "nil" UUID. More...
 
void FromRaw (const std::array< Byte, 16 > &a_Raw)
 Assigns from raw memory representation, respecting UUID variant. More...
 
bool FromString (const AString &a_StringUUID)
 Tries to interpret the string as a short or long form UUID and assign from it. More...
 
bool IsNil () const
 Returns true if this contains the "nil" UUID with all bits set to 0. More...
 
AString ToLongString () const
 Converts the UUID to a long form string (i.e. More...
 
std::array< Byte, 16 > ToRaw () const
 Converts UUID to raw memory representation, respecting UUID variant. More...
 
AString ToShortString () const
 Converts the UUID to a short form string (i.e without dashes). More...
 
UInt8 Variant () const
 Returns the variant number of the UUID. More...
 
UInt8 Version () const
 Returns the version number of the UUID. More...
 

Static Public Member Functions

static cUUID GenerateVersion3 (const AString &a_Name)
 Generates a version 3, variant 1 UUID based on the md5 hash of a_Name. More...
 

Private Attributes

std::array< Byte, 16 > m_UUID
 Binary UUID stored big-endian. More...
 

Detailed Description

Definition at line 10 of file UUID.h.

Constructor & Destructor Documentation

◆ cUUID()

cUUID::cUUID ( )
inline

Default constructed "nil" UUID.

Definition at line 14 of file UUID.h.

Member Function Documentation

◆ Compare()

int cUUID::Compare ( const cUUID a_Other) const
inline

Lexicographically compare bytes with another UUID.

Returns: 0 when equal to a_Other, < 0 when less than a_Other, > 0 when greater than a_Other

Definition at line 24 of file UUID.h.

◆ FromRaw()

void cUUID::FromRaw ( const std::array< Byte, 16 > &  a_Raw)

Assigns from raw memory representation, respecting UUID variant.

Definition at line 238 of file UUID.cpp.

◆ FromString()

bool cUUID::FromString ( const AString a_StringUUID)

Tries to interpret the string as a short or long form UUID and assign from it.

On error, returns false and does not set the value.

Definition at line 102 of file UUID.cpp.

◆ GenerateVersion3()

cUUID cUUID::GenerateVersion3 ( const AString a_Name)
static

Generates a version 3, variant 1 UUID based on the md5 hash of a_Name.

Definition at line 263 of file UUID.cpp.

◆ IsNil()

bool cUUID::IsNil ( ) const
inline

Returns true if this contains the "nil" UUID with all bits set to 0.

Definition at line 30 of file UUID.h.

◆ ToLongString()

AString cUUID::ToLongString ( ) const

Converts the UUID to a long form string (i.e.

with dashes).

Definition at line 151 of file UUID.cpp.

◆ ToRaw()

std::array< Byte, 16 > cUUID::ToRaw ( ) const

Converts UUID to raw memory representation, respecting UUID variant.

Definition at line 214 of file UUID.cpp.

◆ ToShortString()

AString cUUID::ToShortString ( ) const

Converts the UUID to a short form string (i.e without dashes).

Definition at line 133 of file UUID.cpp.

◆ Variant()

UInt8 cUUID::Variant ( ) const

Returns the variant number of the UUID.

Definition at line 179 of file UUID.cpp.

◆ Version()

UInt8 cUUID::Version ( ) const

Returns the version number of the UUID.

Definition at line 170 of file UUID.cpp.

Member Data Documentation

◆ m_UUID

std::array<Byte, 16> cUUID::m_UUID
private

Binary UUID stored big-endian.

Definition at line 64 of file UUID.h.


The documentation for this class was generated from the following files: