foobar2000 SDK  2015-08-03
Public Member Functions | Private Types | Private Member Functions | Private Attributes
pfc::ptrholder_t< T, t_releaser >

#include <other.h>

Public Member Functions

 ptrholder_t (T *p_ptr)
 
 ptrholder_t ()
 
 ~ptrholder_t ()
 
void attach (T *p_ptr)
 
Tdetach ()
 
Tget_ptr () const
 
bool is_empty () const
 
bool is_valid () const
 
Toperator* () const
 
Toperator-> () const
 
t_selfoperator<< (t_self &p_source)
 
const t_selfoperator= (T *p_ptr)
 
t_selfoperator>> (t_self &p_dest)
 
void release ()
 
void set (T *p_ptr)
 

Private Types

typedef ptrholder_t< T, t_releaser > t_self
 

Private Member Functions

 ptrholder_t (const t_self &)
 
const t_selfoperator= (const t_self &)
 

Private Attributes

Tm_ptr
 

Detailed Description

template<typename T, typename t_releaser = releaser_delete>
class pfc::ptrholder_t< T, t_releaser >

Assumes t_freefunc to never throw exceptions.

Definition at line 93 of file other.h.

Member Typedef Documentation

template<typename T, typename t_releaser = releaser_delete>
typedef ptrholder_t<T,t_releaser> pfc::ptrholder_t< T, t_releaser >::t_self
private

Definition at line 95 of file other.h.

Constructor & Destructor Documentation

template<typename T, typename t_releaser = releaser_delete>
pfc::ptrholder_t< T, t_releaser >::ptrholder_t ( T p_ptr)
inline

Definition at line 97 of file other.h.

97 : m_ptr(p_ptr) {}
template<typename T, typename t_releaser = releaser_delete>
pfc::ptrholder_t< T, t_releaser >::ptrholder_t ( )
inline

Definition at line 98 of file other.h.

98 : m_ptr(NULL) {}
template<typename T, typename t_releaser = releaser_delete>
pfc::ptrholder_t< T, t_releaser >::~ptrholder_t ( )
inline

Definition at line 99 of file other.h.

99 {t_releaser::release(m_ptr);}
template<typename T, typename t_releaser = releaser_delete>
pfc::ptrholder_t< T, t_releaser >::ptrholder_t ( const t_self )
inlineprivate

Definition at line 116 of file other.h.

116 {throw pfc::exception_not_implemented();}

Member Function Documentation

template<typename T, typename t_releaser = releaser_delete>
void pfc::ptrholder_t< T, t_releaser >::attach ( T p_ptr)
inline

Definition at line 105 of file other.h.

105 {release(); m_ptr = p_ptr;}
void release()
Definition: other.h:104
template<typename T, typename t_releaser = releaser_delete>
T* pfc::ptrholder_t< T, t_releaser >::detach ( )
inline

Definition at line 107 of file other.h.

107 {return pfc::replace_null_t(m_ptr);}
t_type replace_null_t(t_type &p_var)
Definition: primitives.h:688
template<typename T, typename t_releaser = releaser_delete>
T* pfc::ptrholder_t< T, t_releaser >::get_ptr ( ) const
inline

Definition at line 103 of file other.h.

103 {return m_ptr;}
template<typename T, typename t_releaser = releaser_delete>
bool pfc::ptrholder_t< T, t_releaser >::is_empty ( ) const
inline

Definition at line 101 of file other.h.

101 {return m_ptr == NULL;}
template<typename T, typename t_releaser = releaser_delete>
bool pfc::ptrholder_t< T, t_releaser >::is_valid ( ) const
inline

Definition at line 100 of file other.h.

100 {return m_ptr != NULL;}
template<typename T, typename t_releaser = releaser_delete>
T& pfc::ptrholder_t< T, t_releaser >::operator* ( ) const
inline

Definition at line 108 of file other.h.

108 {return *m_ptr;}
template<typename T, typename t_releaser = releaser_delete>
T* pfc::ptrholder_t< T, t_releaser >::operator-> ( ) const
inline

Definition at line 102 of file other.h.

102 {return m_ptr;}
template<typename T, typename t_releaser = releaser_delete>
t_self& pfc::ptrholder_t< T, t_releaser >::operator<< ( t_self p_source)
inline

Definition at line 110 of file other.h.

110 {attach(p_source.detach());return *this;}
void attach(T *p_ptr)
Definition: other.h:105
template<typename T, typename t_releaser = releaser_delete>
const t_self& pfc::ptrholder_t< T, t_releaser >::operator= ( T p_ptr)
inline

Definition at line 106 of file other.h.

106 {set(p_ptr);return *this;}
template<typename T, typename t_releaser = releaser_delete>
const t_self& pfc::ptrholder_t< T, t_releaser >::operator= ( const t_self )
inlineprivate

Definition at line 117 of file other.h.

117 {throw pfc::exception_not_implemented();}
template<typename T, typename t_releaser = releaser_delete>
t_self& pfc::ptrholder_t< T, t_releaser >::operator>> ( t_self p_dest)
inline

Definition at line 111 of file other.h.

111 {p_dest.attach(detach());return *this;}
T * detach()
Definition: other.h:107
template<typename T, typename t_releaser = releaser_delete>
void pfc::ptrholder_t< T, t_releaser >::release ( )
inline

Definition at line 104 of file other.h.

104 {t_releaser::release(replace_null_t(m_ptr));;}
t_type replace_null_t(t_type &p_var)
Definition: primitives.h:688
template<typename T, typename t_releaser = releaser_delete>
void pfc::ptrholder_t< T, t_releaser >::set ( T p_ptr)
inline

Definition at line 114 of file other.h.

114 {attach(p_ptr);}
void attach(T *p_ptr)
Definition: other.h:105

Field Documentation

template<typename T, typename t_releaser = releaser_delete>
T* pfc::ptrholder_t< T, t_releaser >::m_ptr
private

Definition at line 119 of file other.h.


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