VirtualBox

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

Last change on this file since 70675 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: MediumFormatImpl.h 69500 2017-10-28 15:14:05Z vboxsync $ */
2
3/** @file
4 *
5 * MediumFormat COM class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2017 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 MEDIUMFORMAT_IMPL_H_
21#define MEDIUMFORMAT_IMPL_H_
22
23#include "MediumFormatWrap.h"
24
25
26struct VDBACKENDINFO;
27
28/**
29 * The MediumFormat class represents the backend used to store medium data
30 * (IMediumFormat interface).
31 *
32 * @note Instances of this class are permanently caller-referenced by Medium
33 * objects (through addCaller()) so that an attempt to uninitialize or delete
34 * them before all Medium objects are uninitialized will produce an endless
35 * wait!
36 */
37class ATL_NO_VTABLE MediumFormat :
38 public MediumFormatWrap
39{
40public:
41
42 struct Property
43 {
44 Utf8Str strName;
45 Utf8Str strDescription;
46 DataType_T type;
47 ULONG flags;
48 Utf8Str strDefaultValue;
49 };
50
51 typedef std::vector<Property> PropertyArray;
52 typedef std::vector<com::Utf8Str> StrArray;
53
54 DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
55
56 HRESULT FinalConstruct();
57 void FinalRelease();
58
59 // public initializer/uninitializer for internal purposes only
60 HRESULT init(const VDBACKENDINFO *aVDInfo);
61 void uninit();
62
63 // public methods for internal purposes only
64 // (ensure there is a caller and a read lock before calling them!)
65
66 /** Const, no need to lock */
67 const Utf8Str &i_getId() const { return m.strId; }
68 /** Const, no need to lock */
69 const StrArray &i_getFileExtensions() const { return m.maFileExtensions; }
70 /** Const, no need to lock */
71 MediumFormatCapabilities_T i_getCapabilities() const { return m.capabilities; }
72 /** Const, no need to lock */
73 const PropertyArray &i_getProperties() const { return m.maProperties; }
74
75private:
76
77 // wrapped IMediumFormat properties
78 HRESULT getId(com::Utf8Str &aId);
79 HRESULT getName(com::Utf8Str &aName);
80 HRESULT getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities);
81
82 // wrapped IMediumFormat methods
83 HRESULT describeFileExtensions(std::vector<com::Utf8Str> &aExtensions,
84 std::vector<DeviceType_T> &aTypes);
85 HRESULT describeProperties(std::vector<com::Utf8Str> &aNames,
86 std::vector<com::Utf8Str> &aDescriptions,
87 std::vector<DataType_T> &aTypes,
88 std::vector<ULONG> &aFlags,
89 std::vector<com::Utf8Str> &aDefaults);
90
91 // types
92 typedef std::vector<DeviceType_T> DeviceTypeArray;
93
94 // data
95 struct Data
96 {
97 Data() : capabilities((MediumFormatCapabilities_T)0) {}
98
99 const Utf8Str strId;
100 const Utf8Str strName;
101 const StrArray maFileExtensions;
102 const DeviceTypeArray maDeviceTypes;
103 const MediumFormatCapabilities_T capabilities;
104 const PropertyArray maProperties;
105 };
106
107 Data m;
108};
109
110#endif // MEDIUMFORMAT_IMPL_H_
111
112/* 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