VirtualBox

source: vbox/trunk/src/VBox/Main/include/SharedFolderImpl.h@ 26270

Last change on this file since 26270 was 26044, checked in by vboxsync, 15 years ago

Main: move Host::Get{DVD|Floppy}Drives implementation into implementation methods to eliminate useless conversions in mountMedium()

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ____H_SHAREDFOLDERIMPL
23#define ____H_SHAREDFOLDERIMPL
24
25#include "VirtualBoxBase.h"
26#include <VBox/shflsvc.h>
27
28class Console;
29
30class ATL_NO_VTABLE SharedFolder :
31 public VirtualBoxBaseWithChildrenNEXT,
32 public VirtualBoxSupportErrorInfoImpl<SharedFolder, ISharedFolder>,
33 public VirtualBoxSupportTranslation<SharedFolder>,
34 VBOX_SCRIPTABLE_IMPL(ISharedFolder)
35{
36public:
37
38 struct Data
39 {
40 Data() {}
41
42 const Bstr name;
43 const Bstr hostPath;
44 BOOL writable;
45 Bstr lastAccessError;
46 };
47
48 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SharedFolder)
49
50 DECLARE_NOT_AGGREGATABLE(SharedFolder)
51
52 DECLARE_PROTECT_FINAL_CONSTRUCT()
53
54 BEGIN_COM_MAP(SharedFolder)
55 COM_INTERFACE_ENTRY (ISupportErrorInfo)
56 COM_INTERFACE_ENTRY (ISharedFolder)
57 COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
58 END_COM_MAP()
59
60 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
61
62 HRESULT FinalConstruct();
63 void FinalRelease();
64
65 // public initializer/uninitializer for internal purposes only
66 HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
67 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
68 HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
69 HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
70 void uninit();
71
72 // ISharedFolder properties
73 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
74 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
75 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
76 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
77 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
78
79 // public methods for internal purposes only
80 // (ensure there is a caller and a read lock before calling them!)
81
82 // public methods that don't need a lock (because access constant data)
83 // (ensure there is a caller added before calling them!)
84
85 const Bstr& getName() const { return m.name; }
86 const Bstr& getHostPath() const { return m.hostPath; }
87 BOOL isWritable() const { return m.writable; }
88
89 // for VirtualBoxSupportErrorInfoImpl
90 static const wchar_t *getComponentName() { return L"SharedFolder"; }
91
92protected:
93
94 HRESULT protectedInit(VirtualBoxBase *aParent,
95 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
96
97private:
98
99 VirtualBoxBase *const mParent;
100
101 /* weak parents (only one of them is not null) */
102 const ComObjPtr<Machine, ComWeakRef> mMachine;
103 const ComObjPtr<Console, ComWeakRef> mConsole;
104 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox;
105
106 Data m;
107};
108
109#endif // ____H_SHAREDFOLDERIMPL
110/* 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