VirtualBox

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

Last change on this file since 86506 was 82968, checked in by vboxsync, 4 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: MediumFormatImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * MediumFormat COM class implementation
4 */
5
6/*
7 * Copyright (C) 2008-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_MediumFormatImpl_h
19#define MAIN_INCLUDED_MediumFormatImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "MediumFormatWrap.h"
25
26
27struct VDBACKENDINFO;
28
29/**
30 * The MediumFormat class represents the backend used to store medium data
31 * (IMediumFormat interface).
32 *
33 * @note Instances of this class are permanently caller-referenced by Medium
34 * objects (through addCaller()) so that an attempt to uninitialize or delete
35 * them before all Medium objects are uninitialized will produce an endless
36 * wait!
37 */
38class ATL_NO_VTABLE MediumFormat :
39 public MediumFormatWrap
40{
41public:
42
43 struct Property
44 {
45 Utf8Str strName;
46 Utf8Str strDescription;
47 DataType_T type;
48 ULONG flags;
49 Utf8Str strDefaultValue;
50 };
51
52 typedef std::vector<Property> PropertyArray;
53 typedef std::vector<com::Utf8Str> StrArray;
54
55 DECLARE_EMPTY_CTOR_DTOR(MediumFormat)
56
57 HRESULT FinalConstruct();
58 void FinalRelease();
59
60 // public initializer/uninitializer for internal purposes only
61 HRESULT init(const VDBACKENDINFO *aVDInfo);
62 void uninit();
63
64 // public methods for internal purposes only
65 // (ensure there is a caller and a read lock before calling them!)
66
67 /** Const, no need to lock */
68 const Utf8Str &i_getId() const { return m.strId; }
69 /** Const, no need to lock */
70 const Utf8Str &i_getName() const { return m.strName; }
71 /** Const, no need to lock */
72 const StrArray &i_getFileExtensions() const { return m.maFileExtensions; }
73 /** Const, no need to lock */
74 MediumFormatCapabilities_T i_getCapabilities() const { return m.capabilities; }
75 /** Const, no need to lock */
76 const PropertyArray &i_getProperties() const { return m.maProperties; }
77
78private:
79
80 // wrapped IMediumFormat properties
81 HRESULT getId(com::Utf8Str &aId);
82 HRESULT getName(com::Utf8Str &aName);
83 HRESULT getCapabilities(std::vector<MediumFormatCapabilities_T> &aCapabilities);
84
85 // wrapped IMediumFormat methods
86 HRESULT describeFileExtensions(std::vector<com::Utf8Str> &aExtensions,
87 std::vector<DeviceType_T> &aTypes);
88 HRESULT describeProperties(std::vector<com::Utf8Str> &aNames,
89 std::vector<com::Utf8Str> &aDescriptions,
90 std::vector<DataType_T> &aTypes,
91 std::vector<ULONG> &aFlags,
92 std::vector<com::Utf8Str> &aDefaults);
93
94 // types
95 typedef std::vector<DeviceType_T> DeviceTypeArray;
96
97 // data
98 struct Data
99 {
100 Data() : capabilities((MediumFormatCapabilities_T)0) {}
101
102 const Utf8Str strId;
103 const Utf8Str strName;
104 const StrArray maFileExtensions;
105 const DeviceTypeArray maDeviceTypes;
106 const MediumFormatCapabilities_T capabilities;
107 const PropertyArray maProperties;
108 };
109
110 Data m;
111};
112
113#endif /* !MAIN_INCLUDED_MediumFormatImpl_h */
114
115/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use