libecs-cpp 2.1.0
Entity Component System library in C++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ecs::Uuid Class Reference

A 128-bit random identifier in the standard version 4 text form (for example "550e8400-e29b-41d4-a716-446655440000"). More...

#include <Uuid.hpp>

Public Member Functions

 Uuid ()
 Generates a new random identifier.
 
 Uuid (const std::string &id)
 Parses the canonical 36-character text form, in either letter case and of any version.
 
std::string Get () const
 Returns the canonical lowercase 36-character text form.
 

Detailed Description

A 128-bit random identifier in the standard version 4 text form (for example "550e8400-e29b-41d4-a716-446655440000").

The layout is the same in every build: two 64-bit halves, 16 bytes in total.

Constructor & Destructor Documentation

◆ Uuid() [1/2]

ecs::Uuid::Uuid ( )

Generates a new random identifier.

Safe to call from any number of threads at once. Each thread has its own independently seeded generator, so no lock is taken. The identifiers are unique in practice but are not cryptographically unpredictable; do not use them as secrets.

◆ Uuid() [2/2]

ecs::Uuid::Uuid ( const std::string &  id)

Parses the canonical 36-character text form, in either letter case and of any version.

The text is not trimmed.

Parameters
idthe text to parse
Exceptions
std::runtime_errorif the text is empty, is not 36 characters long, or has a character that does not belong at its position

Member Function Documentation

◆ Get()

std::string ecs::Uuid::Get ( ) const

Returns the canonical lowercase 36-character text form.


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