Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Member Functions
nsCOMPtr< nsISupports > Class Reference

#include <nsCOMPtr.h>

Inheritance diagram for nsCOMPtr< nsISupports >:
Inheritance graph
[legend]
Collaboration diagram for nsCOMPtr< nsISupports >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef nsISupports element_type

Public Member Functions

 nsCOMPtr ()
 nsCOMPtr (const nsCOMPtr< nsISupports > &aSmartPtr)
 nsCOMPtr (nsISupports *aRawPtr)
 nsCOMPtr (const already_AddRefed< nsISupports > &aSmartPtr)
 nsCOMPtr (const nsQueryInterface qi)
 nsCOMPtr (const nsQueryInterfaceWithError &qi)
 nsCOMPtr (const nsGetServiceByCID gs)
 nsCOMPtr (const nsGetServiceByCIDWithError &gs)
 nsCOMPtr (const nsGetServiceByContractID gs)
 nsCOMPtr (const nsGetServiceByContractIDWithError &gs)
 nsCOMPtr (const nsCOMPtr_helper &helper)
nsCOMPtr< nsISupports > & operator= (const nsCOMPtr< nsISupports > &rhs)
nsCOMPtr< nsISupports > & operator= (nsISupports *rhs)
nsCOMPtr< nsISupports > & operator= (const already_AddRefed< nsISupports > &rhs)
nsCOMPtr< nsISupports > & operator= (const nsQueryInterface rhs)
nsCOMPtr< nsISupports > & operator= (const nsQueryInterfaceWithError &rhs)
nsCOMPtr< nsISupports > & operator= (const nsGetServiceByCID rhs)
nsCOMPtr< nsISupports > & operator= (const nsGetServiceByCIDWithError &rhs)
nsCOMPtr< nsISupports > & operator= (const nsGetServiceByContractID rhs)
nsCOMPtr< nsISupports > & operator= (const nsGetServiceByContractIDWithError &rhs)
nsCOMPtr< nsISupports > & operator= (const nsCOMPtr_helper &rhs)
void swap (nsCOMPtr< nsISupports > &rhs)
void swap (nsISupports *&rhs)
nsDerivedSafe< nsISupports > * get () const
 operator nsDerivedSafe< nsISupports > * () const
nsDerivedSafe< nsISupports > * operator-> () const
nsCOMPtr< nsISupports > * get_address ()
const nsCOMPtr< nsISupports > * get_address () const
nsDerivedSafe< nsISupports > & operator* () const
nsISupports ** StartAssignment ()

Private Member Functions

