aboutsummaryrefslogtreecommitdiff
path: root/core/src/Utils/IO/UuidIntegration.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Utils/IO/UuidIntegration.hpp')
-rw-r--r--core/src/Utils/IO/UuidIntegration.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/src/Utils/IO/UuidIntegration.hpp b/core/src/Utils/IO/UuidIntegration.hpp
new file mode 100644
index 0000000..202e021
--- /dev/null
+++ b/core/src/Utils/IO/UuidIntegration.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "Utils/IO/DataStream.hpp"
+
+#include <uuid/uuid.h>
+#include <cstddef>
+#include <cstdint>
+#include <iterator>
+
+void ReadFromDataStream(DataStream& s, uuids::uuid& uuid)
+{
+ uint8_t buffer[16];
+ s.ReadBytes(16, buffer);
+
+ uuid = uuids::uuid(gsl::span<uint8_t, 16>{ buffer });
+}
+
+void WriteToDataStream(DataStream& s, const uuids::uuid& uuid)
+{
+ auto gslSpan = uuid.as_bytes();
+ s.WriteBytes(gslSpan.size(), gslSpan.data());
+}