VirtualBox

source: vbox/trunk/src/VBox/Main/include/MediumFormatImpl.h@ 41105

Last change on this file since 41105 was 37587, checked in by vboxsync, 14 years ago

vcc build fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: MediumFormatImpl.h 37587 2011-06-22 12:02:13Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2011 Oracle Corporation
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
20#ifndef ____H_MEDIUMFORMAT
21#define ____H_MEDIUMFORMAT
22
23#include "VirtualBoxBase.h"
24
25#include <VBox/com/array.h>
26
27#include <list>
28
29struct VDBACKENDINFO;
30
31/**
32 * The MediumFormat class represents the backend used to store medium data
33 * (IMediumFormat interface).
34 *
35 * @note Instances of this class are permanently caller-referenced by Medium
36 * objects (through addCaller()) so that an attempt to uninitialize or delete
37 * them before all Medium objects are uninitialized will produce an endless
38 * wait!
39 */
40class ATL_NO_VTABLE MediumFormat :
41 public VirtualBoxBase,
42 VBOX_SCRIPTABLE_IMPL(IMediumFormat)
43{
44public:
45
46 struct Property
47 {
48 Utf8Str strName;
49 Utf8Str strDescription;
50 DataType_T type;
51 ULONG flags;
52 Utf8Str strDefaultValue;
53 };
54
55 typedef std::list<Utf8Str> StrList;
56 typedef std::list<DeviceType_T> DeviceTypeList;
57 typedef std::list<Property> PropertyList;
58
59 struct Data
60 {
61 Data() : capabilities((MediumFormatCapabilities_T)0) {}
62
63 const Utf8Str strId;
64 const Utf8Str strName;
65 const StrList llFileExtensions;
66 const DeviceTypeList llDeviceTypes;
67 const MediumFormatCapabilities_T capabilities;
68 const PropertyList llProperties;
69 };
70
71 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat)
72
73 DECLARE_NOT_AGGREGATABLE(MediumFormat)
74
75 DECLARE_PROTECT_FINAL_CONSTRUCT()
76
77 BEGIN_COM_MAP(MediumFormat)
78 VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumFormat)
79 END_COM_MAP()
80
81 DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
82
83 HRESULT FinalConstruct();
84 void FinalRelease();
85
86 // public initializer/uninitializer for internal purposes only
87 HRESULT init(const VDBACKENDINFO *aVDInfo);
88 void uninit();
89
90 // IMediumFormat properties
91 STDMETHOD(COMGETTER(Id))(BSTR *aId);
92 STDMETHOD(COMGETTER(Name))(BSTR *aName);
93 STDMETHOD(COMGETTER(Capabilities))(ULONG *aCaps);
94
95 // IMediumFormat methods
96 STDMETHOD(DescribeFileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions),
97 ComSafeArrayOut(DeviceType_T, aDeviceTypes));
98 STDMETHOD(DescribeProperties)(ComSafeArrayOut(BSTR, aNames),
99 ComSafeArrayOut(BSTR, aDescriptions),
100 ComSafeArrayOut(DataType_T, aTypes),
101 ComSafeArrayOut(ULONG, aFlags),
102 ComSafeArrayOut(BSTR, aDefaults));
103
104 // public methods only for internal purposes
105
106 // public methods for internal purposes only
107 // (ensure there is a caller and a read lock before calling them!)
108
109 /** Const, no need to lock */
110 const Utf8Str& getId() const { return m.strId; }
111 /** Const, no need to lock */
112 const StrList& getFileExtensions() const { return m.llFileExtensions; }
113 /** Const, no need to lock */
114 MediumFormatCapabilities_T getCapabilities() const { return m.capabilities; }
115 /** Const, no need to lock */
116 const PropertyList& getProperties() const { return m.llProperties; }
117
118private:
119
120 Data m;
121};
122
123#endif // ____H_MEDIUMFORMAT
124
125/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette