MediumFormatImpl.cpp revision c08aa36b1e3aa3c1ece14402ab7440f1e7f52503
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2008-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.
*/
#include "MediumFormatImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return BaseFinalConstruct();
}
void MediumFormat::FinalRelease()
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the hard disk format object.
*
* @param aVDInfo Pointer to a backend info object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* The ID of the backend */
/* The Name of the backend */
/* Use id for now as long as VDBACKENDINFO hasn't any extra
* name/description field. */
/* The capabilities of the backend. Assumes 1:1 mapping! */
/* Save the supported file extensions in a list */
if (aVDInfo->paFileExtensions)
{
{
switch(papExtension->enmType)
{
case VDTYPE_HDD:
break;
case VDTYPE_DVD:
break;
case VDTYPE_FLOPPY:
break;
default:
return E_INVALIDARG;
}
++papExtension;
}
}
/* Save a list of configure properties */
if (aVDInfo->paConfigInfo)
{
/* Walk through all available keys */
{
/* Check for the configure data type */
switch (pa->enmValueType)
{
case VDCFGVALUETYPE_INTEGER:
{
dt = DataType_Int32;
/* If there is a default value get them in the right format */
if (pa->pszDefaultValue)
break;
}
case VDCFGVALUETYPE_BYTES:
{
dt = DataType_Int8;
/* If there is a default value get them in the right format */
if (pa->pszDefaultValue)
{
/* Copy the bytes over - treated simply as a string */
flags |= DataFlags_Array;
}
break;
}
case VDCFGVALUETYPE_STRING:
{
/* If there is a default value get them in the right format */
if (pa->pszDefaultValue)
break;
}
default:
return E_INVALIDARG;
}
/// @todo add extendedFlags to Property when we reach the 32 bit
/// limit (or make the argument ULONG64 after checking that COM is
/// capable of defining enums (used to represent bit flags) that
/// contain 64-bit values)
/* Create one property structure */
Utf8Str(""),
dt,
defaultValue };
++pa;
}
}
/* Confirm a successful initialization */
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void MediumFormat::uninit()
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
// IMediumFormat properties
/////////////////////////////////////////////////////////////////////////////
{
AutoCaller autoCaller(this);
/* this is const, no need to lock */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* this is const, no need to lock */
return S_OK;
}
STDMETHODIMP MediumFormat::COMGETTER(Capabilities)(ComSafeArrayOut(MediumFormatCapabilities_T, aCaps))
{
AutoCaller autoCaller(this);
{
temp &= 1<<i;
}
return S_OK;
}
{
AutoCaller autoCaller(this);
/* this is const, no need to lock */
int i = 0;
++it, ++i)
i = 0;
++it, ++i)
deviceTypes[i] = (*it);
return S_OK;
}
{
AutoCaller autoCaller(this);
/* this is const, no need to lock */
int i = 0;
++it, ++i)
{
}
return S_OK;
}
// IMediumFormat methods
/////////////////////////////////////////////////////////////////////////////
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/* vi: set tabstop=4 shiftwidth=4 expandtab: */