VirtualBox

source: vbox/trunk/src/VBox/Main/include/HostDVDDriveImpl.h@ 2957

Last change on this file since 2957 was 2957, checked in by vboxsync, 18 years ago

Made IHostFloppyDrive use libhal on Linux and added UDI strings to the host floppy and DVD devices

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_HOSTDVDDRIVEIMPL
23#define ____H_HOSTDVDDRIVEIMPL
24
25#include "VirtualBoxBase.h"
26#include "Collection.h"
27
28class ATL_NO_VTABLE HostDVDDrive :
29 public VirtualBoxBaseNEXT,
30 public VirtualBoxSupportErrorInfoImpl <HostDVDDrive, IHostDVDDrive>,
31 public VirtualBoxSupportTranslation <HostDVDDrive>,
32 public IHostDVDDrive
33{
34public:
35
36 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostDVDDrive)
37
38 DECLARE_NOT_AGGREGATABLE (HostDVDDrive)
39
40 DECLARE_PROTECT_FINAL_CONSTRUCT()
41
42 BEGIN_COM_MAP(HostDVDDrive)
43 COM_INTERFACE_ENTRY(ISupportErrorInfo)
44 COM_INTERFACE_ENTRY(IHostDVDDrive)
45 END_COM_MAP()
46
47 NS_DECL_ISUPPORTS
48
49 DECLARE_EMPTY_CTOR_DTOR (HostDVDDrive)
50
51 HRESULT FinalConstruct();
52 void FinalRelease();
53
54 // public initializer/uninitializer for internal purposes only
55 HRESULT init (INPTR BSTR aName, INPTR BSTR aUdi = NULL, INPTR BSTR aDescription = NULL);
56 void uninit();
57
58 // IHostDVDDrive properties
59 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
60 STDMETHOD(COMGETTER(Udi)) (BSTR *aUdi);
61 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
62
63 // public methods for internal purposes only
64
65 /* @note Must be called from under the object read lock. */
66 const Bstr &name() const { return mName; }
67 const Bstr &udi() const { return mUdi; }
68 const Bstr &description() const { return mDescription; }
69
70 // for VirtualBoxSupportErrorInfoImpl
71 static const wchar_t *getComponentName() { return L"HostDVDDrive"; }
72
73private:
74
75 const Bstr mName;
76 const Bstr mDescription;
77 const Bstr mUdi;
78};
79
80COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostDVDDrive)
81
82 STDMETHOD(FindByName) (INPTR BSTR aName, IHostDVDDrive **aDrive)
83 {
84 if (!aName)
85 return E_INVALIDARG;
86 if (!aDrive)
87 return E_POINTER;
88
89 *aDrive = NULL;
90 Vector::value_type found;
91 Vector::iterator it = vec.begin();
92 while (it != vec.end() && !found)
93 {
94 Bstr n;
95 (*it)->COMGETTER(Name) (n.asOutParam());
96 if (n == aName)
97 found = *it;
98 ++ it;
99 }
100
101 if (!found)
102 return setError (E_INVALIDARG, HostDVDDriveCollection::tr (
103 "The host DVD drive named '%ls' could not be found"), aName);
104
105 return found.queryInterfaceTo (aDrive);
106 }
107
108COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostDVDDrive)
109
110#endif // ____H_HOSTDVDDRIVEIMPL
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