NS_COM_GLUE void NS_FASTCALL assign_with_AddRef (nsISupports *)
NS_COM_GLUE void NS_FASTCALL assign_from_qi (const nsQueryInterface, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_qi_with_error (const nsQueryInterfaceWithError &, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_gs_cid (const nsGetServiceByCID, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_gs_cid_with_error (const nsGetServiceByCIDWithError &, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_gs_contractid (const nsGetServiceByContractID, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_gs_contractid_with_error (const nsGetServiceByContractIDWithError &, const nsIID &)
NS_COM_GLUE void NS_FASTCALL assign_from_helper (const nsCOMPtr_helper &, const nsIID &)
NS_COM_GLUE void **NS_FASTCALL begin_assignment ()
 NS_MAY_ALIAS_PTR (nsISupports) mRawPtr
void assign_assuming_AddRef (nsISupports *newPtr)

Detailed Description

Definition at line 921 of file nsCOMPtr.h.


Member Typedef Documentation

typedef nsISupports nsCOMPtr< nsISupports >::element_type

Definition at line 925 of file nsCOMPtr.h.


Constructor & Destructor Documentation

nsCOMPtr< nsISupports >::nsCOMPtr ( ) [inline]

Definition at line 929 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // default constructor
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
        }
nsCOMPtr< nsISupports >::nsCOMPtr ( const nsCOMPtr< nsISupports > &  aSmartPtr) [inline]

Definition at line 936 of file nsCOMPtr.h.

            : nsCOMPtr_base(aSmartPtr.mRawPtr)
          // copy constructor
        {
          if ( mRawPtr )
            NSCAP_ADDREF(this, mRawPtr);
          NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
        }
nsCOMPtr< nsISupports >::nsCOMPtr ( nsISupports *  aRawPtr) [inline]

Definition at line 945 of file nsCOMPtr.h.

            : nsCOMPtr_base(aRawPtr)
          // construct from a raw pointer (of the right type)
        {
          if ( mRawPtr )
            NSCAP_ADDREF(this, mRawPtr);
          NSCAP_LOG_ASSIGNMENT(this, aRawPtr);
        }
nsCOMPtr< nsISupports >::nsCOMPtr ( const already_AddRefed< nsISupports > &  aSmartPtr) [inline]

Definition at line 954 of file nsCOMPtr.h.

            : nsCOMPtr_base(aSmartPtr.mRawPtr)
          // construct from |dont_AddRef(expr)|
        {
          NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
        }
nsCOMPtr< nsISupports >::nsCOMPtr ( const nsQueryInterface  qi) [inline]

Definition at line 961 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_QueryInterface(expr)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_qi(qi, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsQueryInterfaceWithError &  qi) [inline]

Definition at line 969 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_QueryInterface(expr, &rv)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_qi_with_error(qi, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsGetServiceByCID  gs) [inline]

Definition at line 977 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_GetService(cid_expr)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_gs_cid(gs, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsGetServiceByCIDWithError &  gs) [inline]

Definition at line 985 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_GetService(cid_expr, &rv)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_gs_cid_with_error(gs, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsGetServiceByContractID  gs) [inline]

Definition at line 993 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_GetService(contractid_expr)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_gs_contractid(gs, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsGetServiceByContractIDWithError &  gs) [inline]

Definition at line 1001 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // assign from |do_GetService(contractid_expr, &rv)|
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_gs_contractid_with_error(gs, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:

nsCOMPtr< nsISupports >::nsCOMPtr ( const nsCOMPtr_helper helper) [inline]

Definition at line 1009 of file nsCOMPtr.h.

            : nsCOMPtr_base(0)
          // ...and finally, anything else we might need to construct from
          //  can exploit the |nsCOMPtr_helper| facility
        {
          NSCAP_LOG_ASSIGNMENT(this, 0);
          assign_from_helper(helper, NS_GET_IID(nsISupports));
        }

Here is the call graph for this function:


Member Function Documentation

void nsCOMPtr_base::assign_assuming_AddRef ( nsISupports *  newPtr) [inline, protected, inherited]

Definition at line 516 of file nsCOMPtr.h.

        {
            /*
              |AddRef()|ing the new value (before entering this function) before
              |Release()|ing the old lets us safely ignore the self-assignment case.
              We must, however, be careful only to |Release()| _after_ doing the
              assignment, in case the |Release()| leads to our _own_ destruction,
              which would, in turn, cause an incorrect second |Release()| of our old
              pointer.  Thank <waterson@netscape.com> for discovering this.
            */
          nsISupports* oldPtr = mRawPtr;
          mRawPtr = newPtr;
          NSCAP_LOG_ASSIGNMENT(this, newPtr);
          NSCAP_LOG_RELEASE(this, oldPtr);
          if ( oldPtr )
            NSCAP_RELEASE(this, oldPtr);
        }

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_gs_cid ( const nsGetServiceByCID  gs,
const nsIID iid 
) [inherited]

Definition at line 111 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_gs_cid_with_error ( const nsGetServiceByCIDWithError &  gs,
const nsIID iid 
) [inherited]

Definition at line 120 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_gs_contractid ( const nsGetServiceByContractID  gs,
const nsIID iid 
) [inherited]

Definition at line 129 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_gs_contractid_with_error ( const nsGetServiceByContractIDWithError &  gs,
const nsIID iid 
) [inherited]

Definition at line 138 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( gs(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_helper ( const nsCOMPtr_helper helper,
const nsIID iid 
) [inherited]

Definition at line 147 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( helper(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_qi ( const nsQueryInterface  qi,
const nsIID iid 
) [inherited]

Definition at line 93 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( qi(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_from_qi_with_error ( const nsQueryInterfaceWithError &  qi,
const nsIID iid 
) [inherited]

Definition at line 102 of file nsCOMPtr.cpp.

       {
              nsISupports* newRawPtr;
              if ( NS_FAILED( qi(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
                     newRawPtr = 0;
    assign_assuming_AddRef(newRawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsCOMPtr_base::assign_with_AddRef ( nsISupports *  rawPtr) [inherited]

Definition at line 85 of file nsCOMPtr.cpp.

       {
    if ( rawPtr )
       NSCAP_ADDREF(this, rawPtr);
    assign_assuming_AddRef(rawPtr);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file nsCOMPtr.cpp.

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

Here is the call graph for this function:

Here is the caller graph for this function:

nsDerivedSafe<nsISupports>* nsCOMPtr< nsISupports >::get ( ) const [inline]

Definition at line 1130 of file nsCOMPtr.h.

Here is the caller graph for this function:

nsCOMPtr<nsISupports>* nsCOMPtr< nsISupports >::get_address ( ) [inline]

Definition at line 1174 of file nsCOMPtr.h.

        {
          return this;
        }
const nsCOMPtr<nsISupports>* nsCOMPtr< nsISupports >::get_address ( ) const [inline]

Definition at line 1182 of file nsCOMPtr.h.

        {
          return this;
        }
nsCOMPtr_base::NS_MAY_ALIAS_PTR ( nsISupports  ) [protected, inherited]
nsCOMPtr< nsISupports >::operator nsDerivedSafe< nsISupports > * ( ) const [inline]

Definition at line 1141 of file nsCOMPtr.h.

        {
          return get();
        }
nsDerivedSafe<nsISupports>& nsCOMPtr< nsISupports >::operator* ( ) const [inline]

Definition at line 1194 of file nsCOMPtr.h.

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

Definition at line 1154 of file nsCOMPtr.h.

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

Definition at line 1022 of file nsCOMPtr.h.

        {
          assign_with_AddRef(rhs.mRawPtr);
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( nsISupports *  rhs) [inline]

Definition at line 1030 of file nsCOMPtr.h.

        {
          assign_with_AddRef(rhs);
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const already_AddRefed< nsISupports > &  rhs) [inline]

Definition at line 1038 of file nsCOMPtr.h.

        {
          assign_assuming_AddRef(rhs.mRawPtr);
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsQueryInterface  rhs) [inline]

Definition at line 1046 of file nsCOMPtr.h.

        {
          assign_from_qi(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsQueryInterfaceWithError &  rhs) [inline]

Definition at line 1054 of file nsCOMPtr.h.

        {
          assign_from_qi_with_error(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsGetServiceByCID  rhs) [inline]

Definition at line 1062 of file nsCOMPtr.h.

        {
          assign_from_gs_cid(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsGetServiceByCIDWithError &  rhs) [inline]

Definition at line 1070 of file nsCOMPtr.h.

        {
          assign_from_gs_cid_with_error(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsGetServiceByContractID  rhs) [inline]

Definition at line 1078 of file nsCOMPtr.h.

        {
          assign_from_gs_contractid(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsGetServiceByContractIDWithError &  rhs) [inline]

Definition at line 1086 of file nsCOMPtr.h.

        {
          assign_from_gs_contractid_with_error(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsCOMPtr<nsISupports>& nsCOMPtr< nsISupports >::operator= ( const nsCOMPtr_helper rhs) [inline]

Definition at line 1094 of file nsCOMPtr.h.

        {
          assign_from_helper(rhs, NS_GET_IID(nsISupports));
          return *this;
        }

Here is the call graph for this function:

nsISupports** nsCOMPtr< nsISupports >::StartAssignment ( ) [inline]

Definition at line 1206 of file nsCOMPtr.h.

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

Here is the call graph for this function:

void nsCOMPtr< nsISupports >::swap ( nsCOMPtr< nsISupports > &  rhs) [inline]

Definition at line 1103 of file nsCOMPtr.h.

        {
          nsISupports* temp = rhs.mRawPtr;
          NSCAP_LOG_ASSIGNMENT(&rhs, mRawPtr);
          NSCAP_LOG_ASSIGNMENT(this, temp);
          NSCAP_LOG_RELEASE(this, mRawPtr);
          NSCAP_LOG_RELEASE(&rhs, temp);
          rhs.mRawPtr = mRawPtr;
          mRawPtr = temp;
        }

Here is the caller graph for this function:

void nsCOMPtr< nsISupports >::swap ( nsISupports *&  rhs) [inline]

Definition at line 1116 of file nsCOMPtr.h.

        {
          nsISupports* temp = rhs;
          NSCAP_LOG_ASSIGNMENT(this, temp);
          NSCAP_LOG_RELEASE(this, mRawPtr);
          rhs = mRawPtr;
          mRawPtr = temp;
        }

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