VirtualBox

Ignore:
Timestamp:
Nov 7, 2008 12:41:45 PM (16 years ago)
Author:
vboxsync
Message:

Main, FE/Qt: Added support for safe arrays of enums.

File:
1 edited

Legend:

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

    r13580 r13956  
    287287    static void FromSafeArray (const com::SafeGUIDArray &aArr,
    288288                               QValueVector <QUuid> &aVec);
     289
     290    /* Arrays of enums. Does a cast similar to what ENUMOut does. */
     291
     292    template <typename QE, typename CE>
     293    static void ToSafeArray (const QVector <QE> &aVec,
     294                             com::SafeIfaceArray <CE> &aArr)
     295    {
     296        aArr.reset (static_cast <int> (aVec.size()));
     297        for (int i = 0; i < aVec.size(); ++i)
     298            aArr [i] = static_cast <CE> (aVec.at (i));
     299    }
     300
     301    template <typename CE, typename QE>
     302    static void FromSafeArray (const com::SafeIfaceArray <CE> &aArr,
     303                               QVector <QE> &aVec)
     304    {
     305        aVec.resize (static_cast <int> (aArr.size()));
     306        for (int i = 0; i < aVec.size(); ++i)
     307            aVec [i] = static_cast <QE> (aArr [i]);
     308    }
    289309
    290310    /* Arrays of interface pointers. Note: we need a separate pair of names
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