2013-05-29 08:06:41 +08:00
|
|
|
|
|
|
|
#ifndef __CCDATA_H__
|
|
|
|
#define __CCDATA_H__
|
|
|
|
|
|
|
|
#include "platform/CCPlatformMacros.h"
|
|
|
|
#include "CCObject.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
class CC_DLL Data : public Object
|
2013-05-29 08:06:41 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:13:12 +08:00
|
|
|
Data(unsigned char *pBytes, const unsigned long nSize);
|
|
|
|
Data(Data *pData);
|
|
|
|
~Data();
|
2013-05-29 08:06:41 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
static Data* create(unsigned char *pBytes, const unsigned long nSize)
|
2013-05-29 08:06:41 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Data* pRet = new Data(pBytes, nSize);
|
2013-05-29 08:06:41 +08:00
|
|
|
if (pRet)
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char* getBytes() const;
|
|
|
|
unsigned long getSize() const;
|
|
|
|
|
|
|
|
/* override functions */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual void acceptVisitor(DataVisitor &visitor) { visitor.visit(this); }
|
2013-05-29 08:06:41 +08:00
|
|
|
|
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
unsigned char* _bytes;
|
|
|
|
unsigned long _size;
|
2013-05-29 08:06:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __CCDATA_H__
|