Back to index

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

#include <scguardedptr.h>

Inheritance diagram for ScGuardedObject< T >:
Inheritance graph
[legend]
Collaboration diagram for ScGuardedObject< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ScGuardedObject (T *ptr)
 ScGuardedObject (const ScGuardedObject &gPtr)
 ~ScGuardedObject ()
ScGuardedObjectoperator= (const ScGuardedObject &gPtr)
bool operator== (const ScGuardedObject< T > &p) const
bool operator!= (const ScGuardedObject< T > &p) const
void nullify (void)
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 ScGuardedObject< T >

Definition at line 52 of file scguardedptr.h.


Constructor & Destructor Documentation

template<typename T>
ScGuardedObject< T >::ScGuardedObject ( T *  ptr)

Definition at line 117 of file scguardedptr.h.

                                          : ScGuardedPtr<T>(ptr)
{
};
template<typename T>
ScGuardedObject< T >::ScGuardedObject ( const ScGuardedObject< T > &  gPtr)

Definition at line 122 of file scguardedptr.h.

{
       this->data=NULL;
       // Must never be used
       assert(false);
};
template<typename T >
ScGuardedObject< T >::~ScGuardedObject ( )

Definition at line 145 of file scguardedptr.h.

{
       nullify();
       // deref() is called by ScGuardedPtr<T> dtor
};

Member Function Documentation

template<typename T >
void ScGuardedPtr< T >::deref ( void  ) [inherited]

Definition at line 107 of file scguardedptr.h.

{
       if (data && --(data->refs) == 0)
       {
              delete data;
              data = NULL;
       }
};
template<typename T >
void ScGuardedObject< T >::nullify ( void  )

Definition at line 138 of file scguardedptr.h.

{
       if (this->data)
              this->data->pointer = NULL;
};
template<typename T>
ScGuardedPtr< T >::operator T * ( ) const [inline, inherited]

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, inherited]

Definition at line 42 of file scguardedptr.h.

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

Definition at line 61 of file scguardedptr.h.

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

Definition at line 45 of file scguardedptr.h.

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

Definition at line 44 of file scguardedptr.h.

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

Definition at line 130 of file scguardedptr.h.

{
       // We do nothing, think about an object being assigned to another
       // The object being assigned must keep track of its own data
       return *this;
};
template<typename T>
bool ScGuardedPtr< T >::operator== ( const ScGuardedPtr< T > &  p) const [inline, inherited]

Definition at line 41 of file scguardedptr.h.

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

Definition at line 60 of file scguardedptr.h.

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

Member Data Documentation

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

Definition at line 33 of file scguardedptr.h.


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