aboutsummaryrefslogtreecommitdiff
path: root/source/Uid.hpp
diff options
context:
space:
mode:
authorhnOsmium0001 <[email protected]>2022-04-18 20:18:09 -0700
committerhnOsmium0001 <[email protected]>2022-04-18 20:59:31 -0700
commitf77e73c01a15426bcc6e3d7fe5826d2a741fed38 (patch)
tree91330f87041a2b8a484b06a3c747a12370bd7034 /source/Uid.hpp
parent4b57fe1fb1401bab9439a639bd842ca61386fe22 (diff)
Add Uid for IresObject
Diffstat (limited to 'source/Uid.hpp')
-rw-r--r--source/Uid.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/Uid.hpp b/source/Uid.hpp
new file mode 100644
index 0000000..a076533
--- /dev/null
+++ b/source/Uid.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+#include "Utils.hpp"
+
+#include <rapidjson/fwd.h>
+#include <cstdint>
+#include <functional>
+
+struct Uid {
+ uint64_t upper = 0;
+ uint64_t lower = 0;
+
+ static Uid Create();
+
+ bool IsNull() const;
+
+ void Read(const rapidjson::Value& value);
+ void WriteInto(rapidjson::Value& value, rapidjson::Document& root);
+ rapidjson::Value Write(rapidjson::Document& root);
+
+ auto operator<=>(const Uid&) const = default;
+};
+
+template <>
+struct std::hash<Uid> {
+ size_t operator()(const Uid& uid) const {
+ size_t hash = 0;
+ Utils::HashCombine(hash, uid.upper);
+ Utils::HashCombine(hash, uid.lower);
+ return hash;
+ }
+};