2013-05-29 08:06:41 +08:00
|
|
|
#include <string.h>
|
2012-09-17 14:27:17 +08:00
|
|
|
#include "CCData.h"
|
|
|
|
|
2013-05-29 08:06:41 +08:00
|
|
|
NS_CC_BEGIN
|
2012-09-17 14:27:17 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
Data::Data(unsigned char *pBytes, const unsigned long nSize)
|
2012-11-26 21:51:05 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_size = nSize;
|
|
|
|
_bytes = new unsigned char[_size];
|
|
|
|
memcpy(_bytes, pBytes, _size);
|
2012-11-26 21:51:05 +08:00
|
|
|
}
|
2012-09-17 14:27:17 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
Data::Data(Data *pData)
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
_size = pData->_size;
|
|
|
|
_bytes = new unsigned char[_size];
|
|
|
|
memcpy(_bytes, pData->_bytes, _size);
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
Data::~Data()
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
CC_SAFE_DELETE_ARRAY(_bytes);
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
unsigned char* Data::getBytes() const
|
2012-09-17 14:27:17 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
return _bytes;
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
unsigned long Data::getSize() const
|
2013-04-09 02:58:50 +08:00
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
return _size;
|
2013-04-09 02:58:50 +08:00
|
|
|
}
|
|
|
|
|
2013-05-29 08:06:41 +08:00
|
|
|
NS_CC_END
|