• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Member Functions | List of all members
TDESharedPtr< T > Class Template Reference

#include <ksharedptr.h>

Public Member Functions

 TDESharedPtr ()
 
 TDESharedPtr (T *t)
 
 TDESharedPtr (const TDESharedPtr &p)
 
 ~TDESharedPtr ()
 
TDESharedPtr< T > & operator= (const TDESharedPtr< T > &p)
 
TDESharedPtr< T > & operator= (T *p)
 
bool operator== (const TDESharedPtr< T > &p) const
 
bool operator!= (const TDESharedPtr< T > &p) const
 
bool operator== (const T *p) const
 
bool operator!= (const T *p) const
 
bool operator! () const
 
 operator T* () const
 
T * data ()
 
const T * data () const
 
const T & operator* () const
 
T & operator* ()
 
const T * operator-> () const
 
T * operator-> ()
 
int count () const
 

Detailed Description

template<class T>
class TDESharedPtr< T >

Can be used to control the lifetime of an object that has derived TDEShared.

As long a someone holds a TDESharedPtr on some TDEShared object it won't become deleted but is deleted once its reference count is 0. This struct emulates C++ pointers virtually perfectly. So just use it like a simple C++ pointer.

TDEShared and TDESharedPtr are preferred over QShared / QSharedPtr since they are more safe.

WARNING: Please note that this class template provides an implicit conversion to T*. Do not change this pointer or the pointee (don't call delete on it, for instance) behind TDESharedPtr's back.

Author
Waldo Bastian basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g

Definition at line 100 of file ksharedptr.h.

Constructor & Destructor Documentation

◆ TDESharedPtr() [1/3]

template<class T >
TDESharedPtr< T >::TDESharedPtr ( )
inline

Creates a null pointer.

Definition at line 106 of file ksharedptr.h.

◆ TDESharedPtr() [2/3]

template<class T >
TDESharedPtr< T >::TDESharedPtr ( T *  t)
inline

Creates a new pointer.

Parameters
tthe pointer

Definition at line 112 of file ksharedptr.h.

◆ TDESharedPtr() [3/3]

template<class T >
TDESharedPtr< T >::TDESharedPtr ( const TDESharedPtr< T > &  p)
inline

Copies a pointer.

Parameters
pthe pointer to copy

Definition at line 119 of file ksharedptr.h.

◆ ~TDESharedPtr()

template<class T >
TDESharedPtr< T >::~TDESharedPtr ( )
inline

Unreferences the object that this pointer points to.

If it was the last reference, the object will be deleted.

Definition at line 126 of file ksharedptr.h.

Member Function Documentation

◆ count()

template<class T >
int TDESharedPtr< T >::count ( ) const
inline

Returns the number of references.

Returns
the number of references

Definition at line 170 of file ksharedptr.h.

◆ data() [1/2]

template<class T >
T * TDESharedPtr< T >::data ( )
inline

Returns the pointer.

Returns
the pointer

Definition at line 153 of file ksharedptr.h.

◆ data() [2/2]

template<class T >
const T * TDESharedPtr< T >::data ( ) const
inline

Returns the pointer.

Returns
the pointer

Definition at line 159 of file ksharedptr.h.

◆ operator T*()

template<class T >
TDESharedPtr< T >::operator T* ( ) const
inline

Definition at line 147 of file ksharedptr.h.

◆ operator!()

template<class T >
bool TDESharedPtr< T >::operator! ( ) const
inline

Definition at line 146 of file ksharedptr.h.

◆ operator!=() [1/2]

template<class T >
bool TDESharedPtr< T >::operator!= ( const T *  p) const
inline

Definition at line 145 of file ksharedptr.h.

◆ operator!=() [2/2]

template<class T >
bool TDESharedPtr< T >::operator!= ( const TDESharedPtr< T > &  p) const
inline

Definition at line 143 of file ksharedptr.h.

◆ operator*() [1/2]

template<class T >
T & TDESharedPtr< T >::operator* ( )
inline

Definition at line 162 of file ksharedptr.h.

◆ operator*() [2/2]

template<class T >
const T & TDESharedPtr< T >::operator* ( ) const
inline

Definition at line 161 of file ksharedptr.h.

◆ operator->() [1/2]

template<class T >
T * TDESharedPtr< T >::operator-> ( )
inline

Definition at line 164 of file ksharedptr.h.

◆ operator->() [2/2]

template<class T >
const T * TDESharedPtr< T >::operator-> ( ) const
inline

Definition at line 163 of file ksharedptr.h.

◆ operator=() [1/2]

template<class T >
TDESharedPtr< T > & TDESharedPtr< T >::operator= ( const TDESharedPtr< T > &  p)
inline

Definition at line 128 of file ksharedptr.h.

◆ operator=() [2/2]

template<class T >
TDESharedPtr< T > & TDESharedPtr< T >::operator= ( T *  p)
inline

Definition at line 135 of file ksharedptr.h.

◆ operator==() [1/2]

template<class T >
bool TDESharedPtr< T >::operator== ( const T *  p) const
inline

Definition at line 144 of file ksharedptr.h.

◆ operator==() [2/2]

template<class T >
bool TDESharedPtr< T >::operator== ( const TDESharedPtr< T > &  p) const
inline

Definition at line 142 of file ksharedptr.h.


The documentation for this class was generated from the following file:
  • ksharedptr.h

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.