VirtualBox

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

Last change on this file since 56328 was 45518, checked in by vboxsync, 12 years ago

Main: Code generator for (xp)com API implementations, including logging and parameter conversion, so far only used by MediumFormat. Next try, needed significant tweaks to work with xpcom (safearray handling fixes in the parameter conversion helpers), different STL implementation (which doesn't support declaring template type parameters as const), missing build dependencies (which didn't show on the dual core system used for writing the code), and finally the duplicate XPCOM classinfo and AddRef/Release/QueryInterface method definitions needed to be removed.

  • 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 45518 2013-04-12 12:01:02Z vboxsync $ */
2
3/** @file
4 *
5 * MediumFormat COM class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2013 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