diff options
Diffstat (limited to 'core/src/Utils/IO/TslArrayIntegration.hpp')
-rw-r--r-- | core/src/Utils/IO/TslArrayIntegration.hpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/core/src/Utils/IO/TslArrayIntegration.hpp b/core/src/Utils/IO/TslArrayIntegration.hpp deleted file mode 100644 index af1197c..0000000 --- a/core/src/Utils/IO/TslArrayIntegration.hpp +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "Utils/IO/DataStream.hpp" -#include "Utils/IO/Helper.hpp" -#include "Utils/IO/StringIntegration.hpp" - -#include <tsl/array_map.h> -#include <tsl/array_set.h> -#include <string> -#include <type_traits> - -// TODO support custom key types - -namespace DataStreamAdapters { -template <class TAdapter = void> -struct TslArrayMap -{ - template <class TValue> - static void ReadFromDataStream(InputDataStream& stream, tsl::array_map<char, TValue>& map) - { - static_assert(std::is_default_constructible_v<TValue>); - static_assert(std::is_move_constructible_v<TValue>); - - uint64_t size; - stream.Read(size); - map.reserve(size); - - for (uint64_t i = 0; i < size; ++i) { - std::string key; - stream.ReadObjectAdapted<DataStreamAdapters::String>(key); - - TValue value; - ReadHelper<TAdapter>(stream, value); - - map.insert(key, std::move(value)); - } - } - - template <class TValue> - static void WriteToDataStream(OutputDataStream& stream, const tsl::array_map<char, TValue>& map) - { - stream.Write((uint64_t)map.size()); - - for (auto it = map.begin(); it != map.end(); ++it) { - stream.WriteObjectAdapted<DataStreamAdapters::StringView>(it.key_sv()); - WriteHelper<TAdapter>(stream, it.value()); - } - } -}; -} // namespace DataStreamAdapters |