VirtualBox

source: vbox/trunk/src/VBox/Main/include/DVDImageImpl.h@ 2106

Last change on this file since 2106 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_DVDIMAGEIMPL
23#define ____H_DVDIMAGEIMPL
24
25#include "VirtualBoxBase.h"
26#include "Collection.h"
27
28class VirtualBox;
29
30class ATL_NO_VTABLE DVDImage :
31 public VirtualBoxSupportErrorInfoImpl <DVDImage, IDVDImage>,
32 public VirtualBoxSupportTranslation <DVDImage>,
33 public VirtualBoxBase,
34 public IDVDImage
35{
36public:
37
38 // to satisfy the ComObjPtr template (we have const members)
39 DVDImage() {}
40
41 DECLARE_NOT_AGGREGATABLE(DVDImage)
42
43 DECLARE_PROTECT_FINAL_CONSTRUCT()
44
45 BEGIN_COM_MAP(DVDImage)
46 COM_INTERFACE_ENTRY(ISupportErrorInfo)
47 COM_INTERFACE_ENTRY(IDVDImage)
48 END_COM_MAP()
49
50 NS_DECL_ISUPPORTS
51
52 HRESULT FinalConstruct();
53 void FinalRelease();
54
55 // public initializer/uninitializer for internal purposes only
56 HRESULT init (VirtualBox *parent, const BSTR filePath,
57 BOOL isRegistered, const Guid &id);
58 void uninit();
59
60 // IDVDImage properties
61 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT id);
62 STDMETHOD(COMGETTER(FilePath)) (BSTR *filePath);
63 STDMETHOD(COMGETTER(Accessible)) (BOOL *accessible);
64 STDMETHOD(COMGETTER(Size)) (ULONG64 *size);
65
66 // public methods for internal purposes only
67
68 const Bstr &filePath() { return mImageFile; }
69 const Bstr &filePathFull() { return mImageFileFull; }
70 const Guid &id() { return mUuid; }
71
72 void updatePath (const char *aNewFullPath, const char *aNewPath);
73
74 // for VirtualBoxSupportErrorInfoImpl
75 static const wchar_t *getComponentName() { return L"DVDImage"; }
76
77private:
78
79 /** weak parent */
80 ComObjPtr <VirtualBox, ComWeakRef> mParent;
81
82 BOOL mAccessible;
83
84 const Guid mUuid;
85 const Bstr mImageFile;
86 const Bstr mImageFileFull;
87};
88
89COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (DVDImage)
90
91 STDMETHOD(FindByPath) (INPTR BSTR path, IDVDImage **dvdImage)
92 {
93 if (!path)
94 return E_INVALIDARG;
95 if (!dvdImage)
96 return E_POINTER;
97
98 *dvdImage = NULL;
99 Vector::value_type found;
100 Vector::iterator it = vec.begin();
101 while (it != vec.end() && !found)
102 {
103 Bstr filePath;
104 (*it)->COMGETTER(FilePath) (filePath.asOutParam());
105 if (filePath == path)
106 found = *it;
107 ++ it;
108 }
109
110 if (!found)
111 return setError (E_INVALIDARG, DVDImageCollection::tr (
112 "The DVD image named '%ls' could not be found"), path);
113
114 return found.queryInterfaceTo (dvdImage);
115 }
116
117COM_DECL_READONLY_ENUM_AND_COLLECTION_END (DVDImage)
118
119
120#endif // ____H_DVDIMAGEIMPL
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