From f24107368fa47f911f4491f644ff3755525c91e1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 19 Aug 2017 20:20:51 +0500 Subject: 2017-08-19 --- old/network/Stream.hpp | 107 ------------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 old/network/Stream.hpp (limited to 'old/network/Stream.hpp') diff --git a/old/network/Stream.hpp b/old/network/Stream.hpp deleted file mode 100644 index bf75bdb..0000000 --- a/old/network/Stream.hpp +++ /dev/null @@ -1,107 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -#include "Socket.hpp" -#include "../Vector.hpp" -#include "../Utility.hpp" - -class Stream { -public: - virtual ~Stream() {}; -}; - -class StreamInput : Stream { - virtual void ReadData(unsigned char *buffPtr, size_t buffLen) = 0; -public: - virtual ~StreamInput() = default; - bool ReadBool(); - signed char ReadByte(); - unsigned char ReadUByte(); - short ReadShort(); - unsigned short ReadUShort(); - int ReadInt(); - long long ReadLong(); - float ReadFloat(); - double ReadDouble(); - std::string ReadString(); - std::string ReadChat(); - int ReadVarInt(); - long long ReadVarLong(); - std::vector ReadEntityMetadata(); - std::vector ReadSlot(); - std::vector ReadNbtTag(); - Vector ReadPosition(); - unsigned char ReadAngle(); - std::vector ReadUuid(); - std::vector ReadByteArray(size_t arrLength); -}; - -class StreamOutput : Stream { - virtual void WriteData(unsigned char *buffPtr, size_t buffLen) = 0; -public: - virtual ~StreamOutput() = default; - void WriteBool(bool value); - void WriteByte(signed char value); - void WriteUByte(unsigned char value); - void WriteShort(short value); - void WriteUShort(unsigned short value); - void WriteInt(int value); - void WriteLong(long long value); - void WriteFloat(float value); - void WriteDouble(double value); - void WriteString(std::string value); - void WriteChat(std::string value); - void WriteVarInt(int value); - void WriteVarLong(long long value); - void WriteEntityMetadata(std::vector value); - void WriteSlot(std::vector value); - void WriteNbtTag(std::vector value); - void WritePosition(Vector value); - void WriteAngle(unsigned char value); - void WriteUuid(std::vector value); - void WriteByteArray(std::vector value); -}; - -class StreamBuffer : public StreamInput, public StreamOutput { - unsigned char *buffer; - unsigned char *bufferPtr; - size_t bufferLength; - - void ReadData(unsigned char *buffPtr, size_t buffLen) override; - void WriteData(unsigned char *buffPtr, size_t buffLen) override; - -public: - StreamBuffer(unsigned char *data, size_t dataLen); - StreamBuffer(size_t bufferLen); - ~StreamBuffer(); - - std::vector GetBuffer(); -}; - -class StreamCounter : public StreamOutput { - void WriteData(unsigned char *buffPtr, size_t buffLen) override; - - size_t size; -public: - StreamCounter(size_t initialSize = 0); - ~StreamCounter(); - - size_t GetCountedSize(); -}; - -class StreamSocket : public StreamInput, public StreamOutput { - Socket *socket; - void ReadData(unsigned char *buffPtr, size_t buffLen) override; - void WriteData(unsigned char *buffPtr, size_t buffLen) override; -public: - StreamSocket(Socket *socketPtr); - ~StreamSocket() = default; -}; \ No newline at end of file -- cgit v1.2.3