VirtualBox

source: vbox/trunk/src/VBox/Main/HostFloppyDriveImpl.cpp@ 4920

Last change on this file since 4920 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#include "HostFloppyDriveImpl.h"
19#include <iprt/cpputils.h>
20
21// constructor / destructor
22/////////////////////////////////////////////////////////////////////////////
23
24DEFINE_EMPTY_CTOR_DTOR (HostFloppyDrive)
25
26HRESULT HostFloppyDrive::FinalConstruct()
27{
28 return S_OK;
29}
30
31void HostFloppyDrive::FinalRelease()
32{
33 uninit();
34}
35
36// public initializer/uninitializer for internal purposes only
37/////////////////////////////////////////////////////////////////////////////
38
39/**
40 * Initializes the host floppy drive object.
41 *
42 * @param aName Name of the drive.
43 * @param aUdi Universal device identifier (currently may be NULL).
44 * @param aDescription Human-readable drive description (may be NULL).
45 *
46 * @return COM result indicator.
47 */
48HRESULT HostFloppyDrive::init (INPTR BSTR aName,
49 INPTR BSTR aUdi /* = NULL */,
50 INPTR BSTR aDescription /* = NULL */)
51{
52 ComAssertRet (aName, E_INVALIDARG);
53
54 /* Enclose the state transition NotReady->InInit->Ready */
55 AutoInitSpan autoInitSpan (this);
56 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED);
57
58 unconst (mName) = aName;
59 unconst (mUdi) = aUdi;
60 unconst (mDescription) = aDescription;
61
62 /* Confirm the successful initialization */
63 autoInitSpan.setSucceeded();
64
65 return S_OK;
66}
67
68
69/**
70 * Uninitializes the instance and sets the ready flag to FALSE.
71 * Called either from FinalRelease() or by the parent when it gets destroyed.
72 */
73void HostFloppyDrive::uninit()
74{
75 /* Enclose the state transition Ready->InUninit->NotReady */
76 AutoUninitSpan autoUninitSpan (this);
77 if (autoUninitSpan.uninitDone())
78 return;
79
80 unconst (mName).setNull();
81}
82
83// IHostFloppyDrive properties
84/////////////////////////////////////////////////////////////////////////////
85
86STDMETHODIMP HostFloppyDrive::COMGETTER(Name) (BSTR *aName)
87{
88 if (!aName)
89 return E_POINTER;
90
91 AutoCaller autoCaller (this);
92 CheckComRCReturnRC (autoCaller.rc());
93
94 /* mName is constant during life time, no need to lock */
95
96 mName.cloneTo (aName);
97
98 return S_OK;
99}
100
101STDMETHODIMP HostFloppyDrive::COMGETTER(Description) (BSTR *aDescription)
102{
103 if (!aDescription)
104 return E_POINTER;
105
106 AutoCaller autoCaller (this);
107 CheckComRCReturnRC (autoCaller.rc());
108
109 /* mDescription is constant during life time, no need to lock */
110
111 mDescription.cloneTo (aDescription);
112
113 return S_OK;
114}
115
116STDMETHODIMP HostFloppyDrive::COMGETTER(Udi) (BSTR *aUdi)
117{
118 if (!aUdi)
119 return E_POINTER;
120
121 AutoCaller autoCaller (this);
122 CheckComRCReturnRC (autoCaller.rc());
123
124 /* mUdi is constant during life time, no need to lock */
125
126 mUdi.cloneTo (aUdi);
127
128 return S_OK;
129}
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