cocos2d-x  3.3rc0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RefPtr< T > Class Template Reference

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

#include <CCRefPtr.h>

Public Member Functions

 RefPtr ()
 RefPtr ()
 RefPtr ()
 RefPtr (RefPtr< T > &&other)
 RefPtr ( var other)
 RefPtr ( local other)
 RefPtr (T *ptr)
 RefPtr ( var ptr)
 RefPtr ( local ptr)
 RefPtr (std::nullptr_t ptr)
 RefPtr ( var ptr)
 RefPtr ( local ptr)
 RefPtr (const RefPtr< T > &other)
 RefPtr ( var other)
 RefPtr ( local other)
 ~RefPtr ()
RefPtr< T > & operator= (const RefPtr< T > &other)
var operator= ( var other)
local operator= ( local other)
RefPtr< T > & operator= (RefPtr< T > &&other)
local operator= ( local other)
RefPtr< T > & operator= (T *other)
var operator= ( var other)
local operator= ( local other)
RefPtr< T > & operator= (std::nullptr_t other)
local operator= ( local other)
 operator T * () const
 operator T * ()
 operator T * ()
T & operator* () const
var operator* ()
local operator* ()
T * operator-> () const
var operator-> ()
local operator-> ()
T * get () const
var get ()
local get ()
bool operator== (const RefPtr< T > &other) const
var operator== ( var other)
local operator== ( local other)
bool operator== (const T *other) const
var operator== ( var other)
local operator== ( local other)
bool operator== (typename std::remove_const< T >::type *other) const
var operator== ( var other)
local operator== ( local other)
bool operator== (const std::nullptr_t other) const
bool operator!= (const RefPtr< T > &other) const
bool operator!= (const T *other) const
var operator!= ( var other)
local operator!= ( local other)
bool operator!= (typename std::remove_const< T >::type *other) const
var operator!= ( var other)
local operator!= ( local other)
bool operator!= (const std::nullptr_t other) const
var operator!= ( var other)
local operator!= ( local other)
bool operator> (const RefPtr< T > &other) const
bool operator> (const T *other) const
var operator> ( var other)
local operator> ( local other)
bool operator> (typename std::remove_const< T >::type *other) const
var operator> ( var other)
local operator> ( local other)
bool operator> (const std::nullptr_t other) const
var operator> ( var other)
local operator> ( local other)
bool operator< (const RefPtr< T > &other) const
bool operator< (const T *other) const
var operator< ( var other)
local operator< ( local other)
bool operator< (typename std::remove_const< T >::type *other) const
var operator< ( var other)
local operator< ( local other)
bool operator< (const std::nullptr_t other) const
var operator< ( var other)
local operator< ( local other)
bool operator>= (const RefPtr< T > &other) const
bool operator>= (const T *other) const
var operator>= ( var other)
local operator>= ( local other)
bool operator>= (typename std::remove_const< T >::type *other) const
var operator>= ( var other)
local operator>= ( local other)
bool operator>= (const std::nullptr_t other) const
var operator>= ( var other)
local operator>= ( local other)
bool operator<= (const RefPtr< T > &other) const
bool operator<= (const T *other) const
var operator<= ( var other)
local operator<= ( local other)
bool operator<= (typename std::remove_const< T >::type *other) const
var operator<= ( var other)
local operator<= ( local other)
bool operator<= (const std::nullptr_t other) const
var operator<= ( var other)
local operator<= ( local other)
 operator bool () const
void reset ()
var reset ()
local reset ()
void swap (RefPtr< T > &other)
var swap ( var other)
local swap ( local other)
void weakAssign (const RefPtr< T > &other)
 This function assigns to this RefPtr<T> but does not increase the reference count of the object pointed to. More...
 

Detailed Description

template<typename T>
class cocos2d::RefPtr< T >

Wrapper class which maintains a strong reference to a cocos2dx cocos2d::Ref* type object.

Similar in concept to a boost smart pointer.

Enables the use of the RAII idiom with Cocos2dx objects and helps automate some of the more mundane tasks of pointer initialization and cleanup.

The class itself is modelled on C++ 11 std::shared_ptr, and trys to keep some of the methods and functionality consistent with std::shared_ptr.

Constructor & Destructor Documentation

RefPtr ( )
inline
var RefPtr ( )
inline
local RefPtr ( )
inline
RefPtr ( RefPtr< T > &&  other)
inline
var RefPtr ( var  other)
inline
local RefPtr ( local  other)
inline
RefPtr ( T *  ptr)
inline
var RefPtr ( var  ptr)
inline
local RefPtr ( local  ptr)
inline
RefPtr ( std::nullptr_t  ptr)
inline
var RefPtr ( var  ptr)
inline
local RefPtr ( local  ptr)
inline
RefPtr ( const RefPtr< T > &  other)
inline
var RefPtr ( var  other)
inline
local RefPtr ( local  other)
inline
~RefPtr ( )
inline
var ~RefPtr ( )
inline
local ~RefPtr ( )
inline

Member Function Documentation

