VirtualBox

Changeset 9425 in vbox for trunk/src


Ignore:
Timestamp:
Jun 5, 2008 1:43:54 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Some more minor Qt4 COM wrapper updates.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 edited

Legend:

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

    r9401 r9425  
    3131 * @{
    3232 *
    33  * The Qt-COM support layer provides a set of defintions and smart classes for
     33 * The Qt-COM support layer provides a set of definitions and smart classes for
    3434 * writing simple, clean and platform-independent code to access COM/XPCOM
    3535 * components through exposed COM interfaces. This layer is based on the
    36  * COM/XPCOM Abstarction Layer library (the VBoxCOM glue library defined in
     36 * COM/XPCOM Abstraction Layer library (the VBoxCOM glue library defined in
    3737 * include/VBox/com and implemented in src/VBox/Main/glue).
    3838 *
     
    4242 * @{
    4343 *
    44  * COM/XPCOM arrays are mapped to QValueVector objects. QValueVector templates
    45  * declared with a type that corresponds to the COM type of elements in the
    46  * array using normal Qt-COM type mapping rules. Here is a code example that
    47  * demonstrates how to call interface methods that take and return arrays (this
    48  * example is based on examples given in @ref grp_COM_arrays):
     44 * COM/XPCOM arrays are mapped to QVector objects. QVector templates declared
     45 * with a type that corresponds to the COM type of elements in the array using
     46 * normal Qt-COM type mapping rules. Here is a code example that demonstrates
     47 * how to call interface methods that take and return arrays (this example is
     48 * based on examples given in @ref grp_COM_arrays):
    4949 * @code
    5050
     
    5353    // ...
    5454
    55     QValueVector <LONG> in (3);
     55    QVector <LONG> in (3);
    5656    in [0] = -1;
    5757    in [1] = -2;
    5858    in [2] = -3;
    5959
    60     QValueVector <LONG> out;
    61     QValueVector <LONG> ret;
     60    QVector <LONG> out;
     61    QVector <LONG> ret;
    6262
    6363    ret = component.TestArrays (in, out);
     
    258258    {
    259259        aArr.reset (aVec.size());
    260         size_t i = 0;
    261         for (typename QVector <T>::const_iterator it = aVec.begin();
    262              it != aVec.end(); ++ it, ++ i)
    263             aArr [i] = *it;
     260        for (int i = 0; i < aVec.size(); ++i)
     261            aArr [i] = aVec.at (i);
    264262    }
    265263
     
    267265    static void FromSafeArray (const com::SafeArray <T> &aArr, QVector <T> &aVec)
    268266    {
    269         aVec = QVector <T> (aArr.size());
    270         size_t i = 0;
    271         for (typename QVector <T>::iterator it = aVec.begin();
    272              it != aVec.end(); ++ it, ++ i)
    273             *it = aArr [i];
     267        aVec.resize (aArr.size());
     268        for (int i = 0; i < aVec.size(); ++i)
     269            aVec [i] = aArr [i];
    274270    }
    275271
     
    295291    {
    296292        aArr.reset (aVec.size());
    297         size_t i = 0;
    298         for (typename QVector <CI>::const_iterator it = aVec.begin();
    299              it != aVec.end(); ++ it, ++ i)
    300         {
    301             aArr [i] = (*it).iface();
     293        for (int i = 0; i < aVec.size(); ++i)
     294        {
     295            aArr [i] = aVec.at (i);
    302296            if (aArr [i])
    303297                aArr [i]->AddRef();
     
    309303                                    QVector <CI> &aVec)
    310304    {
    311         aVec = QVector <CI> (aArr.size());
    312         size_t i = 0;
    313         for (typename QVector <CI>::iterator it = aVec.begin();
    314              it != aVec.end(); ++ it, ++ i)
    315             (*it).attach (aArr [i]);
     305        aVec.resize (aArr.size());
     306        for (int i = 0; i < aVec.size(); ++i)
     307            aVec [i].attach (aArr [i]);
    316308    }
    317309
     
    525517
    526518    /**
    527      * Returns @c true if the result code repesents success (with or without
     519     * Returns @c true if the result code represents success (with or without
    528520     * warnings).
    529521     */
     
    531523
    532524    /**
    533      * Returns @c true if the result code represends success with one or more
     525     * Returns @c true if the result code represents success with one or more
    534526     * warnings.
    535527     */
     
    537529
    538530    /**
    539      * Returns @c true if the result code represends success with no warnings.
     531     * Returns @c true if the result code represents success with no warnings.
    540532     */
    541533    bool isReallyOk() const { return mRC == S_OK; }
     
    647639
    648640    /**
    649      * Returns @c true if the result code repesents success (with or without
     641     * Returns @c true if the result code represents success (with or without
    650642     * warnings).
    651643     */
     
    653645
    654646    /**
    655      * Returns @c true if the result code represends success with one or more
     647     * Returns @c true if the result code represents success with one or more
    656648     * warnings.
    657649     */
     
    659651
    660652    /**
    661      * Returns @c true if the result code represends success with no warnings.
     653     * Returns @c true if the result code represents success with no warnings.
    662654     */
    663655    bool isReallyOk() const { return !isNull() && B::mRC == S_OK; }
  • trunk/src/VBox/Frontends/VirtualBox4/src/COMDefs.cpp

    r9402 r9425  
    191191{
    192192    aArr.reset (aVec.size());
    193     size_t i = 0;
    194     for (QVector <QString>::const_iterator it = aVec.begin();
    195          it != aVec.end(); ++ it, ++ i)
    196         aArr [i] = SysAllocString ((const OLECHAR *) (*it).utf16());
     193    for (int i = 0; i < aVec.size(); ++i)
     194        aArr [i] = SysAllocString ((const OLECHAR *) aVec.at (i).utf16());
    197195}
    198196
     
    201199                             QVector <QString> &aVec)
    202200{
    203     aVec = QVector <QString> (aArr.size());
    204     size_t i = 0;
    205     for (QVector <QString>::iterator it = aVec.begin();
    206          it != aVec.end(); ++ it, ++ i)
    207         *it = QString::fromUtf16 (aArr [i]);
     201    aVec.resize (aArr.size());
     202    for (int i = 0; i < aVec.size(); ++i)
     203        aVec [i] = QString::fromUtf16 (aArr [i]);
    208204}
    209205
     
    226222    if (info.isOk())
    227223        mInterfaceName = getInterfaceNameFromIID (mInterfaceID);
     224    printf("iface %s\n", qPrintable (mInterfaceName));
    228225
    229226    mComponent = info.GetComponent();
     
    322319#else /* !defined (VBOX_WITH_XPCOM) */
    323320
     321    printf("1\n");
    324322    nsCOMPtr <nsIExceptionService> es;
    325323    es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
    326324    if (NS_SUCCEEDED (rc))
    327325    {
     326        printf("2\n");
    328327        nsCOMPtr <nsIExceptionManager> em;
    329328        rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
    330329        if (NS_SUCCEEDED (rc))
    331330        {
     331            printf("3\n");
    332332            nsCOMPtr <nsIException> ex;
    333333            rc = em->GetCurrentException (getter_AddRefs(ex));
    334334            if (NS_SUCCEEDED (rc) && ex)
    335335            {
     336                printf("4\n");
    336337                nsCOMPtr <IVirtualBoxErrorInfo> info;
    337338                info = do_QueryInterface (ex, &rc);
     
    339340                    init (CVirtualBoxErrorInfo (info));
    340341
     342                printf("5\n");
    341343                if (!mIsFullAvailable)
    342344                {
     345                    printf("6\n");
    343346                    bool gotSomething = false;
    344347
     
    351354                    if (NS_SUCCEEDED (rc) && message)
    352355                    {
    353                         mText = QString::fromUtf8 (message);
    354                         nsMemory::Free (message);
     356                        printf("7\n");
     357//                        mText = QString::fromUtf8 (message);
     358                        printf ("%s\n", message);
     359                        mText = "sdafsdf";
     360//                        nsMemory::Free (message);
    355361                    }
    356362
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