VirtualBox

source: vbox/trunk/src/VBox/Main/include/HardDiskFormatImpl.h@ 16560

Last change on this file since 16560 was 14949, checked in by vboxsync, 15 years ago

Appended vim modeline to set tabstop and expand tabs (in the way
suggested by our coding guidelines).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1/* $Id: HardDiskFormatImpl.h 14949 2008-12-03 15:17:16Z 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
33struct VDBACKENDINFO;
34
35/**
36 * The HardDiskFormat class represents the backend used to store hard disk data
37 * (IHardDiskFormat interface).
38 *
39 * @note Instances of this class are permanently caller-referenced by HardDisk2
40 * objects (through addCaller()) so that an attempt to uninitialize or delete
41 * them before all HardDisk2 objects are uninitialized will produce an endless
42 * wait!
43 */
44class ATL_NO_VTABLE HardDiskFormat :
45 public VirtualBoxBaseNEXT,
46 public VirtualBoxSupportErrorInfoImpl <HardDiskFormat, IHardDiskFormat>,
47 public VirtualBoxSupportTranslation <HardDiskFormat>,
48 public IHardDiskFormat
49{
50public:
51
52 struct Property
53 {
54 Bstr name;
55 Bstr description;
56 DataType_T type;
57 ULONG flags;
58 Bstr defaultValue;
59 };
60
61 typedef std::list <Bstr> BstrList;
62 typedef std::list <Property> PropertyList;
63
64 struct Data
65 {
66 Data() : capabilities (0) {}
67
68 const Bstr id;
69 const Bstr name;
70 const BstrList fileExtensions;
71 const uint64_t capabilities;
72 const PropertyList properties;
73 };
74
75 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HardDiskFormat)
76
77 DECLARE_NOT_AGGREGATABLE (HardDiskFormat)
78
79 DECLARE_PROTECT_FINAL_CONSTRUCT()
80
81 BEGIN_COM_MAP(HardDiskFormat)
82 COM_INTERFACE_ENTRY (ISupportErrorInfo)
83 COM_INTERFACE_ENTRY (IHardDiskFormat)
84 END_COM_MAP()
85
86 NS_DECL_ISUPPORTS
87
88 DECLARE_EMPTY_CTOR_DTOR (HardDiskFormat)
89
90 HRESULT FinalConstruct();
91 void FinalRelease();
92
93 // public initializer/uninitializer for internal purposes only
94 HRESULT init (const VDBACKENDINFO *aVDInfo);
95 void uninit();
96
97 // IHardDiskFormat properties
98 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
99 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
100 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
101 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
102
103 // IHardDiskFormat methods
104 STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
105 ComSafeArrayOut (BSTR, aDescriptions),
106 ComSafeArrayOut (DataType_T, aTypes),
107 ComSafeArrayOut (ULONG, aFlags),
108 ComSafeArrayOut (BSTR, aDefaults));
109
110 // public methods only for internal purposes
111
112 // public methods for internal purposes only
113 // (ensure there is a caller and a read lock before calling them!)
114
115 /** Const, no need to lock */
116 const Bstr &id() const { return m.id; }
117 /** Const, no need to lock */
118 const BstrList &fileExtensions() const { return m.fileExtensions; }
119 /** Const, no need to lock */
120 uint64_t capabilities() const { return m.capabilities; }
121 /** Const, no need to lock */
122 const PropertyList &properties() const { return m.properties; }
123
124 // for VirtualBoxSupportErrorInfoImpl
125 static const wchar_t *getComponentName() { return L"HardDiskFormat"; }
126
127private:
128
129 Data m;
130};
131
132#endif // ____H_HARDDISKFORMAT
133
134/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use