VirtualBox

Changeset 76012 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Dec 6, 2018 12:08:52 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: Tweaked the COM wrapper headers to optionally not require VirtualBox.h. Feature acessible by putting VBOX_WITH_LESS_VIRTUALBOX_INCLUDING=1 in LocalConfig.kmk (maybe default later).

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r75763 r76012  
    197197if  "$(KBUILD_TYPE)" != "release" || defined(VBOX_GUI_WITH_EXTRADATA_MANAGER_UI)
    198198 VirtualBox_DEFS          += VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
     199endif
     200ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     201 VirtualBox_DEFS          += VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
    199202endif
    200203
     
    267270  VirtualBoxVM_DEFS          += VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
    268271 endif
     272 ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     273  VirtualBoxVM_DEFS          += VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     274 endif
    269275
    270276
     
    275281 VBoxGlobal_NAME = VBoxGlobal
    276282 VBoxGlobal_DEFS         =
    277  VBoxGlobal_DEFS         += VBOX_GUI_LIBRARY
     283 VBoxGlobal_DEFS        += VBOX_GUI_LIBRARY
    278284 VBoxGlobal_DEFS.darwin  = VBOX_WS_MAC
    279285 VBoxGlobal_DEFS.freebsd = VBOX_WS_X11
     
    322328 if  "$(KBUILD_TYPE)" != "release" || defined(VBOX_GUI_WITH_GUEST_CONTROL_UI)
    323329  VBoxGlobal_DEFS        += VBOX_GUI_WITH_GUEST_CONTROL_UI
     330 endif
     331 ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     332  VBoxGlobal_DEFS        += VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
    324333 endif
    325334
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h

    r74878 r76012  
    701701    }
    702702
     703#ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     704    virtual IID const &getIID() const = 0;
     705#else
     706    IID const &getIID() const { return COM_IIDOF(I); }
     707#endif
     708
    703709    // utility methods
    704710    void createInstance(const CLSID &aClsId)
     
    709715            I* pObj = NULL;
    710716#if !defined(VBOX_WITH_XPCOM)
    711             B::mRC = CoCreateInstance(aClsId, NULL, CLSCTX_ALL,
    712                                       COM_IIDOF(I), (void **)&pObj);
     717            B::mRC = CoCreateInstance(aClsId, NULL, CLSCTX_ALL, getIID(), (void **)&pObj);
    713718#else
    714719            nsCOMPtr<nsIComponentManager> manager;
    715720            B::mRC = NS_GetComponentManager(getter_AddRefs(manager));
    716721            if (SUCCEEDED(B::mRC))
    717                 B::mRC = manager->CreateInstance(aClsId, nsnull, NS_GET_IID(I),
    718                                                  (void **)&pObj);
     722                B::mRC = manager->CreateInstance(aClsId, nsnull, getIID(), (void **)&pObj);
    719723#endif
    720724
     
    746750        {
    747751            amIface = NULL;
    748             B::mRC = aIface->QueryInterface(COM_IIDOF(I), (void **)&amIface);
     752            B::mRC = aIface->QueryInterface(getIID(), (void **)&amIface);
    749753            this->release((IUnknown*)aIface);
    750754            setPtr(amIface);
     
    907911    }
    908912
     913#ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     914    virtual IID const &getIID() const = 0;
     915#else
     916    IID const &getIID() const { return COM_IIDOF(I); }
     917#endif
     918
    909919    // utility methods
    910920
     
    916926            I* pObj = NULL;
    917927#if !defined(VBOX_WITH_XPCOM)
    918             COMBase::mRC = CoCreateInstance(clsId, NULL, CLSCTX_ALL,
    919                                             COM_IIDOF(I), (void **)&pObj);
     928            COMBase::mRC = CoCreateInstance(clsId, NULL, CLSCTX_ALL, getIID(), (void **)&pObj);
    920929#else
    921930            nsCOMPtr<nsIComponentManager> manager;
    922931            COMBase::mRC = NS_GetComponentManager(getter_AddRefs(manager));
    923932            if (SUCCEEDED(COMBase::mRC))
    924                 COMBase::mRC = manager->CreateInstance(clsId, nsnull, NS_GET_IID(I),
    925                                                        (void **)&pObj);
     933                COMBase::mRC = manager->CreateInstance(clsId, nsnull, getIID(), (void **)&pObj);
    926934#endif
    927935
     
    948956        {
    949957            pmIface = NULL;
    950             COMBase::mRC = pIface->QueryInterface(COM_IIDOF(I), (void **)&pmIface);
     958            COMBase::mRC = pIface->QueryInterface(getIID(), (void **)&pmIface);
    951959            this->release((IUnknown*)pIface);
    952960            setPtr(pmIface);
     
    11271135        return *this;
    11281136    }
     1137
     1138#ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING
     1139    IID const &getIID() const RT_OVERRIDE { return COM_IIDOF(IUnknown); }
     1140#else
     1141    IID const &getIID() const { return COM_IIDOF(IUnknown); }
     1142#endif
    11291143};
    11301144
    11311145/** @} */
    11321146
    1133 #endif // __COMDefs_h__
    1134 
     1147#endif // !__COMDefs_h__
     1148
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl

    r74878 r76012  
    256256    <xsl:text> * Generator : src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl&#x0A;</xsl:text>
    257257    <xsl:text> */&#x0A;&#x0A;</xsl:text>
     258
     259    <xsl:text>#include "VBox/com/VirtualBox.h"&#x0A;&#x0A;</xsl:text>
     260
    258261    <xsl:text>/* COM includes: */&#x0A;</xsl:text>
    259262    <xsl:text>#include "COMEnums.h"&#x0A;</xsl:text>
     
    300303    <xsl:text>#include "UILibraryDefs.h"&#x0A;&#x0A;</xsl:text>
    301304    <xsl:text>/* VirtualBox interface declarations: */&#x0A;</xsl:text>
    302     <xsl:text>#ifndef VBOX_WITH_XPCOM&#x0A;</xsl:text>
    303     <xsl:text># include "VirtualBox.h"&#x0A;</xsl:text>
    304     <xsl:text>#else /* !VBOX_WITH_XPCOM */&#x0A;</xsl:text>
    305     <xsl:text># include "VirtualBox_XPCOM.h"&#x0A;</xsl:text>
    306     <xsl:text>#endif /* VBOX_WITH_XPCOM */&#x0A;&#x0A;</xsl:text>
     305    <xsl:text>#ifndef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING&#x0A;</xsl:text>
     306    <xsl:text># ifndef VBOX_WITH_XPCOM&#x0A;</xsl:text>
     307    <xsl:text>#  include "VirtualBox.h"&#x0A;</xsl:text>
     308    <xsl:text># else /* !VBOX_WITH_XPCOM */&#x0A;</xsl:text>
     309    <xsl:text>#  include "VirtualBox_XPCOM.h"&#x0A;</xsl:text>
     310    <xsl:text># endif /* VBOX_WITH_XPCOM */&#x0A;</xsl:text>
     311    <xsl:text>#else&#x0A;</xsl:text>
     312    <xsl:text>COM_STRUCT_OR_CLASS(</xsl:text><xsl:value-of select="@name"/><xsl:text>);&#x0A;</xsl:text>
     313    <xsl:text>#endif&#x0A;</xsl:text>
    307314
    308315    <!-- Forward declarations: -->
     
    566573<xsl:text> * aIface);&#x0A;</xsl:text>
    567574  <xsl:text>&#x0A;</xsl:text>
     575
     576  <xsl:text>#ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING&#x0A;</xsl:text>
     577  <xsl:text>const IID &amp;getIID() const RT_OVERRIDE;&#x0A;</xsl:text>
     578  <xsl:text>#endif&#x0A;&#x0A;</xsl:text>
    568579
    569580  <xsl:text>    /* Attributes (properties): */&#x0A;</xsl:text>
     
    754765</xsl:template>
    755766
     767<xsl:template name="defineIIDGetter">
     768  <xsl:text>#ifdef VBOX_WITH_LESS_VIRTUALBOX_INCLUDING&#x0A;</xsl:text>
     769  <xsl:text>const IID &amp;C</xsl:text>
     770  <xsl:value-of select="substring(@name,2)"/>
     771  <xsl:text>::getIID() const&#x0A;</xsl:text>
     772  <xsl:text>{&#x0A;</xsl:text>
     773  <xsl:text>    return COM_IIDOF(</xsl:text>
     774  <xsl:value-of select="@name"/>
     775  <xsl:text>);&#x0A;</xsl:text>
     776  <xsl:text>}&#x0A;</xsl:text>
     777  <xsl:text>#endif&#x0A;&#x0A;</xsl:text>
     778
     779</xsl:template>
     780
    756781<xsl:template name="defineAttributes">
    757782
     
    9941019<xsl:template name="defineMembers">
    9951020  <xsl:call-template name="defineConstructors">
     1021    <xsl:with-param name="iface" select="."/>
     1022  </xsl:call-template>
     1023  <xsl:call-template name="defineIIDGetter">
    9961024    <xsl:with-param name="iface" select="."/>
    9971025  </xsl:call-template>
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h

    r75319 r76012  
    3636
    3737/* Other VBox includes: */
    38 #include <VBox/com/listeners.h>
     38#include <VBox/com/listeners.h> /** @todo This drags in VirtualBox.h! It may be possible avoid it for XPCOM, but not COM due to VBoxEventType_T. */
    3939
    4040/* Forward declarations: */
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