VirtualBox

Ignore:
Timestamp:
Mar 11, 2009 12:15:33 PM (16 years ago)
Author:
vboxsync
Message:

#3551: “Main: Replace remaining collections with safe arrays”
Replaced HostUSBDeviceCollection. Reviewed/Okayed by dmik, sunlover.

File:
1 edited

Legend:

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

    r15051 r17684  
    88
    99/*
    10  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     10 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    1111 *
    1212 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727
    2828#include "VirtualBoxBase.h"
    29 #include "Collection.h"
    3029
    3130struct _VRDPUSBDEVICEDESC;
     
    138137};
    139138
    140 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
    141 
    142     STDMETHOD(FindById) (IN_GUID aId, IHostUSBDevice **aDevice)
    143     {
    144         Guid idToFind = aId;
    145         if (idToFind.isEmpty())
    146             return E_INVALIDARG;
    147         if (!aDevice)
    148             return E_POINTER;
    149 
    150         *aDevice = NULL;
    151         Vector::value_type found;
    152         Vector::iterator it = vec.begin();
    153         while (!found && it != vec.end())
    154         {
    155             Guid id;
    156             (*it)->COMGETTER(Id) (id.asOutParam());
    157             if (id == idToFind)
    158                 found = *it;
    159             ++ it;
    160         }
    161 
    162         if (!found)
    163             return setError (E_INVALIDARG, RemoteUSBDeviceCollection::tr (
    164                 "Could not find a USB device with UUID {%s}"),
    165                 idToFind.toString().raw());
    166 
    167         return found.queryInterfaceTo (aDevice);
    168     }
    169 
    170     STDMETHOD(FindByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice)
    171     {
    172         if (!aAddress)
    173             return E_INVALIDARG;
    174         if (!aDevice)
    175             return E_POINTER;
    176 
    177         *aDevice = NULL;
    178         Vector::value_type found;
    179         Vector::iterator it = vec.begin();
    180         while (!found && it != vec.end())
    181         {
    182             Bstr address;
    183             (*it)->COMGETTER(Address) (address.asOutParam());
    184             if (address == aAddress)
    185                 found = *it;
    186             ++ it;
    187         }
    188 
    189         if (!found)
    190             return setError (E_INVALIDARG, RemoteUSBDeviceCollection::tr (
    191                 "Could not find a USB device with address '%ls'"),
    192                 aAddress);
    193 
    194         return found.queryInterfaceTo (aDevice);
    195     }
    196 
    197 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
    198 
    199 
    200139#endif // ____H_REMOTEUSBDEVICEIMPL
    201140/* 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