Index: trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 435)
+++ trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 436)
@@ -1083,5 +1083,5 @@
     AutoReaderLock alock (this);
 
-    ComObjPtr <USBDeviceCollection> collection;
+    ComObjPtr <OUSBDeviceCollection> collection;
     collection.createObject();
     collection->init (mUSBDevices);
@@ -1776,12 +1776,16 @@
 
         case DeviceType_DVDDevice:
+        {
             SumLed.u32 |= readAndClearLed(mapIDELeds[2]);
             break;
+        }
 
         case DeviceType_HardDiskDevice:
+        {
             SumLed.u32 |= readAndClearLed(mapIDELeds[0]);
             SumLed.u32 |= readAndClearLed(mapIDELeds[1]);
             SumLed.u32 |= readAndClearLed(mapIDELeds[3]);
             break;
+        }
 
         case DeviceType_NetworkDevice:
@@ -1789,4 +1793,11 @@
             for (unsigned i = 0; i < ELEMENTS(mapNetworkLeds); i++)
                 SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
+            break;
+        }
+
+        case DeviceType_USBDevice:
+        {
+            /// @todo (r=dmik)
+            //  USB_DEVICE_ACTIVITY
             break;
         }
@@ -1869,5 +1880,5 @@
 
     /* Find it. */
-    ComObjPtr <USBDevice> device;
+    ComObjPtr <OUSBDevice> device;
     USBDeviceList::iterator it = mUSBDevices.begin();
     while (it != mUSBDevices.end())
@@ -3141,5 +3152,5 @@
 
     /* Find the device. */
-    ComObjPtr <USBDevice> device;
+    ComObjPtr <OUSBDevice> device;
     USBDeviceList::iterator it = mUSBDevices.begin();
     while (it != mUSBDevices.end())
@@ -4067,6 +4078,6 @@
     if (VBOX_SUCCESS (vrc))
     {
-        /* Create a USBDevice and add it to the device list */
-        ComObjPtr <USBDevice> device;
+        /* Create a OUSBDevice and add it to the device list */
+        ComObjPtr <OUSBDevice> device;
         device.createObject();
         HRESULT hrc = device->init (aHostDevice);
Index: trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/MachineImpl.cpp	(revision 435)
+++ trunk/src/VBox/Main/MachineImpl.cpp	(revision 436)
@@ -1362,4 +1362,8 @@
             tr ("Invalid boot position: %lu (must be in range [1, %lu])"),
                 aPosition, SchemaDefs::MaxBootPosition);
+
+    if (aDevice == DeviceType_USBDevice)
+        return setError (E_FAIL,
+            tr ("Booting from USB devices is not currently supported"));
 
     AutoCaller autoCaller (this);
Index: trunk/src/VBox/Main/Makefile
===================================================================
--- trunk/src/VBox/Main/Makefile	(revision 435)
+++ trunk/src/VBox/Main/Makefile	(revision 436)
@@ -539,4 +539,5 @@
 
 testidl: $(IDLFILE) $(IDLTYPELIB)
+testidlhdr: $(IDLHEADER)
 
 else
Index: trunk/src/VBox/Main/USBDeviceImpl.cpp
===================================================================
--- trunk/src/VBox/Main/USBDeviceImpl.cpp	(revision 435)
+++ trunk/src/VBox/Main/USBDeviceImpl.cpp	(revision 436)
@@ -26,5 +26,5 @@
 /////////////////////////////////////////////////////////////////////////////
 
-USBDevice::USBDevice()
+OUSBDevice::OUSBDevice()
 {
     mVendorId = 0;
@@ -36,5 +36,5 @@
 }
 
-USBDevice::~USBDevice()
+OUSBDevice::~OUSBDevice()
 {
 }
@@ -50,5 +50,5 @@
  * @param   aUSBDevice    The USB device (interface) to clone.
  */
