QSharedPointer< T > Class Template Reference

QSharedPointer< T > Class Template Reference

#include <qsharedpointer_impl.h>

Class Description

template<class T>
class QSharedPointer< T >

Definition at line 89 of file qsharedpointer_impl.h.

+ Inheritance diagram for QSharedPointer< T >:

Public Member Functions

 QSharedPointer ()
 
 QSharedPointer (T *ptr)
 
template<typename Deleter >
 QSharedPointer (T *ptr, Deleter d)
 
 QSharedPointer (const QSharedPointer< T > &other)
 
QSharedPointer< T > & operator= (const QSharedPointer< T > &other)
 
template<class X >
 QSharedPointer (const QSharedPointer< X > &other)
 
template<class X >
QSharedPointer< T > & operator= (const QSharedPointer< X > &other)
 
template<class X >
 QSharedPointer (const QWeakPointer< X > &other)
 
template<class X >
QSharedPointer< T > & operator= (const QWeakPointer< X > &other)
 
void swap (QSharedPointer &other)
 
template<class X >
QSharedPointer< X > staticCast () const
 
template<class X >
QSharedPointer< X > dynamicCast () const
 
template<class X >
QSharedPointer< X > constCast () const
 
template<class X >
QSharedPointer< X > objectCast () const
 
void clear ()
 
QWeakPointer< T > toWeakRef () const
 
- Public Member Functions inherited from Basic< T >
T * data () const
 
bool isNull () const
 
 operator RestrictedBool () const
 
bool operator! () const
 
T & operator* () const
 
T * operator-> () const
 

Static Public Member Functions

static QSharedPointer< T > create ()
 

Protected Member Functions

 QSharedPointer (Qt::Initialization i)
 
- Protected Member Functions inherited from ExternalRefCount< T >
void deref ()
 
void internalConstruct (T *ptr)
 
template<typename Deleter >
void internalConstruct (T *ptr, Deleter deleter)
 
void internalCreate ()
 
void internalFinishConstruction (T *ptr)
 
 ExternalRefCount ()
 
 ExternalRefCount (Qt::Initialization i)
 
 ExternalRefCount (T *ptr)
 
template<typename Deleter >
 ExternalRefCount (T *ptr, Deleter deleter)
 
 ExternalRefCount (const ExternalRefCount< T > &other)
 
template<class X >
 ExternalRefCount (const ExternalRefCount< X > &other)
 
 ~ExternalRefCount ()
 
template<class X >
void internalCopy (const ExternalRefCount< X > &other)
 
void internalSwap (ExternalRefCount &other)
 
void ref () const
 
void internalSet (Data *o, T *actual)
 
- Protected Member Functions inherited from Basic< T >
 Basic (T *ptr=0)
 
 Basic (Qt::Initialization)
 
void internalConstruct (T *ptr)
 

Additional Inherited Members

- Public Types inherited from Basic< T >
typedef T Type
 
typedef T element_type
 
typedef T value_type
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef qptrdiff difference_type
 
- Protected Types inherited from ExternalRefCount< T >
typedef ExternalRefCountData Data
 
- Static Protected Member Functions inherited from ExternalRefCount< T >
static void deref (Data *d, T *value)
 
- Protected Attributes inherited from ExternalRefCount< T >
Datad
 
- Protected Attributes inherited from Basic< T >
Typevalue
 

Constructor & Destructor Documentation

QSharedPointer ( )
inline

Definition at line 470 of file qsharedpointer_impl.h.

470 { }
QSharedPointer ( T *  ptr)
inlineexplicit

Definition at line 473 of file qsharedpointer_impl.h.

473  : BaseClass(ptr) // throws
474  { }
QSharedPointer ( T *  ptr,
Deleter  d 
)
inline

Definition at line 477 of file qsharedpointer_impl.h.

477  : BaseClass(ptr, d) // throws
478  { }
QSharedPointer ( const QSharedPointer< T > &  other)
inline

Definition at line 480 of file qsharedpointer_impl.h.

480 : BaseClass(other) { }
QSharedPointer ( const QSharedPointer< X > &  other)
inline

Definition at line 495 of file qsharedpointer_impl.h.

495  : BaseClass(other)
496  { }
QSharedPointer ( const QWeakPointer< X > &  other)
inline

Definition at line 507 of file qsharedpointer_impl.h.

507  : BaseClass(Qt::Uninitialized)
508  { this->d = 0; *this = other; }
QSharedPointer ( Qt::Initialization  i)
inlineexplicitprotected

Definition at line 548 of file qsharedpointer_impl.h.

548 : BaseClass(i) {}

Member Function Documentation

QSharedPointer<T>& operator= ( const QSharedPointer< T > &  other)
inline

Definition at line 481 of file qsharedpointer_impl.h.

482  {
484  return *this;
485  }
void internalCopy(const ExternalRefCount< X > &other)
QSharedPointer<T>& operator= ( const QSharedPointer< X > &  other)
inline

Definition at line 499 of file qsharedpointer_impl.h.

500  {
501  QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid
503  return *this;
504  }
#define QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X)
void internalCopy(const ExternalRefCount< X > &other)
QSharedPointer<T>& operator= ( const QWeakPointer< X > &  other)
inline

Definition at line 511 of file qsharedpointer_impl.h.

512  { BaseClass::internalSet(other.d, other.value); return *this; }
void internalSet(Data *o, T *actual)
void swap ( QSharedPointer< T > &  other)
inline

Definition at line 514 of file qsharedpointer_impl.h.

void internalSwap(ExternalRefCount &other)
QSharedPointer<X> staticCast ( ) const
inline

Definition at line 518 of file qsharedpointer_impl.h.

519  {
520  return qSharedPointerCast<X, T>(*this);
521  }
QSharedPointer<X> dynamicCast ( ) const
inline

Definition at line 524 of file qsharedpointer_impl.h.

525  {
526  return qSharedPointerDynamicCast<X, T>(*this);
527  }
QSharedPointer<X> constCast ( ) const
inline

Definition at line 530 of file qsharedpointer_impl.h.

531  {
532  return qSharedPointerConstCast<X, T>(*this);
533  }
QSharedPointer<X> objectCast ( ) const
inline

Definition at line 537 of file qsharedpointer_impl.h.

538  {
539  return qSharedPointerObjectCast<X, T>(*this);
540  }
void clear ( )
inline

Definition at line 543 of file qsharedpointer_impl.h.

Q_INLINE_TEMPLATE QWeakPointer< T > toWeakRef ( ) const

Definition at line 786 of file qsharedpointer_impl.h.

787 {
788  return QWeakPointer<T>(*this);
789 }
static QSharedPointer<T> create ( )
inlinestatic

Definition at line 551 of file qsharedpointer_impl.h.

552  {
554  result.internalCreate();
555 
556  // now initialize the data
557  new (result.data()) T();
558  result.internalFinishConstruction(result.data());
559  return result;
560  }

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