2013-10-12 15:25:45 +08:00
|
|
|
/****************************************************************************
|
2017-02-14 14:36:57 +08:00
|
|
|
Copyright (c) 2013-2017 Chukong Technologies
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CCDOUBLE_H__
|
|
|
|
#define __CCDOUBLE_H__
|
2015-03-24 20:23:51 +08:00
|
|
|
/// @cond DO_NOT_SHOW
|
2013-10-12 15:25:45 +08:00
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "base/CCRef.h"
|
|
|
|
#include "base/CCDataVisitor.h"
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup data_structures
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
class CC_DLL __Double : public Ref, public Clonable
|
2013-10-12 15:25:45 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-12-11 17:15:27 +08:00
|
|
|
__Double(double v)
|
2013-10-12 15:25:45 +08:00
|
|
|
: _value(v) {}
|
|
|
|
double getValue() const {return _value;}
|
|
|
|
|
2013-12-11 17:15:27 +08:00
|
|
|
static __Double* create(double v)
|
2013-10-12 15:25:45 +08:00
|
|
|
{
|
2015-11-25 22:59:49 +08:00
|
|
|
__Double* pRet = new (std::nothrow) __Double(v);
|
2013-10-12 15:25:45 +08:00
|
|
|
if (pRet)
|
|
|
|
{
|
|
|
|
pRet->autorelease();
|
|
|
|
}
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* override functions */
|
|
|
|
virtual void acceptVisitor(DataVisitor &visitor) { visitor.visit(this); }
|
|
|
|
|
2015-11-25 22:59:49 +08:00
|
|
|
virtual __Double* clone() const override
|
2013-10-12 15:25:45 +08:00
|
|
|
{
|
2013-12-11 17:15:27 +08:00
|
|
|
return __Double::create(_value);
|
2013-10-12 15:25:45 +08:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
double _value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// end of data_structure group
|
|
|
|
/// @}
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
2015-03-24 20:23:51 +08:00
|
|
|
/// @endcond
|
2013-10-12 15:25:45 +08:00
|
|
|
#endif /* __CCDOUBLE_H__ */
|