VirtualBox

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

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

Main: remove SupportErrorInfo template magic

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 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 public VirtualBoxSupportTranslation<SharedFolder>,
29 VBOX_SCRIPTABLE_IMPL(ISharedFolder)
30{
31public:
32
33 struct Data
34 {
35 Data() {}
36
37 const Bstr name;
38 const Bstr hostPath;
39 BOOL writable;
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);
62 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
63 HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
64 HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
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(LastAccessError)) (BSTR *aLastAccessError);
73
74 // public methods for internal purposes only
75 // (ensure there is a caller and a read lock before calling them!)
76
77 // public methods that don't need a lock (because access constant data)
78 // (ensure there is a caller added before calling them!)
79
80 const Bstr& getName() const { return m.name; }
81 const Bstr& getHostPath() const { return m.hostPath; }
82 BOOL isWritable() const { return m.writable; }
83
84protected:
85
86 HRESULT protectedInit(VirtualBoxBase *aParent,
87 CBSTR aName, CBSTR aHostPath, BOOL aWritable);
88
89private:
90
91 VirtualBoxBase * const mParent;
92
93 /* weak parents (only one of them is not null) */
94 Machine * const mMachine;
95 Console * const mConsole;
96 VirtualBox * const mVirtualBox;
97
98 Data m;
99};
100
101#endif // ____H_SHAREDFOLDERIMPL
102/* 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