VirtualBox

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

Last change on this file since 108046 was 108046, checked in by vboxsync, 12 days ago

doc/manual,include/VBox,Frontends/{VBoxManage,VirtualBox/src},Main/{include,SharedFolder,Console,Machine,VirtualBox,VirtualBox.xidl}: Added global shared folders and adjusted fetching and handling of folders between shared folder types bugref:3544

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: SharedFolderImpl.h 108046 2025-02-04 05:24:54Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_SharedFolderImpl_h
29#define MAIN_INCLUDED_SharedFolderImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "SharedFolderWrap.h"
35#include <VBox/shflsvc.h>
36
37class Console;
38
39namespace settings
40{
41 struct SharedFolder;
42}
43
44class ATL_NO_VTABLE SharedFolder :
45 public SharedFolderWrap
46{
47public:
48
49 DECLARE_COMMON_CLASS_METHODS (SharedFolder)
50
51 HRESULT FinalConstruct();
52 void FinalRelease();
53
54 // public initializer/uninitializer for internal purposes only
55 HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
56 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError,
57 SymlinkPolicy_T enmSymlinkPolicy);
58 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
59// HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
60// bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
61 HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath,
62 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError,
63 SymlinkPolicy_T enmSymlinkPolicy);
64 HRESULT init(VirtualBox *aVirtualBox, const settings::SharedFolder &rData);
65 void uninit();
66 HRESULT i_saveSettings(settings::SharedFolder &data);
67
68 // public methods for internal purposes only
69 // (ensure there is a caller and a read lock before calling them!)
70
71 /**
72 * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
73 * @return
74 */
75 const Utf8Str &i_getName() const;
76
77 /**
78 * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
79 * @return
80 */
81 const Utf8Str &i_getHostPath() const;
82
83 /**
84 * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
85 * @return
86 */
87 bool i_isWritable() const;
88
89 /**
90 * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
91 * @return
92 */
93 bool i_isAutoMounted() const;
94
95 /**
96 * Public internal method for getting the auto mount point.
97 */
98 const Utf8Str &i_getAutoMountPoint() const;
99
100 /**
101 * Public internal method for getting the symlink policy.
102 */
103 SymlinkPolicy_T i_getSymlinkPolicy() const;
104
105protected:
106
107 HRESULT i_protectedInit(VirtualBoxBase *aParent,
108 const Utf8Str &aName,
109 const Utf8Str &aHostPath,
110 bool aWritable,
111 bool aAutoMount,
112 const com::Utf8Str &aAutoMountPoint,
113 bool fFailOnError,
114 SymlinkPolicy_T enmSymlinkPolicy);
115private:
116
117 // wrapped ISharedFolder properties.
118 HRESULT getName(com::Utf8Str &aName);
119 HRESULT getHostPath(com::Utf8Str &aHostPath);
120 HRESULT getAccessible(BOOL *aAccessible);
121 HRESULT getWritable(BOOL *aWritable);
122 HRESULT setWritable(BOOL aWritable);
123 HRESULT getAutoMount(BOOL *aAutoMount);
124 HRESULT setAutoMount(BOOL aAutoMount);
125 HRESULT getAutoMountPoint(com::Utf8Str &aAutoMountPoint);
126 HRESULT setAutoMountPoint(com::Utf8Str const &aAutoMountPoint);
127 HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
128 HRESULT getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy);
129 HRESULT setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy);
130
131 VirtualBoxBase * const mParent;
132
133 /* weak parents (only one of them is not null) */
134 Machine * const mMachine;
135 VirtualBox * const mVirtualBox;
136
137 struct Data; // opaque data struct, defined in MachineSharedFolderImpl.cpp
138 Data *m;
139};
140
141#endif /* !MAIN_INCLUDED_SharedFolderImpl_h */
142/* 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