VirtualBox

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

Last change on this file since 30670 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • 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-2009 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 public VirtualBoxSupportErrorInfoImpl<SharedFolder, ISharedFolder>,
29 public VirtualBoxSupportTranslation<SharedFolder>,
30 VBOX_SCRIPTABLE_IMPL(ISharedFolder)
31{
32public:
33
34 struct Data
35 {
36 Data() {}
37
38 const Bstr name;
39 const Bstr hostPath;
40 BOOL writable;
41 Bstr lastAccessError;
42 };
43
44 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SharedFolder)
45
46 DECLARE_NOT_AGGREGATABLE(SharedFolder)
47
48 DECLARE_PROTECT_FINAL_CONSTRUCT()
49
50 BEGIN_COM_MAP(SharedFolder)
51 COM_INTERFACE_ENTRY (ISupportErrorInfo)
52 COM_INTERFACE_ENTRY (ISharedFolder)
53 COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
54 END_COM_MAP()
55
56 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
57
58 HRESULT FinalConstruct();
59 void FinalRelease();
60
61 // public initializer/uninitializer for internal purposes only
62 HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
63 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
64 HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
65 HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
66 void uninit();
67
68 // ISharedFolder properties
69 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
70 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
71 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
72 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
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
85 // for VirtualBoxSupportErrorInfoImpl
86 static const wchar_t *getComponentName() { return L"SharedFolder"; }
87
88protected:
89
90 HRESULT protectedInit(VirtualBoxBase *aParent,
91 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
92
93private:
94
95 VirtualBoxBase * const mParent;
96
97 /* weak parents (only one of them is not null) */
98 Machine * const mMachine;
99 Console * const mConsole;
100 VirtualBox * const mVirtualBox;
101
102 Data m;
103};
104
105#endif // ____H_SHAREDFOLDERIMPL
106/* 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