From b1d4b3bb96629b3624e8328d7b1a0bce5333bb7d Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 21 Mar 2015 13:00:20 +0100 Subject: Unified cByteBuffer types. cByteBuffer now reads and writes any of the [U]Int types. --- src/ByteBuffer.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/ByteBuffer.h') diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h index f480ad557..0e50c948a 100644 --- a/src/ByteBuffer.h +++ b/src/ByteBuffer.h @@ -52,13 +52,14 @@ public: bool CanWriteBytes(size_t a_Count) const; // Read the specified datatype and advance the read pointer; return true if successfully read: - bool ReadChar (char & a_Value); - bool ReadByte (unsigned char & a_Value); - bool ReadBEShort (short & a_Value); + bool ReadBEInt8 (Int8 & a_Value); + bool ReadBEInt16 (Int16 & a_Value); + bool ReadBEInt32 (Int32 & a_Value); + bool ReadBEInt64 (Int64 & a_Value); + bool ReadBEUInt8 (UInt8 & a_Value); bool ReadBEUInt16 (UInt16 & a_Value); - bool ReadBEInt (int & a_Value); bool ReadBEUInt32 (UInt32 & a_Value); - bool ReadBEInt64 (Int64 & a_Value); + bool ReadBEUInt64 (UInt64 & a_Value); bool ReadBEFloat (float & a_Value); bool ReadBEDouble (double & a_Value); bool ReadBool (bool & a_Value); @@ -81,19 +82,21 @@ public: } // Write the specified datatype; return true if successfully written - bool WriteChar (char a_Value); - bool WriteByte (unsigned char a_Value); - bool WriteBEShort (short a_Value); - bool WriteBEUShort (unsigned short a_Value); - bool WriteBEInt (int a_Value); + bool WriteBEInt8 (Int8 a_Value); + bool WriteBEInt16 (Int16 a_Value); + bool WriteBEInt32 (Int32 a_Value); bool WriteBEInt64 (Int64 a_Value); + bool WriteBEUInt8 (UInt8 a_Value); + bool WriteBEUInt16 (UInt16 a_Value); + bool WriteBEUInt32 (UInt32 a_Value); + bool WriteBEUInt64 (UInt64 a_Value); bool WriteBEFloat (float a_Value); bool WriteBEDouble (double a_Value); bool WriteBool (bool a_Value); bool WriteVarInt (UInt32 a_Value); bool WriteVarUTF8String (const AString & a_Value); // string length as VarInt, then string as UTF-8 - bool WriteLEInt (int a_Value); - bool WritePosition (int a_BlockX, int a_BlockY, int a_BlockZ); + bool WriteLEInt32 (Int32 a_Value); + bool WritePosition (Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ); /** Reads a_Count bytes into a_Buffer; returns true if successful */ bool ReadBuf(void * a_Buffer, size_t a_Count); -- cgit v1.2.3