IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QExtend::ExtendPtr< T, DeletePolicy > Class Template Reference

QObject Smart pointer which create an object and synchronize its life time. More...

#include <extendptr.hpp>

List of all members.

Classes

struct  interptr
struct  interptr< false, TPTR >
struct  interptr< true, TPTR >

Public Member Functions

 ExtendPtr (T *p=0)
 Smart pointer Constructor.
ExtendPtr< T, DeletePolicy > & operator= (T *p)
 Reassigne pointer to a new object. Use Delete policy on old pointer.
 ~ExtendPtr ()
 Smart pointer Destructor. Use DeletePolicy to decide if object should be deleted.
bool isNull () const
 Test if the pointer is null.
 operator bool () const
 Bool convertion. It's true if object is not destroyed (Parent destruction).
 operator T * ()
 Cast to the object pointer.
 operator const T * () const
 Cast to the const object pointer.
T * operator-> ()
 Indirection Operator.
const T * operator-> () const
 Indirection Operator.
T & operator* ()
 Indirection Operator.
const T & operator* () const
 Indirection Operator.

Detailed Description

template<typename T, typename DeletePolicy = SCOPE>
class QExtend::ExtendPtr< T, DeletePolicy >

QObject Smart pointer which create an object and synchronize its life time.

ExtendPtr is use to interface an object and use a policy for object destruction. Proposed features are :

  1. Interface an Object.
  2. Can use polymorphisme.
  3. it is not copiable
  4. It is reasignable (use delete policy to the old object)
  5. If the object inherint from QObject, check the object life(Qt parent/child destruction feature)
  6. When it's destroyed, use a policy on object destruction.
Template Parameters:
T Object type.
DeletePolicy delete object policy used. Defaut is SCOPE policy.

Definition at line 70 of file extendptr.hpp.


Constructor & Destructor Documentation

template<typename T, typename DeletePolicy = SCOPE>
QExtend::ExtendPtr< T, DeletePolicy >::ExtendPtr ( T *  p = 0  )  [inline]

Smart pointer Constructor.

Create Object with its default constructor.

Parameters:
p Object pointer.

Definition at line 127 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
QExtend::ExtendPtr< T, DeletePolicy >::~ExtendPtr (  )  [inline]

Smart pointer Destructor. Use DeletePolicy to decide if object should be deleted.

Delete Object.

Definition at line 175 of file extendptr.hpp.


Member Function Documentation

template<typename T, typename DeletePolicy = SCOPE>
bool QExtend::ExtendPtr< T, DeletePolicy >::isNull (  )  const [inline]

Test if the pointer is null.

Returns:
Returns true if pointer is null.

Definition at line 198 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
QExtend::ExtendPtr< T, DeletePolicy >::operator bool (  )  const [inline]

Bool convertion. It's true if object is not destroyed (Parent destruction).

Definition at line 209 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
QExtend::ExtendPtr< T, DeletePolicy >::operator const T * (  )  const [inline]

Cast to the const object pointer.

Definition at line 231 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
QExtend::ExtendPtr< T, DeletePolicy >::operator T * (  )  [inline]

Cast to the object pointer.

Definition at line 220 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
T& QExtend::ExtendPtr< T, DeletePolicy >::operator* (  )  [inline]

Indirection Operator.

Returns:
Returns a reference to the object.

Definition at line 291 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
const T& QExtend::ExtendPtr< T, DeletePolicy >::operator* (  )  const [inline]

Indirection Operator.

Returns:
Returns a const reference to the object.

Definition at line 311 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
const T* QExtend::ExtendPtr< T, DeletePolicy >::operator-> (  )  const [inline]

Indirection Operator.

Returns:
Returns the const object pointer.

Definition at line 271 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
T* QExtend::ExtendPtr< T, DeletePolicy >::operator-> (  )  [inline]

Indirection Operator.

Returns:
Returns the object pointer.

Definition at line 252 of file extendptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
ExtendPtr<T,DeletePolicy>& QExtend::ExtendPtr< T, DeletePolicy >::operator= ( T *  p  )  [inline]

Reassigne pointer to a new object. Use Delete policy on old pointer.

Create Object with its default constructor.

Parameters:
p New object pointer.

Definition at line 150 of file extendptr.hpp.

Responsable bénévole de la rubrique Qt : Thibaut Cuvelier -