mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
mal_toolkit::uuid::UUID Class Reference

UUIDv4 (random 128-bits) RFC-4122. More...

#include "uuid.hpp"

Collaboration diagram for mal_toolkit::uuid::UUID:
[legend]

Public Member Functions

 UUID ()
 Default constructor.
 
 UUID (const UUID &other)
 
 UUID (__m128i uuid)
 Constructs an UUID from a 128-bits unsigned int.
 
 UUID (uint64_t x, uint64_t y)
 Constructs an UUID from two 64-bit integers.
 
 UUID (const uint8_t *bytes)
 Constructs an UUID from a byte array.
 
 UUID (const std::string &bytes)
 Constructs an UUID from a byte string.
 
void fromStr (const char *raw)
 
UUIDoperator= (const UUID &other)
 Assignment operator.
 
std::string bytes () const
 Serializes the UUID to a byte string (16 bytes).
 
void bytes (std::string &out) const
 
void bytes (char *bytes) const
 
std::string str () const
 Converts the UUID to its string representation.
 
void str (std::string &s) const
 
void str (char *res) const
 
size_t hash () const
 

Static Public Member Functions

static UUID fromStrFactory (const std::string &s)
 Static factory to parse an UUID from its string representation.
 
static UUID fromStrFactory (const char *raw)
 

Private Attributes

uint8_t data [16]
 

Friends

bool operator== (const UUID &lhs, const UUID &rhs)
 Equality comparison operator.
 
bool operator< (const UUID &lhs, const UUID &rhs)
 Less than comparison operator.
 
bool operator!= (const UUID &lhs, const UUID &rhs)
 
bool operator> (const UUID &lhs, const UUID &rhs)
 
bool operator<= (const UUID &lhs, const UUID &rhs)
 
bool operator>= (const UUID &lhs, const UUID &rhs)
 
std::ostream & operator<< (std::ostream &stream, const UUID &uuid)
 
std::istream & operator>> (std::istream &stream, UUID &uuid)
 

Detailed Description

UUIDv4 (random 128-bits) RFC-4122.

Definition at line 105 of file uuid.hpp.

Constructor & Destructor Documentation

◆ UUID() [1/6]

mal_toolkit::uuid::UUID::UUID ( )
inline

Default constructor.

Definition at line 111 of file uuid.hpp.

Here is the caller graph for this function:

◆ UUID() [2/6]

mal_toolkit::uuid::UUID::UUID ( const UUID & other)
inline

Definition at line 113 of file uuid.hpp.

◆ UUID() [3/6]

mal_toolkit::uuid::UUID::UUID ( __m128i uuid)
inline

Constructs an UUID from a 128-bits unsigned int.

Definition at line 122 of file uuid.hpp.

◆ UUID() [4/6]

mal_toolkit::uuid::UUID::UUID ( uint64_t x,
uint64_t y )
inline

Constructs an UUID from two 64-bit integers.

Definition at line 127 of file uuid.hpp.

◆ UUID() [5/6]

mal_toolkit::uuid::UUID::UUID ( const uint8_t * bytes)
inline

Constructs an UUID from a byte array.

Definition at line 136 of file uuid.hpp.

Here is the call graph for this function:

◆ UUID() [6/6]

mal_toolkit::uuid::UUID::UUID ( const std::string & bytes)
inlineexplicit

Constructs an UUID from a byte string.

Definition at line 145 of file uuid.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ bytes() [1/3]

std::string mal_toolkit::uuid::UUID::bytes ( ) const
inline

Serializes the UUID to a byte string (16 bytes).

Definition at line 206 of file uuid.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bytes() [2/3]

void mal_toolkit::uuid::UUID::bytes ( char * bytes) const
inline

Definition at line 219 of file uuid.hpp.

Here is the call graph for this function:

◆ bytes() [3/3]

void mal_toolkit::uuid::UUID::bytes ( std::string & out) const
inline

Definition at line 213 of file uuid.hpp.

Here is the call graph for this function:

◆ fromStr()

void mal_toolkit::uuid::UUID::fromStr ( const char * raw)
inline

Definition at line 158 of file uuid.hpp.

Here is the call graph for this function:

◆ fromStrFactory() [1/2]

static UUID mal_toolkit::uuid::UUID::fromStrFactory ( const char * raw)
inlinestatic

Definition at line 156 of file uuid.hpp.

Here is the call graph for this function:

◆ fromStrFactory() [2/2]

static UUID mal_toolkit::uuid::UUID::fromStrFactory ( const std::string & s)
inlinestatic

Static factory to parse an UUID from its string representation.

Definition at line 154 of file uuid.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash()

size_t mal_toolkit::uuid::UUID::hash ( ) const
inline

Definition at line 257 of file uuid.hpp.

◆ operator=()

UUID & mal_toolkit::uuid::UUID::operator= ( const UUID & other)
inline

Assignment operator.

Definition at line 163 of file uuid.hpp.

◆ str() [1/3]

std::string mal_toolkit::uuid::UUID::str ( ) const
inline

Converts the UUID to its string representation.

Definition at line 228 of file uuid.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ str() [2/3]

void mal_toolkit::uuid::UUID::str ( char * res) const
inline

Definition at line 241 of file uuid.hpp.

Here is the call graph for this function:

◆ str() [3/3]

void mal_toolkit::uuid::UUID::str ( std::string & s) const
inline

Definition at line 235 of file uuid.hpp.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const UUID & lhs,
const UUID & rhs )
friend

Definition at line 198 of file uuid.hpp.

◆ operator<

bool operator< ( const UUID & lhs,
const UUID & rhs )
friend

Less than comparison operator.

Definition at line 189 of file uuid.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const UUID & uuid )
friend

Definition at line 247 of file uuid.hpp.

◆ operator<=

bool operator<= ( const UUID & lhs,
const UUID & rhs )
friend

Definition at line 200 of file uuid.hpp.

◆ operator==

bool operator== ( const UUID & lhs,
const UUID & rhs )
friend

Equality comparison operator.

Definition at line 177 of file uuid.hpp.

◆ operator>

bool operator> ( const UUID & lhs,
const UUID & rhs )
friend

Definition at line 199 of file uuid.hpp.

◆ operator>=

bool operator>= ( const UUID & lhs,
const UUID & rhs )
friend

Definition at line 201 of file uuid.hpp.

◆ operator>>

std::istream & operator>> ( std::istream & stream,
UUID & uuid )
friend

Definition at line 249 of file uuid.hpp.

Member Data Documentation

◆ data

uint8_t mal_toolkit::uuid::UUID::data[16]
private

Definition at line 260 of file uuid.hpp.


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