Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Protected Attributes
ScGuardedPtr< T > Class Template Reference

#include <scguardedptr.h>

Inheritance diagram for ScGuardedPtr< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ScGuardedPtr (void)
 ScGuardedPtr (T *ptr)
 ScGuardedPtr (const ScGuardedPtr &gPtr)
 ~ScGuardedPtr ()
ScGuardedPtroperator= (const ScGuardedPtr &gPtr)
bool operator== (const ScGuardedPtr< T > &p) const
bool operator!= (const ScGuardedPtr< T > &p) const
T * operator-> () const
T & operator* () const
 operator T * () const
void deref (void)

Protected Attributes

ScGuardedPtrData< T > * data

Detailed Description

template<typename T>
class ScGuardedPtr< T >

Definition at line 30 of file scguardedptr.h.


Constructor & Destructor Documentation

template<typename T >
ScGuardedPtr< T >::ScGuardedPtr ( void  )

Definition at line 67 of file scguardedptr.h.

{
       data = new ScGuardedPtrData<T>();
       ++(data->refs);
};
template<typename T>
ScGuardedPtr< T >::ScGuardedPtr ( T *  ptr)

Definition at line 74 of file scguardedptr.h.

{
       data = new ScGuardedPtrData<T>(ptr);
       ++(data->refs);
};
template<typename T>
ScGuardedPtr< T >::ScGuardedPtr ( const ScGuardedPtr< T > &  gPtr)

Definition at line 81 of file scguardedptr.h.

{
       data = other.data;
       ++(data->refs);
};
template<typename T >
ScGuardedPtr< T >::~ScGuardedPtr ( )

Definition at line 88 of file scguardedptr.h.

{
       deref();
};

Member Function Documentation

template<typename T >
void ScGuardedPtr< T >::deref ( void  )

Definition at line 107 of file scguardedptr.h.

{
       if (data && --(data->refs) == 0)
       {
              delete data;
              data = NULL;
       }
};
template<typename T>
ScGuardedPtr< T >::operator T * ( ) const [inline]

Definition at line 46 of file scguardedptr.h.

{ return (T*)(data ? data->pointer : 0); }
template<typename T>
bool ScGuardedPtr< T >::operator!= ( const ScGuardedPtr< T > &  p) const [inline]

Definition at line 42 of file scguardedptr.h.

{ return !( *this == p ); }
template<typename T>
T& ScGuardedPtr< T >::operator* ( ) const [inline]

Definition at line 45 of file scguardedptr.h.

{ return *((T*)(data ? data->pointer : 0)); }
template<typename T>
T* ScGuardedPtr< T >::operator-> ( ) const [inline]

Definition at line 44 of file scguardedptr.h.

{ return (T*)(data ? data->pointer : 0); }
template<typename T >
ScGuardedPtr< T > & ScGuardedPtr< T >::operator= ( const ScGuardedPtr< T > &  gPtr)

Definition at line 94 of file scguardedptr.h.

{
       // We do not copy the owner member
       if (data != other.data)
       {
              ++(other.data->refs);
              deref();
              data = other.data;
       }
       return *this;
};
template<typename T>
bool ScGuardedPtr< T >::operator== ( const ScGuardedPtr< T > &  p) const [inline]

Definition at line 41 of file scguardedptr.h.

{ return (T*)(*this) == (T*) p;}

Member Data Documentation

template<typename T>
ScGuardedPtrData<T>* ScGuardedPtr< T >::data [protected]

Definition at line 33 of file scguardedptr.h.


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