1
/* $Id: HardDiskFormatImpl.h $ */
5
* VirtualBox COM class implementation
9
* Copyright (C) 2008 Sun Microsystems, Inc.
11
* This file is part of VirtualBox Open Source Edition (OSE), as
12
* available from http://www.virtualbox.org. This file is free software;
13
* you can redistribute it and/or modify it under the terms of the GNU
14
* General Public License (GPL) as published by the Free Software
15
* Foundation, in version 2 as it comes in the "COPYING" file of the
16
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20
* Clara, CA 95054 USA or visit http://www.sun.com if you need
21
* additional information or have any questions.
24
#ifndef ____H_HARDDISKFORMAT
25
#define ____H_HARDDISKFORMAT
27
#include "VirtualBoxBase.h"
29
#include <VBox/com/array.h>
36
* The HardDiskFormat class represents the backend used to store hard disk data
37
* (IHardDiskFormat interface).
39
* @note Instances of this class are permanently caller-referenced by HardDisk
40
* objects (through addCaller()) so that an attempt to uninitialize or delete
41
* them before all HardDisk objects are uninitialized will produce an endless
44
class ATL_NO_VTABLE HardDiskFormat :
45
public VirtualBoxBaseNEXT,
46
public VirtualBoxSupportErrorInfoImpl <HardDiskFormat, IHardDiskFormat>,
47
public VirtualBoxSupportTranslation <HardDiskFormat>,
48
VBOX_SCRIPTABLE_IMPL(IHardDiskFormat)
61
typedef std::list <Bstr> BstrList;
62
typedef std::list <Property> PropertyList;
66
Data() : capabilities (0) {}
70
const BstrList fileExtensions;
71
const uint64_t capabilities;
72
const PropertyList properties;
75
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HardDiskFormat)
77
DECLARE_NOT_AGGREGATABLE (HardDiskFormat)
79
DECLARE_PROTECT_FINAL_CONSTRUCT()
81
BEGIN_COM_MAP(HardDiskFormat)
82
COM_INTERFACE_ENTRY (ISupportErrorInfo)
83
COM_INTERFACE_ENTRY (IHardDiskFormat)
84
COM_INTERFACE_ENTRY (IDispatch)
89
DECLARE_EMPTY_CTOR_DTOR (HardDiskFormat)
91
HRESULT FinalConstruct();
94
// public initializer/uninitializer for internal purposes only
95
HRESULT init (const VDBACKENDINFO *aVDInfo);
98
// IHardDiskFormat properties
99
STDMETHOD(COMGETTER(Id)) (BSTR *aId);
100
STDMETHOD(COMGETTER(Name)) (BSTR *aName);
101
STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
102
STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
104
// IHardDiskFormat methods
105
STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
106
ComSafeArrayOut (BSTR, aDescriptions),
107
ComSafeArrayOut (DataType_T, aTypes),
108
ComSafeArrayOut (ULONG, aFlags),
109
ComSafeArrayOut (BSTR, aDefaults));
111
// public methods only for internal purposes
113
// public methods for internal purposes only
114
// (ensure there is a caller and a read lock before calling them!)
116
/** Const, no need to lock */
117
const Bstr &id() const { return m.id; }
118
/** Const, no need to lock */
119
const BstrList &fileExtensions() const { return m.fileExtensions; }
120
/** Const, no need to lock */
121
uint64_t capabilities() const { return m.capabilities; }
122
/** Const, no need to lock */
123
const PropertyList &properties() const { return m.properties; }
125
// for VirtualBoxSupportErrorInfoImpl
126
static const wchar_t *getComponentName() { return L"HardDiskFormat"; }
133
#endif // ____H_HARDDISKFORMAT
135
/* vi: set tabstop=4 shiftwidth=4 expandtab: */