Back to index

enigmail  1.4.3
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
mozilla::RefPtr< T > Class Template Reference

RefPtr points to a refcounted thing that has AddRef and Release methods to increase/decrease the refcount, respectively. More...

#include <RefPtr.h>

List of all members.

Classes

struct  dontRef

Public Member Functions

 RefPtr ()
 RefPtr (const RefPtr &o)
 RefPtr (const TemporaryRef< T > &o)
 RefPtr (T *t)
template<typename U >
 RefPtr (const RefPtr< U > &o)
 ~RefPtr ()
RefPtroperator= (const RefPtr &o)
RefPtroperator= (const TemporaryRef< T > &o)
RefPtroperator= (T *t)
template<typename U >
RefPtroperator= (const RefPtr< U > &o)
TemporaryRef< T > forget ()
T * get () const
 operator T * () const
T * operator-> () const
T & operator* () const
template<typename U >
 operator TemporaryRef< U > ()

Private Member Functions

void assign (T *t)

Static Private Member Functions

static MOZ_ALWAYS_INLINE T * ref (T *t)
static MOZ_ALWAYS_INLINE void unref (T *t)

Private Attributes

T * ptr

Friends

class TemporaryRef< T >
class OutParamRef< T >

Detailed Description

template<typename T>
class mozilla::RefPtr< T >

RefPtr points to a refcounted thing that has AddRef and Release methods to increase/decrease the refcount, respectively.

After a RefPtr<T> is assigned a T*, the T* can be used through the RefPtr as if it were a T*.

A RefPtr can forget its underlying T*, which results in the T* being wrapped in a temporary object until the T* is either re-adopted from or released by the temporary.

Definition at line 127 of file RefPtr.h.


Class Documentation

struct mozilla::RefPtr::dontRef

template<typename T>
struct mozilla::RefPtr< T >::dontRef

Definition at line 133 of file RefPtr.h.


Constructor & Destructor Documentation

template<typename T>
mozilla::RefPtr< T >::RefPtr ( ) [inline]

Definition at line 136 of file RefPtr.h.

: ptr(0) { }
template<typename T>
mozilla::RefPtr< T >::RefPtr ( const RefPtr< T > &  o) [inline]

Definition at line 137 of file RefPtr.h.

: ptr(ref(o.ptr)) {}
template<typename T>
mozilla::RefPtr< T >::RefPtr ( const TemporaryRef< T > &  o) [inline]

Definition at line 138 of file RefPtr.h.

: ptr(o.drop()) {}
template<typename T>
mozilla::RefPtr< T >::RefPtr ( T *  t) [inline]

Definition at line 139 of file RefPtr.h.

: ptr(ref(t)) {}
template<typename T>
template<typename U >
mozilla::RefPtr< T >::RefPtr ( const RefPtr< U > &  o) [inline]

Definition at line 142 of file RefPtr.h.

: ptr(ref(o.get())) {}
template<typename T>
mozilla::RefPtr< T >::~RefPtr ( ) [inline]

Definition at line 144 of file RefPtr.h.

{ unref(ptr); }

Here is the call graph for this function:


Member Function Documentation

template<typename T>
void mozilla::RefPtr< T >::assign ( T *  t) [inline, private]

Definition at line 179 of file RefPtr.h.

                      {
        unref(ptr);
        ptr = t;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
TemporaryRef<T> mozilla::RefPtr< T >::forget ( ) [inline]

Definition at line 165 of file RefPtr.h.

                             {
        T* tmp = ptr;
        ptr = 0;
        return TemporaryRef<T>(tmp, dontRef());
    }
template<typename T>
T* mozilla::RefPtr< T >::get ( ) const [inline]

Definition at line 171 of file RefPtr.h.

{ return ptr; }

Here is the caller graph for this function:

template<typename T>
mozilla::RefPtr< T >::operator T * ( ) const [inline]

Definition at line 172 of file RefPtr.h.

{ return ptr; }
template<typename T>
template<typename U >
mozilla::RefPtr< T >::operator TemporaryRef< U > ( ) [inline]

Definition at line 176 of file RefPtr.h.

{ return TemporaryRef<U>(ptr); }
template<typename T>
T& mozilla::RefPtr< T >::operator* ( ) const [inline]

Definition at line 174 of file RefPtr.h.

{ return *ptr; }
template<typename T>
T* mozilla::RefPtr< T >::operator-> ( ) const [inline]

Definition at line 173 of file RefPtr.h.

{ return ptr; }
template<typename T>
RefPtr& mozilla::RefPtr< T >::operator= ( const RefPtr< T > &  o) [inline]

Definition at line 146 of file RefPtr.h.

                                       {
        assign(ref(o.ptr));
        return *this;
    }

Here is the call graph for this function:

template<typename T>
RefPtr& mozilla::RefPtr< T >::operator= ( const TemporaryRef< T > &  o) [inline]

Definition at line 150 of file RefPtr.h.

                                                {
        assign(o.drop());
        return *this;
    }

Here is the call graph for this function:

template<typename T>
RefPtr& mozilla::RefPtr< T >::operator= ( T *  t) [inline]

Definition at line 154 of file RefPtr.h.

                            {
        assign(ref(t));
        return *this;
    }

Here is the call graph for this function:

template<typename T>
template<typename U >
RefPtr& mozilla::RefPtr< T >::operator= ( const RefPtr< U > &  o) [inline]

Definition at line 160 of file RefPtr.h.

                                          {
        assign(ref(o.get()));
        return *this;
    }

Here is the call graph for this function:

template<typename T>
static MOZ_ALWAYS_INLINE T* mozilla::RefPtr< T >::ref ( T *  t) [inline, static, private]

Definition at line 186 of file RefPtr.h.

                                          {
        if (t) {
            t->AddRef();
        }
        return t;
    }

Here is the caller graph for this function:

template<typename T>
static MOZ_ALWAYS_INLINE void mozilla::RefPtr< T >::unref ( T *  t) [inline, static, private]

Definition at line 193 of file RefPtr.h.

                                              {
        if (t) {
            t->Release();
        }
    }

Here is the caller graph for this function:


Friends And Related Function Documentation

template<typename T>
friend class OutParamRef< T > [friend]

Definition at line 131 of file RefPtr.h.

template<typename T>
friend class TemporaryRef< T > [friend]

Definition at line 130 of file RefPtr.h.


Member Data Documentation

template<typename T>
T* mozilla::RefPtr< T >::ptr [private]

Definition at line 184 of file RefPtr.h.


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