21 char* envv = getenv(
"POOL_GUID_TIME");
23 envv = getenv(
"POOL_GUID_RANDOM");
37 ::uuid_generate_time(me_);
43 unsigned int *d1 = (
unsigned int*)me_;
44 unsigned short *d2 = (
unsigned short*)(me_ + 4);
45 unsigned short *d3 = (
unsigned short*)(me_ + 6);
49 for (
unsigned int i = 0; i < 8; i++) {
50 guid.m_data4[i] = me_[i + 8];
56 if (sv.size() != 36) {
61 if (sv[8] !=
'-' || sv[13] !=
'-' || sv[18] !=
'-' || sv[23] !=
'-') {
66 for (
size_t i = 0; i < 36; ++i) {
68 if (i == 8 || i == 13 || i == 18 || i == 23) {
74 if (!((c >=
'0' && c <=
'9') || (c >=
'a' && c <=
'f') || (c >=
'A' && c <=
'F'))) {
98 static const char*
const fmt_Guid =
"%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX";
108 os.write(buff.data(), buff.size());
std::ostream & operator<<(std::ostream &os, const Guid &rhs)
This file contains the class definition for the Guid class (migrated from POOL).
static constexpr int stringSize()
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
constexpr void fromString(std::string_view s)
Automatic conversion from string representation.
static const Guid & null() noexcept
NULL-Guid: static class method.
bool operator==(const Guid &) const =default
static void create(Guid &guid, GuidGenMethod method=GuidGenDefault)
Create a new Guid default method is currently Random, can be changed by param, API or environment.
constexpr Guid::string to_fixed_string(bool uppercase=true) const
std::array< unsigned char, 8 > m_data4
constexpr Guid()
Standard constructor.
constexpr void setToNull() noexcept
static GuidGenMethod initGuidGenMethod()
Checks for POOL_GUID_TIME or POOL_GUID_RANDOM env variables.
static const GuidGenMethod m_guidGenMethod
void fromStringFallBack(const std::string &)
static bool isGuid(std::string_view) noexcept
static const char *const fmt_Guid
static const offline_poolCopy_v5::Guid clid_null(std::string("00000000-0000-0000-0000-000000000000"))