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
|
|
|
|
|
|
|
CCData::CCData(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
|
|
|
|
|
|
|
CCData::CCData(CCData *pData)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
|
|
CCData::~CCData()
|
|
|
|
{
|
2013-06-15 14:03:30 +08:00
|
|
|
CC_SAFE_DELETE_ARRAY(_bytes);
|
2012-09-17 14:27:17 +08:00
|
|
|
}
|
|
|
|
|
2013-05-29 08:06:41 +08:00
|
|
|
unsigned char* CCData::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-05-29 08:06:41 +08:00
|
|
|
unsigned long CCData::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
|