cheshirekow  v0.1.0
fontconfig::RefPtr< Traits > Class Template Reference

object which acts like a c-pointer, but when dereferenced returns a delegate object which adds methods to the pointer More...

#include <cpp_fontconfig/CPtr.h>

Public Types

typedef Traits::cobjptr cobjptr
 
typedef Traits::Delegate Delegate
 
typedef Traits::Storage Storage
 

Public Member Functions

 operator bool () const
 exposes the boolean interpretation of the underlying pointer More...
 
CPtr< Traits > operator* ()
 returns a delegate object which acts exactly like a c-pointer but cannot be copied and so reference counting cannot be subverted More...
 
ConstCPtr< Traits > operator* () const
 returns a delegate object which acts exactly like a c-pointer but cannot be copied and so reference counting cannot be subverted More...
 
template<typename T2 >
LValuePair< RefPtr< Traits >, T2 > operator, (T2 &other)
 can be paired with other objects for multiple (tuple) returns More...
 
Delegate operator-> ()
 returns a delegate object which exposes member functions of the underlying object More...
 
const Delegate operator-> () const
 returns a delegate object which exposes member functions of the underlying object More...
 
RefPtr< Traits > & operator= (const RefPtr< Traits > &other)
 assignment operator, decreases reference count of current object, increases reference count of copied pointer More...
 
RefPtr< Traits > & operator= (cobjptr ptr)
 assignment operator, decreases reference count of current object, increases reference count of copied pointer More...
 
 RefPtr (cobjptr ptr=0, bool doRef=false)
 create a RefPtr from the specified cobj More...
 
 RefPtr (const RefPtr< Traits > &other)
 copy construct a pointer, increasing the reference count More...
 
cobjptr subvert ()
 return the stored pointer, subverting reference safety, see specializations if Storage is not the same as cobjptr More...
 
const cobjptr subvert () const
 return the stored pointer, subverting reference safety, see specializations if Storage is not the same as cobjptr More...
 
void unlink ()
 dereference the stored object and turn this into a null pointer More...
 
 ~RefPtr ()
 when the RefPtr is destroyed the reference count of the pointed-to object is decreased More...
 

Private Member Functions

void dereference ()
 decrease reference count by one, see specializations More...
 
template<>
void dereference ()
 
template<>
void dereference ()
 
template<>
void dereference ()
 
void reference ()
 increase reference count by one, see specializations More...
 
template<>
void reference ()
 
template<>
void reference ()
 
template<>
void reference ()
 

Private Attributes

Storage m_ptr
 

Detailed Description

template<class Traits>
class fontconfig::RefPtr< Traits >

object which acts like a c-pointer, but when dereferenced returns a delegate object which adds methods to the pointer

Note
If the pointer is a reference counted object then the reference count is managed by this class and so long as pointer safety is not subverted all reference counted objects will be freed automatically when their references are all destroyed.

Definition at line 33 of file CPtr.h.

Member Typedef Documentation

template<class Traits>
typedef Traits::cobjptr fontconfig::RefPtr< Traits >::cobjptr

Definition at line 49 of file RefPtr.h.

template<class Traits>
typedef Traits::Delegate fontconfig::RefPtr< Traits >::Delegate

Definition at line 50 of file RefPtr.h.

template<class Traits>
typedef Traits::Storage fontconfig::RefPtr< Traits >::Storage

Definition at line 51 of file RefPtr.h.

Constructor & Destructor Documentation

template<class Traits>
fontconfig::RefPtr< Traits >::RefPtr ( cobjptr  ptr = 0,
bool  doRef = false 
)
inline

create a RefPtr from the specified cobj

Parameters
ptrthe c-obj pointer to wrap
doRefwhether or not to increase the reference count
Note
since fontconfig sometimes gives us a pointer which already has a reference count of 1, reference defaults to false.

Definition at line 72 of file RefPtr.h.

template<class Traits>
fontconfig::RefPtr< Traits >::RefPtr ( const RefPtr< Traits > &  other)
inline

