diff options
author | rtk0c <[email protected]> | 2021-08-15 17:14:06 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-08-15 17:14:06 -0700 |
commit | c51a61c0f0de65a3e64f589816a56f21ed4e8528 (patch) | |
tree | ba1737b64d5307f9dedc934d9398297d3fb8ee82 /core/src/Utils/IO/UuidIntegration.hpp | |
parent | 64a6dbcfdb89a5f57d93d47a2be0c741dda4662d (diff) |
Initial work on data streams
Diffstat (limited to 'core/src/Utils/IO/UuidIntegration.hpp')
-rw-r--r-- | core/src/Utils/IO/UuidIntegration.hpp | 22 |
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()); +} |