#include <scim_pointer.h>
Public Member Functions | |
Constructors | |
Pointer (T *object=0) | |
Pointer (Pointer &src) | |
template<typename T1> | |
Pointer (const Pointer< T1 > &src) | |
~Pointer () | |
Pointer & | operator= (T *object) |
Pointer & | operator= (const Pointer &src) |
template<typename T1> | |
Pointer & | operator= (const Pointer< T1 > &src) |
Accessors | |
T & | operator * () const |
T * | operator-> () const |
operator T * () const | |
T * | get () const |
bool | null () const |
Returns true if the Pointer has no dumb pointer. | |
Methods | |
T * | release () |
void | reset (T *object=0) |
Friends | |
template<typename T1, typename T2> | |
bool | operator== (const Pointer< T1 > &t1, const Pointer< T2 > &t2) |
Pointer is a standard auto_ptr-like smart pointer for managing heap allocated reference counted objects. T must be a class derived from scim::ReferencedObject.
scim::Pointer< T >::Pointer | ( | T * | object = 0 |
) | [inline] |
Construct a new smart pointer.
object | - a pointer to an object allocated on the heap. |
scim::Pointer< T >::Pointer | ( | Pointer< T > & | src | ) | [inline] |
scim::Pointer< T >::Pointer | ( | const Pointer< T1 > & | src | ) | [inline] |
scim::Pointer< T >::~Pointer | ( | ) | [inline] |
Destructor. Decreases the object reference count.
Pointer& scim::Pointer< T >::operator= | ( | T * | object | ) | [inline] |
Assignment operator.
object | - a pointer to an object allocated on the heap. |
Pointer& scim::Pointer< T >::operator= | ( | const Pointer< T > & | src | ) | [inline] |
Assignment operator.
src | - a reference to a smart pointer. |
Pointer& scim::Pointer< T >::operator= | ( | const Pointer< T1 > & | src | ) | [inline] |
T& scim::Pointer< T >::operator * | ( | ) | const [inline] |
Dereference operator.
T* scim::Pointer< T >::operator-> | ( | ) | const [inline] |
Member selection operator.
scim::Pointer< T >::operator T * | ( | ) | const [inline] |
Conversion operator. Converts a Pointer into its dumb pointer: the C pointer it manages. Normally it is considered pretty evil to mix smart and regular pointers. In scim you can safely if you just follow the reference counting rules for each of them. You can never call delete on Pointer either because you don't call delete on scim objects; you call unref().
T* scim::Pointer< T >::get | ( | ) | const [inline] |
Returns the dumb pointer; the regular C pointer managed by the Pointer.
bool scim::Pointer< T >::null | ( | ) | const [inline] |
Returns true if the Pointer has no dumb pointer.
T* scim::Pointer< T >::release | ( | ) | [inline] |
Releases the dumb pointer.
void scim::Pointer< T >::reset | ( | T * | object = 0 |
) | [inline] |
bool operator== | ( | const Pointer< T1 > & | t1, | |
const Pointer< T2 > & | t2 | |||
) | [friend] |
Compares two Pointers.