summaryrefslogtreecommitdiffhomepage
path: root/Private/CFKit/GUIDWrapper.hpp
blob: 15e59d1cd0c1a26c44cb31b7a2ac77df8b228eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 *	========================================================
 *
 *	hCore
 * 	Copyright 2024 Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#pragma once

#include <NewKit/Defines.hpp>
#include <NewKit/Ref.hpp>
#include <NewKit/Stream.hpp>

/* GUID for C++ Components */

#define NULL_GUID "XRN:{........-....-M...-N...-............}"

// eXtensible Resource Information
namespace hCore::XRN
{
union GUIDSequence {
    alignas(8) UShort u8[16];
    alignas(8) UShort u16[8];
    alignas(8) UInt u32[4];
    alignas(8) ULong u64[2];

    struct
    {
        alignas(8) UInt m_Ms1;
        UShort m_Ms2;
        UShort m_Ms3;
        UChar m_Ms4[8];
    };
};

class GUID final
{
  public:
    explicit GUID() = default;
    ~GUID() = default;

  public:
    GUID &operator=(const GUID &) = default;
    GUID(const GUID &) = default;

  public:
    GUIDSequence &operator->() noexcept
    {
        return m_UUID;
    }

    GUIDSequence &Leak() noexcept
    {
        return m_UUID;
    }

  private:
    GUIDSequence m_UUID;
};
} // namespace hCore::XRN