VirtualBox

Changeset 17553 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Mar 9, 2009 9:34:22 AM (16 years ago)
Author:
vboxsync
Message:

#3551: “Main: Replace remaining collections with safe arrays”
Replaced IUSBDeviceCollection. Reviewed by Christian.

Location:
trunk/src/VBox/Main/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r17275 r17553  
    115115    STDMETHOD(COMGETTER(Display)) (IDisplay **aDisplay);
    116116    STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger);
    117     STDMETHOD(COMGETTER(USBDevices)) (IUSBDeviceCollection **aUSBDevices);
     117    STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut (IUSBDevice *, aUSBDevices));
    118118    STDMETHOD(COMGETTER(RemoteUSBDevices)) (IHostUSBDeviceCollection **aRemoteUSBDevices);
    119119    STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo);
     
    139139    STDMETHOD(AttachUSBDevice) (IN_GUID aId);
    140140    STDMETHOD(DetachUSBDevice) (IN_GUID aId, IUSBDevice **aDevice);
     141    STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IUSBDevice **aDevice);
     142    STDMETHOD(FindUSBDeviceById) (IN_GUID aId, IUSBDevice **aDevice);
    141143    STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
    142144    STDMETHOD(RemoveSharedFolder) (IN_BSTR aName);
  • trunk/src/VBox/Main/include/USBDeviceImpl.h

    r15051 r17553  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2525
    2626#include "VirtualBoxBase.h"
    27 #include "Collection.h"
    2827#include "Logging.h"
    2928
     
    121120};
    122121
    123 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
    124 
    125     STDMETHOD(FindById) (IN_GUID aId, IUSBDevice **aDevice)
    126     {
    127         Guid idToFind = aId;
    128         if (idToFind.isEmpty())
    129             return E_INVALIDARG;
    130         if (!aDevice)
    131             return E_POINTER;
    132 
    133         *aDevice = NULL;
    134         Vector::value_type found;
    135         Vector::iterator it = vec.begin();
    136         while (!found && it != vec.end())
    137         {
    138             Guid id;
    139             (*it)->COMGETTER(Id) (id.asOutParam());
    140             if (id == idToFind)
    141                 found = *it;
    142             ++ it;
    143         }
    144 
    145         if (!found)
    146         {
    147             return setErrorNoLog (E_INVALIDARG, OUSBDeviceCollection::tr (
    148                 "Could not find a USB device with UUID {%s}"),
    149                 idToFind.toString().raw());
    150         }
    151 
    152         return found.queryInterfaceTo (aDevice);
    153     }
    154 
    155     STDMETHOD(FindByAddress) (IN_BSTR aAddress, IUSBDevice **aDevice)
    156     {
    157         if (!aAddress)
    158             return E_INVALIDARG;
    159         if (!aDevice)
    160             return E_POINTER;
    161 
    162         *aDevice = NULL;
    163         Vector::value_type found;
    164         Vector::iterator it = vec.begin();
    165         while (!found && it != vec.end())
    166         {
    167             Bstr address;
    168             (*it)->COMGETTER(Address) (address.asOutParam());
    169             if (address == aAddress)
    170                 found = *it;
    171             ++ it;
    172         }
    173 
    174         if (!found)
    175             return setErrorNoLog (E_INVALIDARG, OUSBDeviceCollection::tr (
    176                 "Could not find a USB device with address '%ls'"),
    177                 aAddress);
    178 
    179         return found.queryInterfaceTo (aDevice);
    180     }
    181 
    182 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
    183 
    184122#endif // ____H_USBDEVICEIMPL
    185123/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette