1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 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 |
|
---|
24 | class Console;
|
---|
25 |
|
---|
26 | class ATL_NO_VTABLE SharedFolder :
|
---|
27 | public VirtualBoxBase,
|
---|
28 | VBOX_SCRIPTABLE_IMPL(ISharedFolder)
|
---|
29 | {
|
---|
30 | public:
|
---|
31 |
|
---|
32 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SharedFolder, ISharedFolder)
|
---|
33 |
|
---|
34 | DECLARE_NOT_AGGREGATABLE(SharedFolder)
|
---|
35 |
|
---|
36 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
37 |
|
---|
38 | BEGIN_COM_MAP(SharedFolder)
|
---|
39 | VBOX_DEFAULT_INTERFACE_ENTRIES (ISharedFolder)
|
---|
40 | END_COM_MAP()
|
---|
41 |
|
---|
42 | DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
|
---|
43 |
|
---|
44 | HRESULT FinalConstruct();
|
---|
45 | void FinalRelease();
|
---|
46 |
|
---|
47 | // public initializer/uninitializer for internal purposes only
|
---|
48 | HRESULT init(Machine *aMachine, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
|
---|
49 | HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
|
---|
50 | HRESULT init(Console *aConsole, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
|
---|
51 | // HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
|
---|
52 | void uninit();
|
---|
53 |
|
---|
54 | // ISharedFolder properties
|
---|
55 | STDMETHOD(COMGETTER(Name)) (BSTR *aName);
|
---|
56 | STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
|
---|
57 | STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
|
---|
58 | STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
|
---|
59 | STDMETHOD(COMGETTER(AutoMount)) (BOOL *aAutoMount);
|
---|
60 | STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
|
---|
61 |
|
---|
62 | // public methods for internal purposes only
|
---|
63 | // (ensure there is a caller and a read lock before calling them!)
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
|
---|
67 | * @return
|
---|
68 | */
|
---|
69 | const Utf8Str& getName() const;
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
|
---|
73 | * @return
|
---|
74 | */
|
---|
75 | const Utf8Str& getHostPath() const;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
|
---|
79 | * @return
|
---|
80 | */
|
---|
81 | bool isWritable() const;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
|
---|
85 | * @return
|
---|
86 | */
|
---|
87 | bool isAutoMounted() const;
|
---|
88 |
|
---|
89 | protected:
|
---|
90 |
|
---|
91 | HRESULT protectedInit(VirtualBoxBase *aParent,
|
---|
92 | const Utf8Str &aName,
|
---|
93 | const Utf8Str &aHostPath,
|
---|
94 | bool aWritable,
|
---|
95 | bool aAutoMount,
|
---|
96 | bool fFailOnError);
|
---|
97 | private:
|
---|
98 |
|
---|
99 | VirtualBoxBase * const mParent;
|
---|
100 |
|
---|
101 | /* weak parents (only one of them is not null) */
|
---|
102 | #if !defined(VBOX_COM_INPROC)
|
---|
103 | Machine * const mMachine;
|
---|
104 | VirtualBox * const mVirtualBox;
|
---|
105 | #else
|
---|
106 | Console * const mConsole;
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | struct Data; // opaque data struct, defined in SharedFolderImpl.cpp
|
---|
110 | Data *m;
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif // ____H_SHAREDFOLDERIMPL
|
---|
114 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|