VirtualBox

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

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

Main: remove VirtualBoxSupportTranslation template, add translation support to generic base class, clean up COM headers more, remove SupportErrorInfo.cpp|h

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 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.215389.xyz. 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 Bstr lastAccessError;
40 };
41
42 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SharedFolder, ISharedFolder)
43
44 DECLARE_NOT_AGGREGATABLE(SharedFolder)
45
46 DECLARE_PROTECT_FINAL_CONSTRUCT()
47
48 BEGIN_COM_MAP(SharedFolder)
49 COM_INTERFACE_ENTRY (ISupportErrorInfo)
50 COM_INTERFACE_ENTRY (ISharedFolder)
51 COM_INTERFACE_ENTRY2 (IDispatch, ISharedFolder)
52 END_COM_MAP()
53
54 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
55
56 HRESULT FinalConstruct();
57 void FinalRelease();
58
59 // public initializer/uninitializer for internal purposes only
60 HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
61 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
62 HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
63 HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
64 void uninit();
65
66 // ISharedFolder properties
67 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
68 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
69 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
70 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
71 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
72
73 // public methods for internal purposes only
74 // (ensure there is a caller and a read lock before calling them!)
75
76 // public methods that don't need a lock (because access constant data)
77 // (ensure there is a caller added before calling them!)
78
79 const Bstr& getName() const { return m.name; }
80 const Bstr& getHostPath() const { return m.hostPath; }
81 BOOL isWritable() const { return m.writable; }
82
83protected:
84
85 HRESULT protectedInit(VirtualBoxBase *aParent,
86 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
87
88private:
89
90 VirtualBoxBase * const mParent;
91
92 /* weak parents (only one of them is not null) */
93 Machine * const mMachine;
94 Console * const mConsole;
95 VirtualBox * const mVirtualBox;
96
97 Data m;
98};
99
100#endif // ____H_SHAREDFOLDERIMPL
101/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette