1 | /* $Id: HardDiskFormatImpl.h 14225 2008-11-14 17:55:28Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2008 Sun Microsystems, Inc.
|
---|
10 | *
|
---|
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.
|
---|
18 | *
|
---|
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.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef ____H_HARDDISKFORMAT
|
---|
25 | #define ____H_HARDDISKFORMAT
|
---|
26 |
|
---|
27 | #include "VirtualBoxBase.h"
|
---|
28 |
|
---|
29 | #include <VBox/com/array.h>
|
---|
30 |
|
---|
31 | #include <list>
|
---|
32 |
|
---|
33 | struct VDBACKENDINFO;
|
---|
34 |
|
---|
35 | class ATL_NO_VTABLE HardDiskFormat :
|
---|
36 | public VirtualBoxBaseNEXT,
|
---|
37 | public VirtualBoxSupportErrorInfoImpl <HardDiskFormat, IHardDiskFormat>,
|
---|
38 | public VirtualBoxSupportTranslation <HardDiskFormat>,
|
---|
39 | public IHardDiskFormat
|
---|
40 | {
|
---|
41 | public:
|
---|
42 |
|
---|
43 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HardDiskFormat)
|
---|
44 |
|
---|
45 | DECLARE_NOT_AGGREGATABLE (HardDiskFormat)
|
---|
46 |
|
---|
47 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
48 |
|
---|
49 | BEGIN_COM_MAP(HardDiskFormat)
|
---|
50 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
51 | COM_INTERFACE_ENTRY (IHardDiskFormat)
|
---|
52 | END_COM_MAP()
|
---|
53 |
|
---|
54 | NS_DECL_ISUPPORTS
|
---|
55 |
|
---|
56 | DECLARE_EMPTY_CTOR_DTOR (HardDiskFormat)
|
---|
57 |
|
---|
58 | HRESULT FinalConstruct();
|
---|
59 | void FinalRelease();
|
---|
60 |
|
---|
61 | // public initializer/uninitializer for internal purposes only
|
---|
62 | HRESULT init (const VDBACKENDINFO *aVDInfo);
|
---|
63 | void uninit();
|
---|
64 |
|
---|
65 | // IHardDiskFormat properties
|
---|
66 | STDMETHOD(COMGETTER(Id)) (BSTR *aId);
|
---|
67 | STDMETHOD(COMGETTER(Name)) (BSTR *aName);
|
---|
68 | STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
|
---|
69 | STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
|
---|
70 |
|
---|
71 | // IHardDiskFormat methods
|
---|
72 | STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
|
---|
73 | ComSafeArrayOut (BSTR, aDescriptions),
|
---|
74 | ComSafeArrayOut (DataType_T, aTypes),
|
---|
75 | ComSafeArrayOut (ULONG, aFlags),
|
---|
76 | ComSafeArrayOut (BSTR, aDefaults));
|
---|
77 |
|
---|
78 | // public methods only for internal purposes
|
---|
79 |
|
---|
80 | // public methods for internal purposes only
|
---|
81 | // (ensure there is a caller and a read lock before calling them!)
|
---|
82 |
|
---|
83 | /** Const, no need to lock */
|
---|
84 | const Bstr &id() { return m.id; }
|
---|
85 | /** Const, no need to lock */
|
---|
86 | uint64_t capabilities() { return m.capabilities; }
|
---|
87 |
|
---|
88 | // for VirtualBoxSupportErrorInfoImpl
|
---|
89 | static const wchar_t *getComponentName() { return L"HardDiskFormat"; }
|
---|
90 |
|
---|
91 | private:
|
---|
92 |
|
---|
93 | typedef std::list <Bstr> BstrList;
|
---|
94 |
|
---|
95 | struct Property
|
---|
96 | {
|
---|
97 | Bstr name;
|
---|
98 | Bstr description;
|
---|
99 | DataType_T type;
|
---|
100 | ULONG flags;
|
---|
101 | Bstr defaultValue;
|
---|
102 | };
|
---|
103 | typedef std::list <Property> PropertyList;
|
---|
104 |
|
---|
105 | struct Data
|
---|
106 | {
|
---|
107 | Data() : capabilities (0) {}
|
---|
108 |
|
---|
109 | const Bstr id;
|
---|
110 | const Bstr name;
|
---|
111 | const BstrList fileExtensions;
|
---|
112 | const uint64_t capabilities;
|
---|
113 | const PropertyList properties;
|
---|
114 | };
|
---|
115 |
|
---|
116 | Data m;
|
---|
117 | };
|
---|
118 |
|
---|
119 | #endif // ____H_HARDDISKFORMAT
|
---|
120 |
|
---|