VirtualBox

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

Last change on this file since 29853 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • 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 28800 2010-04-27 08:22:32Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2009 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 public VirtualBoxSupportErrorInfoImpl<MediumFormat, IMediumFormat>,
43 public VirtualBoxSupportTranslation<MediumFormat>,
44 VBOX_SCRIPTABLE_IMPL(IMediumFormat)
45{
46public:
47
48 struct Property
49 {
50 Bstr name;
51 Bstr description;
52 DataType_T type;
53 ULONG flags;
54 Bstr defaultValue;
55 };
56
57 typedef std::list <Bstr> BstrList;
58 typedef std::list <Property> PropertyList;
59
60 struct Data
61 {
62 Data() : capabilities (0) {}
63
64 const Bstr id;
65 const Bstr name;
66 const BstrList fileExtensions;
67 const uint64_t capabilities;
68 const PropertyList properties;
69 };
70
71 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (MediumFormat)
72
73 DECLARE_NOT_AGGREGATABLE (MediumFormat)
74
75 DECLARE_PROTECT_FINAL_CONSTRUCT()
76
77 BEGIN_COM_MAP(MediumFormat)
78 COM_INTERFACE_ENTRY (ISupportErrorInfo)
79 COM_INTERFACE_ENTRY (IMediumFormat)
80 COM_INTERFACE_ENTRY (IDispatch)
81 END_COM_MAP()
82
83 DECLARE_EMPTY_CTOR_DTOR (MediumFormat)
84
85 HRESULT FinalConstruct();
86 void FinalRelease();
87
88 // public initializer/uninitializer for internal purposes only
89 HRESULT init (const VDBACKENDINFO *aVDInfo);
90 void uninit();
91
92 // IMediumFormat properties
93 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
94 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
95 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
96 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
97
98 // IMediumFormat methods
99 STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
100 ComSafeArrayOut (BSTR, aDescriptions),
101 ComSafeArrayOut (DataType_T, aTypes),
102 ComSafeArrayOut (ULONG, aFlags),
103 ComSafeArrayOut (BSTR, aDefaults));
104
105 // public methods only for internal purposes
106
107 // public methods for internal purposes only
108 // (ensure there is a caller and a read lock before calling them!)
109
110 /** Const, no need to lock */
111 const Bstr &id() const { return m.id; }
112 /** Const, no need to lock */
113 const BstrList &fileExtensions() const { return m.fileExtensions; }
114 /** Const, no need to lock */
115 uint64_t capabilities() const { return m.capabilities; }
116 /** Const, no need to lock */
117 const PropertyList &properties() const { return m.properties; }
118
119 // for VirtualBoxSupportErrorInfoImpl
120 static const wchar_t *getComponentName() { return L"MediumFormat"; }
121
122private:
123
124 Data m;
125};
126
127#endif // ____H_MEDIUMFORMAT
128
129/* 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