#pragma once #include "binary-serializer.hpp" #include #include #include namespace floormat::Serialize { template concept char_sequence = requires(T& x, const T& cx) { requires std::same_as; requires std::same_as; requires std::forward_iterator; requires std::forward_iterator; requires std::same_as>; requires std::same_as>; }; template concept string_input_iterator = requires(It it) { requires std::forward_iterator; requires std::is_same_v>; }; template struct binary_reader final { template explicit constexpr binary_reader(const Seq& seq) noexcept; constexpr binary_reader(It begin, It end) noexcept; constexpr void assert_end() noexcept(false); constexpr size_t bytes_read() const noexcept { return num_bytes_read; } template constexpr T read() noexcept(false); template constexpr std::array read() noexcept(false); template constexpr auto read_asciiz_string() noexcept(false); binary_reader(binary_reader&&) noexcept = default; binary_reader& operator=(binary_reader&&) noexcept = default; binary_reader(const binary_reader&) = delete; binary_reader& operator=(const binary_reader&) = delete; constexpr char peek() const; private: size_t num_bytes_read = 0; It it, end; }; template constexpr void operator<<(T& x, binary_reader& reader) noexcept(false); template constexpr void operator>>(binary_reader& reader, T& x) noexcept(false); template binary_reader(It&& begin, It&& end) -> binary_reader>; template binary_reader(const Array& array) -> binary_reader>; } // namespace floormat::Serialize