From 87b964591c9a93146bd43e8813387392f8520337 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sun, 15 Aug 2021 21:12:35 -0700 Subject: Turn IO adapter's mechanism from function overload into structs that are given by the user --- core/src/Utils/IO/UuidIntegration.hpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'core/src/Utils/IO/UuidIntegration.hpp') diff --git a/core/src/Utils/IO/UuidIntegration.hpp b/core/src/Utils/IO/UuidIntegration.hpp index 9cba4b1..b6ca062 100644 --- a/core/src/Utils/IO/UuidIntegration.hpp +++ b/core/src/Utils/IO/UuidIntegration.hpp @@ -1,22 +1,26 @@ #pragma once -#include +#include "Utils/UUID.hpp" + #include #include #include -namespace DataStreamIntegrations { -void ReadFromDataStream(DataStream& s, uuids::uuid& uuid) +namespace DataStreamAdapters { +struct Uuid { - uint8_t buffer[16]; - s.ReadBytes(16, buffer); + void ReadFromDataStream(DataStream& s, uuids::uuid& uuid) + { + uint8_t buffer[16]; + s.ReadBytes(16, buffer); - uuid = uuids::uuid(gsl::span{ buffer }); -} + uuid = uuids::uuid(gsl::span{ buffer }); + } -void WriteToDataStream(DataStream& s, const uuids::uuid& uuid) -{ - auto gslSpan = uuid.as_bytes(); - s.WriteBytes(gslSpan.size(), gslSpan.data()); -} -} // namespace DataStreamIntegrations + void WriteToDataStream(DataStream& s, const uuids::uuid& uuid) + { + auto gslSpan = uuid.as_bytes(); + s.WriteBytes(gslSpan.size(), gslSpan.data()); + } +}; +} // namespace DataStreamAdapters -- cgit v1.2.3-70-g09d2