galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Guid.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_UTILS_GUID_HPP_
9#define GALAXY_UTILS_GUID_HPP_
10
11#include <string>
12
13namespace galaxy
14{
15 namespace utils
16 {
21 class Guid final
22 {
23 public:
27 Guid();
28
32 Guid(Guid&&) noexcept;
33
37 [[maybe_unused]]
38 Guid& operator=(Guid&&) noexcept;
39
43 Guid(const Guid&) noexcept;
44
48 [[maybe_unused]]
49 Guid& operator=(const Guid&) noexcept;
50
54 ~Guid() noexcept;
55
61 [[nodiscard]]
62 const std::string& to_string() const noexcept;
63
71 [[nodiscard]]
72 bool operator==(const Guid& rhs) noexcept;
73
81 [[nodiscard]]
82 bool operator!=(const Guid& rhs) noexcept;
83
84 private:
88 std::string m_id;
89 };
90 } // namespace utils
91} // namespace galaxy
92
93namespace std
94{
98 template<>
99 struct hash<galaxy::utils::Guid>
100 {
104 std::size_t operator()(const galaxy::utils::Guid& guid) const
105 {
106 return hash<std::string>()(guid.to_string());
107 }
108 };
109} // namespace std
110
111#endif
Contains a 128bit randomly generated GUID, along with helper functions.
Definition Guid.hpp:22
bool operator!=(const Guid &rhs) noexcept
Inequality comparison.
Definition Guid.cpp:87
Guid()
Constructor.
Definition Guid.cpp:20
Guid & operator=(Guid &&) noexcept
Move assignment operator.
Definition Guid.cpp:48
const std::string & to_string() const noexcept
Get the GUID as a string.
Definition Guid.cpp:77
~Guid() noexcept
Destructor.
Definition Guid.cpp:73
std::string m_id
Guid.
Definition Guid.hpp:88
bool operator==(const Guid &rhs) noexcept
Equality comparison.
Definition Guid.cpp:82
Timer.hpp galaxy.
Definition Async.hpp:17
STL namespace.
std::size_t operator()(const galaxy::utils::Guid &guid) const
Hash specialization function for Guid.
Definition Guid.hpp:104