Kodi Documentation
Kodi is an open source media player and entertainment hub.
XBMCAddon::AddonClass::Ref< T > Class Template Reference

#include <AddonClass.h>

Public Member Functions

 Ref ()
 
 Ref (const T *_ac)
 
 Ref (Ref< T > const &oref)
 
template<class O >
 Ref (Ref< O > const &oref)
 
Ref< T > & operator= (Ref< T > const &oref)
 
T * operator-> () const
 
 operator T* () const
 
T * get () const
 
T & getRef () const
 
 ~Ref ()
 
bool isNull () const
 
bool isNotNull () const
 
bool isSet () const
 
bool operator! () const
 
bool operator== (const AddonClass::Ref< T > &oref) const
 
bool operator< (const AddonClass::Ref< T > &oref) const
 
template<class O >
void reset (Ref< O > const &oref)
 
template<class O >
void reset (O *oref)
 
void reset ()
 

Detailed Description

template<class T>
class XBMCAddon::AddonClass::Ref< T >

This class is a smart pointer for a Referenced class.

Constructor & Destructor Documentation

◆ Ref() [1/4]

template<class T>
XBMCAddon::AddonClass::Ref< T >::Ref ( )
inline

◆ Ref() [2/4]

template<class T>
XBMCAddon::AddonClass::Ref< T >::Ref ( const T *  _ac)
inline

◆ Ref() [3/4]

template<class T>
XBMCAddon::AddonClass::Ref< T >::Ref ( Ref< T > const &  oref)
inline

◆ Ref() [4/4]

template<class T>
template<class O >
XBMCAddon::AddonClass::Ref< T >::Ref ( Ref< O > const &  oref)
inline

◆ ~Ref()

template<class T>
XBMCAddon::AddonClass::Ref< T >::~Ref ( )
inline

Member Function Documentation

◆ get()

template<class T>
T* XBMCAddon::AddonClass::Ref< T >::get ( ) const
inline

◆ getRef()

template<class T>
T& XBMCAddon::AddonClass::Ref< T >::getRef ( ) const
inline

◆ isNotNull()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::isNotNull ( ) const
inline

◆ isNull()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::isNull ( ) const
inline

◆ isSet()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::isSet ( ) const
inline

◆ operator T*()

template<class T>
XBMCAddon::AddonClass::Ref< T >::operator T* ( ) const
inline

This operator doubles as the value in a boolean expression.

◆ operator!()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::operator! ( ) const
inline

◆ operator->()

template<class T>
T* XBMCAddon::AddonClass::Ref< T >::operator-> ( ) const
inline

◆ operator<()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::operator< ( const AddonClass::Ref< T > &  oref) const
inline

◆ operator=()

template<class T>
Ref<T>& XBMCAddon::AddonClass::Ref< T >::operator= ( Ref< T > const &  oref)
inline

operator= should work with either another smart pointer or a pointer since it will be able to convert a pointer to a smart pointer using one of the above constructors.

Note: There is a trick here. The temporary variable is necessary because otherwise the following code will fail:

Ref<T> ptr = new T; ptr = ptr;

What happens without the tmp is the dereference is called first so the object ends up deleted and then the reference happens on a deleted object. The order is reversed in the following.

Note: Operator= is ambiguous if you define both an operator=(Ref<T>&) and an operator=(T*). I'm opting for the route the boost took here figuring it has more history behind it.

◆ operator==()

template<class T>
bool XBMCAddon::AddonClass::Ref< T >::operator== ( const AddonClass::Ref< T > &  oref) const
inline

◆ reset() [1/3]

template<class T>
template<class O >
void XBMCAddon::AddonClass::Ref< T >::reset ( Ref< O > const &  oref)
inline

◆ reset() [2/3]

template<class T>
template<class O >
void XBMCAddon::AddonClass::Ref< T >::reset ( O *  oref)
inline

◆ reset() [3/3]

template<class T>
void XBMCAddon::AddonClass::Ref< T >::reset ( void  )
inline

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