VirtualBox

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

Last change on this file since 31964 was 31002, checked in by vboxsync, 14 years ago

First support for auto-mounted Shared Folders (Windows only yet).

  • 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-2010 Oracle Corporation
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
18#ifndef ____H_SHAREDFOLDERIMPL
19#define ____H_SHAREDFOLDERIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/shflsvc.h>
23
24class Console;
25
26class ATL_NO_VTABLE SharedFolder :
27 public VirtualBoxBaseWithChildrenNEXT,
28 VBOX_SCRIPTABLE_IMPL(ISharedFolder)
29{
30public:
31
32 struct Data
33 {
34 Data() {}
35
36 const Bstr name;
37 const Bstr hostPath;
38 BOOL writable;
39 BOOL autoMount;
40 Bstr lastAccessError;
41 };
42
43 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SharedFolder, ISharedFolder)
44
45 DECLARE_NOT_AGGREGATABLE(SharedFolder)
46
47 DECLARE_PROTECT_FINAL_CONSTRUCT()
48
49 BEGIN_COM_MAP(SharedFolder)
50 COM_INTERFACE_ENTRY (ISupportErrorInfo)
51 COM_INTERFACE_ENTRY (ISharedFolder)
52 COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
53 END_COM_MAP()
54
55 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
56
57 HRESULT FinalConstruct();
58 void FinalRelease();
59
60 // public initializer/uninitializer for internal purposes only
61 HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
62 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
63 HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
64 HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
65 void uninit();
66
67 // ISharedFolder properties
68 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
69 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
70 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
71 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
72 STDMETHOD(COMGETTER(AutoMount)) (BOOL *aAutoMount);
73 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
74
75 // public methods for internal purposes only
76 // (ensure there is a caller and a read lock before calling them!)
77
78 // public methods that don't need a lock (because access constant data)
79 // (ensure there is a caller added before calling them!)
80
81 const Bstr& getName() const { return m.name; }
82 const Bstr& getHostPath() const { return m.hostPath; }
83 BOOL isWritable() const { return m.writable; }
84 BOOL isAutoMounted() const { return m.autoMount; }
85
86protected:
87
88 HRESULT protectedInit(VirtualBoxBase *aParent,
89 CBSTR aName, CBSTR aHostPath,
90 BOOL aWritable, BOOL aAutoMount);
91private:
92
93 VirtualBoxBase * const mParent;
94
95 /* weak parents (only one of them is not null) */
96 Machine * const mMachine;
97 Console * const mConsole;
98 VirtualBox * const mVirtualBox;
99
100 Data m;
101};
102
103#endif // ____H_SHAREDFOLDERIMPL
104/* 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