VirtualBox

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

Last change on this file since 25275 was 25184, checked in by vboxsync, 15 years ago

Main: bring back r55600 with fix for broken machine creation

  • 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 VirtualBoxBaseWithChildrenNEXT,
34 public VirtualBoxSupportErrorInfoImpl<SharedFolder, ISharedFolder>,
35 public VirtualBoxSupportTranslation<SharedFolder>,
36 VBOX_SCRIPTABLE_IMPL(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 COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
60 END_COM_MAP()
61
62 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
63
64 HRESULT FinalConstruct();
65 void FinalRelease();
66
67 // public initializer/uninitializer for internal purposes only
68 HRESULT init (Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
69 HRESULT initCopy (Machine *aMachine, SharedFolder *aThat);
70 HRESULT init (Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
71 HRESULT init (VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
72 void uninit();
73
74 // ISharedFolder properties
75 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
76 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
77 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
78 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
79 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
80
81 // public methods for internal purposes only
82 // (ensure there is a caller and a read lock before calling them!)
83
84 // public methods that don't need a lock (because access constant data)
85 // (ensure there is a caller added before calling them!)
86
87 const Bstr& getName() const { return m.name; }
88 const Bstr& getHostPath() const { return m.hostPath; }
89 BOOL isWritable() const { return m.writable; }
90
91 // for VirtualBoxSupportErrorInfoImpl
92 static const wchar_t *getComponentName() { return L"SharedFolder"; }
93
94protected:
95
96 HRESULT protectedInit(VirtualBoxBase *aParent,
97 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
98
99private:
100
101 VirtualBoxBase *const mParent;
102
103 /* weak parents (only one of them is not null) */
104 const ComObjPtr<Machine, ComWeakRef> mMachine;
105 const ComObjPtr<Console, ComWeakRef> mConsole;
106 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox;
107
108 Data m;
109};
110
111#endif // ____H_SHAREDFOLDERIMPL
112/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use