VirtualBox

Changeset 9401 in vbox for trunk


Ignore:
Timestamp:
Jun 5, 2008 8:01:41 AM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Some updates to the COM wrapper for Qt4.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/COMDefs.h

    r9381 r9401  
    1010
    1111/*
    12  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     12 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    1313 *
    1414 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8080#undef ASSERT
    8181
    82 #include <qstring.h>
    83 #include <quuid.h>
    84 #include <q3valuevector.h>
     82/* Qt includes */
     83#include <QString>
     84#include <QUuid>
     85#include <QVector>
    8586
    8687#include <iprt/memory> // for auto_copy_ptr
     
    228229
    229230    template <typename QT, typename CT>
    230     static void ToSafeArray (const Q3ValueVector <QT> &aVec, com::SafeArray <CT> &aArr)
     231    static void ToSafeArray (const QVector <QT> &aVec, com::SafeArray <CT> &aArr)
    231232    {
    232233        AssertMsgFailedReturnVoid (("No conversion!\n"));
     
    234235
    235236    template <typename CT, typename QT>
    236     static void FromSafeArray (const com::SafeArray <CT> &aArr, Q3ValueVector <QT> &aVec)
     237    static void FromSafeArray (const com::SafeArray <CT> &aArr, QVector <QT> &aVec)
    237238    {
    238239        AssertMsgFailedReturnVoid (("No conversion!\n"));
     
    240241
    241242    template <typename QT, typename CT>
    242     static void ToSafeArray (const Q3ValueVector <QT *> &aVec, com::SafeArray <CT *> &aArr)
     243    static void ToSafeArray (const QVector <QT *> &aVec, com::SafeArray <CT *> &aArr)
    243244    {
    244245        AssertMsgFailedReturnVoid (("No conversion!\n"));
     
    246247
    247248    template <typename CT, typename QT>
    248     static void FromSafeArray (const com::SafeArray <CT *> &aArr, Q3ValueVector <QT *> &aVec)
     249    static void FromSafeArray (const com::SafeArray <CT *> &aArr, QVector <QT *> &aVec)
    249250    {
    250251        AssertMsgFailedReturnVoid (("No conversion!\n"));
     
    254255
    255256    template <typename T>
    256     static void ToSafeArray (const Q3ValueVector <T> &aVec, com::SafeArray <T> &aArr)
     257    static void ToSafeArray (const QVector <T> &aVec, com::SafeArray <T> &aArr)
    257258    {
    258259        aArr.reset (aVec.size());
    259260        size_t i = 0;
    260         for (typename Q3ValueVector <T>::const_iterator it = aVec.begin();
     261        for (typename QVector <T>::const_iterator it = aVec.begin();
    261262             it != aVec.end(); ++ it, ++ i)
    262263            aArr [i] = *it;
     
    264265
    265266    template <typename T>
    266     static void FromSafeArray (const com::SafeArray <T> &aArr, Q3ValueVector <T> &aVec)
    267     {
    268         aVec = Q3ValueVector <T> (aArr.size());
     267    static void FromSafeArray (const com::SafeArray <T> &aArr, QVector <T> &aVec)
     268    {
     269        aVec = QVector <T> (aArr.size());
    269270        size_t i = 0;
    270         for (typename Q3ValueVector <T>::iterator it = aVec.begin();
     271        for (typename QVector <T>::iterator it = aVec.begin();
    271272             it != aVec.end(); ++ it, ++ i)
    272273            *it = aArr [i];
     
    275276    /* Arrays of strings */
    276277
    277     static void ToSafeArray (const Q3ValueVector <QString> &aVec,
     278    static void ToSafeArray (const QVector <QString> &aVec,
    278279                             com::SafeArray <BSTR> &aArr);
    279280    static void FromSafeArray (const com::SafeArray <BSTR> &aArr,
    280                                Q3ValueVector <QString> &aVec);
     281                               QVector <QString> &aVec);
    281282
    282283    /* Arrays of interface pointers. Note: we need a separate pair of names
     
    290291
    291292    template <class CI, class I>
    292     static void ToSafeIfaceArray (const Q3ValueVector <CI> &aVec,
     293    static void ToSafeIfaceArray (const QVector <CI> &aVec,
    293294                                  com::SafeIfaceArray <I> &aArr)
    294295    {
    295296        aArr.reset (aVec.size());
    296297        size_t i = 0;
    297         for (typename Q3ValueVector <CI>::const_iterator it = aVec.begin();
     298        for (typename QVector <CI>::const_iterator it = aVec.begin();
    298299             it != aVec.end(); ++ it, ++ i)
    299300        {
     
    306307    template <class I, class CI>
    307308    static void FromSafeIfaceArray (const com::SafeIfaceArray <I> &aArr,
    308                                     Q3ValueVector <CI> &aVec)
    309     {
    310         aVec = Q3ValueVector <CI> (aArr.size());
     309                                    QVector <CI> &aVec)
     310    {
     311        aVec = QVector <CI> (aArr.size());
    311312        size_t i = 0;
    312         for (typename Q3ValueVector <CI>::iterator it = aVec.begin();
     313        for (typename QVector <CI>::iterator it = aVec.begin();
    313314             it != aVec.end(); ++ it, ++ i)
    314315            (*it).attach (aArr [i]);
  • trunk/src/VBox/Frontends/VirtualBox4/include/COMWrappers.xsl

    r8155 r9401  
    1111
    1212/*
    13      Copyright (C) 2006-2007 Sun Microsystems, Inc.
     13     Copyright (C) 2006-2008 Sun Microsystems, Inc.
    1414   
    1515     This file is part of VirtualBox Open Source Edition (OSE), as
     
    238238      (//param[@safearray='yes' and not(../@internal='yes') and @type=current()/@name])
    239239    ">
    240       <xsl:text>typedef Q3ValueVector &lt;C</xsl:text>
     240      <xsl:text>typedef QVector &lt;C</xsl:text>
    241241      <xsl:value-of select="substring(@name,2)"/>
    242242      <xsl:text>&gt; C</xsl:text>
     
    11541154    <xsl:otherwise>
    11551155      <xsl:if test="../@safearray">
    1156         <xsl:text>Q3ValueVector &lt;</xsl:text>
     1156        <xsl:text>QVector &lt;</xsl:text>
    11571157      </xsl:if>
    11581158      <xsl:choose>
     
    15551555          <xsl:if test="(name()='attribute' and $isSetter) or
    15561556                        (name()='param' and @dir='in')">
    1557             <!-- convert Q3ValueVector to SafeArray -->
     1557            <!-- convert QVector to SafeArray -->
    15581558            <xsl:choose>
    15591559              <!-- interface types need special treatment here -->
     
    15811581          <xsl:if test="(name()='attribute' and not($isSetter)) or
    15821582                        (name()='param' and (@dir='out' or @dir='return'))">
    1583             <!-- convert SafeArray to Q3ValueVector -->
     1583            <!-- convert SafeArray to QVector -->
    15841584            <xsl:choose>
    15851585              <!-- interface types need special treatment here -->
  • trunk/src/VBox/Frontends/VirtualBox4/src/COMDefs.cpp

    r8155 r9401  
    66
    77/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727#else /* !defined (VBOX_WITH_XPCOM) */
    2828
    29 #include <qobject.h>
     29/* Qt includes */
     30#include <QObject>
    3031#include <qsocketnotifier.h>
    3132
     
    6465        mEventQ = eq;
    6566        mNotifier = new QSocketNotifier (mEventQ->GetEventQueueSelectFD(),
    66                                          QSocketNotifier::Read, this,
    67                                          "XPCOMEventQSocketNotifier");
     67                                         QSocketNotifier::Read, this);
    6868        QObject::connect (mNotifier, SIGNAL (activated (int)),
    6969                          this, SLOT (processEvents()));
     
    187187
    188188/* static */
    189 void COMBase::ToSafeArray (const Q3ValueVector <QString> &aVec,
     189void COMBase::ToSafeArray (const QVector <QString> &aVec,
    190190                           com::SafeArray <BSTR> &aArr)
    191191{
    192192    aArr.reset (aVec.size());
    193193    size_t i = 0;
    194     for (Q3ValueVector <QString>::const_iterator it = aVec.begin();
     194    for (QVector <QString>::const_iterator it = aVec.begin();
    195195         it != aVec.end(); ++ it, ++ i)
    196         aArr [i] = SysAllocString ((const OLECHAR *) (*it).ucs2());
     196        aArr [i] = SysAllocString ((const OLECHAR *) (*it).utf16());
    197197}
    198198
    199199/* static */
    200200void COMBase::FromSafeArray (const com::SafeArray <BSTR> &aArr,
    201                              Q3ValueVector <QString> &aVec)
    202 {
    203     aVec = Q3ValueVector <QString> (aArr.size());
     201                             QVector <QString> &aVec)
     202{
     203    aVec = QVector <QString> (aArr.size());
    204204    size_t i = 0;
    205     for (Q3ValueVector <QString>::iterator it = aVec.begin();
     205    for (QVector <QString>::iterator it = aVec.begin();
    206206         it != aVec.end(); ++ it, ++ i)
    207         *it = QString::fromUcs2 (aArr [i]);
     207        *it = QString::fromUtf16 (aArr [i]);
    208208}
    209209
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r9362 r9401  
    3838 *     of the Main API)
    3939 *
    40  * 6. src/VBox/Installer/win32/VirtualBox_TypeLib.xsl =>
     40 * 6. src/VBox/Frontends/VirtualBox4/include/COMWrappers.xsl =>
     41 *    out/<platform>/obj/src/VBox/Frontends/VirtualBox4/VirtualBox/include/COMWrappers.h
     42 *    (smart Qt-based C++ wrapper classes for COM interfaces
     43 *     of the Main API)
     44 *
     45 * 7. src/VBox/Installer/win32/VirtualBox_TypeLib.xsl =>
    4146 *    out/<platform>/obj/src/VBox/Installer/win32/VirtualBox_TypeLib.wxi
    4247 *    (Main API TypeLib block for the WiX installer)
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