Changeset 17255 in vbox for trunk/src/VBox
- Timestamp:
- Mar 2, 2009 3:42:10 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r17238 r17255 733 733 ComPtr<IHost> host; 734 734 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 735 ComPtr<IHostFloppyDriveCollection> hostFloppies; 736 CHECK_ERROR(host, COMGETTER(FloppyDrives)(hostFloppies.asOutParam())); 735 com::SafeIfaceArray <IHostFloppyDrive> hostFloppies; 736 rc = host->COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(hostFloppies)); 737 CheckComRCReturnRC (rc); 737 738 ComPtr<IHostFloppyDrive> hostFloppyDrive; 738 rc = hostFloppies->FindByName(Bstr(a->argv[2] + 5), hostFloppyDrive.asOutParam());739 host->FindHostFloppyDrive(Bstr(a->argv[2] + 5), hostFloppyDrive.asOutParam()); 739 740 if (!hostFloppyDrive) 740 741 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r17238 r17255 264 264 ComPtr<IHost> host; 265 265 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 266 ComPtr<IHostFloppyDriveCollection> coll; 267 ComPtr<IHostFloppyDriveEnumerator> enumerator; 268 CHECK_ERROR(host, COMGETTER(FloppyDrives)(coll.asOutParam())); 269 if (SUCCEEDED(rc) && coll) 270 { 271 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 272 BOOL hasMore; 273 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 274 { 275 ComPtr<IHostFloppyDrive> floppyDrive; 276 CHECK_ERROR_BREAK(enumerator, GetNext(floppyDrive.asOutParam())); 266 com::SafeIfaceArray <IHostFloppyDrive> coll; 267 CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll))); 268 if (SUCCEEDED(rc)) 269 { 270 for (size_t i = 0; i < coll.size(); ++i) 271 { 272 ComPtr<IHostFloppyDrive> floppyDrive = coll[i]; 277 273 Bstr name; 278 274 floppyDrive->COMGETTER(Name)(name.asOutParam()); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r17238 r17255 1196 1196 ComPtr<IHost> host; 1197 1197 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 1198 ComPtr<IHostFloppyDriveCollection> hostFloppies;1199 CHECK_ERROR(host, COMGETTER(FloppyDrives)( hostFloppies.asOutParam()));1198 com::SafeIfaceArray <IHostFloppyDrive> hostFloppies; 1199 CHECK_ERROR(host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(hostFloppies))); 1200 1200 ComPtr<IHostFloppyDrive> hostFloppyDrive; 1201 rc = host Floppies->FindByName(Bstr(floppy + 5), hostFloppyDrive.asOutParam());1201 rc = host->FindHostFloppyDrive(Bstr(floppy + 5), hostFloppyDrive.asOutParam()); 1202 1202 if (!hostFloppyDrive) 1203 1203 { -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r17238 r17255 1711 1711 ComPtr <IHost> host; 1712 1712 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam())); 1713 ComPtr <IHostFloppyDriveCollection> coll;1714 CHECK_ERROR_BREAK (host, COMGETTER(FloppyDrives)( coll.asOutParam()));1713 com::SafeIfaceArray <IHostFloppyDrive> coll; 1714 CHECK_ERROR_BREAK (host, COMGETTER(FloppyDrives)(ComSafeArrayAsOutParam(coll))); 1715 1715 ComPtr <IHostFloppyDrive> hostDrive; 1716 rc = coll->FindByName (medium, hostDrive.asOutParam());1716 rc = host->FindHostFloppyDrive (medium, hostDrive.asOutParam()); 1717 1717 if (SUCCEEDED (rc)) 1718 1718 { -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r17238 r17255 3017 3017 3018 3018 hostFloppyMap.clear(); 3019 CHostFloppyDrive Enumerator en=3020 vboxGlobal().virtualBox().GetHost().GetFloppyDrives() .Enumerate();3021 while (en.HasMore())3022 { 3023 CHostFloppyDrive hostFloppy = en.GetNext();3019 CHostFloppyDriveVector drvvec = 3020 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 3021 for (int i = 0; i < drvvec.size(); ++i) 3022 { 3023 CHostFloppyDrive hostFloppy = drvvec[i]; 3024 3024 /** @todo set icon */ 3025 3025 QString drvName = hostFloppy.GetName(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp
r17238 r17255 198 198 { 199 199 /* Search for the host floppy-drives */ 200 CHostFloppyDrive Collectioncoll =200 CHostFloppyDriveVector coll = 201 201 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 202 mHostFloppys.resize (coll.GetCount()); 203 int id = 0; 204 CHostFloppyDriveEnumerator en = coll.Enumerate(); 205 while (en.HasMore()) 206 { 207 CHostFloppyDrive hostFloppy = en.GetNext(); 202 mHostFloppys.resize (coll.size()); 203 204 for (int id = 0; id < coll.size(); ++id) 205 { 206 CHostFloppyDrive hostFloppy = coll[id]; 208 207 QString name = hostFloppy.GetName(); 209 208 QString description = hostFloppy.GetDescription(); … … 212 211 mCbHost->insertItem (id, fullName); 213 212 mHostFloppys [id] = hostFloppy; 214 ++ id;215 213 } 216 214 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsFD.cpp
r16867 r17255 6 6 7 7 /* 8 * Copyright (C) 2006-200 8Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 60 60 61 61 /* Read out the host floppy drive list and prepare the combobox */ 62 CHostFloppyDrive Collectioncoll =62 CHostFloppyDriveVector coll = 63 63 vboxGlobal().virtualBox().GetHost().GetFloppyDrives(); 64 mHostFDs.resize (coll. GetCount());64 mHostFDs.resize (coll.size()); 65 65 mCbHostFD->clear(); 66 int id = 0; 67 CHostFloppyDriveEnumerator en = coll.Enumerate(); 68 while (en.HasMore()) 69 { 70 CHostFloppyDrive hostFloppy = en.GetNext(); 66 67 for (int id = 0; id < coll.size(); ++id) 68 { 69 CHostFloppyDrive hostFloppy = coll[id]; 71 70 /** @todo set icon? */ 72 71 QString name = hostFloppy.GetName(); … … 77 76 mCbHostFD->insertItem (id, fullName); 78 77 mHostFDs [id] = hostFloppy; 79 ++ id;80 78 } 81 79 … … 91 89 name : 92 90 QString ("%1 (%2)").arg (description, name); 93 if ( coll.FindByName (name).isNull())91 if (vboxGlobal().virtualBox().GetHost().FindHostFloppyDrive (name).isNull()) 94 92 { 95 93 /* If the floppy drive is not currently available, add it to -
trunk/src/VBox/Main/FloppyDriveImpl.cpp
r16867 r17255 7 7 8 8 /* 9 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 459 459 Bstr src = typeNode.stringValue ("src"); 460 460 461 /* find the correspo ding object */461 /* find the corresponding object */ 462 462 ComObjPtr <Host> host = mParent->virtualBox()->host(); 463 463 464 ComPtr <IHostFloppyDriveCollection> coll;465 rc = host->COMGETTER(FloppyDrives) ( coll.asOutParam());464 com::SafeIfaceArray <IHostFloppyDrive> coll; 465 rc = host->COMGETTER(FloppyDrives) (ComSafeArrayAsOutParam(coll)); 466 466 AssertComRC (rc); 467 467 468 468 ComPtr <IHostFloppyDrive> drive; 469 rc = coll->FindByName (src, drive.asOutParam()); 469 rc = host->FindHostFloppyDrive (src, drive.asOutParam()); 470 470 471 if (SUCCEEDED (rc)) 471 472 { -
trunk/src/VBox/Main/HostImpl.cpp
r17238 r17255 410 410 * @param drives address of result pointer 411 411 */ 412 STDMETHODIMP Host::COMGETTER(FloppyDrives) ( IHostFloppyDriveCollection **aDrives)412 STDMETHODIMP Host::COMGETTER(FloppyDrives) (ComSafeArrayOut (IHostFloppyDrive *, aDrives)) 413 413 { 414 414 CheckComArgOutPointerValid(aDrives); … … 462 462 #endif 463 463 464 ComObjPtr<HostFloppyDriveCollection> collection; 465 collection.createObject(); 466 collection->init (list); 467 collection.queryInterfaceTo(aDrives); 464 SafeIfaceArray<IHostFloppyDrive> collection (list); 465 collection.detachTo(ComSafeArrayOutArg (aDrives)); 468 466 return rc; 469 467 } … … 3355 3353 } 3356 3354 3355 STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IHostFloppyDrive **aDrive) 3356 { 3357 CheckComArgNotNull(aName); 3358 CheckComArgOutPointerValid(aDrive); 3359 3360 *aDrive = NULL; 3361 3362 SafeIfaceArray <IHostFloppyDrive> drivevec; 3363 HRESULT rc = COMGETTER(FloppyDrives) (ComSafeArrayAsOutParam(drivevec)); 3364 CheckComRCReturnRC (rc); 3365 3366 for (size_t i = 0; i < drivevec.size(); ++i) 3367 { 3368 Bstr name; 3369 rc = drivevec[i]->COMGETTER(Name) (name.asOutParam()); 3370 CheckComRCReturnRC (rc); 3371 if (name == aName) 3372 { 3373 ComObjPtr<HostFloppyDrive> found; 3374 found.createObject(); 3375 Bstr udi, description; 3376 rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam()); 3377 CheckComRCReturnRC (rc); 3378 rc = drivevec[i]->COMGETTER(Description) (description.asOutParam()); 3379 CheckComRCReturnRC (rc); 3380 found->init(name, udi, description); 3381 return found.queryInterfaceTo(aDrive); 3382 } 3383 } 3384 3385 return setError (VBOX_E_OBJECT_NOT_FOUND, HostFloppyDrive::tr ( 3386 "The host floppy drive named '%ls' could not be found"), aName); 3387 } 3388 3357 3389 STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface) 3358 3390 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17238 r17255 6374 6374 </interface> 6375 6375 6376 <enumerator6377 name="IHostFloppyDriveEnumerator" type="IHostFloppyDrive"6378 uuid="ce04c924-4f54-432a-9dec-11fddc3ea875"6379 />6380 6381 <collection6382 name="IHostFloppyDriveCollection" type="IHostFloppyDrive"6383 enumerator="IHostFloppyDriveEnumerator"6384 uuid="fd84bb86-c59a-4037-a557-755ff263a460"6385 readonly="yes"6386 >6387 <method name="findByName">6388 <desc>6389 Searches this collection for a host drive with the given name.6390 <note>6391 The method returns an error if the given name does not6392 correspond to any host drive in the collection.6393 </note>6394 </desc>6395 <param name="name" type="wstring" dir="in">6396 <desc>Name of the host drive to search for</desc>6397 </param>6398 <param name="drive" type="IHostFloppyDrive" dir="return">6399 <desc>Found host drive object</desc>6400 </param>6401 </method>6402 </collection>6403 6404 6376 <enum 6405 6377 name="HostNetworkInterfaceType" … … 6534 6506 </attribute> 6535 6507 6536 <attribute name="floppyDrives" type="IHostFloppyDrive Collection" readonly="yes">6508 <attribute name="floppyDrives" type="IHostFloppyDrive" readonly="yes" safearray="yes"> 6537 6509 <desc>List of floppy drives available on the host.</desc> 6538 6510 </attribute> … … 6819 6791 <param name="drive" type="IHostDVDDrive" dir="return"> 6820 6792 <desc>Found host drive object</desc> 6793 </param> 6794 </method> 6795 6796 <method name="findHostFloppyDrive"> 6797 <desc> 6798 Searches for a host floppy drive with the given @c name. 6799 6800 <result name="VBOX_E_OBJECT_NOT_FOUND"> 6801 Given @c name does not correspond to any host floppy drive. 6802 </result> 6803 6804 </desc> 6805 <param name="name" type="wstring" dir="in"> 6806 <desc>Name of the host floppy drive to search for</desc> 6807 </param> 6808 <param name="drive" type="IHostFloppyDrive" dir="return"> 6809 <desc>Found host floppy drive object</desc> 6821 6810 </param> 6822 6811 </method> -
trunk/src/VBox/Main/include/HostFloppyDriveImpl.h
r15051 r17255 24 24 25 25 #include "VirtualBoxBase.h" 26 #include "Collection.h"27 26 28 27 class ATL_NO_VTABLE HostFloppyDrive : … … 83 82 }; 84 83 85 COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostFloppyDrive)86 87 STDMETHOD(FindByName) (IN_BSTR aName, IHostFloppyDrive **aDrive)88 {89 if (!aName)90 return E_INVALIDARG;91 if (!aDrive)92 return E_POINTER;93 94 *aDrive = NULL;95 Vector::value_type found;96 Vector::iterator it = vec.begin();97 while (it != vec.end() && !found)98 {99 Bstr n;100 (*it)->COMGETTER(Name) (n.asOutParam());101 if (n == aName)102 found = *it;103 ++ it;104 }105 106 if (!found)107 return setError (E_INVALIDARG, HostFloppyDriveCollection::tr (108 "The host floppy drive named '%ls' could not be found"), aName);109 110 return found.queryInterfaceTo (aDrive);111 }112 113 COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostFloppyDrive)114 115 84 #endif // ____H_HOSTFLOPPYDRIVEIMPL 116 85 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/HostImpl.h
r17238 r17255 82 82 // IHost properties 83 83 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives)); 84 STDMETHOD(COMGETTER(FloppyDrives))( IHostFloppyDriveCollection **drives);84 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IHostFloppyDrive*, drives)); 85 85 STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices); 86 86 STDMETHOD(COMGETTER(USBDeviceFilters))(IHostUSBDeviceFilterCollection ** aUSBDeviceFilters); … … 112 112 113 113 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive); 114 STDMETHOD(FindHostFloppyDrive) (IN_BSTR aName, IHostFloppyDrive **aDrive); 114 115 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface); 115 116 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface); -
trunk/src/VBox/Main/xpcom/server.cpp
r17238 r17255 243 243 244 244 COM_IMPL_READONLY_ENUM_AND_COLLECTION(Snapshot) 245 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostFloppyDrive)246 245 #ifdef VBOX_WITH_USB 247 246 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDevice)
Note:
See TracChangeset
for help on using the changeset viewer.