T* get ( ) const
inline
var get ( )
inline
local get ( )
inline
operator bool ( ) const
inline
var bool ( )
inline
local bool ( )
inline
operator T * ( ) const
inline
operator T * ( )
inline
operator T * ( )
inline
bool operator!= ( const RefPtr< T > &  other) const
inline
bool operator!= ( var  other)
inline
bool operator!= ( local  other)
inline
bool operator!= ( const T *  other) const
inline
bool operator!= ( var  other)
inline
bool operator!= ( local  other)
inline
bool operator!= ( typename std::remove_const< T >::type *  other) const
inline
bool operator!= ( var  other)
inline
bool operator!= ( local  other)
inline
bool operator!= ( const std::nullptr_t  other) const
inline
bool operator!= ( var  other)
inline
bool operator!= ( local  other)
inline
T& operator* ( ) const
inline
T& operator* ( )
inline
T& operator* ( )
inline
T* operator-> ( ) const
inline
T* operator-> ( )
inline
T* operator-> ( )
inline
bool operator< ( const RefPtr< T > &  other) const
inline
bool operator< ( var  other)
inline
bool operator< ( local  other)
inline
bool operator< ( const T *  other) const
inline
bool operator< ( var  other)
inline
bool operator< ( local  other)
inline
bool operator< ( typename std::remove_const< T >::type *  other) const
inline
bool operator< ( var  other)
inline
bool operator< ( local  other)
inline
bool operator< ( const std::nullptr_t  other) const
inline
bool operator< ( var  other)
inline
bool operator< ( local  other)
inline
bool operator<= ( const RefPtr< T > &  other) const
inline
bool operator<= ( var  other)
inline
bool operator<= ( local  other)
inline
bool operator<= ( const T *  other) const
inline
bool operator<= ( var  other)
inline
bool operator<= ( local  other)
inline
bool operator<= ( typename std::remove_const< T >::type *  other) const
inline
bool operator<= ( var  other)
inline
bool operator<= ( local  other)
inline
bool operator<= ( const std::nullptr_t  other) const
inline
bool operator<= ( var  other)
inline
bool operator<= ( local  other)
inline
RefPtr<T>& operator= ( const RefPtr< T > &  other)
inline
RefPtr<T>& operator= ( var  other)
inline
RefPtr<T>& operator= ( local  other)
inline
RefPtr<T>& operator= ( RefPtr< T > &&  other)
inline
RefPtr<T>& operator= ( var  other)
inline
RefPtr<T>& operator= ( local  other)
inline
RefPtr<T>& operator= ( T *  other)
inline
RefPtr<T>& operator= ( var  other)
inline
RefPtr<T>& operator= ( local  other)
inline
RefPtr<T>& operator= ( std::nullptr_t  other)
inline
RefPtr<T>& operator= ( var  other)
inline
RefPtr<T>& operator= ( local  other)
inline
bool operator== ( const RefPtr< T > &  other) const
inline
bool operator== ( var  other)
inline
bool operator== ( local  other)
inline
bool operator== ( const T *  other) const
inline
bool operator== ( var  other)
inline
bool operator== ( local  other)
inline
bool operator== ( typename std::remove_const< T >::type *  other) const
inline
bool operator== ( var  other)
inline
bool operator== ( local  other)
inline
bool operator== ( const std::nullptr_t  other) const
inline
bool operator== ( var  other)
inline
bool operator== ( local  other)
inline
bool operator> ( const RefPtr< T > &  other) const
inline
bool operator> ( var  other)
inline
bool operator> ( local  other)
inline
bool operator> ( const T *  other) const
inline
bool operator> ( var  other)
inline
bool operator> ( local  other)
inline
bool operator> ( typename std::remove_const< T >::type *  other) const
inline
bool operator> ( var  other)
inline
bool operator> ( local  other)
inline
bool operator> ( const std::nullptr_t  other) const
inline
bool operator> ( var  other)
inline
bool operator> ( local  other)
inline
bool operator>= ( const RefPtr< T > &  other) const
inline
bool operator>= ( var  other)
inline
bool operator>= ( local  other)
inline
bool operator>= ( const T *  other) const
inline
bool operator>= ( var  other)
inline
bool operator>= ( local  other)
inline
bool operator>= ( typename std::remove_const< T >::type *  other) const
inline
bool operator>= ( var  other)
inline
bool operator>= ( local  other)
inline
bool operator>= ( const std::nullptr_t  other) const
inline
bool operator>= ( var  other)
inline
bool operator>= ( local  other)
inline
void reset ( )
inline
var reset ( )
inline
local reset ( )
inline
void swap ( RefPtr< T > &  other)
inline
var swap ( var  other)
inline
local swap ( local  other)
inline
void weakAssign ( const RefPtr< T > &  other)
inline

This function assigns to this RefPtr<T> but does not increase the reference count of the object pointed to.

Useful for assigning an object created through the 'new' operator to a RefPtr<T>. Basically used in scenarios where the RefPtr<T> has the initial ownership of the object.

E.G: RefPtr<cocos2d::Image> image; image.weakAssign(new cocos2d::Image());

Instead of: RefPtr<cocos2d::Image> image; image = new cocos2d::Image(); image->release(); // Required because new'd object already has a reference count of '1'.

var weakAssign ( var  other)
inline

This function assigns to this RefPtr<T> but does not increase the reference count of the object pointed to.

Useful for assigning an object created through the 'new' operator to a RefPtr<T>. Basically used in scenarios where the RefPtr<T> has the initial ownership of the object.

E.G: RefPtr<cocos2d::Image> image; image.weakAssign(new cocos2d::Image());

Instead of: RefPtr<cocos2d::Image> image; image = new cocos2d::Image(); image->release(); // Required because new'd object already has a reference count of '1'.

local weakAssign ( local  other)
inline

This function assigns to this RefPtr<T> but does not increase the reference count of the object pointed to.

Useful for assigning an object created through the 'new' operator to a RefPtr<T>. Basically used in scenarios where the RefPtr<T> has the initial ownership of the object.

E.G: RefPtr<cocos2d::Image> image; image.weakAssign(new cocos2d::Image());

Instead of: RefPtr<cocos2d::Image> image; image = new cocos2d::Image(); image->release(); // Required because new'd object already has a reference count of '1'.


The documentation for this class was generated from the following file: