summaryrefslogtreecommitdiffstats
path: root/source/ByteBuffer.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-02 21:38:37 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-02 21:38:37 +0200
commit38efe73154f30200fafb2631b17106bc6935ae05 (patch)
treee2524ff0d0a14241f84569b9df65e789cd31473e /source/ByteBuffer.h
parentFixed Bug #241: (diff)
downloadcuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar.gz
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar.bz2
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar.lz
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar.xz
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.tar.zst
cuberite-38efe73154f30200fafb2631b17106bc6935ae05.zip
Diffstat (limited to '')
-rw-r--r--source/ByteBuffer.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/ByteBuffer.h b/source/ByteBuffer.h
index 68dc48cd9..c0ffed43c 100644
--- a/source/ByteBuffer.h
+++ b/source/ByteBuffer.h
@@ -45,6 +45,9 @@ public:
/// Returns true if the specified amount of bytes are available for reading
bool CanReadBytes(int a_Count) const;
+ /// Returns true if the specified amount of bytes are available for writing
+ bool CanWriteBytes(int 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);
@@ -56,13 +59,27 @@ public:
bool ReadBool (bool & a_Value);
bool ReadBEUTF16String16(AString & a_Value);
- /// Reads a_Count bytes into a_Buffer; return true if successful
+ // 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 WriteBEInt (int a_Value);
+ bool WriteBEInt64 (Int64 a_Value);
+ bool WriteBEFloat (float a_Value);
+ bool WriteBEDouble (double a_Value);
+ bool WriteBool (bool a_Value);
+ bool WriteBEUTF16String16(const AString & a_Value);
+
+ /// Reads a_Count bytes into a_Buffer; returns true if successful
bool ReadBuf(void * a_Buffer, int a_Count);
- /// Reads a_Count bytes into a_String; return true if successful
+ /// Writes a_Count bytes into a_Buffer; returns true if successful
+ bool WriteBuf(const void * a_Buffer, int a_Count);
+
+ /// Reads a_Count bytes into a_String; returns true if successful
bool ReadString(AString & a_String, int a_Count);
- /// Reads 2 * a_NumChars bytes and interprets it as a UTF16 string, converting it into UTF8 string a_String
+ /// Reads 2 * a_NumChars bytes and interprets it as a UTF16-BE string, converting it into UTF8 string a_String
bool ReadUTF16String(AString & a_String, int a_NumChars);
/// Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer