cocos2d-x  3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCRefPtr.h File Reference
#include "base/CCRef.h"
#include "base/ccMacros.h"
#include <type_traits>

Classes

class  RefPtr< T >
 Wrapper class which maintains a strong reference to a cocos2dx cocos2d::Ref* type object. More...
 

Namespaces

 cocos2d
 Add deprecated global functions and variables here.
 

Macros

#define CC_REF_PTR_SAFE_RETAIN(ptr)
 Utility/support macros. More...
 
#define CC_REF_PTR_SAFE_RELEASE(ptr)
#define CC_REF_PTR_SAFE_RELEASE_NULL(ptr)

Functions

template<class T , class U >
RefPtr< T >  (const RefPtr< U > &r)
 Cast between RefPtr types statically. More...
 
template<class T , class U >
var  ( var r)
 Cast between RefPtr types statically. More...
 
template<class T , class U >
local  ( local r)
 Cast between RefPtr types statically. More...
 
template<class T , class U >
RefPtr< T >  (const RefPtr< U > &r)
 Cast between RefPtr types dynamically. More...
 

Macro Definition Documentation

#define CC_REF_PTR_SAFE_RELEASE (   ptr)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->release();\
}\
\
} while (0);
#define
CC_REF_PTR_SAFE_RELEASE_NULL
(   ptr)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->release();\
ptr = nullptr;\
}\
\
} while (0);
var CC_REF_PTR_SAFE_RELEASE_NULL (   var)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->release();\
ptr = nullptr;\
}\
\
} while (0);
local CC_REF_PTR_SAFE_RELEASE_NULL (   local)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->release();\
ptr = nullptr;\
}\
\
} while (0);
#define CC_REF_PTR_SAFE_RETAIN (   ptr)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->retain();\
}\
\
} while (0);

Utility/support macros.

Defined to enable RefPtr<T> to contain types like 'const T' because we do not regard retain()/release() as affecting mutability of state.

var CC_REF_PTR_SAFE_RETAIN (   var)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->retain();\
}\
\
} while (0);

Utility/support macros.

Defined to enable RefPtr<T> to contain types like 'const T' because we do not regard retain()/release() as affecting mutability of state.

local CC_REF_PTR_SAFE_RETAIN (   local)
Value:
\
do\
{\
if (ptr)\
{\
const_cast<Ref*>(static_cast<const Ref*>(ptr))->retain();\
}\
\
} while (0);

Utility/support macros.

Defined to enable RefPtr<T> to contain types like 'const T' because we do not regard retain()/release() as affecting mutability of state.