diff options
Diffstat (limited to 'core/src/Utils/IO/StringIntegration.hpp')
-rw-r--r-- | core/src/Utils/IO/StringIntegration.hpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/core/src/Utils/IO/StringIntegration.hpp b/core/src/Utils/IO/StringIntegration.hpp index 35b1660..a90ea98 100644 --- a/core/src/Utils/IO/StringIntegration.hpp +++ b/core/src/Utils/IO/StringIntegration.hpp @@ -4,26 +4,32 @@ #include <string> #include <string_view> -namespace DataStreamIntegrations { -void ReadFromDataStream(DataStream& s, std::string& str) +namespace DataStreamAdapters { +struct String { - uint64_t size; - s.Read(size); + void ReadFromDataStream(DataStream& s, std::string& str) + { + uint64_t size; + s.Read(size); - str = {}; - str.reserve(size); - s.ReadBytes(size, std::back_inserter(str)); -} + str = {}; + str.reserve(size); + s.ReadBytes(size, std::back_inserter(str)); + } -void WriteToDataStream(DataStream& s, const std::string& str) -{ - s.Write((uint64_t)str.size()); - s.WriteBytes(str.size(), str.data()); -} + void WriteToDataStream(DataStream& s, const std::string& str) + { + s.Write((uint64_t)str.size()); + s.WriteBytes(str.size(), str.data()); + } +}; -void WriteToDataStream(DataStream& s, const std::string_view& str) +struct StringView { - s.Write((uint64_t)str.size()); - s.WriteBytes(str.size(), str.data()); -} -} // namespace DataStreamIntegrations + void WriteToDataStream(DataStream& s, const std::string_view& str) + { + s.Write((uint64_t)str.size()); + s.WriteBytes(str.size(), str.data()); + } +}; +} // namespace DataStreamAdapters |