Back to index

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

#include <nsAutoPtr.h>

Inheritance diagram for nsAutoPtr< T >:
Inheritance graph
[legend]
Collaboration diagram for nsAutoPtr< T >:
Collaboration graph
[legend]

List of all members.

Classes

class  Ptr

Public Types

typedef T element_type

Public Member Functions

 ~nsAutoPtr ()
 nsAutoPtr ()
 nsAutoPtr (Ptr aRawPtr)
 nsAutoPtr (nsAutoPtr< T > &aSmartPtr)
nsAutoPtr< T > & operator= (T *rhs)
nsAutoPtr< T > & operator= (nsAutoPtr< T > &rhs)
Tget () const
 operator T * () const
Tforget ()
Toperator-> () const
nsAutoPtr< T > * get_address ()
const nsAutoPtr< T > * get_address () const
Toperator* () const
T ** StartAssignment ()

Private Member Functions

void ** begin_assignment ()
void assign (T *newPtr)

Private Attributes

TmRawPtr

Detailed Description

template<class T>
class nsAutoPtr< T >

Definition at line 56 of file nsAutoPtr.h.


Member Typedef Documentation

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

Definition at line 100 of file nsAutoPtr.h.


Constructor & Destructor Documentation

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

Definition at line 102 of file nsAutoPtr.h.

        {
          delete mRawPtr;
        }
template<class T>
nsAutoPtr< T >::nsAutoPtr ( ) [inline]

Definition at line 109 of file nsAutoPtr.h.

            : mRawPtr(0)
          // default constructor
        {
        }
template<class T>
nsAutoPtr< T >::nsAutoPtr ( Ptr  aRawPtr) [inline]

Definition at line 115 of file nsAutoPtr.h.

            : mRawPtr(aRawPtr)
          // construct from a raw pointer (of the right type)
        {
        }
template<class T>
nsAutoPtr< T >::nsAutoPtr ( nsAutoPtr< T > &  aSmartPtr) [inline]

Definition at line 121 of file nsAutoPtr.h.

            : mRawPtr( aSmartPtr.forget() )
          // Construct by transferring ownership from another smart pointer.
        {
        }

Member Function Documentation

template<class T>
void nsAutoPtr< T >::assign ( T newPtr) [inline, private]

Definition at line 67 of file nsAutoPtr.h.

        {
          T* oldPtr = mRawPtr;
          mRawPtr = newPtr;
          delete oldPtr;
        }

Here is the caller graph for this function:

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

Definition at line 60 of file nsAutoPtr.h.

        {
          assign(0);
          return NS_REINTERPRET_CAST(void**, &mRawPtr);
        }

Here is the caller graph for this function:

template<class T>
T* nsAutoPtr< T >::forget ( ) [inline]

Definition at line 173 of file nsAutoPtr.h.

        {
          T* temp = mRawPtr;
          mRawPtr = 0;
          return temp;
        }
template<class T>
T* nsAutoPtr< T >::get ( ) const [inline]

Definition at line 148 of file nsAutoPtr.h.

        {
          return mRawPtr;
        }

Here is the caller graph for this function:

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

Definition at line 201 of file nsAutoPtr.h.

        {
          return this;
        }

Here is the caller graph for this function:

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

Definition at line 209 of file nsAutoPtr.h.

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

Definition at line 158 of file nsAutoPtr.h.

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

Definition at line 220 of file nsAutoPtr.h.

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

Definition at line 181 of file nsAutoPtr.h.

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

Definition at line 131 of file nsAutoPtr.h.

        {
          assign(rhs);
          return *this;
        }
template<class T>
nsAutoPtr<T>& nsAutoPtr< T >::operator= ( nsAutoPtr< T > &  rhs) [inline]

Definition at line 138 of file nsAutoPtr.h.

        {
          assign(rhs.forget());
          return *this;
        }
template<class T>
T** nsAutoPtr< T >::StartAssignment ( ) [inline]

Definition at line 227 of file nsAutoPtr.h.

        {
#ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
          return NS_REINTERPRET_CAST(T**, begin_assignment());
#else
          assign(0);
          return NS_REINTERPRET_CAST(T**, &mRawPtr);
#endif
        }

Here is the caller graph for this function:


Member Data Documentation

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

Definition at line 97 of file nsAutoPtr.h.


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