Files
cocos4/native/cocos/scripting/js-bindings/jswrapper/RefCounter.cpp
T
James Chen 53250dad49 se::Ref -> se::RefCounter, addRef -> incRef, release -> decRef
This is for distinguishing from cocos2d::Ref.
2017-08-31 14:24:34 +08:00

42 lines
537 B
C++

//
// Ref.cpp
// cocos2d_js_bindings
//
// Created by James Chen on 4/27/17.
//
//
#include "RefCounter.hpp"
namespace se {
void RefCounter::incRef()
{
++_refCount;
}
void RefCounter::decRef()
{
--_refCount;
if (_refCount == 0)
{
delete this;
}
}
unsigned int RefCounter::getRefCount()
{
return _refCount;
}
RefCounter::RefCounter()
: _refCount(1)
{
}
RefCounter::~RefCounter()
{
}
} // namespace se {