Fawkes API  Fawkes Development Version
fawkes::Uuid Class Reference

A convenience class for universally unique identifiers (UUIDs). More...

Public Member Functions

 Uuid () noexcept
 Generate a new Uuid. More...
 
 ~Uuid () noexcept
 Destructor, clears up the occupied storage. More...
 
 Uuid (const Uuid &other) noexcept
 Copy constructor. More...
 
 Uuid (Uuid &&other) noexcept
 Move constructor. More...
 
 Uuid (const char *string)
 Construct a Uuid from a string. More...
 
Uuidoperator= (const Uuid &other) noexcept
 Assignment operator. More...
 
Uuidoperator= (Uuid &&other) noexcept
 Move assignment operator. More...
 
std::string get_string () const
 Get the string representation of the Uuid. More...
 

Friends

bool operator< (const Uuid &uuid, const Uuid &other) noexcept
 Compare two Uuids. More...
 
bool operator== (const Uuid &uuid, const Uuid &other) noexcept
 Compare two Uuids. More...
 
bool operator!= (const Uuid &uuid, const Uuid &other) noexcept
 Compare two Uuids. More...
 

Detailed Description

A convenience class for universally unique identifiers (UUIDs).

It wraps uuid(3) to allow easier creation and deletion of UUIDs.

Definition at line 28 of file uuid.h.

Constructor & Destructor Documentation

◆ Uuid() [1/4]

fawkes::Uuid::Uuid ( )
noexcept

Generate a new Uuid.

Definition at line 34 of file uuid.cpp.

◆ ~Uuid()

fawkes::Uuid::~Uuid ( )
noexcept

Destructor, clears up the occupied storage.

Definition at line 40 of file uuid.cpp.

◆ Uuid() [2/4]

fawkes::Uuid::Uuid ( const Uuid other)
noexcept

Copy constructor.

The newly constructed Uuid is guaranteed to be the same as the source Uuid.

Parameters
otherThe Uuid to copy from

Definition at line 49 of file uuid.cpp.

◆ Uuid() [3/4]

fawkes::Uuid::Uuid ( Uuid &&  other)
noexcept

Move constructor.

This leaves the other Uuid in an undefined state. The newly constructed Uuid is guaranteed to be the same as the source Uuid.

Parameters
otherThe Uuid to move from

Definition at line 59 of file uuid.cpp.

◆ Uuid() [4/4]

fawkes::Uuid::Uuid ( const char *  string)
explicit

Construct a Uuid from a string.

Parameters
stringThe string represenation of the Uuid, of the form 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb

Definition at line 69 of file uuid.cpp.

Member Function Documentation

◆ get_string()

◆ operator=() [1/2]

Uuid & fawkes::Uuid::operator= ( const Uuid other)
noexcept

Assignment operator.

After assignment, both Uuids are guaranteed to be the same.

Parameters
otherThe Uuid to assign from
Returns
A reference to the assigned Uuid

Definition at line 83 of file uuid.cpp.

◆ operator=() [2/2]

Uuid & fawkes::Uuid::operator= ( Uuid &&  other)
noexcept

Move assignment operator.

This leaves the other Uuid in an undefined state. The assigned Uuid is guaranteed to be the same as the source Uuid.

Parameters
otherThe Uuid to assign from
Returns
A reference to the assigned Uuid

Definition at line 96 of file uuid.cpp.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Uuid uuid,
const Uuid other 
)
friend

Compare two Uuids.

Parameters
uuidThe first Uuid to compare
otherThe second Uuid to compare
Returns
True if the two Uuids are not the same

Definition at line 142 of file uuid.cpp.

◆ operator<

bool operator< ( const Uuid uuid,
const Uuid other 
)
friend

Compare two Uuids.

Parameters
uuidThe first Uuid to compare
otherThe second Uuid to compare
Returns
True if the first Uuid is smaller than the second

Definition at line 119 of file uuid.cpp.

◆ operator==

bool operator== ( const Uuid uuid,
const Uuid other 
)
friend

Compare two Uuids.

Parameters
uuidThe first Uuid to compare
otherThe second Uuid to compare
Returns
True if the two Uuids are the same

Definition at line 131 of file uuid.cpp.


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