VirtualBox

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

Last change on this file since 18719 was 17684, checked in by vboxsync, 16 years ago

#3551: “Main: Replace remaining collections with safe arrays”
Replaced HostUSBDeviceCollection. Reviewed/Okayed by dmik, sunlover.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 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 Machine;
29class Console;
30class VirtualBox;
31
32class ATL_NO_VTABLE SharedFolder :
33 public VirtualBoxBaseNEXT,
34 public VirtualBoxSupportErrorInfoImpl <SharedFolder, ISharedFolder>,
35 public VirtualBoxSupportTranslation <SharedFolder>,
36 public ISharedFolder
37{
38public:
39
40 struct Data
41 {
42 Data() {}
43
44 const Bstr name;
45 const Bstr hostPath;
46 BOOL writable;
47 Bstr lastAccessError;
48 };
49
50 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SharedFolder)
51
52 DECLARE_NOT_AGGREGATABLE(SharedFolder)
53
54 DECLARE_PROTECT_FINAL_CONSTRUCT()
55
56 BEGIN_COM_MAP(SharedFolder)
57 COM_INTERFACE_ENTRY(ISupportErrorInfo)
58 COM_INTERFACE_ENTRY(ISharedFolder)
59 END_COM_MAP()
60
61 NS_DECL_ISUPPORTS
62
63 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
64
65 HRESULT FinalConstruct();
66 void FinalRelease();
67
68 // public initializer/uninitializer for internal purposes only
69 HRESULT init (Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
70 HRESULT initCopy (Machine *aMachine, SharedFolder *aThat);
71 HRESULT init (Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
72 HRESULT init (VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
73 void uninit();
74
75 // ISharedFolder properties
76 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
77 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
78 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
79 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
80 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
81
82 // public methods for internal purposes only
83 // (ensure there is a caller and a read lock before calling them!)
84
85 // public methods that don't need a lock (because access constant data)
86 // (ensure there is a caller added before calling them!)
87
88 const Bstr &name() const { return m.name; }
89 const Bstr &hostPath() const { return m.hostPath; }
90 BOOL writable() const { return m.writable; }
91
92 // for VirtualBoxSupportErrorInfoImpl
93 static const wchar_t *getComponentName() { return L"SharedFolder"; }
94
95protected:
96
97 HRESULT protectedInit (VirtualBoxBaseWithChildrenNEXT *aParent,
98 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
99
100private:
101
102 VirtualBoxBaseWithChildrenNEXT *const mParent;
103
104 /* weak parents (only one of them is not null) */
105 const ComObjPtr <Machine, ComWeakRef> mMachine;
106 const ComObjPtr <Console, ComWeakRef> mConsole;
107 const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
108
109 Data m;
110};
111
112#endif // ____H_SHAREDFOLDERIMPL
113/* 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