Massive update:

Changed all byte pointers to vectors
NetworkMessage: DecodeMessage and EncodeMessage are now static
TcpClient: Fixed OnMessage function
NetworkMessage: merged both private methods into 1 method
This commit is contained in:
xX-TheDoctor-Xx
2016-07-31 01:28:36 +01:00
parent 9e5cd40847
commit bb6a2a25d3
21 changed files with 86 additions and 109 deletions

View File

@ -9,6 +9,7 @@
#include <string>
#include <map>
#include <vector>
struct Utility
{
@ -17,29 +18,29 @@ struct Utility
struct BitConverter
{
static byte *FromUint8(uint8 number);
static uint8 ToUint8(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromUint8(uint8 number);
static uint8 ToUint8(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromUint16(uint16 number);
static uint16 ToUint16(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromUint16(uint16 number);
static uint16 ToUint16(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromUint32(uint32 number);
static uint32 *ToUint32(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromUint32(uint32 number);
static uint32 ToUint32(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromUint64(uint64 number);
static uint64 ToUint64(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromUint64(uint64 number);
static uint64 ToUint64(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromInt8(int8 number);
static int8 ToInt8(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromInt8(int8 number);
static int8 ToInt8(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromInt16(int16 number);
static int16 ToInt16(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromInt16(int16 number);
static int16 ToInt16(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromInt32(int32 number);
static int32 ToInt32(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromInt32(int32 number);
static int32 ToInt32(const std::vector<byte> &bytes, uint16 start_index = 0);
static byte *FromInt64(int64 number);
static int64 ToInt64(byte *bytes, uint16 start_index);
static const std::vector<byte> &FromInt64(int64 number);
static int64 ToInt64(const std::vector<byte> &bytes, uint16 start_index = 0);
};
struct StringConverter
@ -54,7 +55,7 @@ struct Utility
static const std::string &ToString(int32 value);
static const std::string &ToString(int64 value);
static const std::string &ToString(byte *bytes, uint16 start_index = 0, uint16 lenght = 0);
static const std::string &ToString(const std::vector<byte> &bytes, uint16 start_index = 0, uint16 lenght = 0);
};
struct ConfigReader