summaryrefslogtreecommitdiffstats
path: root/core/io/buffer.hh
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
committeruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
commitf40d09cb8f712e87691af4912f3630d92d692779 (patch)
tree7ac3a4168ff722689372fd489c6f94d0a2546e8f /core/io/buffer.hh
parent8bcbd2729388edc63c82d77d314b583af1447c49 (diff)
downloadvoxelius-f40d09cb8f712e87691af4912f3630d92d692779.tar.bz2
voxelius-f40d09cb8f712e87691af4912f3630d92d692779.zip
Shuffle stuff around
- Use the new and improved hierarchy I figured out when making Prospero chat - Re-add NSIS scripts, again from Prospero - Update most build and utility scripts with their most recent versions
Diffstat (limited to 'core/io/buffer.hh')
-rw-r--r--core/io/buffer.hh88
1 files changed, 0 insertions, 88 deletions
diff --git a/core/io/buffer.hh b/core/io/buffer.hh
deleted file mode 100644
index 5f1ab66..0000000
--- a/core/io/buffer.hh
+++ /dev/null
@@ -1,88 +0,0 @@
-namespace io
-{
-class ReadBuffer final {
-public:
- ReadBuffer(void) = default;
- explicit ReadBuffer(const ReadBuffer& other);
- explicit ReadBuffer(const void* data, std::size_t size);
- explicit ReadBuffer(const ENetPacket* packet);
- explicit ReadBuffer(PHYSFS_File* file);
- virtual ~ReadBuffer(void) = default;
-
- std::size_t size(void) const;
- const std::byte* data(void) const;
-
- void reset(const void* data, std::size_t size);
- void reset(const ENetPacket* packet);
- void reset(PHYSFS_File* file);
-
- constexpr void rewind(void);
- constexpr bool is_ended(void) const;
-
- void read(void* buffer, std::size_t size);
-
- template<typename T>
- T read(void);
-
- template<typename T>
- ReadBuffer& operator>>(T& value);
-
-private:
- std::vector<std::byte> m_vector;
- std::size_t m_position;
-};
-} // namespace io
-
-namespace io
-{
-class WriteBuffer final {
-public:
- WriteBuffer(void) = default;
- explicit WriteBuffer(const WriteBuffer& other);
- virtual ~WriteBuffer(void) = default;
-
- std::size_t size(void) const;
- const std::byte* data(void) const;
-
- void reset(void);
-
- void write(const WriteBuffer& other);
- void write(const void* data, std::size_t size);
-
- template<typename T>
- void write(const T value);
-
- template<typename T>
- WriteBuffer& operator<<(const T value);
-
- PHYSFS_File* to_file(const std::string& path, bool append = false) const;
- ENetPacket* to_packet(enet_uint32 flags = ENET_PACKET_FLAG_RELIABLE) const;
-
-private:
- std::vector<std::byte> m_vector;
-};
-} // namespace io
-
-constexpr void io::ReadBuffer::rewind(void)
-{
- m_position = 0;
-}
-
-constexpr bool io::ReadBuffer::is_ended(void) const
-{
- return m_position >= m_vector.size();
-}
-
-template<typename T>
-io::ReadBuffer& io::ReadBuffer::operator>>(T& value)
-{
- value = read<T>();
- return *this;
-}
-
-template<typename T>
-io::WriteBuffer& io::WriteBuffer::operator<<(const T value)
-{
- write<T>(value);
- return *this;
-}