MediumFormatImpl.cpp revision 13d7da5a8024cf0b129e07b522d434287013a0d9
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include "MediumFormatImpl.h"
#include "Logging.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
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 */
/* Save the supported file extensions in a list */
if (aVDInfo->papszFileExtensions)
{
{
++ papsz;
}
}
/* 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;
unconst (m.capabilities) = 0;
}
// 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;
}
{
return E_POINTER;
AutoCaller autoCaller(this);
/* this is const, no need to lock */
int i = 0;
return S_OK;
}
{
AutoCaller autoCaller(this);
/* m.capabilities is const, no need to lock */
/// @todo add COMGETTER(ExtendedCapabilities) 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)
return S_OK;
}
{
AutoCaller autoCaller(this);
/* this is const, no need to lock */
int i = 0;
{
}
return S_OK;
}
// IMediumFormat methods
/////////////////////////////////////////////////////////////////////////////
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/* vi: set tabstop=4 shiftwidth=4 expandtab: */