VirtualBox

source: vbox/trunk/src/VBox/Main/include/HostFloppyDriveImpl.h@ 5627

Last change on this file since 5627 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • 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-2007 innotek 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
18#ifndef ____H_HOSTFLOPPYDRIVEIMPL
19#define ____H_HOSTFLOPPYDRIVEIMPL
20
21#include "VirtualBoxBase.h"
22#include "Collection.h"
23
24class ATL_NO_VTABLE HostFloppyDrive :
25 public VirtualBoxBaseNEXT,
26 public VirtualBoxSupportErrorInfoImpl <HostFloppyDrive, IHostFloppyDrive>,
27 public VirtualBoxSupportTranslation <HostFloppyDrive>,
28 public IHostFloppyDrive
29{
30public:
31
32 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HostFloppyDrive)
33
34 DECLARE_NOT_AGGREGATABLE (HostFloppyDrive)
35
36 DECLARE_PROTECT_FINAL_CONSTRUCT()
37
38 BEGIN_COM_MAP(HostFloppyDrive)
39 COM_INTERFACE_ENTRY(ISupportErrorInfo)
40 COM_INTERFACE_ENTRY(IHostFloppyDrive)
41 END_COM_MAP()
42
43 NS_DECL_ISUPPORTS
44
45 DECLARE_EMPTY_CTOR_DTOR (HostFloppyDrive)
46
47 HRESULT FinalConstruct();
48 void FinalRelease();
49
50 // public initializer/uninitializer for internal purposes only
51 HRESULT init (INPTR BSTR aName, INPTR BSTR aUdi = NULL,
52 INPTR BSTR aDescription = NULL);
53 void uninit();
54
55 // IHostFloppyDrive properties
56 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
57 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
58 STDMETHOD(COMGETTER(Udi)) (BSTR *aUdi);
59
60 // public methods for internal purposes only
61
62 /* @note Must be called from under the object read lock. */
63 const Bstr &name() const { return mName; }
64
65 /* @note Must be called from under the object read lock. */
66 const Bstr &udi() const { return mUdi; }
67
68 /* @note Must be called from under the object read lock. */
69 const Bstr &description() const { return mDescription; }
70
71 // for VirtualBoxSupportErrorInfoImpl
72 static const wchar_t *getComponentName() { return L"HostFloppyDrive"; }
73
74private:
75
76 const Bstr mName;
77 const Bstr mDescription;
78 const Bstr mUdi;
79};
80
81COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostFloppyDrive)
82
83 STDMETHOD(FindByName) (INPTR BSTR aName, IHostFloppyDrive **aDrive)
84 {
85 if (!aName)
86 return E_INVALIDARG;
87 if (!aDrive)
88 return E_POINTER;
89
90 *aDrive = NULL;
91 Vector::value_type found;
92 Vector::iterator it = vec.begin();
93 while (it != vec.end() && !found)
94 {
95 Bstr n;
96 (*it)->COMGETTER(Name) (n.asOutParam());
97 if (n == aName)
98 found = *it;
99 ++ it;
100 }
101
102 if (!found)
103 return setError (E_INVALIDARG, HostFloppyDriveCollection::tr (
104 "The host floppy drive named '%ls' could not be found"), aName);
105
106 return found.queryInterfaceTo (aDrive);
107 }
108
109COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostFloppyDrive)
110
111#endif // ____H_HOSTFLOPPYDRIVEIMPL
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