libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_uuid.h File Reference

Go to the source code of this file.

Data Structures

struct  GblUuid
 

Macros

#define GBL_UUID_BYTE_COUNT
 
#define GBL_UUID_NODE_COUNT
 
#define GBL_UUID_STRING_SIZE
 
#define GBL_UUID_STRING_LENGTH
 

Functions

GblBool GblUuid_isNil (const GblUuid *pSelf)
 
int GblUuid_compare (const GblUuid *pSelf, const GblUuid *pOther)
 
unsigned GblUuid_version (const GblUuid *pSelf)
 

Detailed Description

GblUuid generator, stringifier, validator, etc.

LibGimbal provides basic UUID functionality by allowing you to deserialize existing UUIDs from strings, generate new version 4 UUIDs, serialize UUIDs, and compare two UUIDs, based on RFC 4122.

Todo:
  • fix reliance on apparently determinsitic random mechanism
  • GblVariant support, stored as a GblRef*?
Author
2023 Falco Girgis

Definition in file gimbal_uuid.h.

Macro Definition Documentation

◆ GBL_UUID_BYTE_COUNT

#define GBL_UUID_BYTE_COUNT

Total number of bytes to representa a UUID, per RFC 4122.

Definition at line 22 of file gimbal_uuid.h.

◆ GBL_UUID_NODE_COUNT

#define GBL_UUID_NODE_COUNT

Number of node bytes in a UUID, per RFC 4122.

Definition at line 23 of file gimbal_uuid.h.

◆ GBL_UUID_STRING_SIZE

#define GBL_UUID_STRING_SIZE

Byte size of a string needed to represent a UUID, including NULL terminator.

Definition at line 24 of file gimbal_uuid.h.

◆ GBL_UUID_STRING_LENGTH

#define GBL_UUID_STRING_LENGTH

Length of string needed to represent a UUID, excluding NULL terminator.

Definition at line 25 of file gimbal_uuid.h.

Function Documentation

◆ GblUuid_isNil()

GblBool GblUuid_isNil ( const GblUuid pSelf)

Returns true if the given UUID is equal to the NIL UUID, per RFC 4122 (all zeroes),.

Throws an error if pSelf is invalid.

Parameters
pSelfpointer to a GblUuid
Returns
whether the given UUID is nil or not

◆ GblUuid_compare()

int GblUuid_compare ( const GblUuid pSelf,
const GblUuid pOther 
)

Lexicographically Compares the given UUID to another, returning 0 if equal, -1 if less than, or 1 if greater than/.

Errors are thrown if either argument is invalid.

Parameters
pSelfpointer to a GblUuid
pOtherpointer to another GblUuid
Returns
0, -1, or 1

◆ GblUuid_version()

unsigned GblUuid_version ( const GblUuid pSelf)

Returns the UUID version type, according to RFC 4122.

Throws an error if the given pointer is invalid.

Parameters
pSelfpointer to a GblUuid
Returns
UUID version