2013-11-27 11:01:22 +01:00
|
|
|
#ifndef NETWORK_DEPENDENCIES_OYSTER_BYTE_H
|
|
|
|
#define NETWORK_DEPENDENCIES_OYSTER_BYTE_H
|
|
|
|
|
|
|
|
/////////////////////////////////////
|
|
|
|
// Created by Pontus Fransson 2013 //
|
|
|
|
/////////////////////////////////////
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Network
|
|
|
|
{
|
|
|
|
class OysterByte
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OysterByte();
|
|
|
|
OysterByte(int cap);
|
2013-12-04 14:58:15 +01:00
|
|
|
OysterByte(const OysterByte& obj);
|
2013-11-27 11:01:22 +01:00
|
|
|
virtual ~OysterByte();
|
|
|
|
|
2013-12-13 08:17:05 +01:00
|
|
|
//Resets size to 0
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
//Resizes the array with, it does not keep anything in it.
|
|
|
|
void Resize(unsigned int cap);
|
2013-11-27 11:01:22 +01:00
|
|
|
|
|
|
|
int GetSize();
|
|
|
|
unsigned char* GetByteArray();
|
|
|
|
|
|
|
|
void AddSize(unsigned int size);
|
|
|
|
void SetBytes(unsigned char* bytes);
|
2013-12-13 08:17:05 +01:00
|
|
|
|
|
|
|
//Only sets the private variable 'size'
|
|
|
|
void SetSize(unsigned int size);
|
2013-11-27 11:01:22 +01:00
|
|
|
|
2013-12-04 14:58:15 +01:00
|
|
|
OysterByte& operator =(const OysterByte& obj);
|
|
|
|
|
2013-11-27 11:01:22 +01:00
|
|
|
operator char*();
|
|
|
|
operator const char*();
|
|
|
|
operator unsigned char*();
|
2013-12-13 08:17:05 +01:00
|
|
|
|
2013-12-17 08:45:47 +01:00
|
|
|
OysterByte& operator +=(const OysterByte& obj);
|
|
|
|
|
2013-11-27 11:01:22 +01:00
|
|
|
private:
|
2013-12-13 08:17:05 +01:00
|
|
|
//Expands the byteArray
|
|
|
|
void IncreaseCapacity(unsigned int cap);
|
2013-11-27 11:01:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned char* byteArray;
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int capacity;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|