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

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

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

#include <objectptr.hpp>

List of all members.

Classes

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

Public Member Functions

template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
 ObjectPtr (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Smart pointer Constructor.
template<typename P1 , typename P2 , typename P3 , typename P4 >
 ObjectPtr (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Smart pointer Constructor.
template<typename P1 , typename P2 , typename P3 >
 ObjectPtr (const P1 &p1, const P2 &p2, const P3 &p3)
 Smart pointer Constructor.
template<typename P1 , typename P2 >
 ObjectPtr (const P1 &p1, const P2 &p2)
 Smart pointer Constructor.
template<typename P >
 ObjectPtr (const P &p)
 Smart pointer Constructor.
 ObjectPtr ()
 Smart pointer Constructor.
 ~ObjectPtr ()
 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::ObjectPtr< T, DeletePolicy >

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

ObjectPtr is use to create automatically the object. Proposed features are :

  1. Create Object in its constructor.
  2. Can't use polymorphisme.
  3. it is not copiable or reasignable
  4. Its constructor can give 0 to 5 parameters, use to call the object creator.
  5. If the object inherint from QObject, check the object life(Qt parent/child destruction feature)
  6. When it's destroyed, ude a policy on object destruction.
Template Parameters:
T QObject type.
DeletePolicy delete object policy used. Defaut is SCOPE policy.

Definition at line 70 of file objectptr.hpp.


Constructor & Destructor Documentation

template<typename T, typename DeletePolicy = SCOPE>
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
QExtend::ObjectPtr< T, DeletePolicy >::ObjectPtr ( const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
) [inline]

Smart pointer Constructor.

Create Object with five parameters. Parameters types are defined by compilator.

Template Parameters:
P1 First parameter type.
P2 Second parameter type.
P3 Third parameter type.
P4 fourth parameter type.
P5 fifth parameter type.
Parameters:
p1 First parameter.
p2 Second parameter.
p3 Third parameter.
p4 fourth parameter.
p5 fifth parameter.

Definition at line 167 of file objectptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
template<typename P1 , typename P2 , typename P3 , typename P4 >
QExtend::ObjectPtr< T, DeletePolicy >::ObjectPtr ( const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
) [inline]

Smart pointer Constructor.

Create Object with four parameters. Parameters types are defined by compilator.

Template Parameters:
P1 First parameter type.
P2 Second parameter type.
P3 Third parameter type.
P4 fourth parameter type.
Parameters:
p1 First parameter.
p2 Second parameter.
p3 Third parameter.
p4 fourth parameter.

Definition at line 226 of file objectptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
template<typename P1 , typename P2 , typename P3 >
QExtend::ObjectPtr< T, DeletePolicy >::ObjectPtr ( const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
) [inline]

Smart pointer Constructor.

Create Object with three parameters. Parameters types are defined by compilator.

Template Parameters:
P1 First parameter type.
P2 Second parameter type.
P3 Third parameter type.
Parameters:
p1 First parameter.
p2 Second parameter.
p3 Third parameter.

Definition at line 279 of file objectptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
template<typename P1 , typename P2 >
QExtend::ObjectPtr< T, DeletePolicy >::ObjectPtr ( const P1 &  p1,
const P2 &  p2 
) [inline]

Smart pointer Constructor.

Create Object with two parameters. Parameters types are defined by compilator.

Template Parameters:
P1 First parameter type.
P2 Second parameter type.
Parameters:
p1 First parameter.
p2 Second parameter.

Definition at line 321 of file objectptr.hpp.

template<typename T, typename DeletePolicy = SCOPE>
template<typename P >
QExtend::ObjectPtr< T, DeletePolicy >::ObjectPtr ( const P &  p  )  [inline]

Smart pointer Constructor.

Create Object with a parameter. Parameter type is defined by compilator.

Template Parameters:
P parameter type.
Parameters:
p parametre.

Definition at line 356 of file objectptr.hpp.

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

Smart pointer Constructor.

Create Object with its default constructor.

Definition at line 379 of file objectptr.hpp.

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

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

Delete Object.

Definition at line 403 of file objectptr.hpp.


Member Function Documentation

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

Test if the pointer is null.

Returns:
Returns true if pointer is null.

Definition at line 427 of file objectptr.hpp.

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

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

Definition at line 438 of file objectptr.hpp.

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

Cast to the const object pointer.

Definition at line 460 of file objectptr.hpp.

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

Cast to the object pointer.

Definition at line 449 of file objectptr.hpp.

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

Indirection Operator.

Returns:
Returns a reference to the object.

Definition at line 520 of file objectptr.hpp.

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

Indirection Operator.

Returns:
Returns a const reference to the object.

Definition at line 539 of file objectptr.hpp.

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

Indirection Operator.

Returns:
Returns the const object pointer.

Definition at line 500 of file objectptr.hpp.

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

Indirection Operator.

Returns:
Returns the object pointer.

Definition at line 481 of file objectptr.hpp.

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