Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

com::ErrorInfoKeeper Class Reference

#include <ErrorInfo.h>

Inheritance diagram for com::ErrorInfoKeeper:


List of all members.

Detailed Description

A convenience subclass of ErrorInfo that allows to preserve the current error info. Instances of this class fetch an error info object set on the current thread and keep a reference to it, which allows to restore it later using the restore() method. This is useful to preserve error information returned by some method for the duration of making another COM call that may set its own error info and overwrite the existing one. Preserving and restoring error information makes sense when some method wants to return error information set by other call as its own error information while it still needs to make another call before return.

Instead of calling restore() explicitly you may let the object destructor do it for you, if you correctly limit the object's lifetime.

The usage pattern is: rc = foo->method(); if (FAILED (rc)) { ErrorInfoKeeper eik; ... // bar may return error info as well bar->method(); ... // no need to call restore() explicitly here because the eik's // destructor will restore error info fetched after the failed // call to foo before returning to the caller return rc; }

Definition at line 351 of file ErrorInfo.h.

Public Member Functions

 ErrorInfoKeeper (bool aIsNull=false)
void fetch ()
void forget ()
const GuidgetCalleeIID () const
const BstrgetCalleeName () const
const BstrgetComponent () const
const GuidgetInterfaceID () const
const BstrgetInterfaceName () const
const ErrorInfogetNext () const
HRESULT getResultCode () const
const BstrgetText () const
bool isBasicAvailable () const
bool isFullAvailable () const
bool isNull () const
HRESULT restore ()
void setNull ()
ComPtr< IUnknown > takeError ()
 ~ErrorInfoKeeper ()

Protected Member Functions

void init (IVirtualBoxErrorInfo *aInfo)
void init (IUnknown *aUnk, const GUID &aIID, bool aKeepObj=false)
void init (bool aKeepObj=false)

Protected Attributes

Guid mCalleeIID
Bstr mCalleeName
Bstr mComponent
ComPtr< IUnknown > mErrorInfo
Guid mInterfaceID
Bstr mInterfaceName
bool mIsBasicAvailable: 1
bool mIsFullAvailable: 1
cppx::auto_copy_ptr< ErrorInfomNext
HRESULT mResultCode
Bstr mText

Private Attributes

bool mForgot: 1

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

Generated by  Doxygen 1.6.0   Back to index