1 | /* $Id: SharedFolderImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 MAIN_INCLUDED_SharedFolderImpl_h
|
---|
19 | #define MAIN_INCLUDED_SharedFolderImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "SharedFolderWrap.h"
|
---|
25 | #include <VBox/shflsvc.h>
|
---|
26 |
|
---|
27 | class Console;
|
---|
28 |
|
---|
29 | class ATL_NO_VTABLE SharedFolder :
|
---|
30 | public SharedFolderWrap
|
---|
31 | {
|
---|
32 | public:
|
---|
33 |
|
---|
34 | DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
|
---|
35 |
|
---|
36 | HRESULT FinalConstruct();
|
---|
37 | void FinalRelease();
|
---|
38 |
|
---|
39 | // public initializer/uninitializer for internal purposes only
|
---|
40 | HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
|
---|
41 | bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
|
---|
42 | HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
|
---|
43 | HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath,
|
---|
44 | bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError);
|
---|
45 | // HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath,
|
---|
46 | // bool aWritable, const com::Utf8Str &aAutoMountPoint, bool aAutoMount, bool fFailOnError);
|
---|
47 | void uninit();
|
---|
48 |
|
---|
49 | // public methods for internal purposes only
|
---|
50 | // (ensure there is a caller and a read lock before calling them!)
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
|
---|
54 | * @return
|
---|
55 | */
|
---|
56 | const Utf8Str &i_getName() const;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
|
---|
60 | * @return
|
---|
61 | */
|
---|
62 | const Utf8Str &i_getHostPath() const;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
|
---|
66 | * @return
|
---|
67 | */
|
---|
68 | bool i_isWritable() const;
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
|
---|
72 | * @return
|
---|
73 | */
|
---|
74 | bool i_isAutoMounted() const;
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Public internal method for getting the auto mount point.
|
---|
78 | */
|
---|
79 | const Utf8Str &i_getAutoMountPoint() const;
|
---|
80 |
|
---|
81 | protected:
|
---|
82 |
|
---|
83 | HRESULT i_protectedInit(VirtualBoxBase *aParent,
|
---|
84 | const Utf8Str &aName,
|
---|
85 | const Utf8Str &aHostPath,
|
---|
86 | bool aWritable,
|
---|
87 | bool aAutoMount,
|
---|
88 | const com::Utf8Str &aAutoMountPoint,
|
---|
89 | bool fFailOnError);
|
---|
90 | private:
|
---|
91 |
|
---|
92 | // wrapped ISharedFolder properies.
|
---|
93 | HRESULT getName(com::Utf8Str &aName);
|
---|
94 | HRESULT getHostPath(com::Utf8Str &aHostPath);
|
---|
95 | HRESULT getAccessible(BOOL *aAccessible);
|
---|
96 | HRESULT getWritable(BOOL *aWritable);
|
---|
97 | HRESULT setWritable(BOOL aWritable);
|
---|
98 | HRESULT getAutoMount(BOOL *aAutoMount);
|
---|
99 | HRESULT setAutoMount(BOOL aAutoMount);
|
---|
100 | HRESULT getAutoMountPoint(com::Utf8Str &aAutoMountPoint);
|
---|
101 | HRESULT setAutoMountPoint(com::Utf8Str const &aAutoMountPoint);
|
---|
102 | HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
|
---|
103 |
|
---|
104 | VirtualBoxBase * const mParent;
|
---|
105 |
|
---|
106 | /* weak parents (only one of them is not null) */
|
---|
107 | #if !defined(VBOX_COM_INPROC)
|
---|
108 | Machine * const mMachine;
|
---|
109 | VirtualBox * const mVirtualBox;
|
---|
110 | #else
|
---|
111 | Console * const mConsole;
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | struct Data; // opaque data struct, defined in SharedFolderImpl.cpp
|
---|
115 | Data *m;
|
---|
116 | };
|
---|
117 |
|
---|
118 | #endif /* !MAIN_INCLUDED_SharedFolderImpl_h */
|
---|
119 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|