Open 3D Engine AzCore API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
AZ::Uuid Struct Reference

Public Types

enum  Variant {
  VAR_UNKNOWN = -1, VAR_NCS = 0, VAR_RFC_4122 = 2, VAR_MICROSOFT = 6,
  VAR_RESERVED = 7
}
 
enum  Version {
  VER_UNKNOWN = -1, VER_TIME = 1, VER_DCE = 2, VER_NAME_MD5 = 3,
  VER_RANDOM = 4, VER_NAME_SHA1 = 5
}
 
typedef unsigned char * iterator
 

Public Member Functions

 Uuid ()=default
 32 Uuid + 4 dashes + 2 brackets + 1 terminate
 
 Uuid (const char *string, size_t stringLength=0)
 
bool IsNull () const
 
Variant GetVariant () const
 
Version GetVersion () const
 
int ToString (char *output, int outputSize, bool isBrackets=true, bool isDashes=true) const
 
template<size_t SizeT>
int ToString (char(&output)[SizeT], bool isBrackets=true, bool isDashes=true) const
 
template<class StringType >
StringType ToString (bool isBrackets=true, bool isDashes=true) const
 The only requirements is that StringType can be constructed from char* and it can copied.
 
template<class StringType >
void ToString (StringType &result, bool isBrackets=true, bool isDashes=true) const
 For inplace version we require resize, data and size members.
 
AZ_MATH_INLINE bool operator== (const Uuid &rhs) const
 
AZ_MATH_INLINE bool operator!= (const Uuid &rhs) const
 
bool operator< (const Uuid &rhs) const
 
bool operator> (const Uuid &rhs) const
 
bool operator<= (const Uuid &rhs) const
 
bool operator>= (const Uuid &rhs) const
 
Uuid operator+ (const Uuid &rhs) const
 Adding two UUID generates SHA1 Uuid based on the data of both uuids.
 
AZ_MATH_INLINE Uuidoperator+= (const Uuid &rhs)
 
AZ_MATH_INLINE iterator begin ()
 
AZ_MATH_INLINE iterator end ()
 
AZ_MATH_INLINE const_iterator begin () const
 
AZ_MATH_INLINE const_iterator end () const
 
size_t GetHash () const
 

Static Public Member Functions

static Uuid CreateNull ()
 
static Uuid Create ()
 Create a Uuid (VAR_RFC_4122,VER_RANDOM)
 
static Uuid CreateString (const char *string, size_t stringLength=0)
 
static Uuid CreateStringSkipWarnings (const char *string, size_t stringLength, bool skipWarnings)
 
static Uuid CreateStringPermissive (const char *string, size_t stringLength=0, bool skipWarnings=true)
 
static Uuid CreateRandom ()
 
static Uuid CreateName (const char *name)
 Create a UUID based on a string name (sha1)
 
static Uuid CreateData (const void *data, size_t dataSize)
 Create a UUID based on a byte stream (sha1)
 

Public Attributes

const typedef unsigned char * const_iterator
 
unsigned char data [16]
 

Static Public Attributes

static constexpr int ValidUuidStringLength = 32
 
static const size_t MaxStringBuffer = 39
 Number of characters (data only, no extra formatting) in a valid UUID string.
 

Member Function Documentation

◆ CreateString()

static Uuid AZ::Uuid::CreateString ( const char *  string,
size_t  stringLength = 0 
)
static

This function accepts the following formats, if format is invalid it returns a NULL UUID. 0123456789abcdef0123456789abcdef 01234567-89ab-cdef-0123-456789abcdef {01234567-89ab-cdef-0123-456789abcdef} {0123456789abcdef0123456789abcdef}

Parameters
stringpointer to a string buffer
stringLengthif zero 'string' pointer must be null terminated so we can compute it's length, otherwise you can provide the length of the buffer.

◆ ToString() [1/2]

int AZ::Uuid::ToString ( char *  output,
int  outputSize,
bool  isBrackets = true,
bool  isDashes = true 
) const

Outputs to a string in one of the following formats 0123456789abcdef0123456789abcdef 01234567-89ab-cdef-0123-456789abcdef {01234567-89ab-cdef-0123-456789abcdef} {0123456789abcdef0123456789abcdef}

Returns
if positive number of characters written to the buffer (including terminate) if negative the the number of characters required for output (nothing is writen to the output), including terminating character.

◆ ToString() [2/2]

template<size_t SizeT>
int AZ::Uuid::ToString ( char(&)  output[SizeT],
bool  isBrackets = true,
bool  isDashes = true 
) const
inline

Outputs to a string in one of the following formats 0123456789abcdef0123456789abcdef 01234567-89ab-cdef-0123-456789abcdef {01234567-89ab-cdef-0123-456789abcdef} {0123456789abcdef0123456789abcdef}

Returns
if positive number of characters written to the buffer (including terminate) if negative the the number of characters required for output (nothing is writen to the output), including terminating character.

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