VirtualBox

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

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

Main: remove SupportErrorInfo template magic

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: MediumFormatImpl.h 30714 2010-07-07 16:20:03Z 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 VirtualBoxSupportTranslation<MediumFormat>,
43 VBOX_SCRIPTABLE_IMPL(IMediumFormat)
44{
45public:
46
47 struct Property
48 {
49 Bstr name;
50 Bstr description;
51 DataType_T type;
52 ULONG flags;
53 Bstr defaultValue;
54 };
55
56 typedef std::list <Bstr> BstrList;
57 typedef std::list <Property> PropertyList;
58
59 struct Data
60 {
61 Data() : capabilities (0) {}
62
63 const Bstr id;
64 const Bstr name;
65 const BstrList fileExtensions;
66 const uint64_t capabilities;
67 const PropertyList properties;
68 };
69
70 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat)
71
72 DECLARE_NOT_AGGREGATABLE (MediumFormat)
73
74 DECLARE_PROTECT_FINAL_CONSTRUCT()
75
76 BEGIN_COM_MAP(MediumFormat)
77 COM_INTERFACE_ENTRY (ISupportErrorInfo)
78 COM_INTERFACE_ENTRY (IMediumFormat)
79 COM_INTERFACE_ENTRY (IDispatch)
80 END_COM_MAP()
81
82 DECLARE_EMPTY_CTOR_DTOR (MediumFormat)
83
84 HRESULT FinalConstruct();
85 void FinalRelease();
86
87 // public initializer/uninitializer for internal purposes only
88 HRESULT init (const VDBACKENDINFO *aVDInfo);
89 void uninit();
90
91 // IMediumFormat properties
92 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
93 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
94 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
95 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
96
97 // IMediumFormat methods
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 Bstr &id() const { return m.id; }
111 /** Const, no need to lock */
112 const BstrList &fileExtensions() const { return m.fileExtensions; }
113 /** Const, no need to lock */
114 uint64_t capabilities() const { return m.capabilities; }
115 /** Const, no need to lock */
116 const PropertyList &properties() const { return m.properties; }
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.

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