VirtualBox

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

Last change on this file since 31883 was 31358, checked in by vboxsync, 14 years ago

Main: convert more Medium and MediumFormat internals to Utf8Str

  • 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 31358 2010-08-04 14:48:26Z 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 VBOX_SCRIPTABLE_IMPL(IMediumFormat)
43{
44public:
45
46 struct Property
47 {
48 Utf8Str strName;
49 Utf8Str strDescription;
50 DataType_T type;
51 ULONG flags;
52 Utf8Str strDefaultValue;
53 };
54
55 typedef std::list<Utf8Str> StrList;
56 typedef std::list<Property> PropertyList;
57
58 struct Data
59 {
60 Data() : capabilities (0) {}
61
62 const Utf8Str strId;
63 const Utf8Str strName;
64 const StrList llFileExtensions;
65 const uint64_t capabilities;
66 const PropertyList llProperties;
67 };
68
69 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat)
70
71 DECLARE_NOT_AGGREGATABLE (MediumFormat)
72
73 DECLARE_PROTECT_FINAL_CONSTRUCT()
74
75 BEGIN_COM_MAP(MediumFormat)
76 COM_INTERFACE_ENTRY (ISupportErrorInfo)
77 COM_INTERFACE_ENTRY (IMediumFormat)
78 COM_INTERFACE_ENTRY (IDispatch)
79 END_COM_MAP()
80
81 DECLARE_EMPTY_CTOR_DTOR (MediumFormat)
82
83 HRESULT FinalConstruct();
84 void FinalRelease();
85
86 // public initializer/uninitializer for internal purposes only
87 HRESULT init (const VDBACKENDINFO *aVDInfo);
88 void uninit();
89
90 // IMediumFormat properties
91 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
92 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
93 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
94 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
95
96 // IMediumFormat methods
97 STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
98 ComSafeArrayOut (BSTR, aDescriptions),
99 ComSafeArrayOut (DataType_T, aTypes),
100 ComSafeArrayOut (ULONG, aFlags),
101 ComSafeArrayOut (BSTR, aDefaults));
102
103 // public methods only for internal purposes
104
105 // public methods for internal purposes only
106 // (ensure there is a caller and a read lock before calling them!)
107
108 /** Const, no need to lock */
109 const Utf8Str& getId() const { return m.strId; }
110 /** Const, no need to lock */
111 const StrList& getFileExtensions() const { return m.llFileExtensions; }
112 /** Const, no need to lock */
113 uint64_t getCapabilities() const { return m.capabilities; }
114 /** Const, no need to lock */
115 const PropertyList& getProperties() const { return m.llProperties; }
116
117private:
118
119 Data m;
120};
121
122#endif // ____H_MEDIUMFORMAT
123
124/* 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