Changeset 17218 in vbox for trunk/src/VBox
- Timestamp:
- Feb 27, 2009 6:02:48 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r17200 r17218 671 671 ComPtr<IHost> host; 672 672 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 673 com::SafeIfaceArray <IHostDVDDrive> hostDVDs; 674 rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs)); 675 673 ComPtr<IHostDVDDriveCollection> hostDVDs; 674 CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam())); 676 675 ComPtr<IHostDVDDrive> hostDVDDrive; 677 rc = host ->FindHostDVDDrive(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());676 rc = hostDVDs->FindByName(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam()); 678 677 if (!hostDVDDrive) 679 678 { -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r17200 r17218 224 224 { 225 225 /* 226 227 226 * Iterate through the collection. 227 */ 228 228 for (size_t i = 0; i < coll.size(); ++ i) 229 229 { … … 245 245 ComPtr<IHost> host; 246 246 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 247 com::SafeIfaceArray <IHostDVDDrive> coll; 248 CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll))); 249 if (SUCCEEDED(rc)) 250 { 251 for (size_t i = 0; i < coll.size(); ++ i) 252 { 253 ComPtr<IHostDVDDrive> dvdDrive = coll[i]; 247 ComPtr<IHostDVDDriveCollection> coll; 248 ComPtr<IHostDVDDriveEnumerator> enumerator; 249 CHECK_ERROR(host, COMGETTER(DVDDrives)(coll.asOutParam())); 250 if (SUCCEEDED(rc) && coll) 251 { 252 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam())); 253 BOOL hasMore; 254 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore) 255 { 256 ComPtr<IHostDVDDrive> dvdDrive; 257 CHECK_ERROR_BREAK(enumerator, GetNext(dvdDrive.asOutParam())); 254 258 Bstr name; 255 259 dvdDrive->COMGETTER(Name)(name.asOutParam()); … … 775 779 776 780 #endif /* !VBOX_ONLY_DOCS */ 777 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ 781 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r17200 r17218 25 25 #ifndef VBOX_ONLY_DOCS 26 26 #include <VBox/com/com.h> 27 #include <VBox/com/array.h>28 27 #include <VBox/com/ErrorInfo.h> 29 28 #include <VBox/com/errorprint2.h> … … 1092 1091 ComPtr<IHost> host; 1093 1092 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam())); 1094 com::SafeIfaceArray <IHostDVDDrive> hostDVDs; 1095 rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs)); 1096 1093 ComPtr<IHostDVDDriveCollection> hostDVDs; 1094 CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam())); 1097 1095 ComPtr<IHostDVDDrive> hostDVDDrive; 1098 rc = host ->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());1096 rc = hostDVDs->FindByName(Bstr(dvd + 5), hostDVDDrive.asOutParam()); 1099 1097 if (!hostDVDDrive) 1100 1098 { … … 1107 1105 break; 1108 1106 } 1109 rc = host ->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());1107 rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam()); 1110 1108 if (!hostDVDDrive) 1111 1109 { -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r17200 r17218 5 5 6 6 /* 7 * Copyright (C) 2006-200 9Sun Microsystems, Inc.7 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1772 1772 ComPtr <IHost> host; 1773 1773 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam())); 1774 SafeIfaceArray <IHostDVDDrive> coll;1775 CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)( ComSafeArrayAsOutParam(coll)));1774 ComPtr <IHostDVDDriveCollection> coll; 1775 CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(coll.asOutParam())); 1776 1776 ComPtr <IHostDVDDrive> hostDrive; 1777 rc = host->FindHostDVDDrive (medium, hostDrive.asOutParam());1777 rc = coll->FindByName (medium, hostDrive.asOutParam()); 1778 1778 if (SUCCEEDED (rc)) 1779 1779 { -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r17201 r17218 6 6 7 7 /* 8 * Copyright (C) 2006-200 9Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 3064 3064 3065 3065 hostDVDMap.clear(); 3066 CHostDVDDrive Vector drvvec=3067 vboxGlobal().virtualBox().GetHost().GetDVDDrives() ;3068 for (int i = 0; i < drvvec.size(); ++i)3069 { 3070 CHostDVDDrive hostDVD = drvvec[i];3066 CHostDVDDriveEnumerator en = 3067 vboxGlobal().virtualBox().GetHost().GetDVDDrives().Enumerate(); 3068 while (en.HasMore()) 3069 { 3070 CHostDVDDrive hostDVD = en.GetNext(); 3071 3071 /** @todo set icon */ 3072 3072 QString drvName = hostDVD.GetName(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp
r17200 r17218 6 6 7 7 /* 8 * Copyright (C) 2006-200 9Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 176 176 { 177 177 /* Search for the host dvd-drives */ 178 CHostDVDDrive Vectorcoll =178 CHostDVDDriveCollection coll = 179 179 vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 180 mHostDVDs.resize (coll.size()); 181 182 for (int id = 0; id < coll.size(); ++id) 183 { 184 CHostDVDDrive hostDVD = coll[id]; 180 mHostDVDs.resize (coll.GetCount()); 181 int id = 0; 182 CHostDVDDriveEnumerator en = coll.Enumerate(); 183 while (en.HasMore()) 184 { 185 CHostDVDDrive hostDVD = en.GetNext(); 185 186 QString name = hostDVD.GetName(); 186 187 QString description = hostDVD.GetDescription(); … … 189 190 mCbHost->insertItem (id, fullName); 190 191 mHostDVDs [id] = hostDVD; 192 ++ id; 191 193 } 192 194 … … 220 222 221 223 /* Repopulate the media list */ 222 mCbImage->repopulate();224 mCbImage->repopulate(); 223 225 224 226 /* Revalidate updated page */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp
r17200 r17218 6 6 7 7 /* 8 * Copyright (C) 2006-200 9Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 59 59 60 60 /* Read out the host DVD drive list and prepare the combobox */ 61 CHostDVDDrive Vectorcoll =61 CHostDVDDriveCollection coll = 62 62 vboxGlobal().virtualBox().GetHost().GetDVDDrives(); 63 mHostCDs.resize (coll. size());63 mHostCDs.resize (coll.GetCount()); 64 64 mCbHostCD->clear(); 65 66 for (int id = 0; id < coll.size(); ++id) 67 { 68 CHostDVDDrive hostDVD = coll[id]; 65 int id = 0; 66 CHostDVDDriveEnumerator en = coll.Enumerate(); 67 while (en.HasMore()) 68 { 69 CHostDVDDrive hostDVD = en.GetNext(); 69 70 /// @todo (r=dmik) set icon? 70 71 QString name = hostDVD.GetName(); … … 74 75 mCbHostCD->insertItem (id, fullName); 75 76 mHostCDs [id] = hostDVD; 77 ++ id; 76 78 } 77 79 … … 87 89 name : 88 90 QString ("%1 (%2)").arg (description, name); 89 if ( vboxGlobal().virtualBox().GetHost().FindHostDVDDrive (name).isNull())91 if (coll.FindByName (name).isNull()) 90 92 { 91 93 /* If the DVD drive is not currently available, -
trunk/src/VBox/Main/DVDDriveImpl.cpp
r17200 r17218 7 7 8 8 /* 9 * Copyright (C) 2006-200 9Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 452 452 Bstr src = typeNode.stringValue ("src"); 453 453 454 /* find the correspo nding object */454 /* find the correspoding object */ 455 455 ComObjPtr <Host> host = mParent->virtualBox()->host(); 456 456 457 com::SafeIfaceArray <IHostDVDDrive> coll;458 rc = host->COMGETTER(DVDDrives) ( ComSafeArrayAsOutParam(coll));457 ComPtr <IHostDVDDriveCollection> coll; 458 rc = host->COMGETTER(DVDDrives) (coll.asOutParam()); 459 459 AssertComRC (rc); 460 460 461 461 ComPtr <IHostDVDDrive> drive; 462 rc = host->FindHostDVDDrive (src, drive.asOutParam()); 463 462 rc = coll->FindByName (src, drive.asOutParam()); 464 463 if (SUCCEEDED (rc)) 465 464 { -
trunk/src/VBox/Main/HostImpl.cpp
r17200 r17218 5 5 6 6 /* 7 * Copyright (C) 2006-200 9Sun Microsystems, Inc.7 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 291 291 * @param drives address of result pointer 292 292 */ 293 STDMETHODIMP Host::COMGETTER(DVDDrives) ( ComSafeArrayOut (IHostDVDDrive *, aDrives))294 { 295 CheckComArgOut SafeArrayPointerValid(aDrives);293 STDMETHODIMP Host::COMGETTER(DVDDrives) (IHostDVDDriveCollection **aDrives) 294 { 295 CheckComArgOutPointerValid(aDrives); 296 296 AutoWriteLock alock (this); 297 297 CHECK_READY(); … … 399 399 #endif 400 400 401 SafeIfaceArray <IHostDVDDrive> array (list); 402 array.detachTo(ComSafeArrayOutArg(aDrives)); 401 ComObjPtr<HostDVDDriveCollection> collection; 402 collection.createObject(); 403 collection->init (list); 404 collection.queryInterfaceTo(aDrives); 403 405 return rc; 404 406 } … … 3321 3323 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 3322 3324 3323 STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IHostDVDDrive **aDrive)3324 {3325 CheckComArgNotNull(aName);3326 CheckComArgOutPointerValid(aDrive);3327 AutoReadLock alock (this);3328 3329 *aDrive = NULL;3330 3331 SafeIfaceArray <IHostDVDDrive> drivevec;3332 HRESULT rc = COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(drivevec));3333 CheckComRCReturnRC (rc);3334 3335 for (size_t i = 0; i < drivevec.size(); ++i)3336 {3337 Bstr name;3338 rc = drivevec[i]->COMGETTER(Name) (name.asOutParam());3339 CheckComRCReturnRC (rc);3340 if (name == aName)3341 {3342 ComObjPtr<HostDVDDrive> found;3343 found.createObject();3344 Bstr udi, description;3345 rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam());3346 CheckComRCReturnRC (rc);3347 rc = drivevec[i]->COMGETTER(Description) (description.asOutParam());3348 CheckComRCReturnRC (rc);3349 found->init(name, udi, description);3350 return found.queryInterfaceTo(aDrive);3351 }3352 }3353 3354 return setError (VBOX_E_OBJECT_NOT_FOUND, HostDVDDrive::tr (3355 "The host DVD drive named '%ls' could not be found"), aName);3356 }3357 3358 3325 STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface) 3359 3326 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17200 r17218 6341 6341 </interface> 6342 6342 6343 <enumerator 6344 name="IHostDVDDriveEnumerator" type="IHostDVDDrive" 6345 uuid="1ed7cfaf-c363-40df-aa4e-89c1afb7d96b" 6346 /> 6347 6348 <collection 6349 name="IHostDVDDriveCollection" type="IHostDVDDrive" 6350 enumerator="IHostDVDDriveEnumerator" 6351 uuid="1909c533-1a1e-445f-a4e1-a267cffc30ed" 6352 readonly="yes" 6353 > 6354 <method name="findByName"> 6355 <desc> 6356 Searches this collection for a host drive with the given name. 6357 <note> 6358 The method returns an error if the given name does not 6359 correspond to any host drive in the collection. 6360 </note> 6361 </desc> 6362 <param name="name" type="wstring" dir="in"> 6363 <desc>Name of the host drive to search for</desc> 6364 </param> 6365 <param name="drive" type="IHostDVDDrive" dir="return"> 6366 <desc>Found host drive object</desc> 6367 </param> 6368 </method> 6369 </collection> 6370 6343 6371 <interface 6344 6372 name="IHostFloppyDrive" extends="$unknown" … … 6515 6543 <interface 6516 6544 name="IHost" extends="$unknown" 6517 uuid=" ba0cb246-478a-4a2b-930e-51ce740ada9c"6545 uuid="7c172c42-b209-4bdc-9ddf-a84f222bd59a" 6518 6546 wsmap="managed" 6519 6547 > … … 6530 6558 6531 6559 </desc> 6532 <attribute name="DVDDrives" type="IHostDVDDrive " readonly="yes" safearray="yes">6560 <attribute name="DVDDrives" type="IHostDVDDriveCollection" readonly="yes"> 6533 6561 <desc>List of DVD drives available on the host.</desc> 6534 6562 </attribute> … … 6805 6833 </method> 6806 6834 6807 <method name="findHostDVDDrive">6808 <desc>6809 Searches for a host DVD drive with the given @c name.6810 6811 <result name="VBOX_E_OBJECT_NOT_FOUND">6812 Given @c name does not correspond to any host drive.6813 </result>6814 6815 </desc>6816 <param name="name" type="wstring" dir="in">6817 <desc>Name of the host drive to search for</desc>6818 </param>6819 <param name="drive" type="IHostDVDDrive" dir="return">6820 <desc>Found host drive object</desc>6821 </param>6822 </method>6823 6824 6835 <method name="findHostNetworkInterfaceByName"> 6825 6836 <desc> 6826 6837 Searches through all host network interfaces for an interface with 6827 the given @cname.6828 <note> 6829 The method returns an error if the given @cname does not6838 the given name. 6839 <note> 6840 The method returns an error if the given name does not 6830 6841 correspond to any host network interface. 6831 6842 </note> -
trunk/src/VBox/Main/include/HostDVDDriveImpl.h
r17200 r17218 5 5 6 6 /* 7 * Copyright (C) 2006-200 9Sun Microsystems, Inc.7 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 25 25 #include "VirtualBoxBase.h" 26 #include "Collection.h" 26 27 27 28 class ATL_NO_VTABLE HostDVDDrive : … … 82 83 }; 83 84 85 COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostDVDDrive) 86 87 STDMETHOD(FindByName) (IN_BSTR aName, IHostDVDDrive **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, HostDVDDriveCollection::tr ( 108 "The host DVD drive named '%ls' could not be found"), aName); 109 110 return found.queryInterfaceTo (aDrive); 111 } 112 113 COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostDVDDrive) 114 84 115 #endif // ____H_HOSTDVDDRIVEIMPL 85 116 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/HostImpl.h
r17200 r17218 5 5 6 6 /* 7 * Copyright (C) 2006-200 9Sun Microsystems, Inc.7 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 81 81 82 82 // IHost properties 83 STDMETHOD(COMGETTER(DVDDrives))( ComSafeArrayOut (IHostDVDDrive*, drives));83 STDMETHOD(COMGETTER(DVDDrives))(IHostDVDDriveCollection **drives); 84 84 STDMETHOD(COMGETTER(FloppyDrives))(IHostFloppyDriveCollection **drives); 85 85 STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices); … … 111 111 STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter **aFilter); 112 112 113 STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive);114 113 STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface); 115 114 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface); -
trunk/src/VBox/Main/webservice/webtest.cpp
r17200 r17218 4 4 * functionality of VBoxManage for testing purposes. 5 5 * 6 * Copyright (C) 2006-200 9Sun Microsystems, Inc.6 * Copyright (C) 2006-2007 Sun Microsystems, Inc. 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 233 233 { 234 234 unsigned int i, 235 c = resp.returnval .size();235 c = resp.returnval->array.size(); 236 236 for(i = 0; 237 237 i < c; 238 238 ++i) 239 239 { 240 std::cout << "DVD drive " << i << ": objref " << resp.returnval [i] << "\n";240 std::cout << "DVD drive " << i << ": objref " << resp.returnval->array[i] << "\n"; 241 241 } 242 242 } -
trunk/src/VBox/Main/xpcom/server.cpp
r17200 r17218 243 243 244 244 COM_IMPL_READONLY_ENUM_AND_COLLECTION(Snapshot) 245 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostDVDDrive) 245 246 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostFloppyDrive) 246 247 #ifdef VBOX_WITH_USB
Note:
See TracChangeset
for help on using the changeset viewer.