copy construct a pointer, increasing the reference count

Definition at line 80 of file RefPtr.h.

template<class Traits>
fontconfig::RefPtr< Traits >::~RefPtr ( )
inline

when the RefPtr is destroyed the reference count of the pointed-to object is decreased

Definition at line 88 of file RefPtr.h.

Member Function Documentation

template<class Traits>
void fontconfig::RefPtr< Traits >::dereference ( )
inlineprivate

decrease reference count by one, see specializations

Definition at line 60 of file RefPtr.h.

template<>
void fontconfig::RefPtr< Pattern >::dereference ( )
private
template<>
void fontconfig::RefPtr< CharSet >::dereference ( )
private
template<>
void fontconfig::RefPtr< Config >::dereference ( )
private
template<class Traits>
fontconfig::RefPtr< Traits >::operator bool ( ) const
inline

exposes the boolean interpretation of the underlying pointer

Definition at line 163 of file RefPtr.h.

template<class Traits>
CPtr<Traits> fontconfig::RefPtr< Traits >::operator* ( )
inline

returns a delegate object which acts exactly like a c-pointer but cannot be copied and so reference counting cannot be subverted

Definition at line 150 of file RefPtr.h.

template<class Traits>
ConstCPtr<Traits> fontconfig::RefPtr< Traits >::operator* ( ) const
inline

returns a delegate object which acts exactly like a c-pointer but cannot be copied and so reference counting cannot be subverted

Definition at line 157 of file RefPtr.h.

template<class Traits>
template<typename T2 >
LValuePair< RefPtr<Traits>,T2 > fontconfig::RefPtr< Traits >::operator, ( T2 &  other)
inline

can be paired with other objects for multiple (tuple) returns

Definition at line 170 of file RefPtr.h.

template<class Traits>
Delegate fontconfig::RefPtr< Traits >::operator-> ( )
inline

returns a delegate object which exposes member functions of the underlying object

Definition at line 136 of file RefPtr.h.

template<class Traits>
const Delegate fontconfig::RefPtr< Traits >::operator-> ( ) const
inline

returns a delegate object which exposes member functions of the underlying object

Definition at line 143 of file RefPtr.h.

template<class Traits>
RefPtr<Traits>& fontconfig::RefPtr< Traits >::operator= ( const RefPtr< Traits > &  other)
inline

assignment operator, decreases reference count of current object, increases reference count of copied pointer

Definition at line 116 of file RefPtr.h.

template<class Traits>
RefPtr<Traits>& fontconfig::RefPtr< Traits >::operator= ( cobjptr  ptr)
inline

assignment operator, decreases reference count of current object, increases reference count of copied pointer

Definition at line 126 of file RefPtr.h.

template<class Traits>
void fontconfig::RefPtr< Traits >::reference ( )
inlineprivate

increase reference count by one, see specializations

Definition at line 57 of file RefPtr.h.

template<>
void fontconfig::RefPtr< Pattern >::reference ( )
private
template<>
void fontconfig::RefPtr< CharSet >::reference ( )
private
template<>
void fontconfig::RefPtr< Config >::reference ( )
private
template<class Traits>
cobjptr fontconfig::RefPtr< Traits >::subvert ( )
inline

return the stored pointer, subverting reference safety, see specializations if Storage is not the same as cobjptr

Definition at line 102 of file RefPtr.h.

template<class Traits>
const cobjptr fontconfig::RefPtr< Traits >::subvert ( ) const
inline

return the stored pointer, subverting reference safety, see specializations if Storage is not the same as cobjptr

Definition at line 109 of file RefPtr.h.

template<class Traits>
void fontconfig::RefPtr< Traits >::unlink ( )
inline

dereference the stored object and turn this into a null pointer

Definition at line 94 of file RefPtr.h.

Member Data Documentation

template<class Traits>
Storage fontconfig::RefPtr< Traits >::m_ptr
private

Definition at line 54 of file RefPtr.h.


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