-HRESULT USBDevice::init(IUSBDevice *aUSBDevice)
+HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice)
 {
     AutoLock lock(this);
@@ -101,5 +101,5 @@
  * @param   aId   Address of result variable.
  */
-STDMETHODIMP USBDevice::COMGETTER(Id)(GUIDPARAMOUT aId)
+STDMETHODIMP OUSBDevice::COMGETTER(Id)(GUIDPARAMOUT aId)
 {
     if (!aId)
@@ -120,5 +120,5 @@
  * @param   aVendorId   Where to store the vendor id.
  */
-STDMETHODIMP USBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
+STDMETHODIMP OUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
 {
     if (!aVendorId)
@@ -139,5 +139,5 @@
  * @param   aProductId  Where to store the product id.
  */
-STDMETHODIMP USBDevice::COMGETTER(ProductId)(USHORT *aProductId)
+STDMETHODIMP OUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
 {
     if (!aProductId)
@@ -158,5 +158,5 @@
  * @param   aRevision  Where to store the revision BCD.
  */
-STDMETHODIMP USBDevice::COMGETTER(Revision)(USHORT *aRevision)
+STDMETHODIMP OUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
 {
     if (!aRevision)
@@ -176,5 +176,5 @@
  * @param   aManufacturer     Where to put the return string.
  */
-STDMETHODIMP USBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
+STDMETHODIMP OUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
 {
     if (!aManufacturer)
@@ -195,5 +195,5 @@
  * @param   aProduct          Where to put the return string.
  */
-STDMETHODIMP USBDevice::COMGETTER(Product)(BSTR *aProduct)
+STDMETHODIMP OUSBDevice::COMGETTER(Product)(BSTR *aProduct)
 {
     if (!aProduct)
@@ -214,5 +214,5 @@
  * @param   aSerialNumber     Where to put the return string.
  */
-STDMETHODIMP USBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
+STDMETHODIMP OUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
 {
     if (!aSerialNumber)
@@ -233,5 +233,5 @@
  * @param   aAddress          Where to put the return string.
  */
-STDMETHODIMP USBDevice::COMGETTER(Address)(BSTR *aAddress)
+STDMETHODIMP OUSBDevice::COMGETTER(Address)(BSTR *aAddress)
 {
     if (!aAddress)
@@ -245,5 +245,5 @@
 }
 
-STDMETHODIMP USBDevice::COMGETTER(Port)(USHORT *aPort)
+STDMETHODIMP OUSBDevice::COMGETTER(Port)(USHORT *aPort)
 {
     if (!aPort)
@@ -257,5 +257,5 @@
 }
 
-STDMETHODIMP USBDevice::COMGETTER(Remote)(BOOL *aRemote)
+STDMETHODIMP OUSBDevice::COMGETTER(Remote)(BOOL *aRemote)
 {
     if (!aRemote)
Index: trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 435)
+++ trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 436)
@@ -263,4 +263,7 @@
         <const name="NetworkDevice"     value="4">
             <desc>Network device.</desc>
+        </const>
+        <const name="USBDevice"         value="5">
+            <desc>USB device.</desc>
         </const>
     </enum>
@@ -5483,22 +5486,30 @@
                 buffer does not have to be aligned and lockable.
 
-                The callee is also allowed to use the memory buffer
-                pointed to by the vram parameter. For non linear
-                modes (such as text and standard VGA), the parameter
-                is NULL and must not be used. When using it, all the
-                IFramebuffer implementation has to do is return the
-                same pointer as the Address property. It is recommended
-                to use it as it will remove one copy operation.
+                The callee is also allowed to use the guest video memory
+                buffer (pointed to by the @a vram parameter) directly instead
+                of allocating its own buffer. To indicate that the framebuffer
+                wants to use the guest video memory, its <link to="#address"/>
+                implementation must return the same address as it gets in
+                the @a vram parameter of this method.
+                
+                For non linear modes (such as text and standard VGA), the
+                @vram parameter is NULL and must not be used. When it's not
+                NULL, it is recommended to use it to access the guest video
+                memory instead of creating a separate buffer as it will at
+                least remove one copy operation.
 
                 The caller checks if the call was successful
-                via IFramebuffer property 'PixelFormat'.
-
-                Note: The method is called by IDisplay under the Framebuffer lock.
+                via the <link to="#pixelFormat"/> property.
+
+                <note>
+                    This method is called by IDisplay under the IFramebuffer
+                    lock.
+                </note>
             </desc>
             <param name="pixelFormat" type="FramebufferPixelFormat" dir="in">
-                <desc>Specifies the pixel format of the surface (bpp and layout)</desc>
+                <desc>Pixel format of the surface (BPP and layout)</desc>
             </param>
             <param name="vram" type="unsigned long" dir="in">
-                <desc>Pointer to original guest VRAM (NULL for non linear modes)</desc>
+                <desc>Pointer to the guest VRAM (NULL for non linear modes)</desc>
             </param>
             <param name="lineSize" type="unsigned long" dir="in"/>
Index: trunk/src/VBox/Main/include/Collection.h
===================================================================
--- trunk/src/VBox/Main/include/Collection.h	(revision 435)
+++ trunk/src/VBox/Main/include/Collection.h	(revision 436)
@@ -257,29 +257,39 @@
 
 /**
- *  This macro declares an enumerator class and a collection class for the
- *  given item class. The namespace of the collection class remains opened after
- *  this macro is expanded (i.e. no closing brace with semicolon), thus allowing
- *  one to declare extra collection class members. This namespace
- *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro.
- *
- *  For example, given a 'SomeItem' argument, this macro will declare the
- *  following:
- *
- *  <code>
- *      class SomeItemEnumerator : public
- *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <SomeItem>,
- *              SomeItemEnumerator> {...};
+ *  This macro declares an enumerator class and a collection class that stores
+ *  elements of the given class @a itemcls that implements the given
+ *  interface @a iface
+ *
+ *  The the @a itemcls class must be either a ComObjPtr or a ComPtr template
+ *  instantiation with the argument being a class that implements the @a iface
+ *  interface.
+ *
+ *  The namespace of the collection class remains opened after
+ *  this macro is expanded (i.e. no closing brace with semicolon), which
+ *  allows to declare extra collection class members. This namespace
+ *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END macro.
+ *
+ *  For example, given |ComObjPtr <OSomeItem>|, |ISomeItem|| and |OSomeItem|
+ *  arguments, this macro will generate the following code:
+ *
+ *  <code>
+ *      class OSomeItemEnumerator : public
+ *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <OSomeItem>,
+ *                                 OSomeItemEnumerator>
+ *      {...};
  *      class SomeItemCollection : public
- *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <SomeItem>,
- *              SomeItemEnumerator, SomeItemCollection> {
+ *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <OSomeItem>,
+ *                               OSomeItemEnumerator, OSomeItemCollection>
+ *      {...};
  *  </code>
  *
  *  i.e. it assumes that ISomeItemEnumerator, ISomeItem and ISomeItemCollection
- *  are existing interfaces, and SomeItem implements the ISomeItem interface.
+ *  are existing interfaces, and OSomeItem implements the ISomeItem interface.
  *  It also assumes, that std::list passed to SomeItemCollection::init()
- *  stores objects of |ComObjPtr <SomeItem>| class, i.e. safe pointers around
- *  SomeItem instances.
- *
- *  See descriptions of the above two templates for more info.
+ *  stores objects of the @a itemcls class (|ComObjPtr <OSomeItem>| in the
+ *  example above).
+ *
+ *  See descriptions of the above IfaceVectorEnumerator and 
+ *  ReadonlyIfaceVector templates for more info.
  *
  *  The generated class also inherits the VirtualBoxSupportTranslation template,
@@ -288,101 +298,19 @@
  *
  *  The macro is best to be placed in the header after SomeItem class
- *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro must follow
- *  all extra member declarations of the collection class, or right after this
- *  macro if the collection doesn't have extra members.
- *
- *  @param c    component class implementing the interface of items to be stored
- *              in the collection
- */
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
-    class c##Enumerator \
-        : public IfaceVectorEnumerator \
-            <I##c##Enumerator, I##c, ComObjPtr <c>, c##Enumerator> \
-        , public VirtualBoxSupportTranslation <c##Enumerator> \
-    { \
-        NS_DECL_ISUPPORTS \
-        public: static const wchar_t *getComponentName() { \
-            return WSTR_LITERAL (c) L"Enumerator"; \
-        } \
-    }; \
-    class c##Collection \
-        : public ReadonlyIfaceVector \
-            <I##c##Collection, I##c, I##c##Enumerator, ComObjPtr <c>, c##Enumerator, \
-         c##Collection> \
-        , public VirtualBoxSupportTranslation <c##Collection> \
-    { \
-        NS_DECL_ISUPPORTS \
-        public: static const wchar_t *getComponentName() { \
-            return WSTR_LITERAL (c) L"Collection"; \
-        }
-
-/**
- *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN
- *  and must be always used to finalize the collection declaration started
- *  by that macro.
- *
- *  Currently the macro just expands to the closing brace with semicolon,
- *  but this might change in the future.
- */
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c) \
-    };
-
-/**
- *  This is a "shortcut" macro, for convenience. It expands exactly to:
- *  <code>
- *      COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c)
- *      COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
- *  </code>
- */
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION(c) \
-    COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
-    COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
-
-/**
- *  This macro declares an enumerator class and a collection class for the
- *  given item class and interface. The namespace of the collection class remains
- *  opened after this macro is expanded (i.e. no closing brace with semicolon),
- *  thus allowing one to declare extra collection class members. This namespace
- *  must be closed by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro.
- *
- *  For example, given a 'SomeItem' and a 'ISomeItem' arguments, this macro will
- *  declare the following:
- *
- *  <code>
- *      class SomeItemEnumerator_ComponentName {...};
- *      class SomeItemCollection_ComponentName {...};
- *
- *      class SomeItemEnumerator : public
- *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComPtr <ISomeItem>,
- *              SomeItemEnumerator_ComponentName> {...};
- *      class SomeItemCollection : public
- *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComPtr <ISomeItem>,
- *              SomeItemEnumerator, SomeItemCollection_ComponentName> {...};
- *  </code>
- *
- *  i.e. it assumes that ISomeItemEnumerator, ISomeItem and ISomeItemCollection
- *  are existing interfaces. It also assumes, that std::list passed to
- *  SomeItemCollection::init() stores objects of |ComPtr <ISomeItem>| class, i.e
- *  safe ISomeItem interface pointers.
- *
- *  See descriptions of the above two templates for more info.
- *
- *  The generated class also inherits the VirtualBoxSupportTranslation template,
- *  providing the support for translation of string constants within class
- *  members.
- *
- *  The macro is best to be placed in the header after SomeItem class
- *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro must follow
- *  all extra member declarations of the collection class, or right after this
- *  macro if the collection doesn't have extra members.
- *
- *  @param prefix   the prefix prepended to the generated collection and
- *                  enumerator classes
- *  @param iface    interface class
- */
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
+ *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END macro must
+ *  follow all extra member declarations of the collection class, or right
+ *  after this macro if the collection doesn't have extra members.
+ *
+ *  @param  itemcls     Either ComObjPtr or ComPtr for the class that implements
+ *                      the given interface of items to be stored in the
+ *                      collection
+ *  @param  iface       Interface of items implemented by the @a itemcls class 
+ *  @param  prefix      Prefix to apply to generated enumerator and collection
+ *                      names.
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN(itemcls, iface, prefix) \
     class prefix##Enumerator \
         : public IfaceVectorEnumerator \
-            <iface##Enumerator, iface, ComPtr <iface>, prefix##Enumerator> \
+            <iface##Enumerator, iface, itemcls, prefix##Enumerator> \
         , public VirtualBoxSupportTranslation <prefix##Enumerator> \
     { \
@@ -394,5 +322,5 @@
     class prefix##Collection \
         : public ReadonlyIfaceVector \
-            <iface##Collection, iface, iface##Enumerator, ComPtr <iface>, prefix##Enumerator, \
+            <iface##Collection, iface, iface##Enumerator, itemcls, prefix##Enumerator, \
              prefix##Collection> \
         , public VirtualBoxSupportTranslation <prefix##Collection> \
@@ -404,13 +332,136 @@
 
 /**
+ *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN
+ *  and must be always used to finalize the collection declaration started
+ *  by that macro.
+ *
+ *  Currently the macro just expands to the closing brace with semicolon,
+ *  but this might change in the future.
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END(itemcls, iface, prefix) \
+    };
+
+/**
+ *  This is a "shortcut" macro, for convenience. It expands exactly to:
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN(itemcls, iface, prefix)
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END(itemcls, iface, prefix)
+ *  </code>
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (itemcls, iface, prefix) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (itemcls, iface, prefix)
+
+/**
+ *  This macro declares an enumerator class and a collection class for the
+ *  given item class @a c.
+ *
+ *  It's a convenience macro that deduces all arguments to the
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN macro from a single @a c
+ *  class name argument. Given a class named |SomeItem|, this macro is
+ *  equivalent to
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <SomeItem>, ISomeItem, SomeItem)
+ *  </code>
+ *  and will generate the following code:
+ *  <code>
+ *      class OSomeItemEnumerator : public
+ *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComObjPtr <SomeItem>,
+ *                                 SomeItemEnumerator>
+ *      {...};
+ *      class SomeItemCollection : public
+ *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComObjPtr <SomeItem>,
+ *                               SomeItemEnumerator, SomeItemCollection>
+ *      {...};
+ *  </code>
+ *
+ *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
+ *  description.
+ *
+ *  The macro is best to be placed in the header after SomeItem class
+ *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_END macro must follow
+ *  all extra member declarations of the collection class, or right after this
+ *  macro if the collection doesn't have extra members.
+ *
+ *  @param c    Component class implementing the interface of items to be stored
+ *              in the collection
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <c>, I##c, c)
+
+/**
+ *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN
+ *  and must be always used to finalize the collection declaration started
+ *  by that macro.
+ *
+ *  This is a "shortcut" macro that expands exactly to:
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
+ *  </code>
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
+
+/**
+ *  This is a "shortcut" macro, for convenience. It expands exactly to:
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c)
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
+ *  </code>
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION(c) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN(c) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_END(c)
+
+/**
+ *  This macro declares an enumerator class and a collection class for the
+ *  given item interface @a iface prefixed with the given @a prefix.
+ *
+ *  It's a convenience macro that deduces all arguments to the
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN macro from the two given
+ *  @a iface and @a prefix arguments. Given an interface named |ISomeItem|,
+ *  and a prefix SomeItem this macro is equivalent to
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComPtr <ISomeItem>, ISomeItem, SomeItem)
+ *  </code>
+ *  and will generate the following code:
+ *  <code>
+ *      class OSomeItemEnumerator : public
+ *          IfaceVectorEnumerator <ISomeItemEnumerator, ISomeItem, ComPtr <ISomeItem>,
+ *                                 SomeItemEnumerator>
+ *      {...};
+ *      class SomeItemCollection : public
+ *          ReadonlyIfaceVector <ISomeItemCollection, ISomeItem, ComPtr <ISomeItem>,
+ *                               SomeItemEnumerator, SomeItemCollection>
+ *      {...};
+ *  </code>
+ *
+ *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
+ *  description.
+ *
+ *  The macro is best to be placed in the header after SomeItem class
+ *  declaration. The COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macro must follow
+ *  all extra member declarations of the collection class, or right after this
+ *  macro if the collection doesn't have extra members.
+ *
+ *  @param prefix   Prefix prepended to the generated collection and
+ *                  enumerator classes
+ *  @param iface    Interface class
+ */
+#define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComPtr <iface>, iface, prefix)
+
+/**
  *  This macro is a counterpart to COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN
  *  and must be always used to finalize the collection declaration started
  *  by that macro.
- *
- *  Currently the macro just expands to the closing brace with semicolon,
- *  but this might change in the future.
+ * 
+ *  This is a "shortcut" macro that expands exactly to:
+ *  <code>
+ *      COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <c>, I##c, c)
+ *  </code>
  */
 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END(prefix, iface) \
-    };
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComPtr <iface>, iface, prefix)
 
 /**
@@ -422,11 +473,13 @@
  */
 #define COM_DECL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
-    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN(prefix, iface) \
-    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END(prefix, iface)
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN (prefix, iface) \
+    COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END (prefix, iface)
 
 #ifdef __WIN__
 
+#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix)
 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c)
 #define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface)
+
 #else // !__WIN__
 
@@ -434,5 +487,10 @@
  *  This macro defines nsISupports implementations (i.e. QueryInterface(),
  *  AddRef() and Release()) for the enumerator and collection classes
- *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION macro.
+ *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_EX,
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN and
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_EX macros.
+ *
+ *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN for the detailed
+ *  description.
  *
  *  The macro should be placed in one of the source files.
@@ -442,28 +500,12 @@
  *      so expands to nothing on Win32.
  *
- *  @param c    component class implementing the item interface
- */
-#define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c) \
-    NS_DECL_CLASSINFO(c##Collection) \
-    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Collection, I##c##Collection) \
-    NS_DECL_CLASSINFO(c##Enumerator) \
-    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Enumerator, I##c##Enumerator)
-
-/**
- *  This macro defines nsISupports implementations (i.e. QueryInterface(),
- *  AddRef() and Release()) for the enumerator and collection classes
- *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS macro.
- *
- *  The macro should be placed in one of the source files.
- *
- *  @note
- *      this macro is XPCOM-specific and not necessary for MS COM,
- *      so expands to nothing on Win32.
- *
- *  @param prefix   the prefix prepended to the generated collection and
- *                  enumerator classes
- *  @param iface    interface class
- */
-#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
+ *  @param  itemcls     Either ComObjPtr or ComPtr for the class that implements
+ *                      the given interface of items to be stored in the
+ *                      collection
+ *  @param  iface       Interface of items implemented by the @a itemcls class 
+ *  @param  prefix      Prefix to apply to generated enumerator and collection
+ *                      names.
+ */
+#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(itemcls, iface, prefix) \
     NS_DECL_CLASSINFO(prefix##Collection) \
     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(prefix##Collection, iface##Collection) \
@@ -471,4 +513,49 @@
     NS_IMPL_THREADSAFE_ISUPPORTS1_CI(prefix##Enumerator, iface##Enumerator)
 
+/**
+ *  This macro defines nsISupports implementations (i.e. QueryInterface(),
+ *  AddRef() and Release()) for the enumerator and collection classes
+ *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION,
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN and
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_END macros.
+ *
+ *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN for the detailed
+ *  description.
+ *
+ *  The macro should be placed in one of the source files.
+ *
+ *  @note
+ *      this macro is XPCOM-specific and not necessary for MS COM,
+ *      so expands to nothing on Win32.
+ *
+ *  @param c    Component class implementing the interface of items to be stored
+ *              in the collection
+ */
+#define COM_IMPL_READONLY_ENUM_AND_COLLECTION(c) \
+    COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX (0, I##c, c) 
+
+/**
+ *  This macro defines nsISupports implementations (i.e. QueryInterface(),
+ *  AddRef() and Release()) for the enumerator and collection classes
+ *  declared by the COM_DECL_READONLY_ENUM_AND_COLLECTION_AS,
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN and
+ *  COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_END macros.
+ *
+ *  See COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN for the detailed
+ *  description.
+ *
+ *  The macro should be placed in one of the source files.
+ *
+ *  @note
+ *      this macro is XPCOM-specific and not necessary for MS COM,
+ *      so expands to nothing on Win32.
+ *
+ *  @param prefix   Prefix prepended to the generated collection and
+ *                  enumerator classes
+ *  @param iface    Interface class
+ */
+#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_AS(prefix, iface) \
+    COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX (0, iface, prefix) 
+
 #endif // !__WIN__
 
Index: trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 435)
+++ trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 436)
@@ -31,5 +31,5 @@
 class Display;
 class MachineDebugger;
-class USBDevice;
+class OUSBDevice;
 class RemoteUSBDevice;
 class SharedFolder;
@@ -323,5 +323,5 @@
 private:
 
-    typedef std::list <ComObjPtr <USBDevice> > USBDeviceList;
+    typedef std::list <ComObjPtr <OUSBDevice> > USBDeviceList;
     typedef std::list <ComObjPtr <RemoteUSBDevice> > RemoteUSBDeviceList;
     typedef std::list <ComObjPtr <SharedFolder> > SharedFolderList;
Index: trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
===================================================================
--- trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h	(revision 435)
+++ trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h	(revision 436)
@@ -128,46 +128,5 @@
 };
 
-
-/// @todo (dmik) give a less stupid name and move to Collection.h
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_BEGIN(c, iface) \
-    class c##Enumerator \
-        : public IfaceVectorEnumerator \
-            <iface##Enumerator, iface, ComObjPtr <c>, c##Enumerator> \
-        , public VirtualBoxSupportTranslation <c##Enumerator> \
-    { \
-        NS_DECL_ISUPPORTS \
-        public: static const wchar_t *getComponentName() { \
-            return WSTR_LITERAL (c) L"Enumerator"; \
-        } \
-    }; \
-    class c##Collection \
-        : public ReadonlyIfaceVector \
-            <iface##Collection, iface, iface##Enumerator, ComObjPtr <c>, c##Enumerator, \
-         c##Collection> \
-        , public VirtualBoxSupportTranslation <c##Collection> \
-    { \
-        NS_DECL_ISUPPORTS \
-        public: static const wchar_t *getComponentName() { \
-            return WSTR_LITERAL (c) L"Collection"; \
-        }
-
-#define COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_END(c, iface) \
-    };
-
-#ifdef __WIN__
-
-#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(c, iface)
-
-#else // !__WIN__
-
-#define COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(c, iface) \
-    NS_DECL_CLASSINFO(c##Collection) \
-    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Collection, iface##Collection) \
-    NS_DECL_CLASSINFO(c##Enumerator) \
-    NS_IMPL_THREADSAFE_ISUPPORTS1_CI(c##Enumerator, iface##Enumerator)
-
-#endif
-
-COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_BEGIN (RemoteUSBDevice, IHostUSBDevice)
+COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
 
     STDMETHOD(FindById) (INPTR GUIDPARAM aId, IHostUSBDevice **aDevice)
@@ -226,5 +185,5 @@
     }
 
-COM_DECL_READONLY_ENUM_AND_COLLECTION_FOR_END (RemoteUSBDevice, IHostUSBDevice)
+COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
 
 
Index: trunk/src/VBox/Main/include/USBDeviceFilterImpl.h
===================================================================
--- trunk/src/VBox/Main/include/USBDeviceFilterImpl.h	(revision 435)
+++ trunk/src/VBox/Main/include/USBDeviceFilterImpl.h	(revision 436)
@@ -279,5 +279,5 @@
  *  Separate IUSBDeviceCollection implementation that is constructed from a list of
  *  IUSBDevice instances (as opposed to a collection defined in IUSBDeviceImpl.h
- *  constructed from USBDevice lists).
+ *  constructed from OUSBDevice lists).
  */
 COM_DECL_READONLY_ENUM_AND_COLLECTION_AS_BEGIN (IfaceUSBDevice, IUSBDevice)
Index: trunk/src/VBox/Main/include/USBDeviceImpl.h
===================================================================
--- trunk/src/VBox/Main/include/USBDeviceImpl.h	(revision 435)
+++ trunk/src/VBox/Main/include/USBDeviceImpl.h	(revision 436)
@@ -31,7 +31,7 @@
  * Generally this contains much less information.
  */
-class ATL_NO_VTABLE USBDevice :
-    public VirtualBoxSupportErrorInfoImpl<USBDevice, IUSBDevice>,
-    public VirtualBoxSupportTranslation<USBDevice>,
+class ATL_NO_VTABLE OUSBDevice :
+    public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>,
+    public VirtualBoxSupportTranslation<OUSBDevice>,
     public VirtualBoxBase,
     public IUSBDevice
@@ -39,12 +39,12 @@
 public:
 
-    USBDevice();
-    virtual ~USBDevice();
+    OUSBDevice();
+    virtual ~OUSBDevice();
 
-    DECLARE_NOT_AGGREGATABLE(USBDevice)
+    DECLARE_NOT_AGGREGATABLE(OUSBDevice)
 
     DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-    BEGIN_COM_MAP(USBDevice)
+    BEGIN_COM_MAP(OUSBDevice)
         COM_INTERFACE_ENTRY(ISupportErrorInfo)
         COM_INTERFACE_ENTRY(IUSBDevice)
@@ -98,5 +98,5 @@
 };
 
-COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (USBDevice)
+COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
 
     STDMETHOD(FindById) (INPTR GUIDPARAM aId, IUSBDevice **aDevice)
@@ -121,5 +121,5 @@
 
         if (!found)
-            return setError (E_INVALIDARG, USBDeviceCollection::tr (
+            return setError (E_INVALIDARG, OUSBDeviceCollection::tr (
                 "Could not find a USB device with UUID {%s}"),
                 idToFind.toString().raw());
@@ -148,5 +148,5 @@
 
         if (!found)
-            return setError (E_INVALIDARG, USBDeviceCollection::tr (
+            return setError (E_INVALIDARG, OUSBDeviceCollection::tr (
                 "Could not find a USB device with address '%ls'"),
                 aAddress);
@@ -155,5 +155,5 @@
     }
 
-COM_DECL_READONLY_ENUM_AND_COLLECTION_END (USBDevice)
+COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
 
 #endif // ____H_USBDEVICEIMPL
Index: trunk/src/VBox/Main/linux/module.cpp
===================================================================
--- trunk/src/VBox/Main/linux/module.cpp	(revision 435)
+++ trunk/src/VBox/Main/linux/module.cpp	(revision 436)
@@ -57,6 +57,6 @@
 NS_DECL_CLASSINFO(CombinedProgress)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
-NS_DECL_CLASSINFO(USBDevice)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDevice, IUSBDevice)
+NS_DECL_CLASSINFO(OUSBDevice)
+NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
 NS_DECL_CLASSINFO(RemoteUSBDevice)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(RemoteUSBDevice, IHostUSBDevice)
@@ -71,6 +71,6 @@
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
 
-COM_IMPL_READONLY_ENUM_AND_COLLECTION(USBDevice)
-COM_IMPL_READONLY_ENUM_AND_COLLECTION_FOR(RemoteUSBDevice, IHostUSBDevice)
+COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(ComObjPtr <OUSBDevice>, IUSBDevice, OUSBDevice)
+COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)
 COM_IMPL_READONLY_ENUM_AND_COLLECTION(SharedFolder)
 
