2012-04-19 14:35:52 +08:00
|
|
|
#ifndef __CCINTEGER_H__
|
|
|
|
#define __CCINTEGER_H__
|
|
|
|
|
|
|
|
#include "CCObject.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup data_structures
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2013-07-08 23:05:47 +08:00
|
|
|
class CC_DLL Integer : public Object, public Clonable
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-06-20 14:13:12 +08:00
|
|
|
Integer(int v)
|
2013-06-15 14:03:30 +08:00
|
|
|
: _value(v) {}
|
|
|
|
int getValue() const {return _value;}
|
2012-04-20 15:23:00 +08:00
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
static Integer* create(int v)
|
2012-04-20 15:23:00 +08:00
|
|
|
{
|
2013-06-20 14:13:12 +08:00
|
|
|
Integer* pRet = new Integer(v);
|
2012-04-20 15:23:00 +08:00
|
|
|
pRet->autorelease();
|
|
|
|
return pRet;
|
|
|
|
}
|
2013-05-23 04:00:34 +08:00
|
|
|
|
|
|
|
/* override functions */
|
2013-06-20 14:13:12 +08:00
|
|
|
virtual void acceptVisitor(DataVisitor &visitor) { visitor.visit(this); }
|
2013-05-23 04:00:34 +08:00
|
|
|
|
2013-07-08 23:05:47 +08:00
|
|
|
Integer* clone() const
|
|
|
|
{
|
|
|
|
return Integer::create(_value);
|
|
|
|
}
|
|
|
|
|
2012-04-20 15:23:00 +08:00
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
int _value;
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2012-06-20 18:09:11 +08:00
|
|
|
// end of data_structure group
|
|
|
|
/// @}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif /* __CCINTEGER_H__ */
|