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/VirtualBox4/include/COMDefs.h

    r13580 r13956  
    283283    static void FromSafeArray (const com::SafeGUIDArray &aArr,
    284284                               QVector <QUuid> &aVec);
     285
     286    /* Arrays of enums. Does a cast similar to what ENUMOut does. */
     287
     288    template <typename QE, typename CE>
     289    static void ToSafeArray (const QVector <QE> &aVec,
     290                             com::SafeIfaceArray <CE> &aArr)
     291    {
     292        aArr.reset (static_cast <int> (aVec.size()));
     293        for (int i = 0; i < aVec.size(); ++i)
     294            aArr [i] = static_cast <CE> (aVec.at (i));
     295    }
     296
     297    template <typename CE, typename QE>
     298    static void FromSafeArray (const com::SafeIfaceArray <CE> &aArr,
     299                               QVector <QE> &aVec)
     300    {
     301        aVec.resize (static_cast <int> (aArr.size()));
     302        for (int i = 0; i < aVec.size(); ++i)
     303            aVec [i] = static_cast <QE> (aArr [i]);
     304    }
    285305
    286306    /* 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