ErrorInfo.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
/* $Id$ */
/** @file
*
* ErrorInfo class definition
*/
/*
* Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#if defined(VBOX_WITH_XPCOM)
# include <nsIServiceManager.h>
# include <nsIExceptionService.h>
# include <nsCOMPtr.h>
#endif
#include "VBox/com/VirtualBox.h"
#include "VBox/com/ErrorInfo.h"
#include "VBox/com/MultiResult.h"
namespace com
{
////////////////////////////////////////////////////////////////////////////////
//
// ErrorInfo class
//
////////////////////////////////////////////////////////////////////////////////
{
mResultCode = x.mResultCode;
mInterfaceID = x.mInterfaceID;
mComponent = x.mComponent;
else
mCalleeIID = x.mCalleeIID;
mCalleeName = x.mCalleeName;
mErrorInfo = x.mErrorInfo;
}
{
mIsBasicAvailable = false;
mIsFullAvailable = false;
if (m_pNext)
{
delete m_pNext;
}
mResultCode = S_OK;
mCalleeIID.clear();
}
{
#if !defined(VBOX_WITH_XPCOM)
{
if (aKeepObj)
mErrorInfo = err;
if (!mIsFullAvailable)
{
bool gotSomething = false;
if (gotSomething)
mIsBasicAvailable = true;
}
}
#else // defined(VBOX_WITH_XPCOM)
if (NS_SUCCEEDED(rc))
{
if (NS_SUCCEEDED(rc))
{
{
if (aKeepObj)
mErrorInfo = ex;
if (!mIsFullAvailable)
{
bool gotSomething = false;
char *pszMsg;
if (NS_SUCCEEDED(rc))
{
}
if (gotSomething)
mIsBasicAvailable = true;
}
// set the exception to NULL (to emulate Win32 behavior)
}
}
}
/* Ignore failure when called after nsComponentManagerImpl::Shutdown(). */
else if (rc == NS_ERROR_UNEXPECTED)
#endif // defined(VBOX_WITH_XPCOM)
}
bool aKeepObj /* = false */)
{
#if !defined(VBOX_WITH_XPCOM)
{
}
#else
#endif
if (mIsBasicAvailable)
{
mCalleeIID = aIID;
}
}
{
bool gotSomething = false;
bool gotAll = true;
{
mInterfaceID = iid;
}
{
if (!m_pNext)
rc = E_OUTOFMEMORY;
}
}
////////////////////////////////////////////////////////////////////////////////
//
// ProgressErrorInfo class
//
////////////////////////////////////////////////////////////////////////////////
ErrorInfo(false /* aDummy */)
{
if (!progress)
return;
}
////////////////////////////////////////////////////////////////////////////////
//
// ErrorInfoKeeper class
//
////////////////////////////////////////////////////////////////////////////////
{
if (mForgot)
return S_OK;
#if !defined(VBOX_WITH_XPCOM)
if (!mErrorInfo.isNull())
{
}
#else // defined(VBOX_WITH_XPCOM)
if (NS_SUCCEEDED(rc))
{
if (NS_SUCCEEDED(rc))
{
if (!mErrorInfo.isNull())
{
}
}
}
#endif // defined(VBOX_WITH_XPCOM)
{
mForgot = true;
}
return rc;
}
} /* namespace com */