Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Member Functions | Private Attributes
nsRefPtr< T > Class Template Reference

#include <nsAutoPtr.h>

Collaboration diagram for nsRefPtr< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef T element_type

Public Member Functions

 ~nsRefPtr ()
 nsRefPtr ()
 nsRefPtr (const nsRefPtr< T > &aSmartPtr)
 nsRefPtr (T *aRawPtr)
 nsRefPtr (const already_AddRefed< T > &aSmartPtr)
nsRefPtr< T > & operator= (const nsRefPtr< T > &rhs)
nsRefPtr< T > & operator= (T *rhs)
nsRefPtr< T > & operator= (const already_AddRefed< T > &rhs)
void swap (nsRefPtr< T > &rhs)
void swap (T *&rhs)
nsDerivedSafe< T > * get () const
 operator nsDerivedSafe< T > * () const
nsDerivedSafe< T > * operator-> () const
nsRefPtr< T > * get_address ()
const nsRefPtr< T > * get_address () const
nsDerivedSafe< T > & operator* () const
T ** StartAssignment ()

Private Member Functions

void assign_with_AddRef (T *rawPtr)
void ** begin_assignment ()
void assign_assuming_AddRef (T *newPtr)

Private Attributes

TmRawPtr

Detailed Description

template<class T>
class nsRefPtr< T >

Definition at line 919 of file nsAutoPtr.h.


Member Typedef Documentation

template<class T>
typedef T nsRefPtr< T >::element_type

Definition at line 951 of file nsAutoPtr.h.


Constructor & Destructor Documentation

template<class T>
nsRefPtr< T >::~nsRefPtr ( ) [inline]

Definition at line 953 of file nsAutoPtr.h.

        {
          if ( mRawPtr )
            mRawPtr->Release();
        }
template<class T>
nsRefPtr< T >::nsRefPtr ( ) [inline]

Definition at line 961 of file nsAutoPtr.h.

            : mRawPtr(0)
          // default constructor
        {
        }
template<class T>
nsRefPtr< T >::nsRefPtr ( const nsRefPtr< T > &  aSmartPtr) [inline]

Definition at line 967 of file nsAutoPtr.h.

            : mRawPtr(aSmartPtr.mRawPtr)
          // copy-constructor
        {
          if ( mRawPtr )
            mRawPtr->AddRef();
        }
template<class T>
nsRefPtr< T >::nsRefPtr ( T aRawPtr) [inline]

Definition at line 975 of file nsAutoPtr.h.

            : mRawPtr(aRawPtr)
          // construct from a raw pointer (of the right type)
        {
          if ( mRawPtr )
            mRawPtr->AddRef();
        }
template<class T>
nsRefPtr< T >::nsRefPtr ( const already_AddRefed< T > &  aSmartPtr) [inline]

Definition at line 983 of file nsAutoPtr.h.

            : mRawPtr(aSmartPtr.mRawPtr)
          // construct from |dont_AddRef(expr)|
        {
        }

Member Function Documentation

template<class T>
void nsRefPtr< T >::assign_assuming_AddRef ( T newPtr) [inline, private]

Definition at line 939 of file nsAutoPtr.h.

        {
          T* oldPtr = mRawPtr;
          mRawPtr = newPtr;
          if ( oldPtr )
            oldPtr->Release();
        }

Here is the caller graph for this function:

template<class T>
void nsRefPtr< T >::assign_with_AddRef ( T rawPtr) [inline, private]

Definition at line 924 of file nsAutoPtr.h.

        {
          if ( rawPtr )
            rawPtr->AddRef();
          assign_assuming_AddRef(rawPtr);
        }

Here is the caller graph for this function:

template<class T>
void** nsRefPtr< T >::begin_assignment ( ) [inline, private]

Definition at line 932 of file nsAutoPtr.h.

Here is the caller graph for this function:

template<class T>
nsDerivedSafe<T>* nsRefPtr< T >::get ( ) const [inline]

Definition at line 1036 of file nsAutoPtr.h.

Here is the caller graph for this function:

template<class T>
nsRefPtr<T>* nsRefPtr< T >::get_address ( ) [inline]

Definition at line 1081 of file nsAutoPtr.h.

        {
          return this;
        }

Here is the caller graph for this function:

template<class T>
const nsRefPtr<T>* nsRefPtr< T >::get_address ( ) const [inline]

Definition at line 1089 of file nsAutoPtr.h.

        {
          return this;
        }
template<class T>
nsRefPtr< T >::operator nsDerivedSafe< T > * ( ) const [inline]

Definition at line 1048 of file nsAutoPtr.h.

        {
          return get();
        }
template<class T>
nsDerivedSafe<T>& nsRefPtr< T >::operator* ( ) const [inline]

Definition at line 1100 of file nsAutoPtr.h.

        {
          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator*().");
          return *get();
        }
template<class T>
nsDerivedSafe<T>* nsRefPtr< T >::operator-> ( void  ) const [inline]

Definition at line 1061 of file nsAutoPtr.h.

        {
          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator->().");
          return get();
        }
template<class T>
nsRefPtr<T>& nsRefPtr< T >::operator= ( const nsRefPtr< T > &  rhs) [inline]

Definition at line 992 of file nsAutoPtr.h.

        {
          assign_with_AddRef(rhs.mRawPtr);
          return *this;
        }
template<class T>
nsRefPtr<T>& nsRefPtr< T >::operator= ( T rhs) [inline]

Definition at line 1000 of file nsAutoPtr.h.

        {
          assign_with_AddRef(rhs);
          return *this;
        }
template<class T>
nsRefPtr<T>& nsRefPtr< T >::operator= ( const already_AddRefed< T > &  rhs) [inline]

Definition at line 1008 of file nsAutoPtr.h.

        {
          assign_assuming_AddRef(rhs.mRawPtr);
          return *this;
        }
template<class T>
T** nsRefPtr< T >::StartAssignment ( ) [inline]

Definition at line 1107 of file nsAutoPtr.h.

        {
#ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
          return NS_REINTERPRET_CAST(T**, begin_assignment());
#else
          assign_assuming_AddRef(0);
          return NS_REINTERPRET_CAST(T**, &mRawPtr);
#endif
        }
template<class T>
void nsRefPtr< T >::swap ( nsRefPtr< T > &  rhs) [inline]

Definition at line 1018 of file nsAutoPtr.h.

        {
          T* temp = rhs.mRawPtr;
          rhs.mRawPtr = mRawPtr;
          mRawPtr = temp;
        }

Here is the caller graph for this function:

template<class T>
void nsRefPtr< T >::swap ( T *&  rhs) [inline]

Definition at line 1027 of file nsAutoPtr.h.

        {
          T* temp = rhs;
          rhs = mRawPtr;
          mRawPtr = temp;
        }

Member Data Documentation

template<class T>
T* nsRefPtr< T >::mRawPtr [private]

Definition at line 948 of file nsAutoPtr.h.


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