Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
MinecraftUUID Class Reference

MinecraftUUID compliant data holder. More...

#include <uuid.h>

Public Member Functions

 MinecraftUUID ()
 Construct a new MinecraftUUID object.
 
bool operator== (const MinecraftUUID &other)
 Equality operator.
 
std::string getFull () const
 Get the hex of the MinecraftUUID with hyphens.
 
std::string getTrimmed () const
 Get the hex of the MinecraftUUID without hyphens.
 
const std::byte * getBytes () const
 Get the raw bytes of the MinecraftUUID.
 

Static Public Member Functions

static MinecraftUUID newRandom ()
 Constructs a new random MinecraftUUID.
 
static MinecraftUUID fromUsername (const std::string &name)
 Constructs an MinecraftUUID from an username.
 
static MinecraftUUID fromHex (const std::string &hexString)
 Contructs an MinecraftUUID from an hex string.
 
static MinecraftUUID fromBytes (const std::byte *buff)
 Constructs an MinecraftUUID from the raw bytes.
 
static void loadLua (lua_State *state, const char *namespaceName)
 Loads MinecraftUUID to the lua state.
 

Detailed Description

MinecraftUUID compliant data holder.

Data holder for an RFC 4122 compliant MinecraftUUID.

Constructor & Destructor Documentation

◆ MinecraftUUID()

MinecraftUUID::MinecraftUUID ( )

Construct a new MinecraftUUID object.

In reality, just a wrapper around newRandom()

Member Function Documentation

◆ fromBytes()

MinecraftUUID MinecraftUUID::fromBytes ( const std::byte * buff)
static

Constructs an MinecraftUUID from the raw bytes.

Parameters
buffa pointer to the MinecraftUUID
Returns
MinecraftUUID the newly created MinecraftUUID

◆ fromHex()

MinecraftUUID MinecraftUUID::fromHex ( const std::string & hexString)
static

Contructs an MinecraftUUID from an hex string.

Interprets the hex string as an MinecraftUUID, whether it contains hyphens or not.

Parameters
hexStringthe string to construct from
Returns
MinecraftUUID the newly created MinecraftUUID

◆ fromUsername()

MinecraftUUID MinecraftUUID::fromUsername ( const std::string & name)
static

Constructs an MinecraftUUID from an username.

In reality, uses MD5 to generate a sequence of hex characters so that we can interpret the digested name as an MinecraftUUID. It is then a deterministic function. See more at crypto::md5Digest

Parameters
namethe name to generate from
Returns
MinecraftUUID the newly created MinecraftUUID

◆ getBytes()

const std::byte * MinecraftUUID::getBytes ( ) const

Get the raw bytes of the MinecraftUUID.

Returns
const std::byte* pointer to byte data

◆ getFull()

std::string MinecraftUUID::getFull ( ) const

Get the hex of the MinecraftUUID with hyphens.

It will resemble something such as :

constexpr std::string_view type_name()
Gets the name of the type paramater.
Definition event.h:56
Returns
std::string the hex with hyphens

◆ getTrimmed()

std::string MinecraftUUID::getTrimmed ( ) const

Get the hex of the MinecraftUUID without hyphens.

It will resemble something such as :

Returns
std::string the hex without hyphens

◆ loadLua()

void MinecraftUUID::loadLua ( lua_State * state,
const char * namespaceName )
static

Loads MinecraftUUID to the lua state.

Parameters
statethe lua state to load to
namespaceNamethe namespace to load to

◆ newRandom()

MinecraftUUID MinecraftUUID::newRandom ( )
static

Constructs a new random MinecraftUUID.

Returns
MinecraftUUID the newly created MinecraftUUID

◆ operator==()

bool MinecraftUUID::operator== ( const MinecraftUUID & other)

Equality operator.

Parameters
otherthe other member
Returns
true the members are equal
false the member are not equal

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