Back to index

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

OutParamRef is a wrapper that tracks a refcounted pointer passed as an outparam argument to a function. More...

#include <RefPtr.h>

List of all members.

Public Member Functions

 ~OutParamRef ()
 operator T ** ()

Private Member Functions

 OutParamRef (RefPtr< T > &p)
 OutParamRef () MOZ_DELETE
OutParamRefoperator= (const OutParamRef &) MOZ_DELETE

Private Attributes

RefPtr< T > & refPtr
T * tmp

Friends

OutParamRef byRef (RefPtr< T > &)
 byRef cooperates with OutParamRef to implement COM outparam semantics.

Detailed Description

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

OutParamRef is a wrapper that tracks a refcounted pointer passed as an outparam argument to a function.

OutParamRef implements COM T** outparam semantics: this requires the callee to AddRef() the T* returned through the T** outparam on behalf of the caller. This means the caller (through OutParamRef) must Release() the old object contained in the tracked RefPtr. It's OK if the callee returns the same T* passed to it through the T** outparam, as long as the callee obeys the COM discipline.

Prefer returning TemporaryRef<T> from functions over creating T** outparams and passing OutParamRef<T> to T**. Prefer RefPtr<T>* outparams over T** outparams.

Definition at line 253 of file RefPtr.h.


Constructor & Destructor Documentation

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

Definition at line 258 of file RefPtr.h.

                   {
        RefPtr<T>::unref(refPtr.ptr);
        refPtr.ptr = tmp;
    }
template<typename T >
mozilla::OutParamRef< T >::OutParamRef ( RefPtr< T > &  p) [inline, private]

Definition at line 266 of file RefPtr.h.

: refPtr(p), tmp(p.get()) {}
template<typename T >
mozilla::OutParamRef< T >::OutParamRef ( ) [private]

Member Function Documentation

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

Definition at line 263 of file RefPtr.h.

{ return &tmp; }
template<typename T >
OutParamRef& mozilla::OutParamRef< T >::operator= ( const OutParamRef< T > &  ) [private]

Friends And Related Function Documentation

template<typename T >
OutParamRef byRef ( RefPtr< T > &  ptr) [friend]

byRef cooperates with OutParamRef to implement COM outparam semantics.


Member Data Documentation

template<typename T >
RefPtr<T>& mozilla::OutParamRef< T >::refPtr [private]

Definition at line 268 of file RefPtr.h.

template<typename T >
T* mozilla::OutParamRef< T >::tmp [private]

Definition at line 269 of file RefPtr.h.


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