mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 02:52:39 +08:00
53250dad49
This is for distinguishing from cocos2d::Ref.
42 lines
537 B
C++
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 {
|