struct KSharedPtr

# struct KSharedPtr | Can be used to control the lifetime of an object that has derived KShared. More...
Definition | `#include <ksharedptr.h>`
Template form | KSharedPtr< class T >
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KSharedPtr ()
- KSharedPtr ( T* t )
- KSharedPtr ( const KSharedPtr& p )
- ~KSharedPtr ()
- KSharedPtr& operator= ( const KSharedPtr& p )
- KSharedPtr& operator= ( T* p )
- bool operator== ( const KSharedPtr& p ) const
- bool operator!= ( const KSharedPtr& 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

Can be used to control the lifetime of an object that has derived KShared. As long a someone holds a KSharedPtr on some KShared object it won't become deleted but is deleted once its reference count is 0. This struct emulates C++ pointers perfectly. So just use it like a simple C++ pointer.

KShared and KSharedPtr are preferred over QShared / QSharedPtr since they are more safe.

KSharedPtr () | ### KSharedPtr

Creates a null pointer.

KSharedPtr ( T* t ) | ### KSharedPtr

Creates a new pointer.

Parameters:

the | pointer

KSharedPtr ( const KSharedPtr& p ) | ### KSharedPtr

Copies a pointer.

Parameters:

the | pointer to copy

~KSharedPtr () | ### ~KSharedPtr

Unreferences the object that this pointer points to. If it was the last reference, the object will be deleted.

KSharedPtr& operator= ( const KSharedPtr& p ) | ### operator=

KSharedPtr& operator= ( T* p ) | ### operator=

bool operator== ( const KSharedPtr& p ) | ### operator==

[const]

bool operator!= ( const KSharedPtr& p ) | ### operator!=

[const]

bool operator== ( const T* p ) | ### operator==

[const]

bool operator!= ( const T* p ) | ### operator!=

[const]

bool operator! () | ### operator!

[const]

operator T* () | ### operator T*

[const]

T* data () | ### data

Returns the pointer.

Returns: the pointer

const T* data () | ### data

[const]

Returns the pointer.

Returns: the pointer

const T& operator* () | ### operator*

[const]

T& operator* () | ### operator*

const T* operator-> () | ### operator->

[const]

T* operator-> () | ### operator->

int count () | ### count

[const]

Returns the number of references.

Returns: the number of references

- Version: $Id: ksharedptr.h,v 1.20 2002/09/08 14:55:42 tjansen Exp $
- Author: Waldo Bastian
- Generated: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:15 2003, using kdoc 2.0a54.