VirtualBox

Changeset 436 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 30, 2007 3:42:55 PM (18 years ago)
Author:
vboxsync
Message:

Main: Added USBDevice to the DeviceType enum to provide USB device activity (search for USB_DEVICE_ACTIVITY in ConsoleImpl.cpp). Thanks to MS COM C++ bingings polluting the global namespace with enum values, I had to rename the USBDevice class to OUSBDevice (and to add the COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN macro for even more flexible collection declarations).

Location:
trunk/src/VBox/Main
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r358 r436  
    10831083    AutoReaderLock alock (this);
    10841084
    1085     ComObjPtr <USBDeviceCollection> collection;
     1085    ComObjPtr <OUSBDeviceCollection> collection;
    10861086    collection.createObject();
    10871087    collection->init (mUSBDevices);
     
    17761776
    17771777        case DeviceType_DVDDevice:
     1778        {
    17781779            SumLed.u32 |= readAndClearLed(mapIDELeds[2]);
    17791780            break;
     1781        }
    17801782
    17811783        case DeviceType_HardDiskDevice:
     1784        {
    17821785            SumLed.u32 |= readAndClearLed(mapIDELeds[0]);
    17831786            SumLed.u32 |= readAndClearLed(mapIDELeds[1]);
    17841787            SumLed.u32 |= readAndClearLed(mapIDELeds[3]);
    17851788            break;
     1789        }
    17861790
    17871791        case DeviceType_NetworkDevice:
     
    17891793            for (unsigned i = 0; i < ELEMENTS(mapNetworkLeds); i++)
    17901794                SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
     1795            break;
     1796        }
     1797
     1798        case DeviceType_USBDevice:
     1799        {
     1800            /// @todo (r=dmik)
     1801            //  USB_DEVICE_ACTIVITY
    17911802            break;
    17921803        }
     
    18691880
    18701881    /* Find it. */
    1871     ComObjPtr <USBDevice> device;
     1882    ComObjPtr <OUSBDevice> device;
    18721883    USBDeviceList::iterator it = mUSBDevices.begin();
    18731884    while (it != mUSBDevices.end())
     
    31413152
    31423153    /* Find the device. */
    3143     ComObjPtr <USBDevice> device;
     3154    ComObjPtr <OUSBDevice> device;
    31443155    USBDeviceList::iterator it = mUSBDevices.begin();
    31453156    while (it != mUSBDevices.end())
     
    40674078    if (VBOX_SUCCESS (vrc))
    40684079    {
    4069         /* Create a USBDevice and add it to the device list */
    4070         ComObjPtr <USBDevice> device;
     4080        /* Create a OUSBDevice and add it to the device list */
     4081        ComObjPtr <OUSBDevice> device;
    40714082        device.createObject();
    40724083        HRESULT hrc = device->init (aHostDevice);
  • trunk/src/VBox/Main/MachineImpl.cpp

    r202 r436  
    13621362            tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
    13631363                aPosition, SchemaDefs::MaxBootPosition);
     1364
     1365    if (aDevice == DeviceType_USBDevice)
     1366        return setError (E_FAIL,
     1367            tr ("Booting from USB devices is not currently supported"));
    13641368
    13651369    AutoCaller autoCaller (this);
  • trunk/src/VBox/Main/Makefile

    r1 r436  
    539539
    540540testidl: $(IDLFILE) $(IDLTYPELIB)
     541testidlhdr: $(IDLHEADER)
    541542
    542543else
  • trunk/src/VBox/Main/USBDeviceImpl.cpp

    r1 r436  
    2626/////////////////////////////////////////////////////////////////////////////
    2727
    28 USBDevice::USBDevice()
     28OUSBDevice::OUSBDevice()
    2929{
    3030    mVendorId = 0;
     
    3636}
    3737
    38 USBDevice::~USBDevice()
     38OUSBDevice::~OUSBDevice()
    3939{
    4040}
     
    5050 * @param   aUSBDevice    The USB device (interface) to clone.
    5151 */
    52 HRESULT USBDevice::init(IUSBDevice *aUSBDevice)
     52HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice)
    5353{
    5454    AutoLock lock(this);
     
    101101 * @param   aId   Address of result variable.
    102102 */
    103 STDMETHODIMP USBDevice::COMGETTER(Id)(GUIDPARAMOUT aId)
     103STDMETHODIMP OUSBDevice::COMGETTER(Id)(GUIDPARAMOUT aId)
    104104{
    105105    if (!aId)
     
    120120 * @param   aVendorId   Where to store the vendor id.
    121121 */
    122 STDMETHODIMP USBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
     122STDMETHODIMP OUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
    123123{
    124124    if (!aVendorId)
     
    139139 * @param   aProductId  Where to store the product id.
    140140 */
    141 STDMETHODIMP USBDevice::COMGETTER(ProductId)(USHORT *aProductId)
     141STDMETHODIMP OUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
    142142{
    143143    if (!aProductId)
     
    158158 * @param   aRevision  Where to store the revision BCD.
    159159 */
    160 STDMETHODIMP USBDevice::COMGETTER(Revision)(USHORT *aRevision)
     160STDMETHODIMP OUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
    161161{
    162162    if (!aRevision)
     
    176176 * @param   aManufacturer     Where to put the return string.
    177177 */
    178 STDMETHODIMP USBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
     178STDMETHODIMP OUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
    179179{
    180180    if (!aManufacturer)
     
    195195 * @param   aProduct          Where to put the return string.
    196196 */
    197 STDMETHODIMP USBDevice::COMGETTER(Product)(BSTR *aProduct)
     197STDMETHODIMP OUSBDevice::COMGETTER(Product)(BSTR *aProduct)
    198198{
    199199    if (!aProduct)
     
    214214 * @param   aSerialNumber     Where to put the return string.
    215215 */
    216 STDMETHODIMP USBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
     216STDMETHODIMP OUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
    217217{
    218218    if (!aSerialNumber)
     
    233233 * @param   aAddress          Where to put the return string.
    234234 */
    235 STDMETHODIMP USBDevice::COMGETTER(Address)(BSTR *aAddress)
     235STDMETHODIMP OUSBDevice::COMGETTER(Address)(BSTR *aAddress)
    236236{
    237237    if (!aAddress)
     
    245245}
    246246
    247 STDMETHODIMP USBDevice::COMGETTER(Port)(USHORT *aPort)
     247STDMETHODIMP OUSBDevice::COMGETTER(Port)(USHORT *aPort)
    248248{
    249249    if (!aPort)
     
    257257}
    258258
    259 STDMETHODIMP USBDevice::COMGETTER(Remote)(BOOL *aRemote)
     259STDMETHODIMP OUSBDevice::COMGETTER(Remote)(BOOL *aRemote)
    260260{
    261261    if (!aRemote)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r359 r436  
    263263        <const name="NetworkDevice"     value="4">
    264264            <desc>Network device.</desc>
     265        </const>
     266        <const name="USBDevice"         value="5">
     267            <desc>USB device.</desc>
    265268        </const>
    266269    </enum>
     
    54835486                buffer does not have to be aligned and lockable.
    54845487
    5485                 The callee is also allowed to use the memory buffer
    5486                 pointed to by the vram parameter. For non linear
    5487                 modes (such as text and standard VGA), the parameter
    5488                 is NULL and must not be used. When using it, all the
    5489                 IFramebuffer implementation has to do is return the
    5490                 same pointer as the Address property. It is recommended
    5491                 to use it as it will remove one copy operation.
     5488                The callee is also allowed to use the guest video memory
     5489                buffer (pointed to by the @a vram parameter) directly instead
     5490                of allocating its own buffer. To indicate that the framebuffer
     5491                wants to use the guest video memory, its <link to="#address"/>
     5492                implementation must return the same address as it gets in
     5493                the @a vram parameter of this method.
     5494               
     5495                For non linear modes (such as text and standard VGA), the
     5496                @vram parameter is NULL and must not be used. When it's not
     5497                NULL, it is recommended to use it to access the guest video
     5498                memory instead of creating a separate buffer as it will at
     5499                least remove one copy operation.
    54925500
    54935501                The caller checks if the call was successful
    5494                 via IFramebuffer property 'PixelFormat'.
    5495 
    5496                 Note: The method is called by IDisplay under the Framebuffer lock.
     5502                via the <link to="#pixelFormat"/> property.
     5503
     5504                <note>
     5505                    This method is called by IDisplay under the IFramebuffer
     5506                    lock.
     5507                </note>
    54975508            </desc>
    54985509            <param name="pixelFormat" type="FramebufferPixelFormat" dir="in">
    5499                 <desc>Specifies the pixel format of the surface (bpp and layout)</desc>
     5510                <desc>Pixel format of the surface (BPP and layout)</desc>
    55005511            </param>
    55015512            <param name="vram" type="unsigned long" dir="in">
    5502                 <desc>Pointer to original guest VRAM (NULL for non linear modes)</desc>
     5513                <desc>Pointer to the guest VRAM (NULL for non linear modes)</desc>
    55035514            </param>
    55045515            <param name="lineSize" type="unsigned long" dir="in"/>
  • trunk/src/VBox/Main/include/Collection.h

    r1 r436  
    257257
    258258/**
    259  *  This macro declares an enumerator class and a collection class for the
    260  *  given item class. The namespace of the collection class remains opened after
    261  *  this macro is expanded (i.e. no closing brace with semicolon), thus allowing
    262  *  one to declare extra collection class members. This namespace
    263  *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro.
    264  *
    265  *  For example, given a 'SomeItem' argument, this macro will declare the
    266  *  following:
    267  *
    268  *  <code>
    269  *      class SomeItemEnumerator : public
    270  *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <SomeItem>,
    271  *              SomeItemEnumerator> {...};
     259 *  This macro declares an enumerator class and a collection class that stores
     260 *  elements of the given class @a itemcls that implements the given
     261 *  interface @a iface
     262 *
     263 *  The the @a itemcls class must be either a ComObjPtr or a ComPtr template
     264 *  instantiation with the argument being a class that implements the @a iface
     265 *  interface.
     266 *
     267 *  The namespace of the collection class remains opened after
     268 *  this macro is expanded (i.e. no closing brace with semicolon), which
     269 *  allows to declare extra collection class members. This namespace
     270 *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END macro.
     271 *
     272 *  For example, given |ComObjPtr <OSomeItem>|, |ISomeItem|| and |OSomeItem|
     273 *  arguments, this macro will generate the following code:
     274 *
     275 *  <code>
     276 *      class OSomeItemEnumerator : public
     277 *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <OSomeItem>,
     278 *                                 OSomeItemEnumerator>
     279 *      {...};
    272280 *      class SomeItemCollection : public
    273  *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <SomeItem>,
    274  *              SomeItemEnumerator, SomeItemCollection> {
     281 *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <OSomeItem>,
     282 *                               OSomeItemEnumerator, OSomeItemCollection>
     283 *      {...};
    275284 *  </code>
    276285 *
    277286 *  i.e. it assumes that ISomeItemEnumerator, ISomeItem and ISomeItemCollection
    278  *  are existing interfaces, and SomeItem implements the ISomeItem interface.
     287 *  are existing interfaces, and OSomeItem implements the ISomeItem interface.
    279288 *  It also assumes, that std::list passed to SomeItemCollection::init()
    280  *  stores objects of |ComObjPtr <SomeItem>| class, i.e. safe pointers around
    281  *  SomeItem instances.
    282  *
    283  *  See descriptions of the above two templates for more info.
     289 *  stores objects of the @a itemcls class (|ComObjPtr <OSomeItem>| in the
     290 *  example above).
     291 *
     292 *  See descriptions of the above IfaceVectorEnumerator and
     293 *  ReadonlyIfaceVector templates for more info.
    284294 *
    285295 *  The generated class also inherits the VirtualBoxSupportTranslation template,
     
    288298 *
    289299 *  The macro is best to be placed in the header after SomeItem class
    290  *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro must follow
    291  *  all extra member declarations of the collection class, or right after this
    292  *  macro if the collection doesn't have extra members.
    293  *
    294  *  @param c    component class implementing the interface of items to be stored
    295  *              in the collection
    296  */
    297 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
    298     class c##Enumerator \
    299         : public IfaceVectorEnumerator \
    300             <I##c##Enumerator, I##c, ComObjPtr <c>, c##Enumerator> \
    301         , public VirtualBoxSupportTranslation <c##Enumerator> \
    302     { \
    303         NS_DECL_ISUPPORTS \
    304         public: static const wchar_t *getComponentName() { \
    305             return WSTR_LITERAL (c) L"Enumerator"; \
    306         } \
    307     }; \
    308     class c##Collection \
    309         : public ReadonlyIfaceVector \
    310             <I##c##Collection, I##c, I##c##Enumerator, ComObjPtr <c>, c##Enumerator, \
    311          c##Collection> \
    312         , public VirtualBoxSupportTranslation <c##Collection> \
    313     { \
    314         NS_DECL_ISUPPORTS \
    315         public: static const wchar_t *getComponentName() { \
    316             return WSTR_LITERAL (c) L"Collection"; \
    317         }
    318 
    319 /**
    320  *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN
    321  *  and must be always used to finalize the collection declaration started
    322  *  by that macro.
    323  *
    324  *  Currently the macro just expands to the closing brace with semicolon,
    325  *  but this might change in the future.
    326  */
    327 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c) \
    328     };
    329 
    330 /**
    331  *  This is a "shortcut" macro, for convenience. It expands exactly to:
    332  *  <code>
    333  *      COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c)
    334  *      COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
    335  *  </code>
    336  */
    337 #define COM_DECL_READONLY_ENUM_AND_COLLECTION(c) \
    338     COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
    339     COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
    340 
    341 /**
    342  *  This macro declares an enumerator class and a collection class for the
    343  *  given item class and interface. The namespace of the collection class remains
    344  *  opened after this macro is expanded (i.e. no closing brace with semicolon),
    345  *  thus allowing one to declare extra collection class members. This namespace
    346  *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro.
    347  *
    348  *  For example, given a 'SomeItem' and a 'ISomeItem' arguments, this macro will
    349  *  declare the following:
    350  *
    351  *  <code>
    352  *      class SomeItemEnumerator_ComponentName {...};
    353  *      class SomeItemCollection_ComponentName {...};
    354  *
    355  *      class SomeItemEnumerator : public
    356  *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComPtr <ISomeItem>,
    357  *              SomeItemEnumerator_ComponentName> {...};
    358  *      class SomeItemCollection : public
    359  *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComPtr <ISomeItem>,
    360  *              SomeItemEnumerator, SomeItemCollection_ComponentName> {...};
    361  *  </code>
    362  *
    363  *  i.e. it assumes that ISomeItemEnumerator, ISomeItem and ISomeItemCollection
    364  *  are existing interfaces. It also assumes, that std::list passed to
    365  *  SomeItemCollection::init() stores objects of |ComPtr <ISomeItem>| class, i.e
    366  *  safe ISomeItem interface pointers.
    367  *
    368  *  See descriptions of the above two templates for more info.
    369  *
    370  *  The generated class also inherits the VirtualBoxSupportTranslation template,
    371  *  providing the support for translation of string constants within class
    372  *  members.
    373  *
    374  *  The macro is best to be placed in the header after SomeItem class
    375  *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro must follow
    376  *  all extra member declarations of the collection class, or right after this
    377  *  macro if the collection doesn't have extra members.
    378  *
    379  *  @param prefix   the prefix prepended to the generated collection and
    380  *                  enumerator classes
    381  *  @param iface    interface class
    382  */
    383 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
     300 *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END macro must
     301 *  follow all extra member declarations of the collection class, or right
     302 *  after this macro if the collection doesn't have extra members.
     303 *
     304 *  @param  itemcls     Either ComObjPtr or ComPtr for the class that implements
     305 *                      the given interface of items to be stored in the
     306 *                      collection
     307 *  @param  iface       Interface of items implemented by the @a itemcls class
     308 *  @param  prefix      Prefix to apply to generated enumerator and collection
     309 *                      names.
     310 */
     311#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN(itemcls, iface, prefix) \
    384312    class prefix##Enumerator \
    385313        : public IfaceVectorEnumerator \
    386             <iface##Enumerator, iface, ComPtr <iface>, prefix##Enumerator> \
     314            <iface##Enumerator, iface, itemcls, prefix##Enumerator> \
    387315        , public VirtualBoxSupportTranslation <prefix##Enumerator> \
    388316    { \
     
    394322    class prefix##Collection \
    395323        : public ReadonlyIfaceVector \
    396             <iface##Collection, iface, iface##Enumerator, ComPtr <iface>, prefix##Enumerator, \
     324            <iface##Collection, iface, iface##Enumerator, itemcls, prefix##Enumerator, \
    397325             prefix##Collection> \
    398326        , public VirtualBoxSupportTranslation <prefix##Collection> \
     
    404332
    405333/**
     334 *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN
     335 *  and must be always used to finalize the collection declaration started
     336 *  by that macro.
     337 *
     338 *  Currently the macro just expands to the closing brace with semicolon,
     339 *  but this might change in the future.
     340 */
     341#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END(itemcls, iface, prefix) \
     342    };
     343
     344/**
     345 *  This is a "shortcut" macro, for convenience. It expands exactly to:
     346 *  <code>
     347 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN(itemcls, iface, prefix)
     348 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END(itemcls, iface, prefix)
     349 *  </code>
     350 */
     351#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix) \
     352    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (itemcls, iface, prefix) \
     353    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (itemcls, iface, prefix)
     354
     355/**
     356 *  This macro declares an enumerator class and a collection class for the
     357 *  given item class @a c.
     358 *
     359 *  It's a convenience macro that deduces all arguments to the
     360 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN macro from a single @a c
     361 *  class name argument. Given a class named |SomeItem|, this macro is
     362 *  equivalent to
     363 *  <code>
     364 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <SomeItem>, ISomeItem, SomeItem)
     365 *  </code>
     366 *  and will generate the following code:
     367 *  <code>
     368 *      class OSomeItemEnumerator : public
     369 *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <SomeItem>,
     370 *                                 SomeItemEnumerator>
     371 *      {...};
     372 *      class SomeItemCollection : public
     373 *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <SomeItem>,
     374 *                               SomeItemEnumerator, SomeItemCollection>
     375 *      {...};
     376 *  </code>
     377 *
     378 *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
     379 *  description.
     380 *
     381 *  The macro is best to be placed in the header after SomeItem class
     382 *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro must follow
     383 *  all extra member declarations of the collection class, or right after this
     384 *  macro if the collection doesn't have extra members.
     385 *
     386 *  @param c    Component class implementing the interface of items to be stored
     387 *              in the collection
     388 */
     389#define COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
     390    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <c>, I##c, c)
     391
     392/**
     393 *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN
     394 *  and must be always used to finalize the collection declaration started
     395 *  by that macro.
     396 *
     397 *  This is a "shortcut" macro that expands exactly to:
     398 *  <code>
     399 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
     400 *  </code>
     401 */
     402#define COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c) \
     403    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
     404
     405/**
     406 *  This is a "shortcut" macro, for convenience. It expands exactly to:
     407 *  <code>
     408 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c)
     409 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
     410 *  </code>
     411 */
     412#define COM_DECL_READONLY_ENUM_AND_COLLECTION(c) \
     413    COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
     414    COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
     415
     416/**
     417 *  This macro declares an enumerator class and a collection class for the
     418 *  given item interface @a iface prefixed with the given @a prefix.
     419 *
     420 *  It's a convenience macro that deduces all arguments to the
     421 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN macro from the two given
     422 *  @a iface and @a prefix arguments. Given an interface named |ISomeItem|,
     423 *  and a prefix SomeItem this macro is equivalent to
     424 *  <code>
     425 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComPtr <ISomeItem>, ISomeItem, SomeItem)
     426 *  </code>
     427 *  and will generate the following code:
     428 *  <code>
     429 *      class OSomeItemEnumerator : public
     430 *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComPtr <ISomeItem>,
     431 *                                 SomeItemEnumerator>
     432 *      {...};
     433 *      class SomeItemCollection : public
     434 *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComPtr <ISomeItem>,
     435 *                               SomeItemEnumerator, SomeItemCollection>
     436 *      {...};
     437 *  </code>
     438 *
     439 *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
     440 *  description.
     441 *
     442 *  The macro is best to be placed in the header after SomeItem class
     443 *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro must follow
     444 *  all extra member declarations of the collection class, or right after this
     445 *  macro if the collection doesn't have extra members.
     446 *
     447 *  @param prefix   Prefix prepended to the generated collection and
     448 *                  enumerator classes
     449 *  @param iface    Interface class
     450 */
     451#define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
     452    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComPtr <iface>, iface, prefix)
     453
     454/**
    406455 *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN
    407456 *  and must be always used to finalize the collection declaration started
    408457 *  by that macro.
    409  *
    410  *  Currently the macro just expands to the closing brace with semicolon,
    411  *  but this might change in the future.
     458 *
     459 *  This is a "shortcut" macro that expands exactly to:
     460 *  <code>
     461 *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
     462 *  </code>
    412463 */
    413464#define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END(prefix, iface) \
    414     };
     465    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComPtr <iface>, iface, prefix)
    415466
    416467/**
     
    422473 */
    423474#define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
    424     COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
    425     COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END(prefix, iface)
     475    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN (prefix, iface) \
     476    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END (prefix, iface)
    426477
    427478#ifdef __WIN__
    428479
     480#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix)
    429481#define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c)
    430482#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface)
     483
    431484#else // !__WIN__
    432485
     
    434487 *  This macro defines nsISupports implementations (i.e. QueryInterface(),
    435488 *  AddRef() and Release()) for the enumerator and collection classes
    436  *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION macro.
     489 *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_EX,
     490 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN and
     491 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX macros.
     492 *
     493 *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
     494 *  description.
    437495 *
    438496 *  The macro should be placed in one of the source files.
     
    442500 *      so expands to nothing on Win32.
    443501 *
    444  *  @param c    component class implementing the item interface
    445  */
    446 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c) \
    447     NS_DECL_CLASSINFO(c##Collection) \
    448     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Collection, I##c##Collection) \
    449     NS_DECL_CLASSINFO(c##Enumerator) \
    450     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Enumerator, I##c##Enumerator)
    451 
    452 /**
    453  *  This macro defines nsISupports implementations (i.e. QueryInterface(),
    454  *  AddRef() and Release()) for the enumerator and collection classes
    455  *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS macro.
    456  *
    457  *  The macro should be placed in one of the source files.
    458  *
    459  *  @note
    460  *      this macro is XPCOM-specific and not necessary for MS COM,
    461  *      so expands to nothing on Win32.
    462  *
    463  *  @param prefix   the prefix prepended to the generated collection and
    464  *                  enumerator classes
    465  *  @param iface    interface class
    466  */
    467 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
     502 *  @param  itemcls     Either ComObjPtr or ComPtr for the class that implements
     503 *                      the given interface of items to be stored in the
     504 *                      collection
     505 *  @param  iface       Interface of items implemented by the @a itemcls class
     506 *  @param  prefix      Prefix to apply to generated enumerator and collection
     507 *                      names.
     508 */
     509#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix) \
    468510    NS_DECL_CLASSINFO(prefix##Collection) \
    469511    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(prefix##Collection, iface##Collection) \
     
    471513    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(prefix##Enumerator, iface##Enumerator)
    472514
     515/**
     516 *  This macro defines nsISupports implementations (i.e. QueryInterface(),
     517 *  AddRef() and Release()) for the enumerator and collection classes
     518 *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION,
     519 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN and
     520 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_END macros.
     521 *
     522 *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN for the detailed
     523 *  description.
     524 *
     525 *  The macro should be placed in one of the source files.
     526 *
     527 *  @note
     528 *      this macro is XPCOM-specific and not necessary for MS COM,
     529 *      so expands to nothing on Win32.
     530 *
     531 *  @param c    Component class implementing the interface of items to be stored
     532 *              in the collection
     533 */
     534#define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c) \
     535    COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX (0, I##c, c)
     536
     537/**
     538 *  This macro defines nsISupports implementations (i.e. QueryInterface(),
     539 *  AddRef() and Release()) for the enumerator and collection classes
     540 *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS,
     541 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN and
     542 *  COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macros.
     543 *
     544 *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN for the detailed
     545 *  description.
     546 *
     547 *  The macro should be placed in one of the source files.
     548 *
     549 *  @note
     550 *      this macro is XPCOM-specific and not necessary for MS COM,
     551 *      so expands to nothing on Win32.
     552 *
     553 *  @param prefix   Prefix prepended to the generated collection and
     554 *                  enumerator classes
     555 *  @param iface    Interface class
     556 */
     557#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
     558    COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX (0, iface, prefix)
     559
    473560#endif // !__WIN__
    474561
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r235 r436  
    3131class Display;
    3232class MachineDebugger;
    33 class USBDevice;
     33class OUSBDevice;
    3434class RemoteUSBDevice;
    3535class SharedFolder;
     
    323323private:
    324324
    325     typedef std::list <ComObjPtr <USBDevice> > USBDeviceList;
     325    typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
    326326    typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
    327327    typedef std::list <ComObjPtr <SharedFolder> > SharedFolderList;
  • trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h

    r1 r436  
    128128};
    129129
    130 
    131 /// @todo (dmik) give a less stupid name and move to Collection.h
    132 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_BEGIN(c, iface) \
    133     class c##Enumerator \
    134         : public IfaceVectorEnumerator \
    135             <iface##Enumerator, iface, ComObjPtr <c>, c##Enumerator> \
    136         , public VirtualBoxSupportTranslation <c##Enumerator> \
    137     { \
    138         NS_DECL_ISUPPORTS \
    139         public: static const wchar_t *getComponentName() { \
    140             return WSTR_LITERAL (c) L"Enumerator"; \
    141         } \
    142     }; \
    143     class c##Collection \
    144         : public ReadonlyIfaceVector \
    145             <iface##Collection, iface, iface##Enumerator, ComObjPtr <c>, c##Enumerator, \
    146          c##Collection> \
    147         , public VirtualBoxSupportTranslation <c##Collection> \
    148     { \
    149         NS_DECL_ISUPPORTS \
    150         public: static const wchar_t *getComponentName() { \
    151             return WSTR_LITERAL (c) L"Collection"; \
    152         }
    153 
    154 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_END(c, iface) \
    155     };
    156 
    157 #ifdef __WIN__
    158 
    159 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(c, iface)
    160 
    161 #else // !__WIN__
    162 
    163 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(c, iface) \
    164     NS_DECL_CLASSINFO(c##Collection) \
    165     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Collection, iface##Collection) \
    166     NS_DECL_CLASSINFO(c##Enumerator) \
    167     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Enumerator, iface##Enumerator)
    168 
    169 #endif
    170 
    171 COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_BEGIN (RemoteUSBDevice, IHostUSBDevice)
     130COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
    172131
    173132    STDMETHOD(FindById) (INPTR GUIDPARAM aId, IHostUSBDevice **aDevice)
     
    226185    }
    227186
    228 COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_END (RemoteUSBDevice, IHostUSBDevice)
     187COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
    229188
    230189
  • trunk/src/VBox/Main/include/USBDeviceFilterImpl.h

    r1 r436  
    279279 *  Separate IUSBDeviceCollection implementation that is constructed from a list of
    280280 *  IUSBDevice instances (as opposed to a collection defined in IUSBDeviceImpl.h
    281  *  constructed from USBDevice lists).
     281 *  constructed from OUSBDevice lists).
    282282 */
    283283COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN (IfaceUSBDevice, IUSBDevice)
  • trunk/src/VBox/Main/include/USBDeviceImpl.h

    r1 r436  
    3131 * Generally this contains much less information.
    3232 */
    33 class ATL_NO_VTABLE USBDevice :
    34     public VirtualBoxSupportErrorInfoImpl<USBDevice, IUSBDevice>,
    35     public VirtualBoxSupportTranslation<USBDevice>,
     33class ATL_NO_VTABLE OUSBDevice :
     34    public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>,
     35    public VirtualBoxSupportTranslation<OUSBDevice>,
    3636    public VirtualBoxBase,
    3737    public IUSBDevice
     
    3939public:
    4040
    41     USBDevice();
    42     virtual ~USBDevice();
     41    OUSBDevice();
     42    virtual ~OUSBDevice();
    4343
    44     DECLARE_NOT_AGGREGATABLE(USBDevice)
     44    DECLARE_NOT_AGGREGATABLE(OUSBDevice)
    4545
    4646    DECLARE_PROTECT_FINAL_CONSTRUCT()
    4747
    48     BEGIN_COM_MAP(USBDevice)
     48    BEGIN_COM_MAP(OUSBDevice)
    4949        COM_INTERFACE_ENTRY(ISupportErrorInfo)
    5050        COM_INTERFACE_ENTRY(IUSBDevice)
     
    9898};
    9999
    100 COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (USBDevice)
     100COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
    101101
    102102    STDMETHOD(FindById) (INPTR GUIDPARAM aId, IUSBDevice **aDevice)
     
    121121
    122122        if (!found)
    123             return setError (E_INVALIDARG, USBDeviceCollection::tr (
     123            return setError (E_INVALIDARG, OUSBDeviceCollection::tr (
    124124                "Could not find a USB device with UUID {%s}"),
    125125                idToFind.toString().raw());
     
    148148
    149149        if (!found)
    150             return setError (E_INVALIDARG, USBDeviceCollection::tr (
     150            return setError (E_INVALIDARG, OUSBDeviceCollection::tr (
    151151                "Could not find a USB device with address '%ls'"),
    152152                aAddress);
     
    155155    }
    156156
    157 COM_DECL_READONLY_ENUM_AND_COLLECTION_END (USBDevice)
     157COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
    158158
    159159#endif // ____H_USBDEVICEIMPL
  • trunk/src/VBox/Main/linux/module.cpp

    r1 r436  
    5757NS_DECL_CLASSINFO(CombinedProgress)
    5858NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
    59 NS_DECL_CLASSINFO(USBDevice)
    60 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDevice, IUSBDevice)
     59NS_DECL_CLASSINFO(OUSBDevice)
     60NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
    6161NS_DECL_CLASSINFO(RemoteUSBDevice)
    6262NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteUSBDevice, IHostUSBDevice)
     
    7171NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
    7272
    73 COM_IMPL_READONLY_ENUM_AND_COLLECTION(USBDevice)
    74 COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(RemoteUSBDevice, IHostUSBDevice)
     73COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
     74COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
    7575COM_IMPL_READONLY_ENUM_AND_COLLECTION(SharedFolder)
    7676
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