mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 02:52:39 +08:00
44 lines
490 B
C++
44 lines
490 B
C++
//
|
|
// Ref.cpp
|
|
// cocos2d_js_bindings
|
|
//
|
|
// Created by James Chen on 4/27/17.
|
|
//
|
|
//
|
|
|
|
#include "Ref.hpp"
|
|
|
|
namespace se {
|
|
|
|
void Ref::addRef()
|
|
{
|
|
++_refCount;
|
|
}
|
|
|
|
void Ref::release()
|
|
{
|
|
--_refCount;
|
|
if (_refCount == 0)
|
|
{
|
|
delete this;
|
|
}
|
|
}
|
|
|
|
unsigned int Ref::getReferenceCount()
|
|
{
|
|
return _refCount;
|
|
}
|
|
|
|
Ref::Ref()
|
|
: _refCount(1)
|
|
{
|
|
|
|
}
|
|
|
|
Ref::~Ref()
|
|
{
|
|
|
|
}
|
|
|
|
} // namespace se {
|