VirtualBox

source: vbox/trunk/src/VBox/Main/include/ParallelPortImpl.h@ 7466

Last change on this file since 7466 was 6168, checked in by vboxsync, 17 years ago

Main: Return errors when the parallel port is enabled but the path is null.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1/* $Id: ParallelPortImpl.h 6168 2007-12-21 14:38:19Z vboxsync $ */
2
3/** @file
4 * VirtualBox COM class implementation.
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef ____H_PARALLELPORTIMPL
20#define ____H_PARALLELPORTIMPL
21
22#include "VirtualBoxBase.h"
23
24class Machine;
25
26class ATL_NO_VTABLE ParallelPort :
27 public VirtualBoxBaseNEXT,
28 public VirtualBoxSupportErrorInfoImpl <ParallelPort, IParallelPort>,
29 public VirtualBoxSupportTranslation <ParallelPort>,
30 public IParallelPort
31{
32public:
33
34 struct Data
35 {
36 Data()
37 : mSlot (0)
38 , mEnabled (FALSE)
39 , mIRQ (4)
40 , mIOBase (0x378)
41 {}
42
43 bool operator== (const Data &that) const
44 {
45 return this == &that ||
46 (mSlot == that.mSlot &&
47 mEnabled == that.mEnabled &&
48 mIRQ == that.mIRQ &&
49 mIOBase == that.mIOBase &&
50 mPath == that.mPath);
51 }
52
53 ULONG mSlot;
54 BOOL mEnabled;
55 ULONG mIRQ;
56 ULONG mIOBase;
57 Bstr mPath;
58 };
59
60 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ParallelPort)
61
62 DECLARE_NOT_AGGREGATABLE(ParallelPort)
63
64 DECLARE_PROTECT_FINAL_CONSTRUCT()
65
66 BEGIN_COM_MAP(ParallelPort)
67 COM_INTERFACE_ENTRY(ISupportErrorInfo)
68 COM_INTERFACE_ENTRY(IParallelPort)
69 END_COM_MAP()
70
71 NS_DECL_ISUPPORTS
72
73 DECLARE_EMPTY_CTOR_DTOR (ParallelPort)
74
75 HRESULT FinalConstruct();
76 void FinalRelease();
77
78 // public initializer/uninitializer for internal purposes only
79 HRESULT init (Machine *aParent, ULONG aSlot);
80 HRESULT init (Machine *aParent, ParallelPort *aThat);
81 HRESULT initCopy (Machine *parent, ParallelPort *aThat);
82 void uninit();
83
84 // IParallelPort properties
85 STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
86 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
87 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
88 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
89 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
90 STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
91 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
92 STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
93 STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath);
94
95 // public methods only for internal purposes
96
97 HRESULT loadSettings (const settings::Key &aPortNode);
98 HRESULT saveSettings (settings::Key &aPortNode);
99
100 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
101 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
102 bool rollback();
103 void commit();
104 void copyFrom (ParallelPort *aThat);
105
106 // public methods for internal purposes only
107 // (ensure there is a caller and a read lock before calling them!)
108
109 // for VirtualBoxSupportErrorInfoImpl
110 static const wchar_t *getComponentName() { return L"ParallelPort"; }
111
112private:
113
114 HRESULT checkSetPath (const BSTR aPath);
115
116 const ComObjPtr <Machine, ComWeakRef> mParent;
117 const ComObjPtr <ParallelPort> mPeer;
118
119 Backupable <Data> mData;
120};
121
122#endif // ____H_FLOPPYDRIVEIMPL
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